On 09/02/2011 03:52 PM, caio wrote:
Hello,

Hello,
The documentation of carrierroute says "If flags and mask are not zero, and no match to the message flags is possible, no routing will be done." Then is there any route entry which can act as default gw (like an always-match entry)?

From what I see in the code and documentation, no.
For example this 'carrierroute' table:

   +---------+--------+-------------+-------+------+------+
   | carrier | domain | scan_prefix | flags | mask |
   +---------+--------+-------------+-------+------+------+
1  |       1 |      1 | 156         |     500 |    0 |
2  |       1 |      1 |             |     0 |    0 |
3  |       1 |      2 |             |     0 |    0 |
   +---------+--------+-------------+-------+------+-

Here if ruri is 156xx, and there is no flag set, then the cr module does not find a match because of the non-zero value in the flag column (entry 1).
But I want to route this call via carrier1 domain1 and scan_prefix empty-value entry (entry 2).

It seems that you can't select route 2, but you can select rule 3. For example

if(!cr_route("default", "1", "$rU", "$rU", "call_id")){
    if(!cr_route("default", "2", "$rU", "$rU", "call_id")) #here rule 3 would be selected because domain is 2, not 1
        send_reply("403", "Not allowed");
}

So you can have a special domain for each carrier that has no flags set and just acts like a catch all construct. Performance should not be impacted.

Hope this helps.
Marius

How can I set a default route entry here? Is possible with cr? Now I only find it possible via a pstn.def_gw_ip variable.
Thank you,

Claudio


-- 
Zbihlei Marius

Head of
Linux Development Services Romania

1&1 Internet Development srl    Tel KA: 754-9512
Str Mircea Eliade 18            Tel RO: +40-31-223-9512
Sect 1, Bucuresti               mailto: marius.zbihlei@1and1.ro
71295, Romania