本文整理汇总了C++中pua_api_t::add_event方法的典型用法代码示例。如果您正苦于以下问题:C++ pua_api_t::add_event方法的具体用法?C++ pua_api_t::add_event怎么用?C++ pua_api_t::add_event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pua_api_t
的用法示例。
在下文中一共展示了pua_api_t::add_event方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mod_init
/**
* init module function
*/
static int mod_init(void)
{
bind_pua_t bind_pua;
evs_process_body_t* evp=0;
bind_pua= (bind_pua_t)find_export("bind_pua", 1,0);
if (!bind_pua)
{
LM_ERR("Can't bind pua\n");
return -1;
}
if (bind_pua(&pua) < 0)
{
LM_ERR("Can't bind pua\n");
return -1;
}
if(pua.send_publish == NULL)
{
LM_ERR("Could not import send_publish\n");
return -1;
}
pua_send_publish= pua.send_publish;
if (nopublish_flag!= -1 && nopublish_flag > MAX_FLAG) {
LM_ERR("invalid nopublish flag %d!!\n", nopublish_flag);
return -1;
}
nopublish_flag = (nopublish_flag!=-1)?(1<<nopublish_flag):0;
if(!osips_ps)
evp = dialoginfo_process_body;
/* add event in pua module */
if(pua.add_event(DIALOG_EVENT, "dialog", "application/dialog-info+xml", evp) < 0) {
LM_ERR("failed to add 'dialog' event to pua module\n");
return -1;
}
/* bind to the dialog API */
if (load_dlg_api(&dlg_api)!=0) {
LM_ERR("failed to find dialog API - is dialog module loaded?\n");
return -1;
}
/* register dialog loading callback */
if (dlg_api.register_dlgcb(NULL, DLGCB_LOADED, __dialog_loaded, NULL, NULL) != 0) {
LM_CRIT("cannot register callback for dialogs loaded from the database\n");
}
if(presence_server.s)
presence_server.len = strlen(presence_server.s);
if(caller_spec_param.s)
{
caller_spec_param.len = strlen(caller_spec_param.s);
if(pv_parse_spec(&caller_spec_param, &caller_spec)==NULL)
{
LM_ERR("failed to parse caller spec\n");
return -2;
}
switch(caller_spec.type) {
case PVT_NONE:
case PVT_EMPTY:
case PVT_NULL:
case PVT_MARKER:
case PVT_COLOR:
LM_ERR("invalid caller spec\n");
return -3;
default: ;
}
}
if(callee_spec_param.s)
{
callee_spec_param.len = strlen(callee_spec_param.s);
if(pv_parse_spec(&callee_spec_param, &callee_spec)==NULL)
{
LM_ERR("failed to parse callee spec\n");
return -2;
}
switch(callee_spec.type) {
case PVT_NONE:
case PVT_EMPTY:
case PVT_NULL:
case PVT_MARKER:
case PVT_COLOR:
LM_ERR("invalid callee spec\n");
return -3;
default: ;
}
}
return 0;
}
示例2: mod_init
/** Module init function */
static int mod_init(void)
{
unsigned int i;
LM_DBG("start\n");
init_db_url( db_url , 0 /*cannot be null*/);
/* load tm api */
if(load_tm_api(&tmb)==-1)
{
LM_ERR("can't load tm functions\n");
return -1;
}
/* load pua api */
if(load_pua_api(&pua_api) < 0)
{
LM_ERR("Can't bind pua\n");
return -1;
}
/* add event in pua module */
if(pua_api.add_event(CALLINFO_EVENT, "call-info", NULL, 0) < 0) {
LM_ERR("failed to add 'call-info' event to pua module\n");
return -1;
}
/* load b2b_logic api */
if(load_b2b_logic_api(&b2bl_api)< 0)
{
LM_ERR("Failed to load b2b_logic api\n");
return -1;
}
if(b2b_sca_hsize<1 || b2b_sca_hsize>20)
{
LM_ERR("Wrong hash size. Needs to be greater than 1"
" and smaller than 20. Be aware that you should set the log 2"
" value of the real size\n");
return -1;
}
b2b_sca_hsize = 1<<b2b_sca_hsize;
if(presence_server.s)
presence_server.len = strlen(presence_server.s);
LM_DBG("fix db columns\n");
sca_table_name.len = strlen(sca_table_name.s);
shared_line_column.len = strlen(shared_line_column.s);
watchers_column.len = strlen(watchers_column.s);
for (i=0; i<MAX_APPEARANCE_INDEX; i++) {
app_shared_entity_column[i].len = strlen(app_shared_entity_column[i].s);
app_call_state_column[i].len = strlen(app_call_state_column[i].s);
app_call_info_uri_column[i].len = strlen(app_call_info_uri_column[i].s);
app_call_info_appearance_uri_column[i].len =
strlen(app_call_info_appearance_uri_column[i].s);
app_b2bl_key_column[i].len = strlen(app_b2bl_key_column[i].s);
}
LM_DBG("fix AVP spec\n");
/* fix AVP spec */
if(watchers_avp_spec.s)
{
watchers_avp_spec.len = strlen(watchers_avp_spec.s);
if(pv_parse_spec(&watchers_avp_spec, &watchers_spec)==NULL ||
watchers_spec.type != PVT_AVP)
{
LM_ERR("failed to parse watchers spec [%.*s]\n",
watchers_avp_spec.len, watchers_avp_spec.s);
return E_CFG;
}
if(pv_get_avp_name(NULL, &(watchers_spec.pvp), &(watchers_avp_name),
&(watchers_avp_type) )!=0)
{
LM_ERR("[%.*s]- invalid AVP definition for watchers_avp_spec\n",
watchers_avp_spec.len, watchers_avp_spec.s);
}
} else {
watchers_avp_name = -1;
watchers_avp_type = 0;
}
if(shared_line_spec_param.s)
{
shared_line_spec_param.len = strlen(shared_line_spec_param.s);
if(pv_parse_spec(&shared_line_spec_param, &shared_line_spec)==NULL)
{
LM_ERR("failed to parse shared_line spec\n");
return E_CFG;
}
switch(shared_line_spec.type) {
case PVT_NONE:
case PVT_EMPTY:
case PVT_NULL:
case PVT_MARKER:
case PVT_COLOR:
LM_ERR("invalid shared_line spec\n");
return -3;
default: ;
}
//.........这里部分代码省略.........
示例3: mod_init
/**
* init module function
*/
static int mod_init(void)
{
bind_pua_t bind_pua;
evs_process_body_t* evp=0;
bind_pua= (bind_pua_t)find_export("bind_pua", 1,0);
if (!bind_pua)
{
LM_ERR("Can't bind pua\n");
return -1;
}
if (bind_pua(&pua) < 0)
{
LM_ERR("Can't bind pua\n");
return -1;
}
if(pua.send_publish == NULL)
{
LM_ERR("Could not import send_publish\n");
return -1;
}
pua_send_publish= pua.send_publish;
if(!osips_ps)
evp = dialoginfo_process_body;
/* add event in pua module */
if(pua.add_event(DIALOG_EVENT, "dialog", "application/dialog-info+xml", evp) < 0) {
LM_ERR("failed to add 'dialog' event to pua module\n");
return -1;
}
/* bind to the dialog API */
if (load_dlg_api(&dlg_api)!=0) {
LM_ERR("failed to find dialog API - is dialog module loaded?\n");
return -1;
}
if(presence_server.s)
presence_server.len = strlen(presence_server.s);
if(caller_spec_param.s)
{
caller_spec_param.len = strlen(caller_spec_param.s);
if(pv_parse_spec(&caller_spec_param, &caller_spec)==NULL)
{
LM_ERR("failed to parse caller spec\n");
return -2;
}
switch(caller_spec.type) {
case PVT_NONE:
case PVT_EMPTY:
case PVT_NULL:
case PVT_MARKER:
case PVT_COLOR:
LM_ERR("invalid caller spec\n");
return -3;
default: ;
}
}
if(callee_spec_param.s)
{
callee_spec_param.len = strlen(callee_spec_param.s);
if(pv_parse_spec(&callee_spec_param, &callee_spec)==NULL)
{
LM_ERR("failed to parse callee spec\n");
return -2;
}
switch(callee_spec.type) {
case PVT_NONE:
case PVT_EMPTY:
case PVT_NULL:
case PVT_MARKER:
case PVT_COLOR:
LM_ERR("invalid callee spec\n");
return -3;
default: ;
}
}
return 0;
}