How to choose 1 of 2 Outbound Routes on the Fly

I’m running two different entities on one FreePBX system. I have two different Inbound Trunks pointing to 2 different IVRs and everything is working as expected on the Inbound side. Now I would like to be able to make outgoing calls but need to be able to tell the system which Outbound Route to use each time.

So I’m figuring that there will be a default kind of catch all Outbound Route, which if you just pickup the phone and dial the call will go through Outbound Route 1 for example.

Now I need to be able to tell the system to choose Outbound Route 2, when I want to dial out from Company 2. I’ve been reading about this and surprisingly there is not any obvious way to do this. I figured to have a choice of putting 2 extensions on each phone and Line 1 would be for Outbound Route 1 and Line 2 would be for Outbound Route 2. But I can’t seem to figure out how to do this!!!

The other option I think would be to setup Outbound Route 2 so that if you dial 9 and then the number, then the system would smartly know to choose Outbound Route 2 for that call.

Sorry for the long description but can anyone tell me which way is possible and how I would go about accomplishing this?

Thank you.

If you care to browse the fora, you will find that your question has been asked about 126,641 times, the answer has always been “Don’t even try” , there is no way that FreePBX can ever be reasonably be multi-tenanted , if you don’t want to accept that, please just wait . . .

With the commercial COS module you can achieve some of this though.
That allows you to allow/deny certain outbound routes for certain extensions.
So e.g. extensions 1000-2000 will use outbound route 1.
Outbound route 1 is denied for extensions 2001-3000, so outbound route 2 will be used for those.

You can select an outbound route based on the extension number of the phone, so if you’re willing to set up a couple of extensions on the phones, you could do it.

As @dicko points out, though, multi-tenant on Asterisk and FreePBX is a LOT of work and usually ends up not working completely right. Virtualization or adding another server (to have two PBX instances, one per client) would be the right course in the long-run (and save yourself hundreds of hours troubleshooting).

Is there a way to assign 2 different Extensions on a phone and then simply choose which extension uses which Outbound Route?

Yes.
Assign different extensions to the line keys and then determine the outbound route either via COS module or the way cynjut has pointed it out.

Can you point me to a link where it describes how to do this?

I don’t have a link, but I can explain it.

On the outbound route there is a block that has 4 fields in it. One is the Prefix added to the number, one is the number, and one is the stuff removed from the number before it’s dialed.

The fourth field is the extension that is allowed to use this route. Through the judicious use of this field, you can control a lot of the outbound route stuff.

1 Like

I believe you are referring to this right:


I have two Outbound Routes that have this setup exactly the same way. Is there a way to program one of them so that if I dial a 9 before dialing a number, it would then choose this route instead of the other one?

Yes.
Put the “9” in the prefix field. A call with 9 + digits would then use this route if the digits also match what you have in the match pattern field.

Cynjut is talking about the CallerID field on the right of your route pattern screenshot.
There you can determine that only extensions that match the CallerID you have put in there can use this route. If they don’t, they will look for another matching route
E.g. 7[89]X would say that only extensions from 780 to 799 will use this route.

1 Like

Thank you this worked perfectly. Very simple fix to what everyone makes out to be a big problem! Here is how I did it:

Don’t get caught up in what’s in the caller id information on the actual trunk. What’s important is that you have the Outbound CID set on each of your Outbound Routes. Then simply make a small modification to the one that you want to dial out on when pressing “9” prior to dialing. So here are screen shots of how I have it.

This is the default Outbound Route Dial Pattern:

And this is the secondary dial pattern which if you dial the number 9 prior to entering the phone number, it will use this Outbound Route:

I hope this makes it simpler to figure out for the next person that has this problem.

Thank you everyone that was so gracious and took the time to answer this question.

2 Likes

Two years later, a quick FYI and SEO boost for the question since it took me a few minutes to locate this info (I wasn’t a community member here yet).

I did this today and it’s still exactly this simple for two related entities to dial out with different numbers and CID using the same PBX and same trunk. Two minor things to add to the above by omnicom:

  • Be sure to disable circuit caller-id at the carrier (easy w most VOIP providers) and set sendrpid=yes in your existing trunk settings.
  • When adding a new outbound route to an existing system, don’t forget to check the existing route and extension CID/DID info. If you didn’t have DID/CID info there it the first place (ie: was handled by the trunk provider), calls might not terminate or have bad CID data on the original route.
  • Don’t make any typos. Failure to exactly matching the expected DID/CID info will probably not be handled well by your trunk provider.

Of course, the assumed usage scenario is the same tenant running multiple companies. Anything beyond this, I would at least add a separate trunk, if not another PBX outright.