Skip to content

Commit

Permalink
dialog: always build the ACK with full Route set for re-INVITE
Browse files Browse the repository at this point in the history
ACKs for re-INVITEs sent with the "dlg_send_sequential" MI command
would not have a full Route set as they were generated by TM instead
of the dialog module itself.

(cherry picked from commit eefd55e)
  • Loading branch information
rvlad-patrascu committed May 26, 2020
1 parent 4b6ebb0 commit 1c3dedd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions modules/dialog/dlg_req_within.c
Expand Up @@ -601,7 +601,7 @@ mi_response_t *mi_terminate_dlg_2(const mi_params_t *params,

int send_leg_msg(struct dlg_cell *dlg,str *method,int src_leg,int dst_leg,
str *hdrs,str *body,dlg_request_callback func,
void *param,dlg_release_func release,char *reply_marker, int no_ack)
void *param,dlg_release_func release,char *reply_marker)
{
context_p old_ctx;
context_p *new_ctx;
Expand Down Expand Up @@ -638,8 +638,7 @@ int send_leg_msg(struct dlg_cell *dlg,str *method,int src_leg,int dst_leg,
if (push_new_processing_context( dlg, &old_ctx, &new_ctx, NULL)!=0)
return -1;

if (no_ack)
dialog_info->T_flags=T_NO_AUTOACK_FLAG;
dialog_info->T_flags=T_NO_AUTOACK_FLAG;

result = d_tmb.t_request_within
(method, /* method*/
Expand Down Expand Up @@ -748,8 +747,8 @@ static void dlg_sequential_reply(struct cell* t, int type, struct tmcb_params* p
p = (struct dlg_sequential_param *)(*ps->param);
dlg = p->dlg;

if (dlg_handle_seq_reply(dlg, rpl, statuscode, p->leg,
dlg_has_reinvite_pinging(dlg)) < 0) {
if (dlg_handle_seq_reply(dlg, rpl, statuscode, other_leg(dlg, p->leg),
(p->method.len == 6 && memcmp(p->method.s, "INVITE", 6) == 0)) < 0) {
LM_ERR("Bad reply %d for callid %.*s\n",
statuscode, dlg->callid.len,dlg->callid.s);
dlg_async_response(p, rpl, statuscode);
Expand Down Expand Up @@ -800,7 +799,7 @@ static void dlg_sequential_reply(struct cell* t, int type, struct tmcb_params* p
if (send_leg_msg(dlg, &p->method, other_leg(dlg, p->leg), p->leg,
&extra_headers, &body,
dlg_sequential_reply, p, dlg_sequential_free,
&dlg->legs[p->leg].reply_received, 0) < 0) {
&dlg->legs[p->leg].reply_received) < 0) {
LM_ERR("cannot send sequential message!\n");
goto error;
}
Expand Down Expand Up @@ -840,7 +839,8 @@ static mi_response_t *mi_send_sequential(struct dlg_cell *dlg, int sleg,

if (send_leg_msg(dlg, method, sleg, dleg, &extra_headers, body,
dlg_sequential_reply, param, dlg_sequential_free,
&dlg->legs[dleg].reply_received, 0) < 0) {
dlg_has_reinvite_pinging(dlg) ? &dlg->legs[dleg].reinvite_confirmed :
&dlg->legs[dleg].reply_received) < 0) {
pkg_free(extra_headers.s);
dlg_sequential_free(param);
LM_ERR("cannot send sequential message!\n");
Expand Down
2 changes: 1 addition & 1 deletion modules/dialog/dlg_req_within.h
Expand Up @@ -190,7 +190,7 @@ mi_response_t *mi_send_sequential_dlg(const mi_params_t *params,

int send_leg_msg(struct dlg_cell *dlg,str *method,int src_leg,int dst_leg,
str *hdrs,str *body,dlg_request_callback func,void *param,
dlg_release_func release,char *reply_marker, int no_ack);
dlg_release_func release,char *reply_marker);
int dlg_handle_seq_reply(struct dlg_cell *dlg, struct sip_msg* rpl,
int statuscode, int leg, int is_reinvite_rpl);
#endif
14 changes: 7 additions & 7 deletions modules/dialog/dlg_timer.c
Expand Up @@ -731,7 +731,7 @@ int dlg_handle_seq_reply(struct dlg_cell *dlg, struct sip_msg* rpl,

*ping_status = DLG_PING_SUCCESS;
if (is_reinvite_rpl && statuscode < 300 && send_leg_msg(dlg, &ack,
other_leg(dlg, leg), leg, NULL, NULL, NULL, NULL, NULL, NULL, 0) < 0)
other_leg(dlg, leg), leg, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
LM_ERR("cannot send ACK message!\n");
return 0;
}
Expand Down Expand Up @@ -907,7 +907,7 @@ void dlg_options_routine(unsigned int ticks , void * attr)
ref_dlg(dlg,1);
if (send_leg_msg(dlg,&options_str,callee_idx(dlg),
DLG_CALLER_LEG,0,0,reply_from_caller,dlg,unref_dlg_cb,
&dlg->legs[DLG_CALLER_LEG].reply_received, 0) < 0) {
&dlg->legs[DLG_CALLER_LEG].reply_received) < 0) {
LM_ERR("failed to ping caller\n");
unref_dlg(dlg,1);
}
Expand All @@ -917,7 +917,7 @@ void dlg_options_routine(unsigned int ticks , void * attr)
ref_dlg(dlg,1);
if (send_leg_msg(dlg,&options_str,DLG_CALLER_LEG,
callee_idx(dlg),0,0,reply_from_callee,dlg,unref_dlg_cb,
&dlg->legs[callee_idx(dlg)].reply_received, 0) < 0) {
&dlg->legs[callee_idx(dlg)].reply_received) < 0) {
LM_ERR("failed to ping callee\n");
unref_dlg(dlg,1);
}
Expand Down Expand Up @@ -1014,7 +1014,7 @@ void dlg_reinvite_routine(unsigned int ticks , void * attr)
if (send_leg_msg(dlg,&invite_str,callee_idx(dlg),
DLG_CALLER_LEG,&extra_headers,sdp,
reinvite_reply_from_caller,dlg,unref_dlg_cb,
&dlg->legs[DLG_CALLER_LEG].reinvite_confirmed, 1) < 0) {
&dlg->legs[DLG_CALLER_LEG].reinvite_confirmed) < 0) {
LM_ERR("failed to ping caller\n");
unref_dlg(dlg,1);
}
Expand All @@ -1035,9 +1035,9 @@ void dlg_reinvite_routine(unsigned int ticks , void * attr)
&dlg->legs[DLG_CALLER_LEG].in_sdp);

ref_dlg(dlg,1);
if (send_leg_msg(dlg,&invite_str,DLG_CALLER_LEG,
callee_idx(dlg),&extra_headers,sdp,reinvite_reply_from_callee,
dlg,unref_dlg_cb,&dlg->legs[callee_idx(dlg)].reinvite_confirmed, 1) < 0) {
if (send_leg_msg(dlg,&invite_str,DLG_CALLER_LEG, callee_idx(dlg),
&extra_headers,sdp,reinvite_reply_from_callee, dlg,unref_dlg_cb,
&dlg->legs[callee_idx(dlg)].reinvite_confirmed) < 0) {
LM_ERR("failed to ping callee\n");
unref_dlg(dlg,1);
}
Expand Down

0 comments on commit 1c3dedd

Please sign in to comment.