<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body 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<br>
    <br>
    On 4/10/12 1:36 PM, Javier Gallart wrote:
    <blockquote
cite="mid:CACviLGaHJo6FAgEc7waxwNgJSu+LT17Hz5gaiUOOb_9yy9bo8Q@mail.gmail.com"
      type="cite">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 class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
sr-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
    </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>