<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 09/02/2011 03:52 PM, caio wrote:
    <blockquote
cite="mid:CAHEbn019YTttermqCxEyMQRkzrCXR_jw7SJQqZRvyX-MSLAKJw@mail.gmail.com"
      type="cite">Hello,<br>
      <br>
    </blockquote>
    Hello,<br>
    <blockquote
cite="mid:CAHEbn019YTttermqCxEyMQRkzrCXR_jw7SJQqZRvyX-MSLAKJw@mail.gmail.com"
      type="cite">The documentation of carrierroute says "If flags and
      mask are not zero, and no match to the message flags is possible,
      no routing will be done." Then is there any route entry which can
      act as default gw (like an always-match entry)?<br>
      <br>
    </blockquote>
    From what I see in the code and documentation, no.<br>
    <blockquote
cite="mid:CAHEbn019YTttermqCxEyMQRkzrCXR_jw7SJQqZRvyX-MSLAKJw@mail.gmail.com"
      type="cite">For example this 'carrierroute' table:<br>
      <br>
         +---------+--------+-------------+-------+------+------+<br>
         | carrier | domain | scan_prefix | flags | mask |<br>
         +---------+--------+-------------+-------+------+------+<br>
      1  |       1 |      1 | 156         |     500 |    0 | <br>
      2  |       1 |      1 |             |     0 |    0 | <br>
      3  |       1 |      2 |             |     0 |    0 | <br>
         +---------+--------+-------------+-------+------+-<br>
      <br>
      Here if ruri is 156xx, and there is no flag set, then the cr
      module does not find a match because of the non-zero value in the
      flag column (entry 1).<br>
      But I want to route this call via carrier1 domain1 and scan_prefix
      empty-value entry (entry 2).<br>
      <br>
    </blockquote>
    It seems that you can't select route 2, but you can select rule 3.
    For example<br>
    <br>
    <span class="Apple-style-span" style="border-collapse: separate;
      color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style:
      normal; font-variant: normal; font-weight: normal; letter-spacing:
      normal; line-height: normal; orphans: 2; text-indent: 0px;
      text-transform: none; white-space: normal; widows: 2;
      word-spacing: 0px; font-size: medium;"><span
        class="Apple-style-span" style="font-family: Helvetica,Arial;"></span></span><span
      class="Apple-style-span" style="border-collapse: separate; color:
      rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal;
      font-variant: normal; font-weight: normal; letter-spacing: normal;
      line-height: normal; orphans: 2; text-indent: 0px; text-transform:
      none; white-space: normal; widows: 2; word-spacing: 0px;
      font-size: medium;"><span class="Apple-style-span"
        style="font-family: Helvetica,Arial;"></span></span>if(!cr_route("default",
    "1", "$rU", "$rU", "call_id")){<br>
        if(!cr_route("default", "2", "$rU", "$rU", "call_id")) #here
    rule 3 would be selected because domain is 2, not 1<br>
            send_reply("403", "Not allowed");<br>
    }<br>
    <br>
    So you can have a special domain for each carrier that has no flags
    set and just acts like a catch all construct. Performance should not
    be impacted. <br>
    <br>
    Hope this helps.<br>
    Marius<br>
    <br>
    <blockquote
cite="mid:CAHEbn019YTttermqCxEyMQRkzrCXR_jw7SJQqZRvyX-MSLAKJw@mail.gmail.com"
      type="cite">How can I set a default route entry here? Is possible
      with cr? Now I only find it possible via a pstn.def_gw_ip
      variable.<br>
      Thank you,<br>
      <br>
      Claudio<br>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Zbihlei Marius

Head of
Linux Development Services Romania

1&amp;1 Internet Development srl    Tel KA: 754-9512
Str Mircea Eliade 18            Tel RO: +40-31-223-9512
Sect 1, Bucuresti               mailto: <a class="moz-txt-link-abbreviated" href="mailto:marius.zbihlei@1and1.ro">marius.zbihlei@1and1.ro</a>
71295, Romania                  </pre>
  </body>
</html>