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?
Thanks in advanced -Shaun