2

I have a Trixbox server (Asterisk and FreePBX) that has multiple tenants on it. I need these tenants calls to go out via different outbound routes in order to split the bills at the SIP trunk provider end. Essentially the extensions need to be grouped and each group needs to have it's own outbound SIP trunk.

This used to be achievable using custom contexts in FreePBX but that functionality no longer exists. How can this be done now? I'd be happy to change to a different VoIP distribution which provides this functionality however I need it to be Asterisk and FreePBX based as that's what the customer knows.

SimonJGreen
  • 3,195
  • 5
  • 30
  • 55

1 Answers1

1

We usually do this by adding contexts in the extensions_custom.conf file. These custom contexts include the default contexts but listen for your outbound calls such as NXXNXXXXXX, 1NXXNXXXXXX and add your dialing codes such as 7777 to the beginning of the call. Then you simply setup your outbound routes so the specific routes are listening for the relevant codes and stripping them off before pushing the call to the carrier.

Phones belonging to client1 would be set in "custom-client1" context while client2 phones would be in "custom-client2".

[custom-client1]
exten => _NXXNXXXXXX,1,Dial(Local/888${EXTEN}@from-internal)
exten => _1NXXNXXXXXX,1,Dial(Local/888${EXTEN}@from-internal)
exten => _NXXXXXX,1,Dial(Local/888${EXTEN}@from-internal)
include => from-internal

[custom-client2] 
exten => _NXXNXXXXXX,1,Dial(Local/889${EXTEN}@from-internal)
exten => _1NXXNXXXXXX,1,Dial(Local/889${EXTEN}@from-internal)
exten => _NXXXXXX,1,Dial(Local/889${EXTEN}@from-internal)
include => from-internal
dkwiebe
  • 641
  • 3
  • 6
  • OK I think I follow that. So the outbound route will be controlled by prefixing the numbers dialed, and these prefixes will be added by matching against extensions? Do you have an example of this? – SimonJGreen Jan 07 '12 at 12:55
  • @SimonJGreen I just added the samples you were looking for. – dkwiebe Jan 09 '12 at 21:19