<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi, <tt>Ehrny!<br>
        <br>
        <tt>You don'<tt>t need to use contexts in the onreply_route<tt>[]<tt>,
                because that r<tt>oute is already ran in the context of
                  the reply message.<br>
                  <br>
                  <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/19/2016 10:40 PM, Ehrny wrote:<br>
    </div>
    <blockquote
      cite="mid:8B36F227BD22B041AEA7015FD914CD9502788AB355@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;}
@font-face
        {font-family:"Times New Roman \, serif";}
/* 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-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";}
@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";}
@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";}
@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">Dear </span><span
            style="color:#1F497D">Răzvan,</span><span
            style="color:#1F497D"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">… I’ve tried to
            add variable to onreply_route[1]<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:windowtext">$var(upstream0)
            = $(&lt;reply&gt;hdr(Via)[0]{via.param,received});<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:windowtext">xlog("upstream0
             =  $var(upstream0) \n");<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">and in the log
            I get critical alert:<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:windowtext">CRITICAL:tm:tm_pv_context_reply:
            no picked branch (-1) for a final response<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>
        <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 class="moz-txt-link-abbreviated" href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>
                [<a class="moz-txt-link-freetext" href="mailto:users-bounces@lists.opensips.org">mailto:users-bounces@lists.opensips.org</a>]
                <b>On Behalf Of </b>Ehrny<br>
                <b>Sent:</b> Saturday, November 19, 2016 2:06 PM<br>
                <b>To:</b> OpenSIPS users mailling list<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"><span style="color:#1F497D">Hi Răzvan,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">I gues so.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D">I’ve got
                 t_on_reply("1");       in the 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">and at the end
            of the script there is:<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]
            {<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">But it doesn’t
            seem to change send_socket back to priv IP addr ((<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>
        <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> Friday, November 18, 2016 12:22 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;"><br>
            <br>
            <tt>Did you try setting the private socket on the reply?</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/17/2016 01:00 AM, 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">Dear Răzvan,</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">Thanks again
              for the prompt help. I was able to change the headers as
              needed but I’m stuck with another problem(</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">I’ve got
              opensips with two Ethernet adapters, eth1 as a private and
              another one eth0 as public.  Opensips works fine when the
              call is coming on the public eth0 and leaves opensips
              through the same public adapter. (All the GWs are behind
              that public eth0 instead of one ). The problem happens
              when the call comes in through the private eth1, please
              see the drawing in attachment.</span><o:p></o:p></p>
          <p class="MsoListParagraph"
            style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span
              style="color:windowtext"><span style="mso-list:Ignore">-<span
                  style="font:7.0pt &quot;Times New Roman&quot;">         
                </span></span></span><!--[endif]--><span
              style="color:#1F497D">sip1.  After I’ve got invite from
              provider on the private eth1 , I send it through the
              public eth0.</span><o:p></o:p></p>
          <p class="MsoListParagraph"
            style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span
              style="color:windowtext"><span style="mso-list:Ignore">-<span
                  style="font:7.0pt &quot;Times New Roman&quot;">         
                </span></span></span><!--[endif]--><span
              style="color:#1F497D">sip2.  I use  
              force_send_socket(udp:PUBLIC_IP:PORT) for the call to be
              able to pass through the opensips and come back from
              external GW (x.x.82.139). I also change SIP Request's URI
              and use uac_replace_to () to change these fields as
              needed. </span><o:p></o:p></p>
          <p class="MsoListParagraph"
            style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span
              style="color:windowtext"><span style="mso-list:Ignore">-<span
                  style="font:7.0pt &quot;Times New Roman&quot;">         
                </span></span></span><!--[endif]--><span
              style="color:#1F497D">sip4.  Opensips has got 180 Ringing
              from external GW (x.x.82.139)
            </span><o:p></o:p></p>
          <p class="MsoListParagraph"
            style="text-indent:-18.0pt;mso-list:l0 level1 lfo2"><!--[if !supportLists]--><span
              style="color:windowtext"><span style="mso-list:Ignore">-<span
                  style="font:7.0pt &quot;Times New Roman&quot;">         
                </span></span></span><!--[endif]--><span
              style="color:#1F497D">sip5.  Opensips tries to send it
              back to originator (10.250.242.74) which is behind private
              NIC eth0 (10.197.26.170)</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">the call can
              not be set up because I send reply from my public eth1</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="font-size:12.0pt">2016-11-16
              18:56:14      : x.x.80.43:5060 -&gt; 10.250.242.74:5060</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="font-size:12.0pt">SIP/2.0 <b>180</b>
              Ringing Via: SIP/2.0/UDP 10.250.242.74:5060;branch=<b>z9hG4bKqci5ec
              </b>Record-Route: &lt;<a moz-do-not-send="true"
href="sip:x.x.80.43;r2=on;lr;ftag=2F81324631353641A405EA00;did=3a2.4667b68">sip:x.x.80.43;r2=on;lr;ftag=<b>2F81324631</b>;did=3a2.4667b68</a>&gt;
              Record-Route: &lt;<a moz-do-not-send="true"
href="sip:10.197.26.170;r2=on;lr;ftag=2F81324631353641A405EA00;did=3a2.4667b68">sip:10.197.26.170;r2=on;lr;ftag=<b>2F81324631</b>;did=3a2.4667b68</a>&gt;
              From: <a moz-do-not-send="true"
                href="sip:300940@domain.com;tag=2F81324631353641A405EA00">sip:300940@domain.com;tag=<b>2F81324631</b></a>
              To:
              <a moz-do-not-send="true"
                href="sip:300905@domain.com:5060;tag=231469dIr894p0D461D0t66">sip:300905@domain.com:5060;tag=231469dIr894</a>
              Call-ID:
              <b>020A3EA03A8@SFESIP4-id1-ext</b> CSeq: 1 INVITE Contact:
              &lt;<a moz-do-not-send="true"
                href="sip:54321@x.x.82.139:5060">sip:54321@x.x.82.139:5060</a>&gt;
            </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’m not sure
              if I do it right way because the packet (sip5) goes to
              10.250.242.74 with the source ip of public eth0 and not
              the one it should pass through to be able to come back.
            </span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">What is the
              right way in my case to get the call through?</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">Thank you for
              all of your help,</span><o:p></o:p></p>
          <p class="MsoNormal"><span style="color:#1F497D">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:windowtext"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:&quot;Times New Roman
              \, serif&quot;"> </span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-bottom:12.0pt"><span
              style="font-size:12.0pt;font-family:&quot;Times New
              Roman&quot;,&quot;serif&quot;"><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 moz-do-not-send="true" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><o:p></o:p></pre>
          <pre><a moz-do-not-send="true" 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:&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>