Force trunk if call comes from extension

I have come up with a way to accomplish having certain extensions/users go out a defined trunk or set of trunks using the Outcall setup for trunk failover. It does NOT involve customizing the Asterisk dialplan. It can be accomplished via the Wazo Web GUI.

An extension to this solution could also be used as a (kludgy) e911 setup since it makes sure extensions from a satellite office go out a trunk devoted to that satellite office - and you would make sure the trunk associated with the satellite office have e911 registered to that satellite office.

I am not sure this is the most effective or efficient way to do this, so any feedback on alternatives or any advice or warnings about dangers of doing it this way would be appreciated. If you see anything I am doing wrong, please also advise.

To recap, I have a setup I expect is not all that uncommon: a home office where each (Aastra IP) phone in the house has two lines, with line 1 being used to make and receive personal calls and line 2 (with a unique ring) being used to make and receive business calls.

I have two trunks/DIDs feeding the server, one for the home calls and one for the business calls. (I actually have multiple lines for each but for now, for simplicity, I’ll talk about 1 line for each)

I want the home trunk used and the home CallerID shown when calls go out from line 1 and the business trunk used and the business CallerID shown when calls go out from line 2.

I have done this using Contexts.

Normally, Wazo has 3 Contexts setup to handle calls:

  • Inbound: Context for all calls originating outside the PBX and terminating at the PBX
  • Internal: Context for all calls originating within the PBX and terminating either inside or outside the PBX
  • Outbound: Context for all calls originating inside the PBX and terminating outside the PBX

The Outbound Context is “included” in the Internal Context so the Internal Context can access the Outbound Context.

What I did was setup 5 Contexts:

  • Inbound: Context for all calls originating outside the PBX and terminating at the PBX
  • Internal-Home: Context for all personal calls originating within the PBX and terminating either inside or outside the PBX
  • Internal-Business: Context for all Business calls originating within the PBX and terminating either inside or outside the PBX
  • Outbound-Home: Context for all Home calls originating inside the PBX and terminating outside the PBX
  • Outbound-Business: Context for all Business calls originating inside the PBX and terminating outside the PBX

The Internal-Home Context is “included” in the Internal-Business Context so the Internal-Home extensions can access the Business extensions
The Internal-Business Context is “included” in the Internal-Home Context so the Internal-Business extensions can access the Home extensions
The Outbound-Home Context is “included” in the Internal-Home Context so the Internal-Home extensions can dial out using the trunks/DIDs associated with the Home. NOTE: The Outbound-Business Context is NOT included in the Internal-Home Context.
The Outbound-Business Context is “included” in the Internal-Business Context so the Internal-Business extensions can dial out using the trunks/DIDs associated with the Business. NOTE: The Outbound-Home Context is NOT included in the Internal-Business Context.

Assign Home Users to the Internal-Home Context

  • Check that Home Extensions (in Advanced) are assigned to the Internal-Home Context

Assign Business Users to the Internal-Business Context

  • Check that Business Extensions (in Advanced) are assigned to the Internal-Business Context

Create Outcall routing using Home trunks and associate it with the Outbound-Home Context
Create Outcall routing using Business trunks and associate it with the Outbound-Business Context

When you now use any Home extension, it will go out the Home Trunk(s)/DID(s)
When you now use any Business extension, it will go out the Business Trunk(s)/DID(s)

As I said at the start, I am not an Asterisk expert so if I am doing something wrong or am creating a troublesome situation, PLEASE let me know.

Thank you for reading all the way to the end :slight_smile:

1 Like