本文整理汇总了C++中run_dlg_callbacks函数的典型用法代码示例。如果您正苦于以下问题:C++ run_dlg_callbacks函数的具体用法?C++ run_dlg_callbacks怎么用?C++ run_dlg_callbacks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_dlg_callbacks函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:Jared-Prime,项目名称:kamailio,代码行数:34,代码来源:dlg_handlers.c
示例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);
}
开发者ID:alexdowad,项目名称:kamailio,代码行数:38,代码来源:dlg_handlers.c
示例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;
}
开发者ID:bluemutedwisdom,项目名称:OpenSIPS,代码行数:37,代码来源:dlg_db_handler.c
示例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;
}
}
开发者ID:alexdowad,项目名称:kamailio,代码行数:38,代码来源:dlg_handlers.c
示例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;
}
开发者ID:alexdowad,项目名称:kamailio,代码行数:35,代码来源:dlg_handlers.c
示例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);
}
开发者ID:andrey-vorobiev,项目名称:opensips,代码行数:27,代码来源:dlg_hash.c
示例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);
}
}
开发者ID:billyyh,项目名称:kamailio,代码行数:37,代码来源:dlg_handlers.c
示例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;
}
开发者ID:MayamaTakeshi,项目名称:opensips,代码行数:60,代码来源:dlg_handlers.c
示例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);
}
}
开发者ID:kingsumos,项目名称:kamailio,代码行数:65,代码来源:dialog.c
示例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);
}
开发者ID:NormB,项目名称:opensips,代码行数:49,代码来源:dlg_replication.c
示例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;
}
开发者ID:Jared-Prime,项目名称:kamailio,代码行数:51,代码来源:dlg_handlers.c
示例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;
}
开发者ID:MayamaTakeshi,项目名称:opensips,代码行数:18,代码来源:dlg_handlers.c
示例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;
}
开发者ID:Jared-Prime,项目名称:kamailio,代码行数:29,代码来源:dlg_handlers.c
示例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;
}
开发者ID:MayamaTakeshi,项目名称:opensips,代码行数:21,代码来源:dlg_handlers.c
示例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);
}
开发者ID:Jared-Prime,项目名称:kamailio,代码行数:28,代码来源:dlg_handlers.c
示例16: 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;
rpc->printf(c, "hash:%u:%u state:%u ref_count:%u timestart:%u timeout:%u",
dlg->h_entry, dlg->h_id, dlg->state, dlg->ref, dlg->start_ts, dlg->tl.timeout);
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);
}
}
开发者ID:aallamaa,项目名称:kamailio,代码行数:46,代码来源:dialog.c
示例17: bye_reply_cb
/*callback function to handle responses to the BYE request */
void bye_reply_cb(struct cell* t, int type, struct tmcb_params* ps) {
struct dlg_cell* dlg;
int event, old_state, new_state, unref, ret;
struct dlg_cell_out *dlg_out = 0;
if (ps->param == NULL || *ps->param == NULL) {
LM_ERR("invalid parameter\n");
return;
}
if (ps->code < 200) {
LM_DBG("receiving a provisional reply\n");
return;
}
LM_DBG("receiving a final reply %d\n", ps->code);
dlg = (struct dlg_cell *) (*(ps->param));
event = DLG_EVENT_REQBYE;
//get the corresponding dlg out structure for this REQ
struct dlg_entry_out *dlg_entry_out = &dlg->dlg_entry_out;
lock_get(dlg->dlg_out_entries_lock);
dlg_out = dlg_entry_out->first; //TODO check for concurrent call
if (!dlg_out)
return;
next_state_dlg(dlg, event, &old_state, &new_state, &unref, &dlg_out->to_tag);
lock_release(dlg->dlg_out_entries_lock);
if (new_state == DLG_STATE_DELETED && old_state != DLG_STATE_DELETED) {
LM_DBG("removing dialog with h_entry %u and h_id %u\n",
dlg->h_entry, dlg->h_id);
/* remove from timer */
ret = remove_dialog_timer(&dlg->tl);
if (ret < 0) {
LM_CRIT("unable to unlink the timer on dlg %p [%u:%u] "
"with clid '%.*s'\n",
dlg, dlg->h_entry, dlg->h_id,
dlg->callid.len, dlg->callid.s);
} else if (ret > 0) {
LM_WARN("inconsitent dlg timer data on dlg %p [%u:%u] "
"with clid '%.*s'\n",
dlg, dlg->h_entry, dlg->h_id,
dlg->callid.len, dlg->callid.s);
} else {
unref++;
}
/* dialog terminated (BYE) */
run_dlg_callbacks(DLGCB_TERMINATED, dlg, ps->req, ps->rpl, DLG_DIR_NONE, 0);
/* derefering the dialog */
unref_dlg(dlg, unref + 1);
}
if (new_state == DLG_STATE_DELETED && old_state == DLG_STATE_DELETED) {
/* trash the dialog from DB and memory */
if (dlg_db_mode)
remove_dialog_in_from_db(dlg);
/* force delete from mem */
unref_dlg(dlg, 1);
}
}
开发者ID:Gitlab11,项目名称:kamailio,代码行数:70,代码来源:dlg_req_within.c
示例18: dlg_onroute
//.........这里部分代码省略.........
/* run state machine */
switch (req->first_line.u.request.method_value) {
case METHOD_PRACK:
event = DLG_EVENT_REQPRACK;
break;
case METHOD_ACK:
event = DLG_EVENT_REQACK;
break;
case METHOD_BYE:
event = DLG_EVENT_REQBYE;
break;
default:
event = DLG_EVENT_REQ;
}
next_state_dlg(dlg, event, &old_state, &new_state, &unref, 0);
LM_DBG("unref after next state is %i\n", unref);
CURR_DLG_ID = req->id;
CURR_DLG_LIFETIME = (unsigned int) (time(0)) - dlg->start_ts;
CURR_DLG_STATUS = new_state;
/* run actions for the transition */
if (event == DLG_EVENT_REQBYE && new_state == DLG_STATE_DELETED &&
old_state != DLG_STATE_DELETED) {
LM_DBG("BYE successfully processed\n");
/* remove from timer */
ret = remove_dialog_timer(&dlg->tl);
if (ret < 0) {
LM_CRIT("unable to unlink the timer on dlg %p [%u:%u] "
"with clid '%.*s' and tags '%.*s'\n",
dlg, dlg->h_entry, dlg->h_id,
dlg->callid.len, dlg->callid.s,
dlg->from_tag.len, dlg->from_tag.s);
} else if (ret > 0) {
LM_WARN("inconsitent dlg timer data on dlg %p [%u:%u] "
"with clid '%.*s' and tags '%.*s' \n",
dlg, dlg->h_entry, dlg->h_id,
dlg->callid.len, dlg->callid.s,
dlg->from_tag.len, dlg->from_tag.s);
} else {
unref++;
}
/* dialog terminated (BYE) */
dlg_terminated(req, dlg, dir);
unref_dlg(dlg, unref);
return;
}
if ((event == DLG_EVENT_REQ || event == DLG_EVENT_REQACK)
&& new_state == DLG_STATE_CONFIRMED) {
timeout = get_dlg_timeout(req);
if (timeout != default_timeout) {
dlg->lifetime = timeout;
}
if (update_dlg_timer(&dlg->tl, dlg->lifetime) == -1) {
LM_ERR("failed to update dialog lifetime\n");
}
if (update_cseqs(dlg, req, dir, &ttag) != 0) {
LM_ERR("cseqs update failed\n");
} else {
dlg->dflags |= DLG_FLAG_CHANGED;
}
if (old_state != DLG_STATE_CONFIRMED) {
LM_DBG("confirming ACK successfully processed\n");
/* confirming ACK request */
run_dlg_callbacks(DLGCB_CONFIRMED, dlg, req, NULL, dir, 0);
} else {
LM_DBG("sequential request successfully processed\n");
/* within dialog request */
run_dlg_callbacks(DLGCB_REQ_WITHIN, dlg, req, NULL, dir, 0);
if ((event != DLG_EVENT_REQACK) &&
(dlg->cbs.types) & DLGCB_RESPONSE_WITHIN) {
/* ref the dialog as registered into the transaction callback.
* unref will be done when the callback will be destroyed */
ref_dlg(dlg, 1);
/* register callback for the replies of this request */
if (d_tmb.register_tmcb(req, 0, TMCB_RESPONSE_FWDED,
(dir == DLG_DIR_UPSTREAM) ? dlg_seq_down_onreply : dlg_seq_up_onreply,
(void*) dlg, unreference_dialog) < 0) {
LM_ERR("failed to register TMCB (2)\n");
unref_dlg(dlg, 1);
}
}
}
}
if (new_state == DLG_STATE_CONFIRMED && old_state != DLG_STATE_CONFIRMED) {
dlg->dflags |= DLG_FLAG_CHANGED;
}
return;
}
开发者ID:Jared-Prime,项目名称:kamailio,代码行数:101,代码来源:dlg_handlers.c
示例19: dialog_update_db
//.........这里部分代码省略.........
SET_STR_VALUE(values+14,cell->legs[callee_leg].from_uri);
SET_STR_VALUE(values+15,cell->legs[callee_leg].to_uri);
SET_INT_VALUE(values+16, cell->state);
SET_INT_VALUE(values+17, (unsigned int)((unsigned int)time(0)
+ cell->tl.timeout - get_ticks()) );
SET_STR_VALUE(values+18, cell->legs[DLG_CALLER_LEG].r_cseq);
SET_STR_VALUE(values+19, cell->legs[callee_leg].r_cseq);
SET_INT_VALUE(values+20, cell->legs[DLG_CALLER_LEG].last_gen_cseq);
SET_INT_VALUE(values+21, cell->legs[callee_leg].last_gen_cseq);
set_final_update_cols(values+22, cell, on_shutdown);
SET_INT_VALUE(values+25, cell->flags & ~(DLG_FLAG_NEW|DLG_FLAG_CHANGED|DLG_FLAG_VP_CHANGED));
CON_PS_REFERENCE(dialog_db_handle) = &my_ps_insert;
if (con_set_inslist(&dialog_dbf,dialog_db_handle,
&ins_list,insert_keys,DIALOG_TABLE_TOTAL_COL_NO) < 0 )
CON_RESET_INSLIST(dialog_db_handle);
if((dialog_dbf.insert(dialog_db_handle, insert_keys,
values, DIALOG_TABLE_TOTAL_COL_NO)) !=0){
LM_ERR("could not add another dialog to db\n");
goto error;
}
if (ins_done==0)
ins_done=1;
/* dialog saved */
run_dlg_callbacks( DLGCB_SAVED, cell, 0, DLG_DIR_NONE, 0);
cell->flags &= ~(DLG_FLAG_NEW |DLG_FLAG_CHANGED|DLG_FLAG_VP_CHANGED);
} else if ( (cell->flags & DLG_FLAG_CHANGED)!=0 || on_shutdown ){
LM_DBG("updating existing dialog %p\n",cell);
SET_INT_VALUE(values, cell->h_entry);
SET_INT_VALUE(values+1, cell->h_id);
SET_INT_VALUE(values+16, cell->state);
SET_INT_VALUE(values+17, (unsigned int)((unsigned int)time(0)
+ cell->tl.timeout - get_ticks()) );
SET_STR_VALUE(values+18, cell->legs[DLG_CALLER_LEG].r_cseq);
SET_STR_VALUE(values+19, cell->legs[callee_leg].r_cseq);
SET_INT_VALUE(values+20, cell->legs[DLG_CALLER_LEG].last_gen_cseq);
SET_INT_VALUE(values+21, cell->legs[callee_leg].last_gen_cseq);
set_final_update_cols(values+22, cell, 1);
SET_INT_VALUE(values+25, cell->flags);
CON_PS_REFERENCE(dialog_db_handle) = &my_ps_update;
if((dialog_dbf.update(dialog_db_handle, (insert_keys), 0,
(values), (insert_keys+16), (values+16), 2, 10)) !=0) {
LM_ERR("could not update database info\n");
goto error;
}
/* dialog saved */
run_dlg_callbacks( DLGCB_SAVED, cell, 0, DLG_DIR_NONE, 0);
cell->flags &= ~(DLG_FLAG_CHANGED|DLG_FLAG_VP_CHANGED);
开发者ID:bluemutedwisdom,项目名称:OpenSIPS,代码行数:67,代码来源:dlg_db_handler.c
示例20: internal_mi_print_dlg
//.........这里部分代码省略.........
goto error;
node1 = add_mi_node_child(node, MI_DUP_VALUE, "callid", 6,
dlg->callid.s, dlg->callid.len);
if(node1 == 0)
goto error;
node1 = add_mi_node_child(node, MI_DUP_VALUE, "from_uri", 8,
dlg->from_uri.s, dlg->from_uri.len);
if(node1 == 0)
goto error;
node1 = add_mi_node_child(node, MI_DUP_VALUE, "from_tag", 8,
dlg->tag[DLG_CALLER_LEG].s, dlg->tag[DLG_CALLER_LEG].len);
if(node1 == 0)
goto error;
node1 = add_mi_node_child(node, MI_DUP_VALUE, "caller_contact", 14,
dlg->contact[DLG_CALLER_LEG].s,
dlg->contact[DLG_CALLER_LEG].len);
if(node1 == 0)
goto error;
node1 = add_mi_node_child(node, MI_DUP_VALUE, "caller_cseq", 11,
dlg->cseq[DLG_CALLER_LEG].s,
dlg->cseq[DLG_CALLER_LEG].len);
if(node1 == 0)
goto error;
node1 = add_mi_node_child(node, MI_DUP_VALUE,"caller_route_set",16,
dlg->route_set[DLG_CALLER_LEG].s,
dlg->route_set[DLG_CALLER_LEG].len);
if(node1 == 0)
goto error;
if (dlg->bind_addr[DLG_CALLER_LEG]) {
node1 = add_mi_node_child(node, 0,
"caller_bind_addr",16,
dlg->bind_addr[DLG_CALLER_LEG]->sock_str.s,
dlg->bind_addr[DLG_CALLER_LEG]->sock_str.len);
} else {
node1 = add_mi_node_child(node, 0,
"caller_bind_addr",16,0,0);
}
if (dlg->bind_addr[DLG_CALLEE_LEG]) {
node1 = add_mi_node_child(node, 0,
"callee_bind_addr",16,
dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.s,
dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.len);
} else {
node1 = add_mi_node_child(node, 0,
"callee_bind_addr",16,0,0);
}
node1 = add_mi_node_child(node, MI_DUP_VALUE, "to_uri", 6,
dlg->to_uri.s, dlg->to_uri.len);
if(node1 == 0)
goto error;
node1 = add_mi_node_child(node, MI_DUP_VALUE, "to_tag", 6,
dlg->tag[DLG_CALLEE_LEG].s, dlg->tag[DLG_CALLEE_LEG].len);
if(node1 == 0)
goto error;
node1 = add_mi_node_child(node, MI_DUP_VALUE, "callee_contact", 14,
dlg->contact[DLG_CALLEE_LEG].s,
dlg->contact[DLG_CALLEE_LEG].len);
if(node1 == 0)
goto error;
node1 = add_mi_node_child(node, MI_DUP_VALUE, "callee_cseq", 11,
dlg->cseq[DLG_CALLEE_LEG].s,
dlg->cseq[DLG_CALLEE_LEG].len);
if(node1 == 0)
goto error;
node1 = add_mi_node_child(node, MI_DUP_VALUE,"callee_route_set",16,
dlg->route_set[DLG_CALLEE_LEG].s,
dlg->route_set[DLG_CALLEE_LEG].len);
if(node1 == 0)
goto error;
if (with_context) {
node1 = add_mi_node_child(node, 0, "context", 7, 0, 0);
if(node1 == 0)
goto error;
run_dlg_callbacks( DLGCB_MI_CONTEXT,
dlg,
NULL,
NULL,
DLG_DIR_NONE,
(void *)node1);
}
return 0;
error:
LM_ERR("failed to add node\n");
return -1;
}
开发者ID:AlessioCasco,项目名称:kamailio,代码行数:101,代码来源:dlg_hash.c
注:本文中的run_dlg_callbacks函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论