<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><tt>Hi Kurtis,<br>
        <br>
        Removing the routeid value does not affect at all the rule
        matching (routeid is not involved in the matching logic at all,
        it is something to be used after the matching was done).<br>
        So, check the rules you have in DR (to be sure they serve your
        scope) - also check the debug log of OpenSIPS to understand why
        the matching fails (if still the case).<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="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
      On 17.06.2014 03:18, Kurtis Heimerl wrote:<br>
    </div>
    <blockquote
cite="mid:CACyT-3=No=Ec8JvCXYo9py5Z39tku6Ys19=_PZ7DdydoWU_w0Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello! 
        <div><br>
        </div>
        <div>Here's the followup issue. Removing the routeid from the
          rule is causing opensips to return a 503 "No rules matching
          the URI" code to the Invite. It does not repeat the invite
          though, so this may be progress. </div>
        <div><br>
        </div>
        <div>Here's the cmd for adding the rule that I'm using:</div>
        <div><br>
        </div>
        <div>
          <div>
            <div>opensipsctl dr addrule 0 $MSISDN  '' 1 '' 1 '' 'Route
              to testbox'<br>
            </div>
          </div>
        </div>
        <div><br>
        </div>
        <div>Gateway 1 is defined correctly as:</div>
        <div>
          <div>
            <div>pgsql_query: /usr/bin/psql  -A -q -t -P fieldsep='<span
                class="Apple-tab-span" style="white-space:pre"> </span>'
              -h localhost -U postgres opensips -c 'select * FROM
              dr_gateways ORDER BY gwid; '</div>
          </div>
          <div>6<span class="Apple-tab-span" style="white-space:pre"> </span>1<span
              class="Apple-tab-span" style="white-space:pre"> </span>1<span
              class="Apple-tab-span" style="white-space:pre"> </span>$SERVERNAME<span
              class="Apple-tab-span" style="white-space:pre"> </span>0<span
              class="Apple-tab-span" style="white-space:pre"> </span>TEST<span
              class="Apple-tab-span" style="white-space:pre"> </span>2<span
              class="Apple-tab-span" style="white-space:pre"> </span>0<span
              class="Apple-tab-span" style="white-space:pre"> </span>test
            box</div>
        </div>
        <div><br>
        </div>
        <div>So it seems routeid must be set in order to forward the
          message?</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Sun, Jun 15, 2014 at 9:09 PM, Kurtis
          Heimerl <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:kheimerl@endaga.com" target="_blank">kheimerl@endaga.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Hi Bogdan,
              <div><br>
              </div>
              <div>This was indeed the issue. I guess setting a routeid
                *and* a gw causes it to send out route in two different
                directions?</div>
              <div><br>
              </div>
              <div>Anyhow, thanks so much for the direction. I'm sure
                I'll come back with new issues.</div>
            </div>
            <div class="HOEnZb">
              <div class="h5">
                <div class="gmail_extra"><br>
                  <br>
                  <div class="gmail_quote">On Wed, Jun 11, 2014 at 10:48
                    PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a
                        moz-do-not-send="true"
                        href="mailto:bogdan@opensips.org"
                        target="_blank">bogdan@opensips.org</a>&gt;</span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div bgcolor="#FFFFFF" text="#000000">
                        <div><tt>Hi Kurtis,<br>
                            <br>
                            Do you use any routeid in the rule
                            definitions ? maybe that's the looping
                            cause.....Be sure it is set to NULL.<br>
                            <br>
                            Regards,<br>
                          </tt>
                          <div>
                            <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
                          </div>
                          <div>
                            <div> On 12.06.2014 03:14, Kurtis Heimerl
                              wrote:<br>
                            </div>
                          </div>
                        </div>
                        <div>
                          <div>
                            <blockquote type="cite">
                              <div dir="ltr">Thanks so much Bogdan, that
                                line is super helpful. 
                                <div><br>
                                </div>
                                <div>I can't yet figure out why it's
                                  looping though. Here's what the log
                                  now shows:</div>
                                <div><br>
                                </div>
                                <div>
                                  <div>Jun 11 23:59:32 ip-172-31-27-53
                                    /usr/sbin/opensips[5836]: [Script
                                    Trace][line 149][me][route 4] -&gt;
                                    (INVITE from IP, ruri=sip:NAME@HOST)</div>
                                  <div>Jun 11 23:59:32 ip-172-31-27-53
                                    /usr/sbin/opensips[5836]: [Script
                                    Trace][line 273][me][core if] -&gt;
                                    (INVITE from IP, ruri=sip:NAME@HOST)</div>
                                  <div>Jun 11 23:59:32 ip-172-31-27-53
                                    /usr/sbin/opensips[5836]: [Script
                                    Trace][line 270][me][module
                                    do_routing] -&gt; (INVITE from IP,
                                    ruri=sip:NAME@HOST)</div>
                                  <div>Jun 11 23:59:32 ip-172-31-27-53
                                    /usr/sbin/opensips[5836]: [Script
                                    Trace][line 273][me][core if] -&gt;
                                    (INVITE from IP, ruri=sip:NAME@HOST)</div>
                                  <div>Jun 11 23:59:32 ip-172-31-27-53
                                    /usr/sbin/opensips[5836]: [Script
                                    Trace][line 270][me][module
                                    do_routing] -&gt; (INVITE from IP,
                                    ruri=sip:NAME@HOST)</div>
                                </div>
                                <div>... (repeated dozens of times)</div>
                                <div>
                                  <div>Jun 11 23:59:32 ip-172-31-27-53
                                    /usr/sbin/opensips[5836]:
                                    CRITICAL:core:eval_expr: too many
                                    expressions (101)</div>
                                  <div>Jun 11 23:59:32 ip-172-31-27-53
                                    /usr/sbin/opensips[5836]:
                                    WARNING:core:do_action: error in
                                    expression (l=273)</div>
                                </div>
                                <div><br>
                                </div>
                                <div>This seems to indicate an issue
                                  with my routing logic. However, I
                                  can't see where I'm infinitely
                                  recursing. Here's the dialplan:</div>
                                <div><br>
                                </div>
                                <div>
                                  <div>route{</div>
                                  <div>        script_trace( 1, "$rm
                                    from $si, ruri=$ru", "me");</div>
                                  <div><br>
                                  </div>
                                  <div>        if
                                    (!mf_process_maxfwd_header("70")) {</div>
                                  <div>               
                                    sl_send_reply("483","Too Many
                                    Hops");</div>
                                  <div>                exit;</div>
                                  <div>        }</div>
                                  <div> <br>
                                  </div>
                                  <div>        #kurtis                  
                                                                       
                                           </div>
                                  <div>        if (is_method("INVITE"))
                                    {</div>
                                  <div>           setflag(1); # do
                                    accounting                          
                                                </div>
                                  <div>           route(4); # Call our
                                    dynamic route.                      
                                            </div>
                                  <div>        }</div>
                                  <div><br>
                                  </div>
                                  <div>        if (has_totag()) {</div>
                                </div>
                                <div>... (default from here)</div>
                                <div><br>
                                </div>
                                <div> and my custom route 4, which i've
                                  tried to poke at to remove the
                                  recursion, but failed. </div>
                                <div><br>
                                </div>
                                <div>
                                  <div>route[4] {</div>
                                  <div>  if (!do_routing("0")) {</div>
                                  <div>    send_reply("503", "No Rules
                                    matching the URI");</div>
                                  <div>  }</div>
                                  <div>  exit;</div>
                                  <div><br>
                                  </div>
                                  <div> #  route(relay);                
                                                                       
                                            </div>
                                  <div>}</div>
                                </div>
                                <div><br>
                                </div>
                                <div>Any guidance? I can't see how I'm
                                  causing it to recurse, but I've done
                                  this in opensips before so I'm not
                                  surprised. </div>
                                <div><br>
                                </div>
                                <div>Thanks for all of your help!</div>
                                <div><br>
                                </div>
                                <div><br>
                                </div>
                              </div>
                              <div class="gmail_extra"><br>
                                <br>
                                <div class="gmail_quote">On Tue, Jun 10,
                                  2014 at 6:08 AM, Bogdan-Andrei Iancu <span
                                    dir="ltr">&lt;<a
                                      moz-do-not-send="true"
                                      href="mailto:bogdan@opensips.org"
                                      target="_blank">bogdan@opensips.org</a>&gt;</span>
                                  wrote:<br>
                                  <blockquote class="gmail_quote"
                                    style="margin:0 0 0
                                    .8ex;border-left:1px #ccc
                                    solid;padding-left:1ex">
                                    <div bgcolor="#FFFFFF"
                                      text="#000000">
                                      <div><tt>Hi Kurtis,<br>
                                          <br>
                                          On a first look, it seems your
                                          script doing doing a kind of
                                          looping (maybe a recursive
                                          call of a route or so) - at
                                          least this is what the log
                                          errors tell. <br>
                                          <br>
                                          You can try the script_trace()
                                          function to understand how
                                          your script is executed:<br>
                                              <a moz-do-not-send="true"
href="http://www.opensips.org/Documentation/Script-CoreFunctions-1-11#toc42"
                                            target="_blank">http://www.opensips.org/Documentation/Script-CoreFunctions-1-11#toc42</a><br>
                                          <br>
                                          Regards,<br>
                                        </tt>
                                        <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
                                        <div>
                                          <div> On 09.06.2014 01:37,
                                            Kurtis Heimerl wrote:<br>
                                          </div>
                                        </div>
                                      </div>
                                      <blockquote type="cite">
                                        <div>
                                          <div>
                                            <div dir="ltr">Hello mailing
                                              list,
                                              <div><br>
                                              </div>
                                              <div>I've been working on
                                                setting up OpenSIPS on
                                                an EC2 instance, routing
                                                traffic between nexmo
                                                and our gateway, a FS
                                                instance on a public IP.
                                                I was kindly directed to
                                                an earlier thread on
                                                OpenSIPs and EC2 (<a
                                                  moz-do-not-send="true"
href="http://lists.opensips.org/pipermail/users/2010-April/012393.html"
                                                  target="_blank">http://lists.opensips.org/pipermail/users/2010-April/012393.html</a>)
                                                but have come to an
                                                issue I think is
                                                unrelated. </div>
                                              <div><br>
                                              </div>
                                              <div>Here's the current
                                                architecture:</div>
                                              <div>Nexmo -&gt; EC2 NAT
                                                -&gt; OpenSIPs -&gt; EC2
                                                NAT -&gt; FS</div>
                                              <div><br>
                                              </div>
                                              <div>I started with a
                                                walkthrough on the
                                                website (<a
                                                  moz-do-not-send="true"
href="http://www.unixnews.net/2010/09/dynamic-routing-with-opensips.html"
                                                  target="_blank">http://www.unixnews.net/2010/09/dynamic-routing-with-opensips.html</a>)
                                                which roughly seems to
                                                be working. I've
                                                configured the gateway,
                                                the routes, and so on.
                                                When I call my Nexmo
                                                number, it successfully
                                                routes to FS and rings
                                                but, when answered,
                                                never connects, failing
                                                after 30 seconds. This
                                                is, as expected, the OK
                                                never reaching Nexmo and
                                                the RTP negotiation
                                                never starting. I
                                                started poking around in
                                                wireshark and ran into
                                                another issue: OpenSIPs
                                                is forwarding 9 invites
                                                in rapid succession
                                                (less than a second)
                                                rather than just the one
                                                it received! FS *seems*
                                                to handle this correctly
                                                (482 Request Merged) but
                                                it makes the SIP trace
                                                an enormous mess and
                                                completely unreadable. </div>
                                              <div><br>
                                              </div>
                                              <div>The opensips log is a
                                                mess, but isn't
                                                particularly useful: </div>
                                              <div>
                                                <div>Jun  8 21:55:51
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  ERROR:signaling:sig_send_reply_mod:
                                                  failed to send reply
                                                  with tm module</div>
                                                <div>Jun  8 21:55:51
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  ERROR:tm:add_uac:
                                                  maximum number of
                                                  branches exceeded</div>
                                                <div>Jun  8 21:55:51
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  ERROR:tm:t_forward_nonack:
                                                  failure to add
                                                  branches</div>
                                                <div>Jun  8 21:55:51
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  ERROR:tm:w_t_relay:
                                                  t_forward_nonack
                                                  failed</div>
                                                <div>Jun  8 21:55:51
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  ERROR:tm:_reply_light:
                                                  failed to generate 500
                                                  reply when a final 500
                                                  was sent out</div>
                                                <div>Jun  8 21:55:51
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  ERROR:signaling:sig_send_reply_mod:
                                                  failed to send reply
                                                  with tm module</div>
                                                <div>Jun  8 21:55:51
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  incoming reply</div>
                                                <div>Jun  8 21:55:51
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  incoming reply</div>
                                                <div>Jun  8 21:56:55
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  CRITICAL:core:eval_expr:
                                                  too many expressions
                                                  (101)</div>
                                                <div>Jun  8 21:56:55
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  WARNING:core:do_action:
                                                  error in expression
                                                  (l=272)</div>
                                                <div>Jun  8 21:56:55
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  CRITICAL:core:eval_expr:
                                                  too many expressions
                                                  (101)</div>
                                                <div>Jun  8 21:56:55
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  WARNING:core:do_action:
                                                  error in expression
                                                  (l=283)</div>
                                                <div>Jun  8 21:56:55
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  CRITICAL:core:eval_expr:
                                                  too many expressions
                                                  (101)</div>
                                                <div>Jun  8 21:56:55
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  WARNING:core:do_action:
                                                  error in expression
                                                  (l=285)</div>
                                                <div>Jun  8 21:56:55
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18082]:
                                                  new branch at <a
                                                    moz-do-not-send="true"
href="mailto:sip%3A18178184971@gadogado.banatao.berkeley.edu"
                                                    target="_blank">sip:18178184971@gadogado.banatao.berkeley.edu</a></div>
                                                <div>Jun  8 21:56:55
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18083]:
                                                  message repeated 5
                                                  times: [ incoming
                                                  reply]</div>
                                                <div>Jun  8 21:56:55
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18083]:
                                                  CRITICAL:tm:t_should_relay_response:

                                                  pick_branch failed
                                                  (lowest==-1) for code
                                                  482</div>
                                                <div>Jun  8 21:56:55
                                                  ip-172-31-27-53
                                                  /usr/sbin/opensips[18083]:
                                                  incoming reply</div>
                                              </div>
                                              <div><br>
                                              </div>
                                              <div>Does anyone have any
                                                idea what would cause
                                                OpenSIPs to forward an
                                                invite 9 times in less
                                                than a second? Fixing
                                                that should allow me to
                                                move onto figuring out
                                                why it's not forwarding
                                                the 200 OK back to
                                                Nexmo. </div>
                                              <div><br>
                                              </div>
                                              <div>Thanks!</div>
                                            </div>
                                            <br>
                                            <fieldset></fieldset>
                                            <br>
                                          </div>
                                        </div>
                                        <pre>_______________________________________________
Users mailing list
<a moz-do-not-send="true" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                                      </blockquote>
                                      <br>
                                    </div>
                                  </blockquote>
                                </div>
                                <br>
                              </div>
                            </blockquote>
                            <br>
                          </div>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>