<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    On 2/13/12 7:48 PM, Uri Shacked wrote:
    <blockquote
cite="mid:CAMMbDhSf6asWui7+HKU7sYQT-o9W_iyupxPGYx5Ede9WnCFpQg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>thanks.</div>
        <div>i find the htable module a little confusing, or a little
          harder to understand. (although i said so on the mtree and
          today i find myself using it a lot).</div>
      </div>
    </blockquote>
    <br>
    you have to understand first the structures behind it:<br>
    <br>
    <a class="moz-txt-link-freetext" href="http://en.wikipedia.org/wiki/Hash_table">http://en.wikipedia.org/wiki/Hash_table</a><br>
    <br>
    In few words, it is a generic storage in shared memory, of pairs
    (key, value) -- the key is a string and the value can be string or
    integer.<br>
    <br>
    $sht(x=&gt;a) = "b"; -- this means storing in hash table 'x' a pair
    ("a", "b"), getting the value is just using $sht(x=&gt;a)<br>
    <br>
    The items in a hash table can be loaded from a database table at
    startup, you don't need event_route[htable:mod-init] and sqlops for
    that.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <blockquote
cite="mid:CAMMbDhSf6asWui7+HKU7sYQT-o9W_iyupxPGYx5Ede9WnCFpQg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>but, i notice at the end of the doc at section 7 to the
          "event_route[htable:mod-init]".</div>
        <div>i wonder, if i just load the htable module, and on this
          route, perform an SQL query and save the values in $shv(),
          will it do the trick?<br>
          cheers,</div>
        <div>uri<br>
        </div>
        <div class="gmail_quote">On Mon, Feb 13, 2012 at 5:34 PM,
          Daniel-Constantin Mierla <span dir="ltr">&lt;<a
              moz-do-not-send="true" href="mailto:miconda@gmail.com">miconda@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px
            0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
            <div bgcolor="#FFFFFF" text="#000000">Hello,
              <div class="im"><br>
                <br>
                On 2/10/12 2:32 PM, Uri Shacked wrote:
                <blockquote type="cite">
                  <div dir="ltr">
                    <div>thanks,</div>
                    <div>it is good see there is a wayto start with
                      -A... and it might&nbsp;make it easier a little (cause
                      i use the define as the group the server belongs
                      to).</div>
                    <div>but, it doesn't help me fully in my case.</div>
                    <div>i would like to have a generic start, and
                      generic cfg file (it is much easier when you need
                      to maintain).</div>
                    <div>the best thing i would like to do is something
                      like that:</div>
                    <div>&nbsp;</div>
                    <div>let say i have "route on start" or "get data
                      from DB on start"... then, i set something like:</div>
                    <div>&nbsp;</div>
                    <div>get "myself" </div>
                    <div>from list of kamailio servers"</div>
                    <div>and set my group to "the value set on me"<br>
                    </div>
                    <div>it seems to me something very usefull, when you
                      use 2 and more kamailio at different sites, and
                      still want a generic code and functions.</div>
                    <div>&nbsp;</div>
                    <div>if i was a programer... i might&nbsp;try to write
                      some module :-)</div>
                  </div>
                </blockquote>
              </div>
              you can load values from a database table via htable
              module and then use them to build the logic -- htable
              values are accessible via $sht(...).<br>
              <br>
              Cheers,<br>
              Daniel
              <div>
                <div class="h5"><br>
                  <blockquote type="cite">
                    <div dir="ltr">
                      <div>&nbsp;</div>
                      <div>thanks anyway,</div>
                      <div>Uri</div>
                      <div><br>
                        &nbsp;</div>
                      <div class="gmail_quote">On Fri, Feb 10, 2012 at
                        2:51 PM, Daniel-Constantin Mierla <span
                          dir="ltr">&lt;<a moz-do-not-send="true"
                            href="mailto:miconda@gmail.com"
                            target="_blank">miconda@gmail.com</a>&gt;</span>
                        wrote:<br>
                        <blockquote style="BORDER-LEFT:#ccc 1px
                          solid;MARGIN:0px 0px 0px
                          0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
                          <div bgcolor="#FFFFFF" text="#000000">Hello,<br>
                            <br>
                            you can use defines to control the order
                            (the values of NP servers), here is an
                            example of defining NP servers (to str
                            value, for sake of explanation):<br>
                            <br>
                            #!ifdef SRV1<br>
                            #!define NPSRV1 "abc"<br>
                            #!define NPSRV2 "xyz"<br>
                            #!else<br>
                            #!define NPSRV2 "abc"<br>
                            #!define NPSRV1 "xyz"<br>
                            #!endif<br>
                            <br>
                            and start kamailio with parameter '-A SRV1'
                            for the first instance.<br>
                            <br>
                            Cheers,<br>
                            Daniel
                            <div>
                              <div><br>
                                <br>
                                <br>
                                On 2/10/12 6:28 AM, Uri Shacked wrote: </div>
                            </div>
                            <blockquote type="cite">
                              <div>
                                <div>
                                  <div dir="ltr">Hi again...<br>
                                    (i do find myself ask many questions
                                    these days.... :-))<br>
                                    <br>
                                    well, now here is one more:<br>
                                    <br>
                                    i have 2 kamailio servers that i use
                                    in 2 locations. both use the same<br>
                                    tables and DBURL.<br>
                                    each of my server turns to a number
                                    portability (NP) server at its same<br>
                                    location.<br>
                                    for example, if server 1 has the
                                    call, it will turn to NP server 1
                                    with the<br>
                                    query, and if the query fails, it
                                    will then turn to NP server 2.<br>
                                    the kamailio server 2 does the same.
                                    but, turns to NP server 2 first and
                                    if<br>
                                    it fails, to NP server 1.<br>
                                    <br>
                                    once this is understood....<br>
                                    <br>
                                    here is my issue - i want to have 1
                                    generic cfg file for my 2 servers.<br>
                                    today, i use the same cfg file, but
                                    in server 1 i set it in the cfg to
                                    its<br>
                                    group, and on server 2 the same but
                                    a different group....<br>
                                    <br>
                                    i tried to understand how do i get
                                    each server to "pull" its group from
                                    the<br>
                                    DB. something like "what is my group
                                    when my IP is X.Y.Z.Q ?<br>
                                    i raed the cfg_db module but didn't
                                    understand how to set it on my cfg
                                    file<br>
                                    and on the DB.<br>
                                    <br>
                                    what is the best way to do what i
                                    want?<br>
                                    hope i was clear....<br>
                                    <br>
                                    BR,<br>
                                    thanks to all the guys that help me
                                    so far, i appriciate it a lot!<br>
                                    Uri<br>
                                  </div>
                                  <br>
                                  <fieldset></fieldset>
                                  <br>
                                </div>
                              </div>
                              <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><span><font color="#888888">
