SOLVED Routing Out Through Multiple SIP Trunks

Status
Not open for further replies.

Caleb

Member
Sep 12, 2017
42
17
8
WA, USA
Hi All,

We have a specific group of extensions whose calls we want to go out through a specific SIP trunk, but still access everything else internally. The essential internal stuff includes regular extensions, the conference server, and ring groups. Does anyone have any pointers or direction on how best to accomplish this? Other kinds of destinations could definitely be needed in the future, so as close to full-proof as possible with the initial setup would be helpful.

Thanks!
 

Caleb

Member
Sep 12, 2017
42
17
8
WA, USA
For the reader's sake... Here's a little bit of the configuration we've got:
  • Two SIP trunk providers, one is 'special' (used by a specific group of extensions)
  • The special trunk has a limited number of simultaneous connections
  • The group of extensions should use the primary trunk (that everyone else uses) when the max number of connections is reached on the special one
  • All internal destinations have to be accessible by all extensions
EasyBB's answer, referencing the toll_allow variable (per-extension), works awesome for specifying which trunk is used by the special extension group. We implemented this by:
  1. Adding a descriptive value to each respective extension's toll_allow value
  2. Added a condition to the outbound routes that point to the special trunk (should probably be the first condition evaluated) that checks if ${toll_allow} contains the descriptive value
To enforce the simultaneous connection limit on the special trunk, in the same outbound routes, we added an action that calls the limit app, and the data field to hash <domain> <trunk_name> <#_of_max_connections>. Note that applying only this step as described here implies that a destination called "limit_exceeded" exists (i.e. is watched for) in the dialplan manager. You can learn more about the limit app here. We took it a bit farther...

To allow outbound connections to 'overflow' from the special trunk to the regular trunk when the special one is full, we:
  1. Changed the data field referenced above (the one that enforces the connection limit) to look like hash <domain> <trunk_name> <#_of_max_connections> trunk_overflow.
  2. Created a dialplan entry near the top (ours was set to order 110) with these settings:
    1. Tag: condition. Type: destination_number. Data: ^trunk_overflow$ (watches for the custom-named destination at the end of the above line)
    2. Tag: condition. Type: rdnis. Data: ^(\+?1?\d{7,10})$ (basically a USA catch-all for external destinations, adjust to fit your current outbound routes)
    3. Tag: action. Type: unset. Data: toll_allow (removes the toll_allow value for this call)
    4. Tag: action. Type: transfer. Data: $1 (causes the FusionPBX to reprocess this outbound call now that we've removed the toll_allow value, thus causing the call to be made via the normal trunk)
This has worked well for us thus far. Hopefully it can simplify the research of another FusionPBX admin like myself!
 

EasyBB

Active Member
Oct 23, 2016
240
33
28
Australia
should probably be the first condition evaluated
This is a must!

when the max number of connections is reached on the special one
If you set continue_on_fail=true and add both gateways one after the other it should do what you want without setting 'limit', provided the special trunk returns a SIP fail code when call limit is reached and the next call is attempted.
 
Status
Not open for further replies.