Exemple #1
0
/**
* @brief add notification peer
*/
int dlg_dmq_initialize()
{
	dmq_peer_t not_peer;

	/* load the DMQ API */
	if (dmq_load_api(&dlg_dmqb)!=0) {
		LM_ERR("cannot load dmq api\n");
		return -1;
	} else {
		LM_DBG("loaded dmq api\n");
	}

	not_peer.callback = dlg_dmq_handle_msg;
	not_peer.init_callback = dlg_dmq_request_sync;
	not_peer.description.s = "dialog";
	not_peer.description.len = 6;
	not_peer.peer_id.s = "dialog";
	not_peer.peer_id.len = 6;
	dlg_dmq_peer = dlg_dmqb.register_dmq_peer(&not_peer);
	if(!dlg_dmq_peer) {
		LM_ERR("error in register_dmq_peer\n");
		goto error;
	} else {
		LM_DBG("dmq peer registered\n");
	}
	return 0;
error:
	return -1;
}
Exemple #2
0
/**
 * @brief add notification peer
 */
int ht_dmq_initialize()
{
    dmq_peer_t not_peer;

    /* load the DMQ API */
    if (dmq_load_api(&ht_dmqb)!=0) {
        LM_ERR("cannot load dmq api\n");
        return -1;
    } else {
        LM_DBG("loaded dmq api\n");
    }

    not_peer.callback = ht_dmq_handle_msg;
    not_peer.init_callback = NULL;
    not_peer.description.s = "htable";
    not_peer.description.len = 6;
    not_peer.peer_id.s = "htable";
    not_peer.peer_id.len = 6;
    ht_dmq_peer = ht_dmqb.register_dmq_peer(&not_peer);
    if(!ht_dmq_peer) {
        LM_ERR("error in register_dmq_peer\n");
        goto error;
    } else {
        LM_DBG("dmq peer registered\n");
    }
    return 0;
error:
    return -1;
}