Hi,

I hope the correct solution to the problem is to add RR parameters on 
sequential requests.
The attached patch restores vsf=, vst= and did=.

Dragons ahead, so far it works for me.

Regards,
Kristian Høgh
Uni-tel A/S


On Friday 27 November 2015 14:07:08 Kristian F. Høgh wrote:
> Hi again,
> 
> I looked at the wrong request, when I wrote it was a patch we applied 
> in-house.
> (I looked at Route: header received from UA, not RR send by kamailio.)
> 
> RR on sequential requests have no did/vsf, using vanilla kamailio version 
> 4.2.5 as written below.
> If required I can test later using master. (I tested ealier, but it included 
> our patches, which doesn't make any difference on 4.2.5)
> 
> The questions still remain.
> Should kamailio add did/vsf on sequential requests, when I call 
> record_route()?
> Should I set dlg_match_mode to 1? (I use 0)
> Is it wrong to call record_route() from sequential requests?
> 
> Regards,
> Kristian.
> 
> 
> On Friday 27 November 2015 12:54:50 Kristian F. Høgh wrote:
> Hi list,
> 
> Record-route on sequential requests doesn't have did/vsf parm.
> 
> On initial INVITE, I call record_route() and set dialog flag.
> kamailio adds the following RR
> Record-Route: <sip:ww.xx.yy.zz;lr;ftag=15af612df;vsf=AAAA....;did=4a8.3ca2>
> 
> UAC sends a re-INVITE, containing the following route:
> Route: <sip:178.21.251.54;lr;ftag=15af612df;vsf=AAAA....;did=4a8.3ca2>
> I call loose_route() followed by record-route(), and kamailio adds the 
> following RR:
> Record-Route: <sip:ww.xx.yy.zz;lr;ftag=15af612df>
> 
> I've got a phone which updates the routeset on sequential requests (which I 
> don't think it should) and the did-matching fails.
> Should kamailio add did/vsf on sequential requests, when I call 
> record_route()?
> Should I set dlg_match_mode to 1? (I use 0)
> Is it wrong to call record_route() from sequential requests?
> 
> Which way is the best to resolve the problem?
> 
> Regards,
> Kristian Høgh
> Uni-tel A/S

Add RR param on sequential requests in dialog and uac_replace

Author: Kristian Høgh <k...@uni-tel.dk>


diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c
index 617502e..b14fcfd 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 error;
+			}
 
 			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..d39af36 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;
 }
 
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to