<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=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
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="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="NL">Hi Henning,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL"><o:p> </o:p></span></p>
<p class="MsoNormal">I’ve performed the test also with the latest stable 5.3.2, with the same results.<o:p></o:p></p>
<p class="MsoNormal">As far as I can tell, Kamailio is failing to alter the URI.<o:p></o:p></p>
<p class="MsoNormal">As for debugging mode, I’ve checked the logs, and I think the dialog variables (storing the original uri) are removed as soon as the BYE is received from the callee. For the BYE received by Kamailio from the callee, I do see the uac module
 restoring the original uri, but no log lines for the 200 OK being sent back to the callee.<o:p></o:p></p>
<p class="MsoNormal">However, I’m not sure, since I’m only human and can never be fast enough to check the output of dlg.list command. The dialog stays alive for some time though (after the BYE).
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Below a trimmed version of the flow of messages. Had to replace some values, could have made a mistake somewhere, but I hope you get the picture.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Callee -> Kamailio<o:p></o:p></p>
<p class="MsoNormal">BYE <o:p></o:p></p>
<p class="MsoNormal">To: <sip:anonymous@anonymous.invalid>;tag=U9etF1ae4rtgQ<o:p></o:p></p>
<p class="MsoNormal">From: <sip:1234556789@1.1.1.1:5060>;tag=0d608960<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Kamailio -> Callee<o:p></o:p></p>
<p class="MsoNormal">SIP/2.0 200 OK<o:p></o:p></p>
<p class="MsoNormal">From: <sip:123456789@1.1.1.1:5060>;tag=0d608960<o:p></o:p></p>
<p class="MsoNormal">To: <sip:1111111111@1.1.1.2>;tag=U9etF1ae4rtgQ<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">While writing this mail, I tried to also call the uac_replace_to function right after calling the uac_replace_from function, and now the To header is correctly replaced in the 200OK of the BYE (sent by callee).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I guess since the Callee (UA) switches the From and To header, Kamailio isn’t able to replace it correctly when the callee initiates the BYE request, but this seems to fix it.
<o:p></o:p></p>
<p class="MsoNormal">I’ll have to do some more tests to see if the values are replaced/restored correctly during reINVITEs.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">uac_replace_from("", "sip:anonymous@anonymous.invalid");<o:p></o:p></p>
<p class="MsoNormal">uac_replace_to("", "$tu");<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Grant<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> Henning Westerholt <hw@skalatan.de> <br>
<b>Sent:</b> vrijdag 6 maart 2020 10:24<br>
<b>To:</b> Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org><br>
<b>Cc:</b> Grant Bagdasarian <grant.bagdasarian@cm.com><br>
<b>Subject:</b> RE: uac_replace_from in 200 OK of BYE<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p><span lang="DE" style="color:#CE1126">[EXTERNAL EMAIL] <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="DE">Hi Grant,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Are you saying the Kamailio is failing to alter the URI or does the User Agent does something wrong?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Check the Kamailio log files if maybe the dialog module tracking does not work correctly here. Last year I did some work in this area, in my experience it should work ok also with the dialog module support.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">If you can easily reproduce it, you can also do a test call in debugging mode, you will get more information about the uac logic in the log files.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Last thing – consider upgrading to a 5.2 or 5.3 based release, as 5.1 branch is end of life.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Henning<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-GB">-- <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Henning Westerholt – </span><span lang="DE"><a href="https://skalatan.de/blog/"><span lang="EN-GB">https://skalatan.de/blog/</span></a></span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Kamailio services – </span><span lang="DE"><a href="https://gilawa.com/"><span lang="EN-GB">https://gilawa.com</span></a>
</span><span lang="EN-GB"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b><span lang="DE">From:</span></b><span lang="DE"> sr-users <<a href="mailto:sr-users-bounces@lists.kamailio.org">sr-users-bounces@lists.kamailio.org</a>>
<b>On Behalf Of </b>Grant Bagdasarian<br>
<b>Sent:</b> Thursday, March 5, 2020 3:13 PM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List <<a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>><br>
<b>Subject:</b> [SR-Users] uac_replace_from in 200 OK of BYE<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt">Hello,<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">We’ve been using the uac_replace_from function to anonymize the From header to
<a href="mailto:anonymous@anonymous.invalid">anonymous@anonymous.invalid</a>. The uac module makes use of the dialog module for restoring the original URI.<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">Everything works fine, except when the callee sends the BYE request (replaced uri is present in To header): the 200 OK received by the callee of the BYE suddenly contains the original URI in the To header.<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">We’re running Kamailio 5.1. <o:p>
</o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">Is this a known bug or limitation of the uac module?
<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">Any way to have this replaced correctly (preferably automatically by uac module)?<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">Regards,<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt">Grant<o:p></o:p></p>
</div>
</div>
</body>
</html>