<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/17/12 1:04 PM, Javier Gallart wrote:
<blockquote
cite="mid:CACviLGZRySU7MvfRC5+B5dWVfETNau+14wcDOZc8GFi7Matn5w@mail.gmail.com"
type="cite">Hi Daniel,
<div><br>
</div>
<div>no, in order to find the best match we do a manual trick
using the s.prefixes transformation (I think you suggested
that). </div>
</blockquote>
<br>
could be, at least is the way I do prefix matching with mysql.
Postgres, on the other hand, afaik, has an index plugin to match the
longest prefix, might not be in default distro, but can be found on
the net for sure.<br>
<br>
<blockquote
cite="mid:CACviLGZRySU7MvfRC5+B5dWVfETNau+14wcDOZc8GFi7Matn5w@mail.gmail.com"
type="cite">
<div>We start with the full $rU and stop when we find a non-null
value. This kamailio is serving many thousands of calls per
hour, and the response time is pretty much the same as when we
used the mtree module. For us , using redis has the advantage of
being able to load the tree data faster than when we used
postgres without the need to perform a mtree reload. <br>
</div>
</blockquote>
<br>
Loading huge amount of records from mysql takes time indeed.<br>
<br>
Maybe prefix matching will be added in redis in the future, or
scripted server side in lua, as I understood it has such feature.
Another option would be to add a custom command in kamailio like
redis_cmd_pmatch() to do internally these prefix-based commands
until a match, could simplify the config if it becomes something
very popular.<br>
<br>
Also, I forgot about the other solution in kamailio - pdb module
written by 1&1 for number portability:<br>
* <a class="moz-txt-link-freetext" href="http://kamailio.org/docs/modules/stable/modules/pdb.html">http://kamailio.org/docs/modules/stable/modules/pdb.html</a><br>
<br>
Just mentioning it here for let it be known, if redis is working
fine for you, makes no sense to look for other solutions.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<blockquote
cite="mid:CACviLGZRySU7MvfRC5+B5dWVfETNau+14wcDOZc8GFi7Matn5w@mail.gmail.com"
type="cite">
<div><br>
</div>
<div>Regards</div>
<div><br>
</div>
<div>Javi</div>
<div><br>
<br>
<div class="gmail_quote">On Fri, Feb 17, 2012 at 10:25 AM,
Daniel-Constantin Mierla <span dir="ltr"><<a
moz-do-not-send="true" 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 Javier,<br>
<br>
one question about redis, can it do longest prefix
matching or all prefixes match?<br>
<br>
Cheers,<br>
Daniel
<div class="im"><br>
<br>
On 2/16/12 2:51 PM, Javier Gallart wrote: </div>
<blockquote type="cite">
<div>
<div class="h5">Hello Uri
<div><br>
</div>
<div>I had similar needs and I found the ndb_redis
module more suited for that type of task. Instead
of a tree you have a hash like this: tname tprefix
tvalue. If you do a hget nts <span>$avp(DID) and
you get a not null value you have found your
exact match. It works very well for me and the
time it takes for that "query" is barely
noticeable. Of course redis does not address
items like persistence, etc the same way a rdbms
does.</span></div>
<div><span>Hope it helps.</span></div>
<div><span><br>
</span></div>
<div><span>Regards</span></div>
<div><span><br>
</span></div>
<div><span>Javi</span></div>
<div><br>
<div class="gmail_quote">On Thu, Feb 16, 2012 at
12:00 PM, <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:sr-users-request@lists.sip-router.org"
target="_blank">sr-users-request@lists.sip-router.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0
0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">Send sr-users mailing
list submissions to<br>
<a moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org"
target="_blank">sr-users@lists.sip-router.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide
Web, visit<br>
<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><br>
or, via email, send a message with subject or
body 'help' to<br>
<a moz-do-not-send="true"
href="mailto:sr-users-request@lists.sip-router.org"
target="_blank">sr-users-request@lists.sip-router.org</a><br>
<br>
You can reach the person managing the list at<br>
<a moz-do-not-send="true"
href="mailto:sr-users-owner@lists.sip-router.org"
target="_blank">sr-users-owner@lists.sip-router.org</a><br>
<br>
When replying, please edit your Subject line
so it is more specific<br>
than "Re: Contents of sr-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. how to match exact string value in mtree
(Uri Shacked)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 16 Feb 2012 12:54:50 +0200<br>
From: Uri Shacked <<a
moz-do-not-send="true"
href="mailto:ushacked@gmail.com"
target="_blank">ushacked@gmail.com</a>><br>
Subject: [SR-Users] how to match exact string
value in mtree<br>
To: "SIP Router - Kamailio (OpenSER) and SIP
Express Router (SER) -<br>
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>><br>
Message-ID:<br>
<CAMMbDhTFNXAE-K88=<a
moz-do-not-send="true"
href="mailto:AeMjO7AnA_QJV3Ajj3AH-AxemXN3ze6HQ@mail.gmail.com"
target="_blank">AeMjO7AnA_QJV3Ajj3AH-AxemXN3ze6HQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hi,<br>
<br>
I am using Mtree to match prefix numbers, some
of them starts with 0 or<br>
characters like D for example.<br>
so, the mtree param is like this:<br>
<br>
modparam("mtree", "db_url", CFGDB)<br>
modparam("mtree", "mtree",
"name=nts;dbtable=service_numbers_view;type=0;")<br>
modpmodparam("mtree", "char_list",
"0123456789*+#YMDabcdefgh")<br>
modparam("mtree", "pv_value", "$avp(mtval)")<br>
modparam("mtree", "pv_values", "$avp(mtvals)")<br>
<br>
The thing is, that i tried all:<br>
<br>
if(!mt_match("nts", "$avp(DID)","1"))<br>
if(!mt_match("nts", "$avp(DID)","2"))<br>
if(!mt_match("nts", "$avp(DID)","0"))<br>
<br>
and lets say i have the both prefix in the nts
mtree:<br>
09555<br>
09555333<br>
<br>
And the prefix i search for is
$avp(DID)=09555444<br>
<br>
I allwasy get the 09555 because it is the
longest match.<br>
I need exact match.....<br>
<br>
how do i do that?<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a moz-do-not-send="true"
href="http://lists.sip-router.org/pipermail/sr-users/attachments/20120216/9d2eb778/attachment.html"
target="_blank">http://lists.sip-router.org/pipermail/sr-users/attachments/20120216/9d2eb778/attachment.html</a>><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
sr-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org"
target="_blank">sr-users@lists.sip-router.org</a><br>
<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><br>
<br>
<br>
End of sr-users Digest, Vol 81, Issue 40<br>
****************************************<br>
</blockquote>
</div>
<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>
</pre>
</blockquote>
<br>
<div class="im">
<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>
</blockquote>
</div>
<br>
</div>
</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>