<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
My apologies, I seem to have <span style="background-color: rgb(255, 255, 0);">​</span>posted an incomplete code segment. I only seem to have issues when it comes to replacing $fU (before using uac_replace_from) - the same action on $rU seems to work properly.
 In the below situation, the $fU variable should be updated with the plus, but the $avp(uacreplacefromdisplay) variable has the value of the original $fU, not the updated one. Is this practice redundant, and should actions on $fU and $rU be avoided in favor
 of uac_replace_to/uac_replace_from?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<p class="p1" style="margin:0px;font:12px Menlo;color:rgb(242, 78, 55);background-color:rgba(53, 53, 76, 0.87)">
<br>
</p>
<p class="p1" style="margin:0px;font:12px Menlo;color:rgb(242, 78, 55);background-color:rgba(53, 53, 76, 0.87)">
<span class="s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(255, 255, 255)"><span class="Apple-converted-space">           
</span>$fU =</span><span class="s2" style="font-variant-ligatures:no-common-ligatures"> "+" + $avp(src=>countrycode) + $fU</span><span class="s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0, 0, 138)">;</span></p>
<p class="p2" style="margin:0px;font:12px Menlo;color:rgb(255, 255, 255);background-color:rgba(53, 53, 76, 0.87)">
<span class="s2" style="font-variant-ligatures:no-common-ligatures"><span class="Apple-converted-space">           
</span>$avp(uacreplacefromdisplay) =</span><span class="s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(242, 78, 55)"> $fU</span><span class="s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0, 0, 138)">;</span></p>
<p class="p2" style="margin:0px;font:12px Menlo;color:rgb(255, 255, 255);background-color:rgba(53, 53, 76, 0.87)">
<span class="s2" style="font-variant-ligatures:no-common-ligatures"><span class="Apple-converted-space">           
</span>$avp(uacreplacefromuri) =</span><span class="s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(242, 78, 55)"> $fu</span><span class="s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0, 0, 138)">;</span></p>
<p class="p2" style="margin:0px;font:12px Menlo;color:rgb(255, 255, 255);background-color:rgba(53, 53, 76, 0.87)">
<span class="s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0, 0, 138)"><br>
</span></p>
<p class="p2" style="margin:0px;font:12px Menlo;color:rgb(255, 255, 255);background-color:rgba(53, 53, 76, 0.87)">
<span class="s2" style="font-variant-ligatures:no-common-ligatures"><span class="Apple-converted-space">       
</span>if ($avp(uacreplacefromdisplay) && $avp(uacreplacefromuri)) {</span></p>
<p class="p2" style="margin:0px;font:12px Menlo;color:rgb(255, 255, 255);background-color:rgba(53, 53, 76, 0.87)">
<span class="s2" style="font-variant-ligatures:no-common-ligatures"><span class="Apple-converted-space">               
</span>uac_replace_from("$avp(uacreplacefromdisplay)","$avp(uacreplacefromuri)")</span><span class="s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0, 0, 138)">;</span></p>
<p class="p2" style="margin:0px;font:12px Menlo;color:rgb(255, 255, 255);background-color:rgba(53, 53, 76, 0.87)">
<span class="s2" style="font-variant-ligatures:no-common-ligatures"><span class="Apple-converted-space">               
</span>$avp(uacreplacefromdisplay</span><span class="s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(75, 213, 53)">[*]</span><span class="s2" style="font-variant-ligatures:no-common-ligatures">)=</span><span class="s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(242, 78, 55)">$null</span><span class="s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0, 0, 138)">;</span></p>
<p class="p2" style="margin:0px;font:12px Menlo;color:rgb(255, 255, 255);background-color:rgba(53, 53, 76, 0.87)">
<span class="s2" style="font-variant-ligatures:no-common-ligatures"><span class="Apple-converted-space">               
</span>$avp(uacreplacefromuri</span><span class="s6" style="font-variant-ligatures:no-common-ligatures;color:rgb(75, 213, 53)">[*]</span><span class="s2" style="font-variant-ligatures:no-common-ligatures">)=</span><span class="s4" style="font-variant-ligatures:no-common-ligatures;color:rgb(242, 78, 55)">$null</span><span class="s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0, 0, 138)">;</span></p>
<p class="p2" style="margin:0px;font:12px Menlo;color:rgb(255, 255, 255);background-color:rgba(53, 53, 76, 0.87)">
<span class="s2" style="font-variant-ligatures:no-common-ligatures"><span class="Apple-converted-space">       
</span>}</span></p>
<p class="p5" style="margin:0px;font:12px Menlo;color:rgb(255, 255, 255);background-color:rgba(53, 53, 76, 0.87);min-height:14px">
<span class="s2" style="font-variant-ligatures:no-common-ligatures"></span><br>
</p>
<p class="p2" style="margin:0px;font:12px Menlo;color:rgb(255, 255, 255);background-color:rgba(53, 53, 76, 0.87)">
<span class="s2" style="font-variant-ligatures:no-common-ligatures"><span class="Apple-converted-space">           
</span>xlog("$ci - converting domestic caller id number to $fU ($fu) - $avp(uacreplacefromdisplay) $avp(uacreplacefromuri)")</span><span class="s3" style="font-variant-ligatures:no-common-ligatures;color:rgb(0, 0, 138)">;<br>
</span></p>
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you so much for your help!</div>
<div>
<div id="Signature">
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="color:rgb(0,0,0)">
<div class="OutlineElement Ltr SCXW197032541" style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; margin:0px; padding:0px; overflow:visible; clear:both">
</div>
<p style="margin-top: 0px; margin-bottom: 0px;font-family:Calibri,Helvetica,sans-serif; font-size:12pt">
</p>
</div>
</div>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Henning Westerholt <hw@skalatan.de><br>
<b>Sent:</b> Wednesday, July 28, 2021 1:29 PM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org><br>
<b>Cc:</b> Melissa Frasik <melissa.frasik@dicecorp.com><br>
<b>Subject:</b> RE: Guidelines on E164 conversions</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
span.x_E-MailFormatvorlage19
        {font-family:"Calibri",sans-serif;
        color:windowtext}
