<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]&#8230;.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>&nbsp;</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>&nbsp;</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>&nbsp;</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(&quot;b2b_logic&quot;, &quot;custom_headers&quot;, &quot;Priority;Calluid;Geolocation;Geolocation-Routing;Contact&quot;)<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>&nbsp;</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)=&quot;/&quot;+$(var(ContactURIHost))+&quot;/192.168.130.105/g&quot;;<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>&nbsp;</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(&quot;Contact&quot;);<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(&quot;Contact: $var(URIwSub)\r\n&quot;);<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>&nbsp;</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(&quot;FailOver&quot;, &quot;sip:$tU@192.168.131.203&quot;);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p>&nbsp;</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(&quot;b2b_reply Route ($ci)\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Protocol of received message: $pr\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Body of request/reply: $rb\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Return Code: $rc\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Request Method: $rm\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Reply Reason: $rr\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Reply Status: $rs\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Transport protocol of original R-URI: $oP\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Transport protocol of R-URI: $rP\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Transport protocol of destination uri: $dP\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Destination set: $ds\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Destination uri: $du\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:URI of From header: $fu\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Domain in request's original R-URI: $od\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Request's original URI: $ou\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Username in request's original URI: $oU\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Domain in URI of 'To' header: $td\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Complete Request URI: $ru\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Username in Request URI: $rU\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Username in URI of 'To' header: $tU\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Surname in URI of 'From' header : $fU\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Contact name:$ct.fields(name)\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Contact uri:$ct.fields(uri)\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Contact q param:$ct.fields(q)\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Contact expires:$ct.fields(expires)\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Contact methods:$ct.fields(methods)\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:Contact params:$ct.fields(params)\n&quot;);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p>&nbsp;</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)=&quot;/&quot;+$(var(ContactURIHostRR))+&quot;/192.168.130.105/g&quot;;<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(&quot;Contact&quot;))<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:removed Contact\n&quot;);<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(&quot;&gt;&gt;&gt;&gt;&gt;B2BRR:DID NOT removed Contact\n&quot;);<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(&quot;Substituted Contact URI Variable Reply Route:$var(URIwSubRR)\n&quot;);<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(&quot;Contact: $var(URIwSubRR)\r\n&quot;);<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(&quot;Contact&quot;, &quot;BlaBla&quot;);<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>&nbsp;</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&#8217;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>&nbsp;</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>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Courier New"'><o:p>&nbsp;</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'>&nbsp;<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.&nbsp; </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'>&nbsp;<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&#8217;en dévoiler la teneur, de la copier, de la distribuer ou de prendre quelque mesure fondée sur l&#8217;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>&nbsp;</o:p></span></p></div></body></html>