[SR-Users] how to match exact string value in mtree (Uri Shacked)

Javier Gallart jgallartm at gmail.com
Thu Feb 16 14:51:53 CET 2012


Hello Uri

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 $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.
Hope it helps.

Regards

Javi

On Thu, Feb 16, 2012 at 12:00 PM, <sr-users-request at lists.sip-router.org>wrote:

> Send sr-users mailing list submissions to
>        sr-users at lists.sip-router.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> or, via email, send a message with subject or body 'help' to
>        sr-users-request at lists.sip-router.org
>
> You can reach the person managing the list at
>        sr-users-owner at lists.sip-router.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of sr-users digest..."
>
>
> Today's Topics:
>
>   1. how to match exact string value in mtree (Uri Shacked)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 16 Feb 2012 12:54:50 +0200
> From: Uri Shacked <ushacked at gmail.com>
> Subject: [SR-Users] how to match exact string value in mtree
> To: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) -
>        Users   Mailing List" <sr-users at lists.sip-router.org>
> Message-ID:
>        <CAMMbDhTFNXAE-K88=AeMjO7AnA_QJV3Ajj3AH-AxemXN3ze6HQ at mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> I am using Mtree to match prefix numbers, some of them starts with 0 or
> characters like D for example.
> so, the mtree param is like this:
>
> modparam("mtree", "db_url", CFGDB)
> modparam("mtree", "mtree", "name=nts;dbtable=service_numbers_view;type=0;")
> modpmodparam("mtree", "char_list", "0123456789*+#YMDabcdefgh")
> modparam("mtree", "pv_value", "$avp(mtval)")
> modparam("mtree", "pv_values", "$avp(mtvals)")
>
> The thing is, that i tried all:
>
> if(!mt_match("nts", "$avp(DID)","1"))
> if(!mt_match("nts", "$avp(DID)","2"))
> if(!mt_match("nts", "$avp(DID)","0"))
>
> and lets say i have the both prefix in the nts mtree:
> 09555
> 09555333
>
> And the prefix i search for is  $avp(DID)=09555444
>
> I allwasy get the 09555 because it is the longest match.
> I need exact match.....
>
> how do i do that?
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.sip-router.org/pipermail/sr-users/attachments/20120216/9d2eb778/attachment.html
> >
>
> ------------------------------
>
> _______________________________________________
> sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> End of sr-users Digest, Vol 81, Issue 40
> ****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120216/d71445f8/attachment-0001.htm>


More information about the sr-users mailing list