<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    how do you plan the operations to be done? Fetch all the rules per
    dpid in private memory at runtime, compile the regexps and then
    start applying them?<br>
    <br>
    From your proposal, the key can be practically anything, can you
    fetch redis records by a regexp/prefix matching over the key?<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    On 4/11/12 9:29 AM, Javier Gallart wrote:
    <blockquote
cite="mid:CACviLGYgW435CSJyzQwgdRiS2uZhqsm8U9Z7EtbTUYcms79uYw@mail.gmail.com"
      type="cite">
      <div><span style="">Helo Daniel</span></div>
      <div><span style=""><br>
        </span></div>
      <span style="">we intend to keep all data in redis. The reason is
        that we have a pretty&nbsp;</span><span style="">big dialplan and it
        takes a while to load the table into shared memory. If&nbsp;</span><span
        style="">we keep it in redis we can make the changes directly; a
        change in one entry&nbsp;</span><span style="">is just one command,
        no reload needed.</span>
      <div>
        <span style=""><br>
        </span></div>
      <div><span style="">Regards</span><br>
        <br>
        <div class="gmail_quote">On Tue, Apr 10, 2012 at 10:49 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 class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> Hello,<br>
              <br>
              do you want to use redis as a replacement for storing the
              dialplan rules in shared memory?<br>
              <br>
              Or just a replacement for the storage backend? So the
              rules are loaded from redis to shared memory.<br>
              <br>
              Cheers,<br>
              Daniel
              <div>
                <div class="h5"><br>
                  <br>
                  On 4/10/12 1:36 PM, Javier Gallart wrote: </div>
              </div>
              <blockquote type="cite">
                <div>
                  <div class="h5">Hello all
                    <div><br>
                    </div>
                    <div>we've been thinking of extending the dialplan
                      module for using redis as its backend. These are
                      our thoughts of how we to use it.</div>
                    <div>For a regular sql backend, each table has 4
                      main fields:</div>
                    <div>dpid,match_exp,subst_exp,repl_exp</div>
                    <div>dpid is given as argument to the only function
                      exported by the module (dp_translate). There are
                      two additional arguments to the function, the
                      source variable upon which the lookup and
                      translation are to be performed and the variable
                      where the transformation will be stored. There are
                      no tables/rows in redis, so the approach we were
                      thinking -there are many- was using a hash for
                      each pair (dpid,match_exp).&nbsp;</div>
                    <div>An example might help:</div>
                    <div>Let's say we have this row in potsgres:</div>
                    <div>dpid|match_exp|subst_exp|repl_exp</div>
                    <div>1 &nbsp;| ^34 | ^34(.*) | \1</div>
                    <div><br>
                    </div>
                    <div>According to this approach it would translate
                      into this redis structure:</div>
                    <div>key = 1:^34</div>
                    <div>field 1 name =&nbsp;subst_exp ; value =&nbsp;^34(.*)</div>
                    <div>field 2 name = repl_exp ; value = \1</div>
                    <div><br>
                    </div>
                    <div>The field names could be configurable as module
                      parameters, and we could add "redis" and driver in
                      the dburl parameter.</div>
                    <div><br>
                    </div>
                    <div>It would be great to now the opinions of the
                      list about this approach, since there are several
                      other ways to accomplish this:</div>
                    <div><br>
                    </div>
                    <div>-"by hand" from the kamailio script</div>
                    <div>-LUA&nbsp;</div>
                    <div>-Implementing a new module</div>
                    <div><br>
                    </div>
                    <div>We would be happy to implement it once there is
                      an agreement on how to proceed. As far as I see
                      it, several modules could be extended in a similar
                      way.</div>
                    <div><br>
                    </div>
                    <div>Thanks in advance</div>
                    <div><br>
                    </div>
                    <div>Javi</div>
                    <div><br>
                    </div>
                    <div><br>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                  </div>
                </div>
                <pre>_______________________________________________
sr-dev mailing list
<a moz-do-not-send="true" href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><span class="HOEnZb"><font color="#888888">
</font></span></pre>
                <span class="HOEnZb"><font color="#888888"> </font></span></blockquote>
              <span class="HOEnZb"><font color="#888888"> <br>
                  <pre cols="72">-- 
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
<a moz-do-not-send="true" href="http://www.asipto.com/index.php/kamailio-advanced-training/" target="_blank">http://www.asipto.com/index.php/kamailio-advanced-training/</a></pre>
                </font></span></div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
<a class="moz-txt-link-freetext" href="http://www.asipto.com/index.php/kamailio-advanced-training/">http://www.asipto.com/index.php/kamailio-advanced-training/</a></pre>
  </body>
</html>