Skip to content

Commit

Permalink
uac: call event route for uac_req_send() for second response
Browse files Browse the repository at this point in the history
- done in case the request is resent after a 401/407
- GH #1598

(cherry picked from commit 5c3df56)
  • Loading branch information
miconda committed Aug 17, 2018
1 parent 1657299 commit f8842b1
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion src/modules/uac/uac_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -753,13 +781,23 @@ 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) {
LM_ERR("failed to send request with authentication\n");
goto error;
}

if(tp->evroute!=0) {
return;
}

done:
error:
if(tp!=NULL)
Expand Down

0 comments on commit f8842b1

Please sign in to comment.