<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><tt>Hi John,<br>
        <br>
        Ideally, you should do something like:<br>
            if (loose_route() || match_dialog() ) {<br>
                ....<br>
            }<br>
        <br>
        In this way you can catch also bogus sequential requests without
        Route header.<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 31.12.2014 14:27, John Nash wrote:<br>
    </div>
    <blockquote
cite="mid:CAA4rGPy6Cd3PB5fQQMnwUzh8qsqTEfqUvwiG4kLK760driD2_g@mail.gmail.com"
      type="cite">
      <div dir="ltr">Or may be should try to match_dialog and then relay<br>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Wed, Dec 31, 2014 at 5:57 PM, John
          Nash <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:john.nash778@gmail.com" target="_blank">john.nash778@gmail.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">OK got it. I also have a situation where I
              receive BYE from callee which has "To" tag but no route
              header. As per default script this request should not be
              allowed to go further. Would fix_route_dialog(); work or I
              should just relay it?<br>
            </div>
            <div class="HOEnZb">
              <div class="h5">
                <div class="gmail_extra"><br>
                  <div class="gmail_quote">On Wed, Dec 31, 2014 at 1:37
                    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 text="#000000" bgcolor="#FFFFFF">
                        <div><tt>Hi John,</tt><tt><br>
                          </tt><tt><br>
                          </tt><tt>1) if the request does not match any
                            dialog it will go on the "else" branch where
                            it simply logs the "valid request" - this is
                            a simple example, but the idea is that
                            without dialog state you cannot check if
                            valid or not; and you maybe do not create
                            dialogs for all your calls and maybe not all
                            your sequential request are part of a INVITE
                            dialog (you may have re-SUBSCRIBE or
                            NOTIFYs)</tt><tt><br>
                          </tt><tt><br>
                          </tt><tt>2) the function just fixes, you need
                            to send it out as usual via the t_relay(),</tt><tt><br>
                          </tt><tt><br>
                          </tt><tt>Regards,</tt><br>
                          <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 30.12.2014 12:16, John Nash wrote:<br>
                            </div>
                          </div>
                        </div>
                        <blockquote type="cite">
                          <div>
                            <div>
                              <div dir="ltr">
                                <div>I was looking at usage of
                                  validate_dialog() and saw the
                                  following snippet from module
                                  documentation page. If you check the
                                  else part... as per my understanding
                                  if a dialog is not found ($DLG_status)
                                  will be NULL) it will go to else part
                                  which indicates a message has To tag
                                  but dialog not found. How can it be a
                                  valid in-dialog request.<br>
                                  <br>
                                  <pre style="font-family:monospace;white-space:pre-wrap;color:rgb(0,0,0);border:1px solid rgb(153,204,204);padding-left:15pt;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(254,254,238)">    if (has_totag()) {
        loose_route();
        if ($DLG_status!=NULL &amp;&amp; !validate_dialog() ) {
            xlog(" in-dialog bogus request \n");
        } else {
            xlog(" in-dialog valid request - $DLG_dir !\n");
        }
    }</pre>
                                  Also there is one more code<br>
                                  <pre style="font-family:monospace;white-space:pre-wrap;color:rgb(0,0,0);border:1px solid rgb(153,204,204);padding-left:15pt;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(254,254,238)">   if (has_totag()) {
        loose_route();
        if ($DLG_status!=NULL)
            if (!validate_dialog())
                fix_route_dialog();
    }
</pre>
                                  <br>
                                </div>
                                After calling fix_route_dialog() do I
                                need to just relay the message? I mean
                                this function will "fix" the message and
                                send?....I was trying to look for some
                                security check where someone can inject
                                a route header and a to tag (Bogus of
                                course) to reach to my gateways through
                                my proxy.<br>
                                <div><br>
                                </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>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>