<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi, Ehrny<tt>!<br>
        <br>
        <tt>If you completely remove the force_send_socket() and any $fs
          settings in onreply_route, <tt>is it doing the same thing?<br>
            <tt>Normally the reply should be automatically routed
              through the same interface the request came from. <tt>Not
                sure why your repl<tt>y goes over the other <tt>one. I
                    will<tt> tr<tt>y to replicate this and let you know
                        <tt>if it <tt>works <tt>or not.</tt></tt></tt></tt></tt></tt></tt></tt></tt><br>
            <br>
            <tt><tt>Best regards,<br>
                <br>
              </tt></tt></tt><tt></tt></tt></tt></tt>
    <pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 11/21/2016 06:40 PM, Ehrny wrote:<br>
    </div>
    <blockquote
      cite="mid:8B36F227BD22B041AEA7015FD914CD9502788AD9EE@JET-EX02.jettel.ru"
      type="cite">
      <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: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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 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";
        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","serif";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New","serif";}
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-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.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;}
/* List Definitions */
@list l0
        {mso-list-id:743376428;
        mso-list-type:hybrid;
        mso-list-template-ids:-76269778 -2130832662 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:2016;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";
        color:windowtext;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New","serif";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        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:-18.0pt;
        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:-18.0pt;
        font-family:"Courier New","serif";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        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:-18.0pt;
        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:-18.0pt;
        font-family:"Courier New","serif";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></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="color:#1F497D">Hi Răzvan,</span><o:p></o:p></p>
        <p class="MsoNormal"><span style="color:#1F497D">Thanks for your
            help.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">The call needs
            to be done through multi homed OpenSIPs  (I don’t use mhomed
            flag)<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Caller  -&gt;
            Carrier1 -&gt; OpenSIPs(eth1)---OpenSIPs(eth0) -&gt; pbx
            -&gt; Callee<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">$var(upstream1)
            = $(hdr(Via)[0]{via.host});     returned the IP  address I
            needed
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></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.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">I’ve got the IP
            address of the Carrier1 in the onreply_route .
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">onreply_route[1]
            {</span><o:p></o:p></p>
        <p class="MsoNormal"><span style="color:#1F497D">…<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">if
            ($(var(upstream1)) == "10.250.242.74") {<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">   
            force_send_socket(udp:10.197.26.170:5060);<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">} <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">…<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">}<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">It doesn’t seem
            to change ip address for replies .<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Would you
            please advise me how to change send_socket in onreply_route
            ?<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">Kind regards,<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>
        <p class="MsoNormal"><span style="color:#1F497D"><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">
                <a moz-do-not-send="true"
                  href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>
                [<a moz-do-not-send="true"
                  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 moz-do-not-send="true"
                  href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><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" style="margin-bottom:12.0pt"><tt><span
              style="font-size:10.0pt">Hi, Ehrny!</span></tt><span
            style="font-size:10.0pt;font-family:&quot;Courier
            New&quot;,&quot;serif&quot;"><br>
            <br>
            <tt>You need the IP address of whom? Caller? Callee?</tt><br>
            <tt>$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.</tt><br>
            <br>
            <tt>Best regards,</tt><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 moz-do-not-send="true" 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 moz-do-not-send="true"
                    href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>
                  [<a moz-do-not-send="true"
                    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 moz-do-not-send="true"
                    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:&quot;Courier
              New&quot;,&quot;serif&quot;"><br>
              <br>
              <tt>You don't need to use contexts in the onreply_route[],
                because that route is already ran in the context of the
                reply message.</tt><br>
              <br>
              <tt>Best regards,</tt><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 moz-do-not-send="true" 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:&quot;Times New
            Roman&quot;,&quot;serif&quot;"><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>