Module: kamailio Branch: master Commit: 3bcdf3aec099fd88ec43fd11af3254cf4431e070 URL: https://github.com/kamailio/kamailio/commit/3bcdf3aec099fd88ec43fd11af3254cf...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2015-12-03T09:16:08+01:00
Merge pull request #425 from khoegh/master
Add RR parameter on sequential requests
---
Modified: modules/dialog/dlg_handlers.c Modified: modules/uac/replace.c
---
Diff: https://github.com/kamailio/kamailio/commit/3bcdf3aec099fd88ec43fd11af3254cf... Patch: https://github.com/kamailio/kamailio/commit/3bcdf3aec099fd88ec43fd11af3254cf...
---
diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index 617502e..0cd97ec 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -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 ) { diff --git a/modules/uac/replace.c b/modules/uac/replace.c index 354b2f9..6d1d1f7 100644 --- a/modules/uac/replace.c +++ b/modules/uac/replace.c @@ -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; @@ -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++) @@ -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; }