Module: kamailio Branch: master Commit: f6a5a28532ff410d03d10e86d43d38a785d0fab2 URL: https://github.com/kamailio/kamailio/commit/f6a5a28532ff410d03d10e86d43d38a7...
Author: Kristian Høgh kfh@uni-tel.dk Committer: Kristian Høgh kfh@uni-tel.dk Date: 2015-12-01T15:24:16+01:00
modules/uac: Add RR parameter on sequential requests when using uac_replace_from/to
---
Modified: modules/uac/replace.c
---
Diff: https://github.com/kamailio/kamailio/commit/f6a5a28532ff410d03d10e86d43d38a7... Patch: https://github.com/kamailio/kamailio/commit/f6a5a28532ff410d03d10e86d43d38a7...
---
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; }