<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Verdana","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>remove_hf doesn't seem to work in route[b2b_reply]….Running OpenSIPS 1.11.5 on CentOS 6.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>This problem started when I discovered that b2b_init_requests removes the user part of the URI in the Contact: field.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>To correct that, did a bit of scripting to correct the outgoing invite:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>First, handle contacts manually:<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>modparam("b2b_logic", "custom_headers", "Priority;Calluid;Geolocation;Geolocation-Routing;Contact")<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>Second, check out the incoming INVITE, and modify the host part to be the OpenSIPs server itself (192.168.130.105):<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>$var(ContactURI)=$ct.fields(uri);<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>$var(ContactURIHost)=$(var(ContactURI){uri.host});<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>$var(ContactURIUser)=$(var(ContactURI){uri.user});<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>$var(regedit)="/"+$(var(ContactURIHost))+"/192.168.130.105/g";<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>$var(URIwSub)=$(var(ContactURI){re.subst,$var(regedit)});<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>Third, in local_route, remove the incoming contact and replace with my own:<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>remove_hf("Contact");<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>append_hf("Contact: $var(URIwSub)\r\n");<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>Fourth, send off the invite downstream (to 192.168.131.203):<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>b2b_init_request("FailOver", "sip:$tU@192.168.131.203");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>All this works! Great, but the reply route, not:<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>route[b2b_reply] {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'> xlog("b2b_reply Route ($ci)\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>###Debug Code<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Protocol of received message: $pr\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Body of request/reply: $rb\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Return Code: $rc\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Request Method: $rm\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Reply Reason: $rr\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Reply Status: $rs\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Transport protocol of original R-URI: $oP\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Transport protocol of R-URI: $rP\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Transport protocol of destination uri: $dP\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Destination set: $ds\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Destination uri: $du\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:URI of From header: $fu\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Domain in request's original R-URI: $od\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span lang=FR-CA style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Request's original URI: $ou\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Username in request's original URI: $oU\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Domain in URI of 'To' header: $td\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Complete Request URI: $ru\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Username in Request URI: $rU\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Username in URI of 'To' header: $tU\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Surname in URI of 'From' header : $fU\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Contact name:$ct.fields(name)\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Contact uri:$ct.fields(uri)\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Contact q param:$ct.fields(q)\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Contact expires:$ct.fields(expires)\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Contact methods:$ct.fields(methods)\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:Contact params:$ct.fields(params)\n");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>$var(ContactURIRR)=$ct.fields(uri);<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>$var(ContactURIHostRR)=$(var(ContactURIRR){uri.host});<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>$var(regeditRR)="/"+$(var(ContactURIHostRR))+"/192.168.130.105/g";<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>$var(URIwSubRR)=$(var(ContactURIRR){re.subst,$var(regeditRR)});<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>if(remove_hf("Contact"))<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:removed Contact\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>} else {<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>xlog(">>>>>B2BRR:DID NOT removed Contact\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>};<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>#<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'># xlog("Substituted Contact URI Variable Reply Route:$var(URIwSubRR)\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>append_hf("Contact: $var(URIwSubRR)\r\n");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>#replace_body_all("Contact", "BlaBla");<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in;text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>So in route[b2b_reply], do the same treatment as in the invite. The xlog says that it did remove the Contact, but it’s still there, according to wireshark. The append_hf works fine, but the remove_hf never works. I end up with 2 Contact.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'>Any ideas?<o:p></o:p></span></p><p class=MsoNormal style='text-indent:.5in'><span style='font-size:12.0pt;font-family:"Courier New"'> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=FR-CA style='font-family:"Courier New";mso-fareast-language:EN-CA'>Louis Rochon</span></b><span lang=FR-CA style='font-family:"Courier New";mso-fareast-language:EN-CA'><o:p></o:p></span></p><p class=MsoNormal><span lang=FR-CA style='font-family:"Courier New";mso-fareast-language:EN-CA'>Senior Systems Designer<o:p></o:p></span></p><p class=MsoNormal><span lang=FR-CA style='font-family:"Courier New";mso-fareast-language:EN-CA'>Solacom Technologies<o:p></o:p></span></p><p class=MsoNormal><span lang=FR-CA style='font-family:"Courier New";mso-fareast-language:EN-CA'>819 205 8100 ext. 274<o:p></o:p></span></p><p class=MsoNormal><i><span lang=FR-CA style='font-family:"Courier New";mso-fareast-language:EN-CA'><a href="http://www.solacom.com/"><span style='color:blue'>http://www.solacom.com</span></a></span></i><i><span lang=FR-CA style='font-size:13.5pt;font-family:"Courier New";mso-fareast-language:EN-CA'><o:p></o:p></span></i></p><p class=MsoNormal><span lang=FR-CA style='font-family:"Courier New";mso-fareast-language:EN-CA'> <o:p></o:p></span></p><p class=MsoNormal><b><i><span lang=FR-CA style='font-size:7.5pt;font-family:"Courier New";color:black;mso-fareast-language:EN-CA'>IMPORTANT EMAIL / FAX INFORMATION</span></i></b><span lang=FR-CA style='font-size:7.5pt;font-family:"Courier New";mso-fareast-language:EN-CA'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;font-family:"Courier New";mso-fareast-language:EN-CA'>The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. If you are not the intended addressee please contact the sender, at (613) 693-0641 and dispose of this email. </span><span lang=FR-CA style='font-size:7.5pt;font-family:"Courier New";mso-fareast-language:EN-CA'>Thanks !<o:p></o:p></span></p><p class=MsoNormal><span lang=FR-CA style='font-size:7.5pt;font-family:"Courier New";mso-fareast-language:EN-CA'> <o:p></o:p></span></p><p class=MsoNormal><b><i><span lang=FR-CA style='font-size:7.5pt;font-family:"Courier New";color:black;mso-fareast-language:EN-CA'>MISE EN GARDE CONCERNANT LA CONFIDENTIALITE DES RENSEIGNEMENTS CONTENUS DANS CE FAX/COURRIEL</span></i></b><span lang=FR-CA style='font-size:7.5pt;font-family:"Courier New";mso-fareast-language:EN-CA'><o:p></o:p></span></p><p class=MsoNormal><i><span lang=FR-CA style='font-size:7.0pt;font-family:"Courier New";color:black;mso-fareast-language:EN-CA'>La présente communication est confidentielle et transmise sous le sceau du secret professionnel et destiné au destinataire seulement.. Il est expressément interdit d’en dévoiler la teneur, de la copier, de la distribuer ou de prendre quelque mesure fondée sur l’information qui y est contenue. Si vous avez reçu cette communication par erreur, veillez S.V.P. la détruire et nous en aviser immédiatement par téléphone, au (613) 693-0641. Merci !</span></i><span lang=EN-CA style='font-family:"Courier New";mso-fareast-language:EN-CA'><o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'><o:p> </o:p></span></p></div></body></html>