[SR-Users] how to match exact string value in mtree

José Luis Millán jmillan at aliax.net
Fri Feb 17 10:54:34 CET 2012


Hi,

El día 16 de febrero de 2012 11:54, Uri Shacked <ushacked at gmail.com> escribió:
> 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.....

If you need the exact match instead of a prefix match perhaps mtree is
not what you are looking for.

If it makes sense for you dividing the entries of your mtree table
based on a criteria (tname_column module option) you can run mt_match
against one or other mtree.

Ie.

| prefix_column | tname_column | tvalue_colum |
| 09555 | 'CC' | 1 |
| 09555333 | 'FULL' | 2 |


mt_match("CC","$avp(DID)", "0")
mt_match("FULL","$avp(DID)", "0")



>
> how do i do that?
>
>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>

Regards,



More information about the sr-users mailing list