<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=utf-8">
<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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Times New Roman \, serif";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Courier New \, serif \, serif";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
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;}
p
        {mso-style-priority:99;
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle24
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle25
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle26
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle27
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle28
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle29
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle30
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle31
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle32
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle33
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle34
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle35
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle36
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle37
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle38
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle39
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle40
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle41
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle42
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle43
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle44
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:2.0cm 42.5pt 2.0cm 3.0cm;}
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 bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hi Răzvan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Yes I can. Would you please shoot me e–mail so I’ll be able to send it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks for your kind help,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Ehrny<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><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"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> users-bounces@lists.opensips.org [mailto:users-bounces@lists.opensips.org]
<b>On Behalf Of </b>Razvan Crainea<br>
<b>Sent:</b> Wednesday, November 23, 2016 12:25 PM<br>
<b>To:</b> users@lists.opensips.org<br>
<b>Subject:</b> Re: [OpenSIPS-Users] $ai transformation<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><tt><span style="font-size:10.0pt">Hi, Ehrny!</span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<br>
<tt>I've just tested, and for me it works as it should - the reply goes through the interface it came from. Is there any chance you could send me your script (privately)? Perhaps I can spot some problems by looking at it.</tt><br>
<br>
<tt>Best regards,</tt><br>
<br>
<br>
</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<pre>Răzvan Crainea<o:p></o:p></pre>
<pre>OpenSIPS Solutions<o:p></o:p></pre>
<pre><a href="http://www.opensips-solutions.com">www.opensips-solutions.com</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 11/22/2016 07:45 PM, Ehrny wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:#1F497D">Hi Răzvan,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">I’ve tried both </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> # force_send_socket(udp:10.197.26.170:5060);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">and</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> $fs="udp:10.197.26.170:5060";</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">with no luck ((</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Without any of these lines it doesn’t work either ((</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Ps.. in the main request routing logic I use
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">force_send_socket(udp:x.x.82.39:5060);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Best Regards,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Ehrny</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><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><span style="color:windowtext">From:</span></b><span style="color:windowtext">
<a href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a> [<a href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>]
<b>On Behalf Of </b>Razvan Crainea<br>
<b>Sent:</b> Tuesday, November 22, 2016 8:33 PM<br>
<b>To:</b> <a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] $ai transformation</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><tt><span style="font-size:10.0pt">Hi, Ehrny!</span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<br>
<tt>If you completely remove the force_send_socket() and any $fs settings in onreply_route, is it doing the same thing?</tt><br>
<tt>Normally the reply should be automatically routed through the same interface the request came from. Not sure why your reply goes over the other one. I will try to replicate this and let you know if it works or not.</tt><br>
<br>
<tt>Best regards,</tt><br>
<br>
<br>
<br>
</span><o:p></o:p></p>
<pre>Răzvan Crainea<o:p></o:p></pre>
<pre>OpenSIPS Solutions<o:p></o:p></pre>
<pre><a href="http://www.opensips-solutions.com">www.opensips-solutions.com</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 11/21/2016 06:40 PM, Ehrny wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:#1F497D">Hi Răzvan,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks for your help.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">The call needs to be done through multi homed OpenSIPs (I don’t use mhomed flag)</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Caller -> Carrier1 -> OpenSIPs(eth1)---OpenSIPs(eth0) -> pbx -> Callee</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">$var(upstream1) = $(hdr(Via)[0]{via.host}); returned the IP address I needed
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">OpenSIPs(eth1) has private IP , so on requests I use force_send_socket(udp:OpenSIPs_PUB_IP:5060) to be able to send call to further destinations. When replies are back I need to change send _socket back to
privateIP for the answers to Carrier1.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">I’ve got the IP address of the Carrier1 in the onreply_route .
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">onreply_route[1] {</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">…</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">if ($(var(upstream1)) == "10.250.242.74") {</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> force_send_socket(udp:10.197.26.170:5060);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">} </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">…</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">}</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">It doesn’t seem to change ip address for replies .</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Would you please advise me how to change send_socket in onreply_route ?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Kind regards,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Ehrny</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><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><span style="color:windowtext">From:</span></b><span style="color:windowtext">
<a href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a> [<a href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>]
<b>On Behalf Of </b>Razvan Crainea<br>
<b>Sent:</b> Monday, November 21, 2016 1:32 PM<br>
<b>To:</b> <a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] $ai transformation</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><tt><span style="font-size:10.0pt">Hi, Ehrny!</span></tt><span style="font-size:10.0pt;font-family:"Courier New , serif , serif","serif""><br>
<br>
</span><tt><span style="font-size:10.0pt">You need the IP address of whom? Caller? Callee?</span></tt><span style="font-size:10.0pt;font-family:"Courier New , serif , serif","serif""><br>
</span><tt><span style="font-size:10.0pt">$rd is null because a reply does not have a R-URI. Perhaps the reply doesn't have a received parameter in the reply either, that's why it is empty.</span></tt><span style="font-size:10.0pt;font-family:"Courier New , serif , serif","serif""><br>
<br>
</span><tt><span style="font-size:10.0pt">Best regards,</span></tt><span style="font-size:10.0pt;font-family:"Courier New , serif , serif","serif""><br>
<br>
<br>
<br>
</span><o:p></o:p></p>
<pre>Răzvan Crainea<o:p></o:p></pre>
<pre>OpenSIPS Solutions<o:p></o:p></pre>
<pre><a href="http://www.opensips-solutions.com">www.opensips-solutions.com</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 11/21/2016 12:13 PM, Ehrny wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:#1F497D">Hello Răzvan,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">I need to do some routing in onreply_route[] based on destination IP.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Tried $rd with no avail , it returns null</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">If I get you right regarding context, the var $var(upstream0) = $(hdr(Via)[0]{via.received}); Is empty also.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">What is the right way to get an IP address in replies and do further routing?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Kind regards,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Ehrny</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><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><span style="color:windowtext">From:</span></b><span style="color:windowtext">
<a href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a> [<a href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>]
<b>On Behalf Of </b>Razvan Crainea<br>
<b>Sent:</b> Monday, November 21, 2016 11:50 AM<br>
<b>To:</b> <a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] $ai transformation</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><tt><span style="font-size:10.0pt">Hi, Ehrny!</span></tt><span style="font-size:10.0pt;font-family:"Courier New , serif , serif","serif""><br>
<br>
</span><tt><span style="font-size:10.0pt">You don't need to use contexts in the onreply_route[], because that route is already ran in the context of the reply message.</span></tt><span style="font-size:10.0pt;font-family:"Courier New , serif , serif","serif""><br>
<br>
</span><tt><span style="font-size:10.0pt">Best regards,</span></tt><span style="font-size:10.0pt;font-family:"Courier New , serif , serif","serif""><br>
<br>
<br>
<br>
<br>
</span><o:p></o:p></p>
<pre>Răzvan Crainea<o:p></o:p></pre>
<pre>OpenSIPS Solutions<o:p></o:p></pre>
<pre><a href="http://www.opensips-solutions.com">www.opensips-solutions.com</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman , serif","serif""><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-size:12.0pt;font-family:"Times New Roman , serif","serif""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><br>
<br>
<br>
<o:p></o:p></span></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-size:12.0pt;font-family:"Times New Roman","serif""><o:p> </o:p></span></p>
</div>
</body>
</html>