<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<tt>Hi Louis,<br>
<br>
The b2b_reply route is invoked for int incoming reply. This reply
is internally consumed and another one is generated on the other
side of the B2B (basically there are two back 2 back transactions).<br>
<br>
The new reply (on A side) is built based on information from the
incoming reply (on B side) - considering that the original INVITE
went from A to B.<br>
<br>
So, any change you do on incoming rely will be discards because a
new reply is to be built on the other side. Headers (as a whole)
may propagate via "custom_headers" parameters. Otherwise, whatever
append_hf() you do in b2b_reply will be lost (not translated to
the other side).<br>
<br>
Even more, the Contact has a special treatment as it is completely
rebuilt by the B2B - old Contact hdr is discarded and a new one
(pointing to B2B) is added in the outbound reply. So your changes
over the incoming contact do conflict with the changed the B2B
module does over the contact.<br>
<br>
In my test, having "contact" in the "custom_headers" and doing
remove_hf()+append_hf() on a contact on b2b_reply, results in two
Contact headers :<br>
- the one removed, added and carried via custom header (from
the incoming reply)<br>
- the one built and added internally by the B2B, pointing to
it self<br>
<br>
So, remove_hf() actually works, but you end up with that conflict
in having you and the B2B changing both the Contact hdr.<br>
<br>
As I understand, your goal is to preserve the username part in B2B
right ?<br>
<br>
Best regards,<br>
</tt>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
<div class="moz-cite-prefix">On 15.10.2015 21:40, Louis Rochon
wrote:<br>
</div>
<blockquote
cite="mid:5E14682204D78E488EC3435C01D723E3015CFF2E3819@SolaMail.solacom.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<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]-->
<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",
<a class="moz-txt-link-rfc2396E" href="mailto:sip:$tU@192.168.131.203">"sip:$tU@192.168.131.203"</a>);<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
style="font-size:12.0pt;font-family:"Courier New""
lang="FR-CA">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 style="font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA">Louis
Rochon</span></b><span style="font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA">Senior
Systems Designer<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA">Solacom
Technologies<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA">819 205
8100 ext. 274<o:p></o:p></span></p>
<p class="MsoNormal"><i><span style="font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA"><a
moz-do-not-send="true" href="http://www.solacom.com/"><span
style="color:blue">http://www.solacom.com</span></a></span></i><i><span
style="font-size:13.5pt;font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA"><o:p></o:p></span></i></p>
<p class="MsoNormal"><span style="font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA"> <o:p></o:p></span></p>
<p class="MsoNormal"><b><i><span
style="font-size:7.5pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-CA"
lang="FR-CA">IMPORTANT EMAIL / FAX INFORMATION</span></i></b><span
style="font-size:7.5pt;font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-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
style="font-size:7.5pt;font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA">Thanks !<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:7.5pt;font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA"> <o:p></o:p></span></p>
<p class="MsoNormal"><b><i><span
style="font-size:7.5pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-CA"
lang="FR-CA">MISE EN GARDE CONCERNANT LA CONFIDENTIALITE
DES RENSEIGNEMENTS CONTENUS DANS CE FAX/COURRIEL</span></i></b><span
style="font-size:7.5pt;font-family:"Courier
New";mso-fareast-language:EN-CA" lang="FR-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><i><span
style="font-size:7.0pt;font-family:"Courier
New";color:black;mso-fareast-language:EN-CA"
lang="FR-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
style="font-family:"Courier
New";mso-fareast-language:EN-CA" lang="EN-CA"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>