.x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:70.85pt 70.85pt 2.0cm 70.85pt}
div.x_WordSection1
        {}
-->
</style>
<div lang="DE" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span lang="EN-GB" style="">Hello,</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style=""> </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">If you want to change the From (or To) header content, you should use the “uac” modules replace_from/_to functions. They will transparently make sure that both end-points get the correct header content.</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style=""> </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">Cheers,</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style=""> </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">Henning</span></p>
<div>
<p class="x_MsoNormal"><span style=""> </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">-- </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">Henning Westerholt – </span><span style=""><a href="https://skalatan.de/blog/"><span lang="EN-GB" style="color:#0563C1">https://skalatan.de/blog/</span></a></span><span lang="EN-GB" style=""></span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">Kamailio services – </span><span style=""><a href="https://gilawa.com/"><span lang="EN-GB" style="color:#0563C1">https://gilawa.com</span></a></span><span style="">
<span lang="EN-GB"></span></span></p>
</div>
<p class="x_MsoNormal"><span lang="EN-GB"> </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style=""> </span></p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="x_MsoNormal" style="margin-left:35.4pt"><b>From:</b> sr-users <sr-users-bounces@lists.kamailio.org>
<b>On Behalf Of </b>Melissa Frasik<br>
<b>Sent:</b> Tuesday, July 27, 2021 11:26 PM<br>
<b>To:</b> sr-users@lists.kamailio.org<br>
<b>Subject:</b> [SR-Users] Guidelines on E164 conversions</p>
</div>
</div>
<p class="x_MsoNormal" style="margin-left:35.4pt"> </p>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">Hi all,</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">I'm running into some issues with E164 conversions and was wondering if there was a decent standardized method for conversions. Conversions using $rU seem to be working
 great, but $fU is behaving badly. This is what I have so far:</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black"><br>
    xlog("$ci - caller id was $avp(src=>callerid)"); </span></p>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">    if($avp(src=>callerid) =~ "^\+"){</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">            xlog("$ci - caller id already E164");</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">    }else if($(rU{s.substr,0,$(avp(src=>countrycode){s.len})}) == $avp(src=>countrycode)){</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">            $avp(src=>callerid) = "+" + $avp(src=>callerid);</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">            $fU = $avp(src=>callerid);</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">            $avp(uacreplacefromdisplay) = $fU;</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">            $avp(uacreplacefromuri) = $fu;</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">            xlog("$ci - Adding plus to make caller id e164");</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">    }else{</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">            $fU = "+" + $avp(src=>countrycode) + $fU;</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">            $avp(uacreplacefromdisplay) = $fU;</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">            $avp(uacreplacefromuri) = $fu;</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">            xlog("$ci - converting domestic caller id number to $fU ($fu) - $avp(uacreplacefromdisplay) $avp(uacreplacefromuri)");</span></p>
</div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">    }</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">Previously, I'd found a suggestion mentioning using uac_replace_from in the route[RELAY] (which is the purpose of the uacreplacefrom avps), but $fU does not appear
 to be changing its value. Is there something I'm doing incorrectly?</span></p>
</div>
</div>
</div>
</body>
</html>