Hello

not sure what you want to accomplish, but in case it might help this is how we use the mtree module.
Our 3 columns are: partition, prefix, route
Partition is just a name that defines a group, this is done inside the script before calling mt_match (via a table lookup for instance). Let's say if a call comes from ip x we assign it to partition 400; if it comes from ip y we assign it to partition 401. Each partition is a different tree. Consider these entries in the tree table:
400,123456,A
401,123456,A
401,1234567,B

Let's say both x and y send a call with $rU 1234567; mt_match will return A for ip x, and B for ip y; we use that information for taking further routing decisions. A common situation might be: x has a unique route for a whole country while y has that entry but has more defined routes for more specific area codes inside that country. The column route could also be for instance the setid of a group of gw's for the dispatcher module, etc...

Regards

Javi



Message: 3
Date: Tue, 14 Jun 2011 14:27:53 +0200
From: I?aki Baz Castillo <ibc@aliax.net>
Subject: Re: [SR-Users] Use of mtree module having multiple trees in
       the     same table
To: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) -
       Users   Mailing List" <sr-users@lists.sip-router.org>
Message-ID: <BANLkTim8h563kUy0YT9pTgOSXJ6W4Qf6ww@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

2011/6/13 jose luis millan <doctore96@gmail.com>:
> I wonder if anyone could help me understanding how can I use this
> module in a scenario where multiple mtrees are defined behind the same
> database table.
>
> I can't guess how to speficy to 'mt_match' the mtree I want to match
> against, since the 'mtree' module parameter defines a specific memory
> tree based on a specific table, but not based on a specific 'tname'
> value.

Indeed we have a table with these colums:

- prefix:    string to identify number destination. This is the regex column.
- id_zone:  integer, points to other table. This is the value column.
- scope:    integer, can be 0 or 1.

So wee need two instances of mtree:
1) those rows with scope 0.
2) those rows with scope 1.

Is it possible with current mtree module? or maybe we'd do better by
creating two views of the table (one for entries with scope 0 and
another for entries with scope 1)?

Thanks a lot.

--
I?aki Baz Castillo
<ibc@aliax.net>