[SR-Users] Using =~ to get the group identifier with longest match
Daniel-Constantin Mierla
miconda at gmail.com
Mon Jun 6 16:33:56 CEST 2011
Hello,
On 6/6/11 3:29 PM, Iñaki Baz Castillo wrote:
> 2011/6/6 Iñaki Baz Castillo<ibc at aliax.net>:
>> 2011/6/6 Daniel-Constantine Mierla<miconda at gmail.com>:
>>> Btw, very lightweight module for longest prefix matching is mtree. It has option to return a value in a cfg variable, that can be the group id for example. It does caching in memory trees, so it is really fast in matching.
>> I also missed that module. Let's take a look to it.
> Hi Daniel, sounds really specific for which I need :)
> Let me ask some doubts:
>
> - You say "It has option to return a value in a cfg variable, that can
> be the group id for example". Do you mean pv_value AVP?:
> http://kamailio.org/docs/modules/3.1.x/modules/mtree.html#id2845134
yes, but it can be any kind of writable variable, not restricted to AVP
-- see the example in the readme where it is a $var()
> Would that AVP be filled with the content of the "value" column for
> the matched row?
Exactly
>
> - Which is the meaning of "payload" here?:
> http://kamailio.org/docs/modules/3.1.x/modules/mtree.html#id2807543
when it is 0, will return the value as string in varibale. The goal is
to parse in cache the value into some internal structure. Right now
there is also the option of 1, expecting some 'id=value', both being
integers, with the purpose of returning all matches for the prefix
ordered by value. It hasn't be tested extensively and thus not
documented - initially work was on hold to get first xavps so the
structure can be returned nicely to config, then lack of time kept it
posponed.
>
> - What does mt_match() return in case there is match? and when there is not?
True and false.
Cheers,
Daniel
>
>
> Thanks a lot.
>
--
Daniel-Constantin Mierla
http://www.asipto.com
More information about the sr-users
mailing list