diff --git a/src/modules/uac/uac_send.c b/src/modules/uac/uac_send.c index 5db66bd1a29..1d939dc8157 100644 --- a/src/modules/uac/uac_send.c +++ b/src/modules/uac/uac_send.c @@ -656,7 +656,35 @@ void uac_req_run_event_route(sip_msg_t *msg, uac_send_info_t *tp, int rcode) } /** - * TM callback function + * TM resend callback function + */ +void uac_resend_tm_callback(struct cell *t, int type, struct tmcb_params *ps) +{ + uac_send_info_t *tp = NULL; + + LM_DBG("tm callback with status %d\n", ps->code); + + if(ps->param==NULL || *ps->param==0) + { + LM_DBG("callback param with message id not received\n"); + goto done; + } + tp = (uac_send_info_t*)(*ps->param); + + if(tp->evroute!=0) { + uac_req_run_event_route((ps->rpl==FAKED_REPLY)?NULL:ps->rpl, + tp, ps->code); + } + +done: + if(tp!=NULL) + shm_free(tp); + return; + +} + +/** + * TM send callback function */ void uac_send_tm_callback(struct cell *t, int type, struct tmcb_params *ps) { @@ -753,6 +781,12 @@ void uac_send_tm_callback(struct cell *t, int type, struct tmcb_params *ps) uac_r.ssock = (tp->s_sock.len <= 0) ? NULL : &tp->s_sock; uac_r.dialog = &tmdlg; uac_r.cb_flags = TMCB_LOCAL_COMPLETED; + if(tp->evroute!=0) { + /* Callback function */ + uac_r.cb = uac_resend_tm_callback; + /* Callback parameter */ + uac_r.cbp = (void*)tp; + } ret = tmb.t_request_within(&uac_r); if(ret<0) { @@ -760,6 +794,10 @@ void uac_send_tm_callback(struct cell *t, int type, struct tmcb_params *ps) goto error; } + if(tp->evroute!=0) { + return; + } + done: error: if(tp!=NULL)