int usrloc_dmq_send(str* body, dmq_node_t* node) { if (!usrloc_dmq_peer) { LM_ERR("dlg_dmq_peer is null!\n"); return -1; } if (node) { LM_DBG("sending dmq message ...\n"); usrloc_dmqb.send_message(usrloc_dmq_peer, body, node, &usrloc_dmq_resp_callback, 1, &usrloc_dmq_content_type); } else { LM_DBG("sending dmq broadcast...\n"); usrloc_dmqb.bcast_message(usrloc_dmq_peer, body, 0, &usrloc_dmq_resp_callback, 1, &usrloc_dmq_content_type); } return 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(¬_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; }
/** * @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(¬_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; }
int ht_dmq_broadcast(str* body) { if (!ht_dmq_peer) { LM_ERR("ht_dmq_peer is null!\n"); return -1; } LM_DBG("sending broadcast...\n"); ht_dmqb.bcast_message(ht_dmq_peer, body, 0, &ht_dmq_resp_callback, 1, &ht_dmq_content_type); return 0; }