QUESTION Order of outbound routes

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
Outbound routes are used in priority from top to bottom, as sorted in FreePBX. Whichever route matches the dialed digits sent from the extension is used first. This is why emergency and extension priority routes (restricting extensions to certain trunks by ext. num.) should always be at the top.

Pattern Matching has to do with the patterns within the outbound routes, but not directly for the sorting/priority. From the wiki, I read it as the standard NXXNXXXXXX that is used to substitute for digits. Instead of typing 200-0001 to 998-9999, you do NXXNXXXXXX and it pulls every number in that pattern. If I have an outbound route at the very top that has dial rules NXXNXXXXXX and is set to TrunkA, any call placed from an extension that matches that format (ex. 8435454545) will go out that trunk.

Does that make more sense?
 
Joined
Nov 14, 2008
Messages
1,398
Reaction score
320
The order can be very important when trying to add logic to the call processing. Some examples are obvious but some work in reverse which can get very ingenious. It's not JUST the order its the kind of MATCH you are making with the rule. Is the route ultimately taken because of a MATCH or a non-MATCH which is effectively provided by the order.

Some routing requires scripting and could even query a database but most needs can be met with this simple scheme that doesn't require any code.
 

mike_h

New Member
Joined
Mar 7, 2014
Messages
2
Reaction score
0
I understand quite well why FreePBX needs to evaluate the routes in the right sequence. My problem was that I didn't understand how is does this. The described behaviour of Asterisk seemed to make this impossible.

If I#m not mistaken, Asterisk take all patterns in the appropriate context and sorts them according to a set of rules.
Here was my problem. Being a programmer, I assumed that the include works like like e.g. in C: Include all referenced include files and then parse the complete resulting file. In fact Asterisk does something a bit more complex here:
  1. Take the patterns in the context without the includes and sort them according to the rules that were described in the link from the first post.
  2. If that doesn't produce a match, parse the first included context.
  3. If there still is no match, continue with the next included context and so on.
Thus everything works exactly as expected. :)
 

Members online

Forum statistics

Threads
25,825
Messages
167,849
Members
19,250
Latest member
mark-curtis
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top