</font></span></pre>
                              <span></span></blockquote>
                            <span><font color="#888888"><br>
                                <pre cols="72">-- 
Daniel-Constantin Mierla -- <a moz-do-not-send="true" href="http://www.asipto.com/" target="_blank">http://www.asipto.com</a>
<a moz-do-not-send="true" href="http://linkedin.com/in/miconda" target="_blank">http://linkedin.com/in/miconda</a> -- <a moz-do-not-send="true" href="http://twitter.com/miconda" target="_blank">http://twitter.com/miconda</a></pre>
                              </font></span></div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
                  </blockquote>
                  <br>
                  <pre cols="72">-- 
Daniel-Constantin Mierla -- <a moz-do-not-send="true" href="http://www.asipto.com/" target="_blank">http://www.asipto.com</a>
<a moz-do-not-send="true" href="http://linkedin.com/in/miconda" target="_blank">http://linkedin.com/in/miconda</a> -- <a moz-do-not-send="true" href="http://twitter.com/miconda" target="_blank">http://twitter.com/miconda</a></pre>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </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>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://linkedin.com/in/miconda">http://linkedin.com/in/miconda</a> -- <a class="moz-txt-link-freetext" href="http://twitter.com/miconda">http://twitter.com/miconda</a></pre>
  </body>
</html>