SIP Trunk we need to redirect differents numbers to different extensions


SIP Trunk we need to redirect differents numbers to different extensions:
We have sip trunk: 21040900 and have the numbers asigned by the provider until 21040916
We create a inbound route to redirect the numbers to a ring group, and it works
also we add 1 rule to redirect the the number 21040916 to the extension 1018 but it use the first route

Main Route Patern: .21040900 to ring group schedule work days
Direct number: Patern
.21040916 to 1018 to ring group schedule work days


Look in the CDR and see how the inbound number is formatted and enter that number in the route to the extension. If that does not work, then a network capture is needed to see what field is being used as well as the format.


This is the format that the provider recomends:

Llamada Entrante:
Request-Line: INVITE SIP/2.0
From: <sip:2xxxxxxx@10.197.xx.xx; user=phone
To: <sip:+5062xxxxxxx@10.197.xx.xx:5060; user=phone
Llamada Saliente:
Request-Line: INVITE sip:2xxxxxxx@ SIP/2.0
From: <
To: <sip:2xxxxxxx@


Then in the SIP trunk settings you want to set the DID mode to Request URI.

In the inbound route, you want the DID to read +5062XXXXXX, but you want the Xs to replaced by the actual number.

Additionally, you should not have any rules set with a DID of .x
Finally, the inbound rules are processed in the order in which they are listed. SO, if a rule high up in the list matches a DID format. then that rule will be executed. So, if you have a number like:

and the rule you have is 999999x, then the x will cover both 1 & 2 and calls received from both numbers 9999991 & 9999992 will use the first rule.