You can also use LCR module.
-Jai Rangi
On 6/29/07, Alfred E. Heggestad <aeh(a)db.org> wrote:
Hi Shaun
Shaun Hofer wrote:
Hi,
To terminate a call to the PSTN, my SER box has to route between
multiple PSTN gateways depending on the destination phone number/prefix.
For instance,
-Use gateway1 if the destination begins with any of these prefixes:
07550[0-4] 075509 07551[0-2] 075514 075515[7-8] 0755187
0755337 07553[7-9] 075551[0-1] 07555[2-8] 07556[0-4] etc..
-Use gateway2 if the destination begins with any of these prefixes:
0730[0-2] 07303[0-6] 0731[0-2] 073131 07313[5-9] 073140
07314[4-6] 0731[6-7] 0732[1-7] 07329[1-2] 07329[5-6] etc..
-Use gateway3 if etc...
-Use gatewayX if etc...
Obviously, one or a small number of regular expressions can't
efficiently
cover all of these prefixes. However, doing it
like this isn't ideal
because ser.cfg would be huge and cumbersome. Also, the prefixes for
each
gateway may change over time:
if ( (uri =~ "^sip:07550[0-4]") || (uri =~ "^sip:075509") || ... )
{ route to gateway1 }
if ( (uri =~ "^sip:0730[0-2]") || (uri =~ "^sip:07303[0-6]") || ...
)
{ route to gateway2 }
if ( ... )
{ route to gatewayX }
What's the most efficient way of doing this with SER?
you might want to try the "prefix_route" module which can be downloaded
from here:
http://aeh.db.org/patch/
it does exactly what you want, moving this logic from ser.cfg to the
database. it does not do regex though, but you can include all digits
in the table for e.g. 07550[0-4]:
075500 -> route 1
075501 -> route 1
075502 -> route 1
075503 -> route 1
075504 -> route 1
etc.
/alfred
Thanks in advanced
-Shaun
_______________________________________________
Serusers mailing list
Serusers(a)lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers
_______________________________________________
Serusers mailing list
Serusers(a)lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers