Skip to content

Commit

Permalink
Merge pull request #425 from khoegh/master
Browse files Browse the repository at this point in the history
Add RR parameter on sequential requests
  • Loading branch information
miconda committed Dec 3, 2015
2 parents 3272ff6 + 18644f9 commit 3bcdf3a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/dialog/dlg_handlers.c
Expand Up @@ -1398,6 +1398,10 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)

/* within dialog request */
run_dlg_callbacks( DLGCB_REQ_WITHIN, dlg, req, NULL, dir, 0);
if (add_dlg_rr_param( req, dlg->h_entry, dlg->h_id)<0 ) {
LM_ERR("failed to add RR param\n");
goto done;
}

if ( (event!=DLG_EVENT_REQACK) &&
(dlg->cbs.types)&DLGCB_RESPONSE_WITHIN ) {
Expand Down
17 changes: 17 additions & 0 deletions modules/uac/replace.c
Expand Up @@ -512,6 +512,7 @@ int restore_uri( struct sip_msg *msg, str *rr_param, str* restore_avp, int check
{
struct lump* l;
str param_val;
str add_to_rr = {0, 0};
struct to_body* old_body;
str old_uri;
str new_uri;
Expand Down Expand Up @@ -540,6 +541,20 @@ int restore_uri( struct sip_msg *msg, str *rr_param, str* restore_avp, int check
goto failed;
}

add_to_rr.s = pkg_malloc(2+rr_param->len+param_val.len);
if ( add_to_rr.s==0 ) {
add_to_rr.len = 0;
LM_ERR("no more pkg mem\n");
goto failed;
}
add_to_rr.len = sprintf(add_to_rr.s, ";%.*s=%.*s", rr_param->len,rr_param->s,param_val.len,param_val.s);

if ( uac_rrb.add_rr_param(msg, &add_to_rr)!=0 ) {
LM_ERR("add_RR_param failed\n");
goto failed;
}
pkg_free(add_to_rr.s);

/* dencrypt parameter ;) */
if (uac_passwd.len)
for( i=0 ; i<new_uri.len ; i++)
Expand Down Expand Up @@ -635,6 +650,8 @@ int restore_uri( struct sip_msg *msg, str *rr_param, str* restore_avp, int check
failed1:
pkg_free(new_uri.s);
failed:
if(add_to_rr.s)
pkg_free(add_to_rr.s);
return -1;
}

Expand Down

0 comments on commit 3bcdf3a

Please sign in to comment.