<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Mark,<br>
      <br>
      Drouting is pushing the the GW IP into the host/domain part of the
      RURI, so you can "see" it via $rd (after do_routing()). Also your
      scripting seems logic.<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Summit 2019
  <a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2019Amsterdam/">https://www.opensips.org/events/Summit-2019Amsterdam/</a>
</pre>
    <div class="moz-cite-prefix">On 03/05/2019 06:00 PM, Mark Farmer
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOvQDesNmHn=atw1Zh3qC5AXh7f9Z+PEUHuD9cFkKxZhtEksvA@mail.gmail.com">
      <div dir="ltr">
        <div dir="ltr">Thanks for the reply.
          <div><br>
          </div>
          <div>This actually stems from an earlier post regarding
            rtpproxy. Within that logic I am testing $si which is fine
            but I also need to test the destination GW IP hence $dd but
            the variable is null at that point so I'm thinking I need to
            grab the destination GW IP address beforehand and store it
            for later use, not nessesarily $dd - just something I can
            test later.</div>
          <div><br>
          </div>
          <div>I've just changed my route logic, see below, does this
            make sense?</div>
          <div><br>
          </div>
          <div>--------</div>
          <div>
            <div>route[RTPPROXY] {</div>
            <div><br>
            </div>
            <div>        if (is_method("BYE|CANCEL")) {</div>
            <div>                rtpproxy_unforce();</div>
            <div>        }</div>
            <div><br>
            </div>
            <div>            if (is_method("INVITE")) {</div>
            <div>                xlog("Processing INVITE);</div>
            <div>                if (is_from_gw("1") &&
              goes_to_gw("2")) {</div>
            <div>                xlog("Internal to External");</div>
            <div>                    setflag(INT_EXT);</div>
            <div>                } else if (is_from_gw("2") &&
              goes_to_gw("3")) {</div>
            <div>                        xlog("External to 3rd Party");</div>
            <div>                        setflag(EXT_PCI);</div>
            <div>                } else if (is_from_gw("3") &&
              goes_to_gw("1")) {</div>
            <div>                        xlog("3rd Party to Internal");</div>
            <div>                        setflag(PCI_INT);</div>
            <div>                } else {</div>
            <div>                        xlog("External to Internal");</div>
            <div>                        setflag(EXT_INT);</div>
            <div>                }</div>
            <div>        }</div>
            <div><br>
            </div>
            <div>        if (isflagset(INT_EXT)) {</div>
            <div>                        rtpproxy_offer("corwfei");</div>
            <div>                } else if (isflagset(EXT_PCI)) {</div>
            <div>                        rtpproxy_offer("corwfie");</div>
            <div>                } else if (isflagset(PCI_INT)) {</div>
            <div>                        rtpproxy_offer("corwfii");</div>
            <div>                } else if (isflagset(EXT_INT)) {</div>
            <div>                        rtpproxy_offer("corwfie");</div>
            <div>                }</div>
            <div>}</div>
          </div>
          <div>-----</div>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Tue, 5 Mar 2019 at 15:13,
          Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org"
            moz-do-not-send="true">bogdan@opensips.org</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF"> <tt>Hi Mark,<br>
              <br>
              The Dynamic Routing module is doing routing based on
              prefix/number - that's what the engine knows. Of course
              you can combine with source IP by translating/mapping
              groups of src IPs into routing groups.<br>
              <br>
              Not sure what you are expect the module to do, if you want
              to route only based on SRC and DST IPs....In order to have
              drouting setting a destination GW, you need to do the
              actual routing (via do_routing()).<br>
              <br>
              Regards,<br>
            </tt>
            <pre class="gmail-m_5757056941577359189moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="gmail-m_5757056941577359189moz-txt-link-freetext" href="https://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>
OpenSIPS Summit 2019
  <a class="gmail-m_5757056941577359189moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2019Amsterdam/" target="_blank" moz-do-not-send="true">https://www.opensips.org/events/Summit-2019Amsterdam/</a>
</pre>
            <div class="gmail-m_5757056941577359189moz-cite-prefix">On
              03/05/2019 04:01 PM, Mark Farmer wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div dir="ltr">Hi all
                  <div><br>
                  </div>
                  <div>I'm using drouting and I need to route calls to
                    various Gateway types based on $si and destination
                    IP but it seems that $dd is not known at this point.</div>
                  <div>How can I get the IP address of the destination
                    gateway from the drouting database and assign it to
                    a usable variable?</div>
                  <div><br>
                  </div>
                  <div>I'm thinking something like this:</div>
                  <div><br>
                  </div>
                  <div>
                    <div>if ($si =~"^(10\.*)" &&
                      goes_to_gw("1")) {</div>
                    <div><span class="gmail-m_5757056941577359189gmail-Apple-tab-span" style="white-space:pre-wrap">            </span>$dd
                      = ???????</div>
                  </div>
                  <div>                }</div>
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                  <div>Many thanks</div>
                  <div>Mark.</div>
                  <div><br clear="all">
                    <div><br>
                    </div>
                    -- <br>
                    <div dir="ltr"
                      class="gmail-m_5757056941577359189gmail_signature">Mark
                      Farmer<br>
                      <a href="mailto:farmorg@gmail.com" target="_blank"
                        moz-do-not-send="true">farmorg@gmail.com</a></div>
                  </div>
                </div>
              </div>
              <br>
              <fieldset
                class="gmail-m_5757056941577359189mimeAttachmentHeader"></fieldset>
              <br>
              <pre>_______________________________________________
Users mailing list
<a class="gmail-m_5757056941577359189moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a class="gmail-m_5757056941577359189moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail_signature">Mark Farmer<br>
        <a href="mailto:farmorg@gmail.com" target="_blank"
          moz-do-not-send="true">farmorg@gmail.com</a></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>