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.

  • How often will the number of tenants be changing? If you're willing to, it's fairly simple to do this in the extensions_custom.conf file. – dkwiebe Nov 29 '11 at 21:42
  • @dkwiebe very rarely. – SimonJGreen Jan 7 '12 at 12:53

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".

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

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
|improve this answer|||||
  • 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 7 '12 at 12:55
  • @SimonJGreen I just added the samples you were looking for. – dkwiebe Jan 9 '12 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.