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:
- Adding a descriptive value to each respective extension's toll_allow value
- 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:
- 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.
- Created a dialplan entry near the top (ours was set to order 110) with these settings:
- Tag: condition. Type: destination_number. Data: ^trunk_overflow$ (watches for the custom-named destination at the end of the above line)
- Tag: condition. Type: rdnis. Data: ^(\+?1?\d{7,10})$ (basically a USA catch-all for external destinations, adjust to fit your current outbound routes)
- Tag: action. Type: unset. Data: toll_allow (removes the toll_allow value for this call)
- 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!