> Am I to naive to think that these ACKs to negatives always (callid masking
> and whether topoh is active or not) need to use the Call-ID from the
> negative (in this case 488) response? Call-ID has only to be rewritten in
> forwarding the negative response towards the endpoint that triggered it
> (which is done correctly in my call trace)

Attached is a diff to topoh_mod.c that implements above (with my limited 
knowledge). Locally generated ACKs don't get masked Call-IDs to downstream.
Works for my 488, will test some more to see if nothing else is broken. But 
maybe somebody more in touch with kamailio source code could take a look to 
see it this patch looks alright?

-- 

Telefoon: 088 0100 700
Sales: sa...@pocos.nl | Service: serviced...@pocos.nl
http://www.pocos.nl/ | Croy 9c, 5653 LC Eindhoven | Kamer van Koophandel 
17097024
--- topoh_mod.c.orig	2015-01-27 11:12:48.680160911 +0100
+++ topoh_mod.c	2015-01-27 10:51:23.162037065 +0100
@@ -397,11 +397,13 @@
 	LM_DBG("the COOKIE is [%.*s]\n", th_cookie_value.len, th_cookie_value.s);
 	if(th_cookie_value.s[0]!='x')
 		th_del_cookie(&msg);
+
+	direction = (th_cookie_value.s[0]=='u')?1:0; /* upstream/downstram */
+	dialog = (get_to(&msg)->tag_value.len>0)?1:0;
+	local = (th_cookie_value.s[0]!='d'&&th_cookie_value.s[0]!='u')?1:0;
+
 	if(msg.first_line.type==SIP_REQUEST)
 	{
-		direction = (th_cookie_value.s[0]=='u')?1:0; /* upstream/downstram */
-		dialog = (get_to(&msg)->tag_value.len>0)?1:0;
-		local = (th_cookie_value.s[0]!='d'&&th_cookie_value.s[0]!='u')?1:0;
 		/* local generated requests */
 		if(local)
 		{
@@ -409,10 +411,10 @@
 			if(get_cseq(&msg)->method_id==METHOD_ACK
 					|| get_cseq(&msg)->method_id==METHOD_CANCEL)
 			{
-				th_mask_callid(&msg);
 				goto ready;
 			} else {
 				/* should be for upstream */
+				th_unmask_callid(&msg);
 				goto done;
 			}
 		}
@@ -434,24 +436,30 @@
 		}
 	} else {
 		/* reply */
-		if(th_cookie_value.s[th_cookie_value.len-1]=='x')
-		{
-			/* ?!?! - we should have a cookie in any reply case */
-			goto done;
-		}
-		if(th_cookie_value.s[th_cookie_value.len-1]=='v')
+
+		if(local && direction && (get_cseq(&msg)->method_id==METHOD_ACK))
 		{
-			/* reply generated locally - direction was set by request */
-			if(th_cookie_value.s[0]=='u')
+			th_unmask_callid(&msg);
+		} else {
+			if(th_cookie_value.s[th_cookie_value.len-1]=='x')
 			{
-				th_mask_callid(&msg);
+				/* ?!?! - we should have a cookie in any reply case */
+				goto done;
 			}
-		} else {
-			th_flip_record_route(&msg, 1);
-			th_mask_contact(&msg);
-			if(th_cookie_value.s[0]=='d')
+			if(th_cookie_value.s[th_cookie_value.len-1]=='v')
 			{
-				th_mask_callid(&msg);
+				/* reply generated locally - direction was set by request */
+				if(th_cookie_value.s[0]=='u')
+				{
+					th_mask_callid(&msg);
+				}
+			} else {
+				th_flip_record_route(&msg, 1);
+				th_mask_contact(&msg);
+				if(th_cookie_value.s[0]=='d')
+				{
+					th_mask_callid(&msg);
+				}
 			}
 		}
 	}
_______________________________________________
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