<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On 29/04/15 12:34, Grant Bagdasarian
      wrote:<br>
    </div>
    <blockquote
      cite="mid:d928a593e6d94f229cbc5ece7b0aff55@CM-EX-V01.cm.local"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;
        mso-fareast-language:EN-US;}
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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;
        mso-fareast-language:EN-US;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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">That sounds
            possible! Thanks.<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" lang="EN-US">That
            does this description mean: “</span><span
style="font-size:9.0pt;font-family:"Helvetica",sans-serif;background:white"
            lang="EN-US">Execution time of load_gws() function is O(N) *
            O(M), where N is number of different prefix lengths and M is
            number of collisions for matching prefix(es) in lcr rules
            hash table of the LCR instance.”?<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:9.0pt;font-family:"Helvetica",sans-serif;background:white"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Does
            this mean it loads the data from its internal memory or does
            it load the data from the database again?</span></p>
      </div>
    </blockquote>
    load_gws() prepares an ordered list of gateways for current
    destination. It loads data only from internal in-memory gateways db
    (hash table).<br>
    <blockquote
      cite="mid:d928a593e6d94f229cbc5ece7b0aff55@CM-EX-V01.cm.local"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">How
            fast does it select a gateway after load_gws using
            next_gw()? Is it O(N) again?</span></p>
      </div>
    </blockquote>
    O(1) since load_gws already prepared ordered (by price) list and
    next_gw() only takes next gw in a list.<br>
    <blockquote
      cite="mid:d928a593e6d94f229cbc5ece7b0aff55@CM-EX-V01.cm.local"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><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" lang="EN-US">What
            about multiple combinations of capabilities? For example
            caller id spoofing and g729 codec, or caller id spoofing and
            g711ulaw codec? Etc.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Wouldn’t
            this cause the data to grow exponentially?
          </span></p>
      </div>
    </blockquote>
    It would.<br>
    <br>
    Another idea:<br>
    You can also have only one lcr instance and keep gateways
    capabilities in the tag field (serialized somehow). Then you can
    just iterate through a list generated by load_gws() skipping
    gateways which don't match your criteria and in the end a call will
    be routed to the cheapest gateway with proper capabilities.<br>
    <blockquote
      cite="mid:d928a593e6d94f229cbc5ece7b0aff55@CM-EX-V01.cm.local"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #E1E1E1
            1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal"><b><span
                  style="color:windowtext;mso-fareast-language:NL"
                  lang="EN-US">From:</span></b><span
                style="color:windowtext;mso-fareast-language:NL"
                lang="EN-US"> sr-users
                [<a class="moz-txt-link-freetext" href="mailto:sr-users-bounces@lists.sip-router.org">mailto:sr-users-bounces@lists.sip-router.org</a>]
                <b>On Behalf Of </b>Vitaliy Aleksandrov<br>
                <b>Sent:</b> Wednesday, April 29, 2015 10:36 AM<br>
                <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
                <b>Subject:</b> Re: [SR-Users] LCR with gateway
                capabilities<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">What about configuring two LCR instances
          with different "lcr_id".<br>
          The first one can use only gateways with requested
          capabilities and the second one all gateways.<br>
          Then you can make a decision about which instance to use
          during call routing process providing this lcr_id to
          load_gws() function.<br>
          <br>
          <br>
          <span style="font-size:12.0pt;mso-fareast-language:NL"><o:p></o:p></span></p>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span lang="EN-US">Hello,</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">From what I understand
              about the LCR module is that the rules have to be
              prioritized by the admin, be it manually or automatically
              by an application.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Let’s say the LCR
              database has 10 gateways, each with their own rules etc.
            </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">4 of these gateways
              support caller id spoofing and the others don’t.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">But the other 6 are
              cheaper and Kamailio has to route a call using a gateway
              which support caller id spoofing and is the cheapest of
              the 4.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Would it be possible
              to tell the LCR module to select a gateway based on
              certain capabilities and is the cheapest of the ones which
              support a certain capability?</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:"Times New
              Roman",serif;mso-fareast-language:NL"><br>
              <br>
              <br>
              <o:p></o:p></span></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><o:p></o:p></pre>
        </blockquote>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;font-family:"Times New
            Roman",serif;mso-fareast-language:NL"><o:p> </o:p></span></p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>