Hi Daniel,<div><br></div><div>we are making ourselves familiar with the dialplan module sources. About the matching in redis, we can't fetch records by regexp/prefix matching over the key: for now we are thinking about exact matching starting from the longest prefix in the number (match_op = 1). Once the best match key is found we have come up with a few general solutions for the subst/repl rules:</div>
<div><br></div><div>-Compile them at runtime</div><div>-Compile them at startup and save them in additional fields of the same redis hash</div><div>-Compile them at startup and save them compiled in memory; the redis hash could store a pointer in another filed.</div>
<div>-(...)</div><div><br></div><div>What do you think?</div><div><br></div><div><br></div><div>Regards</div><div><br></div><div>Javi</div><div><br></div><div><br><div class="gmail_quote">On Wed, Apr 11, 2012 at 11:17 AM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>></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>
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?</div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
<br>
Cheers,<br>
Daniel<div><div class="h5"><br>
<br>
On 4/11/12 9:29 AM, Javier Gallart wrote:
<blockquote type="cite">
<div><span>Helo Daniel</span></div>
<div><span><br>
</span></div>
<span>we intend to keep all data in redis. The reason is
that we have a pretty </span><span>big dialplan and it
takes a while to load the table into shared memory. If </span><span>we keep it in redis we can make the changes directly; a
change in one entry </span><span>is just one command,
no reload needed.</span>
<div>
<span><br>
</span></div>
<div><span>Regards</span><br>
<br>
<div class="gmail_quote">On Tue, Apr 10, 2012 at 10:49 PM,
Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></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><br>
<br>
On 4/10/12 1:36 PM, Javier Gallart wrote: </div>
</div>
<blockquote type="cite">
<div>
<div>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). </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 | ^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 = subst_exp ; value = ^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 </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 href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a>
<a 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><font color="#888888">
</font></span></pre>
<span><font color="#888888"> </font></span></blockquote>
<span><font color="#888888"> <br>
<pre cols="72">--
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
<a 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 cols="72">--
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
<a href="http://www.asipto.com/index.php/kamailio-advanced-training/" target="_blank">http://www.asipto.com/index.php/kamailio-advanced-training/</a></pre>
</div></div></div>
</blockquote></div><br></div>