<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:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mv="http://macVmlSchemaUri" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Courier New";
panose-1:2 7 3 9 2 2 5 2 4 4;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@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:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:Calibri;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:Calibri;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Courier;}
span.EmailStyle20
{mso-style-type:personal;
font-family:Calibri;
color:windowtext;}
span.EmailStyle21
{mso-style-type:personal;
font-family:Calibri;
color:windowtext;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:Calibri;
color:windowtext;}
span.msoIns
{mso-style-type:export-only;
mso-style-name:"";
text-decoration:underline;
color:teal;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1878198596;
mso-list-type:hybrid;
mso-list-template-ids:1154257720 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Wingdings;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Bogdan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I have been able to reproduce this locally now. The piece that was missing is that the Request URI must already have URI parameters on it. If it has both URI and user parameters, the call to route_to_carrier
(and possibly do_routing) replaces all of the URI parameters with the user parameter(s).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Original $ru: <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">sip:+15555551212;npdi=yes@gw2.com;transport=udp;user=phone<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">After call to route_to_carrier:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">sip:+15555551212@gw2.com;npdi=yes<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">After further testing, it appears this behavior is not restricted to the Dynamic Routing module after all. Simply modifying $ru while both user and URI parameters are present causes the issue.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Original $ru: <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">sip:+15555551212;npdi=yes@gw2.com;transport=udp;user=phone<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Perform this action:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">$rU = $rU + “;rn=+15555550000”;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Resultant $ru:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">sip:+15555551212;rn=+15555550000@gw2.com;npdi=yes<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="text-autospace:none"><span style="color:#FC3619">Ben Newlin</span><span style="font-family:"Times New Roman""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;color:#838487">Lead Voice Network Engineer, PureCloud</span><span style="font-family:"Times New Roman""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt"><img width="291" height="9" id="_x0000_i1033" src="cid:image001.png@01D2F1B3.A0646620"></span><span style="font-family:"Times New Roman""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:6.0pt;color:#FC3619"> </span></b><span style="font-family:"Times New Roman""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:6.0pt;color:#FC3619">O</span><span style="font-size:10.0pt">
<span style="color:#838487">+1 317.957.1009</span></span><span style="font-family:"Times New Roman""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><u><span style="font-size:10.0pt;color:#0B4CB4"><a href="mailto:ben.newlin@genesys.com">ben.newlin@genesys.com</a></span></u><span style="font-family:"Times New Roman""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt"><img border="0" width="291" height="9" id="_x0000_i1032" src="cid:image001.png@01D2F1B3.A0646620"></span><span style="font-family:"Times New Roman""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><a href="http://www.genesys.com/"><span style="color:#838487;text-decoration:none"><img border="0" width="143" height="53" id="_x0000_i1031" src="cid:image002.png@01D2F1B3.A0646620"></span></a><span style="font-family:"Times New Roman""><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><a href="https://twitter.com/Genesys"><span style="color:#838487;text-decoration:none"><img border="0" width="25" height="23" id="_x0000_i1030" src="cid:image003.png@01D2F1B3.A0646620"></span></a><a href="http://www.linkedin.com/company/601919?trk=tyah"><span style="color:#838487;text-decoration:none"><img border="0" width="25" height="23" id="_x0000_i1029" src="cid:image004.png@01D2F1B3.A0646620"></span></a><a href="https://plus.google.com/+Genesyslab?rel=publisher"><span style="color:#838487;text-decoration:none"><img border="0" width="23" height="23" id="_x0000_i1028" src="cid:image005.png@01D2F1B3.A0646620"></span></a><a href="https://www.facebook.com/Genesys/"><span style="color:#838487;text-decoration:none"><img border="0" width="25" height="23" id="_x0000_i1027" src="cid:image006.png@01D2F1B3.A0646620"></span></a><a href="https://www.youtube.com/Genesys"><span style="color:#838487;text-decoration:none"><img border="0" width="25" height="23" id="_x0000_i1026" src="cid:image007.png@01D2F1B3.A0646620"></span></a><a href="http://blog.genesys.com/"><span style="color:#838487;text-decoration:none"><img border="0" width="23" height="23" id="_x0000_i1025" src="cid:image008.png@01D2F1B3.A0646620"></span></a><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><span style="color:black">Users <users-bounces@lists.opensips.org> on behalf of Ben Newlin <Ben.Newlin@genesys.com><br>
<b>Reply-To: </b>OpenSIPS users mailling list <users@lists.opensips.org><br>
<b>Date: </b>Friday, June 30, 2017 at 10:47 AM<br>
<b>To: </b>Bogdan-Andrei Iancu <bogdan@opensips.org>, OpenSIPS users mailling list <users@lists.opensips.org><br>
<b>Subject: </b>Re: [OpenSIPS-Users] SIP URI User Parameters<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Times New Roman""><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt">Bogdan,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Sorry for the delayed response, I am having some trouble reproducing this in a local test environment. Currently it is only occurring in our live environment. I do have some clarifications and answers to your
questions:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style="font-size:11.0pt">The npdi parameter is not present in $ru in the failure route when the response is 500. It is present when the response is 503 or 408. I haven’t tested any other responses. This is not terribly important
to my issue, simply an observation.<br>
<br>
<br>
</span><o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style="font-size:11.0pt">We are sometimes using do_routing to populate a list of carriers, but other times we get the list from our own DB query. We use route_to_carrier to send the call to each carrier in sequence. This
is because we don’t always use do_routing, but also because we wish to skip to the next carrier, not just the next gateway, on certain response codes and the normal do_routing mechanism doesn’t allow that.<br>
<br>
<br>
</span><o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style="font-size:11.0pt">The issue actually does not happen when use_next_gw is called. I was wrong about that. You were right that seems to be a straight URI copy. The issue occurs when we skip use_next_gw or there are
no gateways left and we call route_to_carrier for the next carrier with the parameter present in $ru.<br>
<br>
<br>
</span><o:p></o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in;mso-list:l0 level1 lfo2"><![if !supportLists]><span style="font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style="font-size:11.0pt">I printed out the dr_ruri avp after the call to route_to_carrier and it shows the npdi parameter moved to the end, not after the user:<br>
“sip:+15555551212@gw2.com;npdi=yes”</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Also, I should have mentioned that we are running 1.11.11. I’m still working to try to reproduce locally.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Ben Newlin</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><span style="color:black">Bogdan-Andrei Iancu <bogdan@opensips.org><br>
<b>Date: </b>Thursday, June 29, 2017 at 4:38 AM<br>
<b>To: </b>OpenSIPS users mailling list <users@lists.opensips.org>, Ben Newlin <Ben.Newlin@genesys.com><br>
<b>Subject: </b>Re: [OpenSIPS-Users] SIP URI User Parameters</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Times New Roman""> </span><o:p></o:p></p>
</div>
<p class="MsoNormal">Hello Ben<br>
<br>
I understand you add the npdi useraname parameter after performing the initial do_routing() - if you do it in request or branch route is not relevant (for RURI changes) as RURI is anyhow a per-branch value.<br>
In failure route, when resuming, you will get the RURI of the winning branch ( the one which was selected to be sent back to caller), so you see the npdi param.
<br>
<br>
So far so good. And now you do use_next_gw() in failure route and you get "<span style="font-size:11.0pt"><a href="sip:+15555551212@gw2.com;npdi">sip:+15555551212@gw2.com;npdi</a>" directly, without any another npdi addition ? I'm asking, as use_next_gw() does
a full RURI replacement (it doesn;t care what is the existing RURI).<br>
<br>
Could you also do an<br>
xlog("DR ruris are <$(avp(___dr_ruri__)[*])>\n");<br>
right after do_routing() ?<br>
<br>
Regards,<br>
<br>
<br>
</span><o:p></o:p></p>
<pre>Bogdan-Andrei Iancu<o:p></o:p></pre>
<pre> OpenSIPS Founder and Developer<o:p></o:p></pre>
<pre> <a href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
<pre> <o:p></o:p></pre>
<pre>OpenSIPS Bootcamp 2017, Houston, US<o:p></o:p></pre>
<pre> <a href="http://opensips.org/training/OpenSIPS_Bootcamp_2017.html">http://opensips.org/training/OpenSIPS_Bootcamp_2017.html</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 06/28/2017 11:41 PM, Ben Newlin wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt">Hi,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">We have run into an issue with OpenSIPs’ handling of user parameters in SIP URIs with Dynamic Routing module. When a parameter is added to a SIP URI user part, any subsequent modification of the URI by DR
module results in the parameter being moved to be a URI parameter. </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">For example, starting with $ru of “<a href="sip:+15555551212@gw1.com”">sip:+15555551212@gw1.com”</a>, if we modify it this way:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">$rU = $rU + “;npdi”;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">then we get a new $ru of “<a href="sip:+15555551212;npdi@gw1.com”">sip:+15555551212;npdi@gw1.com”</a>.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">We send this call out and if it returns an error we want to use the next available gateway.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">The Request URI in the failure route is still “<a href="sip:+15555551212;npdi@gw1.com”">sip:+15555551212;npdi@gw1.com”</a>.
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Note: this is the case even when the “;npdi” parameter was added in a branch route, which I didn’t expect. I thought changes made in a branch route were isolated to that branch.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Now from the failure route when we call use_next_gw the npdi parameter is moved and the URI is now “<a href="sip:+15555551212@gw2.com;npdi”">sip:+15555551212@gw2.com;npdi”</a>. This is not correct.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Is there some other way to properly manipulate SIP URI user parameters or is this a bug?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thanks,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Ben Newlin</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman""><br>
<br>
<br>
<br>
</span><o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Users mailing list<o:p></o:p></pre>
<pre><a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><o:p></o:p></pre>
<pre><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span style="font-family:"Times New Roman""><br>
<br>
<br>
</span><o:p></o:p></p>
</div>
</body>
</html>