本文整理汇总了C++中run_dlg_callbacks函数的典型用法代码示例。如果您正苦于以下问题:C++ run_dlg_callbacks函数的具体用法?C++ run_dlg_callbacks怎么用?C++ run_dlg_callbacks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_dlg_callbacks函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dlg_terminated
/*!
* \brief Execute callback for the BYE request and register callback for the BYE reply
* \param req request message
* \param dlg corresponding dialog
* \param dir message direction
*/
static void dlg_terminated(struct sip_msg* req,
struct dlg_cell* dlg,
unsigned int dir) {
if (!req) {
LM_ERR("request is empty!");
return;
}
if (!dlg) {
LM_ERR("dialog is empty!");
return;
}
/* dialog terminated (BYE) */
run_dlg_callbacks(DLGCB_TERMINATED, dlg, req, NULL, dir, 0);
/* register callback for the coresponding reply */
LM_DBG("Registering tmcb1\n");
if (d_tmb.register_tmcb(req,
0,
TMCB_RESPONSE_OUT,
dlg_terminated_confirmed,
(void*) dlg,
0) <= 0) {
LM_ERR("cannot register response callback for BYE request\n");
return;
}
}
示例2: dlg_terminated_confirmed
/*!
* \brief Function that executes BYE reply callbacks
* \param t transaction, unused
* \param type type of the callback, should be TMCB_RESPONSE_FWDED
* \param params saved dialog structure inside the callback
*/
static void dlg_terminated_confirmed(tm_cell_t *t, int type,
struct tmcb_params* params)
{
dlg_cell_t *dlg = NULL;
dlg_iuid_t *iuid = NULL;
if(!params || !params->req || !params->param)
{
LM_ERR("invalid parameters!\n");
return;
}
iuid = (dlg_iuid_t*)*params->param;
if(iuid==NULL)
return;
dlg = dlg_get_by_iuid(iuid);
if(dlg==NULL)
{
LM_ERR("failed to get dialog from params!\n");
return;
}
/* dialog termination confirmed (BYE reply) */
run_dlg_callbacks(DLGCB_TERMINATED_CONFIRMED,
dlg,
params->req,
params->rpl,
DLG_DIR_UPSTREAM,
0);
dlg_release(dlg);
}
示例3: remove_dialog_from_db
/* this is only called from destroy_dlg, where the cell's entry
* lock is acquired
*/
int remove_dialog_from_db(struct dlg_cell * cell)
{
static db_ps_t my_ps = NULL;
db_val_t values[2];
db_key_t match_keys[2] = { &h_entry_column, &h_id_column};
/*if the dialog hasn 't been yet inserted in the database*/
LM_DBG("trying to remove a dialog, update_flag is %i\n", cell->flags);
if (cell->flags & DLG_FLAG_NEW)
return 0;
if (use_dialog_table()!=0)
return -1;
VAL_TYPE(values) = VAL_TYPE(values+1) = DB_INT;
VAL_NULL(values) = VAL_NULL(values+1) = 0;
VAL_INT(values) = cell->h_entry;
VAL_INT(values+1) = cell->h_id;
CON_PS_REFERENCE(dialog_db_handle) = &my_ps;
if(dialog_dbf.delete(dialog_db_handle, match_keys, 0, values, 2) < 0) {
LM_ERR("failed to delete database information\n");
return -1;
}
LM_DBG("callid was %.*s\n", cell->callid.len, cell->callid.s );
/* dialog saved */
run_dlg_callbacks( DLGCB_SAVED, cell, 0, DLG_DIR_NONE, 0);
return 0;
}
示例4: dlg_terminated
/*!
* \brief Execute callback for the BYE request and register callback for the BYE reply
* \param req request message
* \param dlg corresponding dialog
* \param dir message direction
*/
static void dlg_terminated(sip_msg_t *req, dlg_cell_t *dlg, unsigned int dir)
{
dlg_iuid_t *iuid = NULL;
if(!req) {
LM_ERR("request is empty!");
return;
}
if(!dlg) {
LM_ERR("dialog is empty!");
return;
}
/* dialog terminated (BYE) */
run_dlg_callbacks(DLGCB_TERMINATED, dlg, req, NULL, dir, 0);
iuid = dlg_get_iuid_shm_clone(dlg);
if(iuid==NULL)
return;
/* register callback for the coresponding reply */
if (d_tmb.register_tmcb(req,
0,
TMCB_RESPONSE_OUT,
dlg_terminated_confirmed,
(void*)iuid,
dlg_iuid_sfree) <= 0 ) {
LM_ERR("cannot register response callback for BYE request\n");
return;
}
}
示例5: dlg_seq_onreply_helper
/*!
* \brief Helper function that run dialog callbacks on forwarded requests
* \see dlg_seq_up_onreply
* \see dlg_seq_down_onreply
* \param t transaction, unused
* \param type type of the callback, should be TMCB_RESPONSE_FWDED
* \param param saved dialog structure inside the callback
* \param direction direction of the request
*/
static void dlg_seq_onreply_helper(struct cell* t, int type,
struct tmcb_params *param, const int direction)
{
dlg_cell_t *dlg = NULL;
dlg_iuid_t *iuid = NULL;
if (shutdown_done)
return;
iuid = (dlg_iuid_t*)(*param->param);
dlg = dlg_get_by_iuid(iuid);
if (dlg==0)
return;
if (type==TMCB_RESPONSE_FWDED)
{
run_dlg_callbacks( DLGCB_RESPONSE_WITHIN,
dlg,
param->req,
param->rpl,
direction,
0);
}
dlg_release(dlg);
return;
}
示例6: destroy_dlg
void destroy_dlg(struct dlg_cell *dlg)
{
int ret = 0;
LM_DBG("destroying dialog %p\n",dlg);
ret = remove_dlg_timer(&dlg->tl);
if (ret < 0) {
LM_CRIT("unable to unlink the timer on dlg %p [%u:%u] "
"with clid '%.*s' and tags '%.*s' '%.*s'\n",
dlg, dlg->h_entry, dlg->h_id,
dlg->callid.len, dlg->callid.s,
dlg_leg_print_info( dlg, DLG_CALLER_LEG, tag),
dlg_leg_print_info( dlg, callee_idx(dlg), tag));
} else if (ret > 0) {
LM_DBG("dlg expired or not in list - dlg %p [%u:%u] "
"with clid '%.*s' and tags '%.*s' '%.*s'\n",
dlg, dlg->h_entry, dlg->h_id,
dlg->callid.len, dlg->callid.s,
dlg_leg_print_info( dlg, DLG_CALLER_LEG, tag),
dlg_leg_print_info( dlg, callee_idx(dlg), tag));
}
run_dlg_callbacks( DLGCB_DESTROY , dlg, 0, DLG_DIR_NONE, NULL, 0);
free_dlg_dlg(dlg);
}
示例7: dlg_onreq
/*!
* \brief Function that is registered as TM callback and called on requests
* \see dlg_new_dialog
* \param t transaction, used to created the dialog
* \param type type of the entered callback
* \param param saved dialog structure in the callback
*/
void dlg_onreq(struct cell* t, int type, struct tmcb_params *param)
{
sip_msg_t *req = param->req;
dlg_cell_t *dlg = NULL;
if(req->first_line.u.request.method_value != METHOD_INVITE)
return;
dlg = dlg_get_ctx_dialog();
if (dlg!=NULL) {
if (!initial_cbs_inscript) {
if (spiral_detected == 1)
run_dlg_callbacks( DLGCB_SPIRALED, dlg,
req, NULL, DLG_DIR_DOWNSTREAM, 0);
else if (spiral_detected == 0)
run_create_callbacks(dlg, req);
}
}
if (dlg==NULL) {
if((req->flags&dlg_flag)!=dlg_flag)
return;
dlg_new_dialog(req, t, 1);
dlg = dlg_get_ctx_dialog();
}
if (dlg!=NULL) {
dlg_set_tm_callbacks(t, req, dlg, spiral_detected);
dlg_release(dlg);
}
}
示例8: dlg_ontimeout
/* When done, this function also has the job to unref the dialog as removed
* from timer list. This must be done in all cases!!
*/
void dlg_ontimeout( struct dlg_tl *tl)
{
struct dlg_cell *dlg;
int new_state;
int old_state;
int unref;
dlg = get_dlg_tl_payload(tl);
LM_DBG("byeontimeout ? %d , state = %d\n",dlg->flags,dlg->state);
if ( (dlg->flags&DLG_FLAG_BYEONTIMEOUT) &&
(dlg->state==DLG_STATE_CONFIRMED_NA || dlg->state==DLG_STATE_CONFIRMED)) {
init_dlg_term_reason(dlg,"Lifetime Timeout",sizeof("Lifetime Timeout")-1);
/* we just send the BYEs in both directions */
dlg_end_dlg( dlg, NULL);
/* dialog is no longer refed by timer; from now one it is refed
by the send_bye functions */
unref_dlg( dlg, 1);
/* is not 100% sure, but do it */
if_update_stat( dlg_enable_stats, expired_dlgs, 1);
return ;
}
next_state_dlg( dlg, DLG_EVENT_REQBYE, &old_state, &new_state, &unref);
if (new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) {
LM_DBG("timeout for dlg with CallID '%.*s' and tags '%.*s' '%.*s'\n",
dlg->callid.len, dlg->callid.s,
dlg->legs[DLG_CALLER_LEG].tag.len,
dlg->legs[DLG_CALLER_LEG].tag.s,
dlg->legs[callee_idx(dlg)].tag.len,
ZSW(dlg->legs[callee_idx(dlg)].tag.s));
/*destroy linkers */
destroy_linkers(dlg->profile_links);
dlg->profile_links = NULL;
/* dialog timeout */
run_dlg_callbacks( DLGCB_EXPIRED, dlg, 0, DLG_DIR_NONE, 0);
/* delete the dialog from DB */
if (should_remove_dlg_db())
remove_dialog_from_db(dlg);
unref_dlg(dlg, unref + 1 /*timer list*/);
if_update_stat( dlg_enable_stats, expired_dlgs, 1);
if_update_stat( dlg_enable_stats, active_dlgs, -1);
} else {
unref_dlg(dlg, 1 /*just timer list*/);
}
return;
}
示例9: internal_rpc_print_dlg
/*!
* \brief Helper method that outputs a dialog via the RPC interface
* \see rpc_print_dlg
* \param rpc RPC node that should be filled
* \param c RPC void pointer
* \param dlg printed dialog
* \param with_context if 1 then the dialog context will be also printed
* \return 0 on success, -1 on failure
*/
static inline void internal_rpc_print_dlg(rpc_t *rpc, void *c, dlg_cell_t *dlg,
int with_context)
{
rpc_cb_ctx_t rpc_cb;
time_t _start_ts, _stop_ts;
struct tm *_start_t, *_stop_t;
char _start_date_buf[RPC_DATE_BUF_LEN]="UNSPECIFIED";
char _stop_date_buf[RPC_DATE_BUF_LEN]="UNSPECIFIED";
_start_ts = (time_t)dlg->start_ts;
if (_start_ts) {
_start_t = localtime(&_start_ts);
strftime(_start_date_buf, RPC_DATE_BUF_LEN - 1,
"%Y-%m-%d %H:%M:%S", _start_t);
if (dlg->tl.timeout) {
_stop_ts = time(0) + dlg->tl.timeout - get_ticks();
_stop_t = localtime(&_stop_ts);
strftime(_stop_date_buf, RPC_DATE_BUF_LEN - 1,
"%Y-%m-%d %H:%M:%S", _stop_t);
}
}
rpc->printf(c, "hash:%u:%u state:%u ref_count:%u "
"timestart:%u timeout:%u lifetime:%u datestart:%s datestop:%s",
dlg->h_entry, dlg->h_id, dlg->state, dlg->ref, _start_ts, dlg->tl.timeout, dlg->lifetime,
_start_date_buf, _stop_date_buf);
rpc->printf(c, "\tcallid:%.*s from_tag:%.*s to_tag:%.*s",
dlg->callid.len, dlg->callid.s,
dlg->tag[DLG_CALLER_LEG].len, dlg->tag[DLG_CALLER_LEG].s,
dlg->tag[DLG_CALLEE_LEG].len, dlg->tag[DLG_CALLEE_LEG].s);
rpc->printf(c, "\tfrom_uri:%.*s to_uri:%.*s",
dlg->from_uri.len, dlg->from_uri.s, dlg->to_uri.len, dlg->to_uri.s);
rpc->printf(c, "\tcaller_contact:%.*s caller_cseq:%.*s",
dlg->contact[DLG_CALLER_LEG].len, dlg->contact[DLG_CALLER_LEG].s,
dlg->cseq[DLG_CALLER_LEG].len, dlg->cseq[DLG_CALLER_LEG].s);
rpc->printf(c, "\tcaller_route_set: %.*s",
dlg->route_set[DLG_CALLER_LEG].len, dlg->route_set[DLG_CALLER_LEG].s);
rpc->printf(c, "\tcallee_contact:%.*s callee_cseq:%.*s",
dlg->contact[DLG_CALLEE_LEG].len, dlg->contact[DLG_CALLEE_LEG].s,
dlg->cseq[DLG_CALLEE_LEG].len, dlg->cseq[DLG_CALLEE_LEG].s);
rpc->printf(c, "\tcallee_route_set: %.*s",
dlg->route_set[DLG_CALLEE_LEG].len, dlg->route_set[DLG_CALLEE_LEG].s);
if (dlg->bind_addr[DLG_CALLEE_LEG]) {
rpc->printf(c, "\tcaller_bind_addr:%.*s callee_bind_addr:%.*s",
dlg->bind_addr[DLG_CALLER_LEG]->sock_str.len, dlg->bind_addr[DLG_CALLER_LEG]->sock_str.s,
dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.len, dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.s);
} else {
rpc->printf(c, "\tcaller_bind_addr:%.*s callee_bind_addr:",
dlg->bind_addr[DLG_CALLER_LEG]->sock_str.len, dlg->bind_addr[DLG_CALLER_LEG]->sock_str.s);
}
if (with_context) {
rpc_cb.rpc = rpc;
rpc_cb.c = c;
run_dlg_callbacks( DLGCB_RPC_CONTEXT, dlg, NULL, NULL, DLG_DIR_NONE, (void *)&rpc_cb);
}
}
示例10: bin_push_dlg
void bin_push_dlg(bin_packet_t *packet, struct dlg_cell *dlg)
{
int callee_leg;
str *vars, *profiles;
callee_leg = callee_idx(dlg);
bin_push_str(packet, &dlg->callid);
bin_push_str(packet, &dlg->legs[DLG_CALLER_LEG].tag);
bin_push_str(packet, &dlg->legs[callee_leg].tag);
bin_push_str(packet, &dlg->from_uri);
bin_push_str(packet, &dlg->to_uri);
bin_push_int(packet, dlg->h_id);
bin_push_int(packet, dlg->start_ts);
bin_push_int(packet, dlg->state);
bin_push_str(packet, &dlg->legs[DLG_CALLER_LEG].bind_addr->sock_str);
if (dlg->legs[callee_leg].bind_addr)
bin_push_str(packet, &dlg->legs[callee_leg].bind_addr->sock_str);
else
bin_push_str(packet, NULL);
bin_push_str(packet, &dlg->legs[DLG_CALLER_LEG].r_cseq);
bin_push_str(packet, &dlg->legs[callee_leg].r_cseq);
bin_push_str(packet, &dlg->legs[DLG_CALLER_LEG].route_set);
bin_push_str(packet, &dlg->legs[callee_leg].route_set);
bin_push_str(packet, &dlg->legs[DLG_CALLER_LEG].contact);
bin_push_str(packet, &dlg->legs[callee_leg].contact);
bin_push_str(packet, &dlg->legs[callee_leg].from_uri);
bin_push_str(packet, &dlg->legs[callee_leg].to_uri);
/* give modules the chance to write values/profiles before replicating */
run_dlg_callbacks(DLGCB_WRITE_VP, dlg, NULL, DLG_DIR_NONE, NULL, 1);
vars = write_dialog_vars(dlg->vals);
profiles = write_dialog_profiles(dlg->profile_links);
bin_push_str(packet, vars);
bin_push_str(packet, profiles);
bin_push_int(packet, dlg->user_flags);
bin_push_int(packet, dlg->mod_flags);
bin_push_int(packet, dlg->flags &
~(DLG_FLAG_NEW|DLG_FLAG_CHANGED|DLG_FLAG_VP_CHANGED|DLG_FLAG_FROM_DB));
bin_push_int(packet, (unsigned int)time(0) + dlg->tl.timeout - get_ticks());
bin_push_int(packet, dlg->legs[DLG_CALLER_LEG].last_gen_cseq);
bin_push_int(packet, dlg->legs[callee_leg].last_gen_cseq);
}
示例11: dlg_ontimeout
/*!
* \brief Timer function that removes expired dialogs, run timeout route
* \param tl dialog timer list
*/
void dlg_ontimeout(struct dlg_tl *tl) {
struct dlg_cell *dlg;
int new_state, old_state, unref;
struct sip_msg *fmsg;
/* get the dialog tl payload */
dlg = ((struct dlg_cell*) ((char *) (tl) -
(unsigned long) (&((struct dlg_cell*) 0)->tl)));
if (dlg->toroute > 0 && dlg->toroute < main_rt.entries
&& main_rt.rlist[dlg->toroute] != NULL) {
fmsg = faked_msg_next();
if (exec_pre_script_cb(fmsg, REQUEST_CB_TYPE) > 0) {
dlg_set_ctx_dialog(dlg);
LM_DBG("executing route %d on timeout\n", dlg->toroute);
set_route_type(REQUEST_ROUTE);
run_top_route(main_rt.rlist[dlg->toroute], fmsg, 0);
dlg_set_ctx_dialog(0);
exec_post_script_cb(fmsg, REQUEST_CB_TYPE);
}
}
if ((dlg->dflags & DLG_FLAG_TOBYE)
&& (dlg->state == DLG_STATE_CONFIRMED)) {
//TODO: dlg_bye_all(dlg, NULL);
unref_dlg(dlg, 1);
return;
}
next_state_dlg(dlg, DLG_EVENT_REQBYE, &old_state, &new_state, &unref, 0);
if (new_state == DLG_STATE_DELETED && old_state != DLG_STATE_DELETED) {
LM_WARN("timeout for dlg with CallID '%.*s' and tags '%.*s'\n",
dlg->callid.len, dlg->callid.s,
dlg->from_tag.len, dlg->from_tag.s);
/* dialog timeout */
run_dlg_callbacks(DLGCB_EXPIRED, dlg, NULL, NULL, DLG_DIR_NONE, 0);
unref_dlg(dlg, unref + 1);
} else {
unref_dlg(dlg, 1);
}
return;
}
示例12: dlg_seq_down_onreply
static void dlg_seq_down_onreply(struct cell* t, int type,
struct tmcb_params *param)
{
struct dlg_cell *dlg;
dlg = (struct dlg_cell *)(*param->param);
if (shutdown_done || dlg==0)
return;
if (type==TMCB_RESPONSE_FWDED &&
(dlg->cbs.types)&DLGCB_RESPONSE_WITHIN) {
run_dlg_callbacks(DLGCB_RESPONSE_WITHIN, dlg, param->rpl,
DLG_DIR_DOWNSTREAM, 0);
return;
}
return;
}
示例13: dlg_seq_onreply_helper
/*!
* \brief Helper function that run dialog callbacks on forwarded requests
* \see dlg_seq_up_onreply
* \see dlg_seq_down_onreply
* \param t transaction, unused
* \param type type of the callback, should be TMCB_RESPONSE_FWDED
* \param param saved dialog structure inside the callback
* \param direction direction of the request
*/
static void dlg_seq_onreply_helper(struct cell* t, int type,
struct tmcb_params *param, const int direction) {
struct dlg_cell *dlg;
dlg = (struct dlg_cell *) (*param->param);
if (shutdown_done || dlg == 0)
return;
if (type == TMCB_RESPONSE_FWDED) {
run_dlg_callbacks(DLGCB_RESPONSE_WITHIN,
dlg,
param->req,
param->rpl,
direction,
0);
return;
}
return;
}
示例14: dlg_seq_down_onreply_mod_cseq
static void dlg_seq_down_onreply_mod_cseq(struct cell* t, int type,
struct tmcb_params *param)
{
struct dlg_cell *dlg;
dlg = ((dlg_cseq_wrapper*)*param->param)->dlg;
if (shutdown_done || dlg==0)
return;
if (update_msg_cseq((struct sip_msg *)param->rpl,&((dlg_cseq_wrapper *)*param->param)->cseq,0) != 0)
LM_ERR("failed to update CSEQ in msg\n");
if (type==TMCB_RESPONSE_FWDED &&
(dlg->cbs.types)&DLGCB_RESPONSE_WITHIN) {
run_dlg_callbacks(DLGCB_RESPONSE_WITHIN, dlg, param->rpl,
DLG_DIR_DOWNSTREAM, 0);
return;
}
return;
}
示例15: dlg_terminated_confirmed
/*!
* \brief Function that executes BYE reply callbacks
* \param t transaction, unused
* \param type type of the callback, should be TMCB_RESPONSE_FWDED
* \param param saved dialog structure inside the callback
*/
static void dlg_terminated_confirmed(struct cell* t,
int type,
struct tmcb_params* params) {
if (!params || !params->req || !params->param) {
LM_ERR("invalid parameters!\n");
return;
}
struct dlg_cell* dlg = (struct dlg_cell*) *params->param;
if (!dlg) {
LM_ERR("failed to get dialog from params!\n");
return;
}
/* dialog termination confirmed (BYE reply) */
run_dlg_callbacks(DLGCB_TERMINATED_CONFIRMED,
dlg,
params->req,
params->rpl,
DLG_DIR_UPSTREAM,
0);
}