Skip to content
Nov 1 / Greg

Asterisk Selective Outbound Routing

I had a customer of mine that a single user inside their office needed an 800 number routed to them…not a big deal. What we did was to order an additional DID from their SIP provider Vitelity. The number was provisioned and I forwarded it from the incoming trunk to the users phone. I made a test call and low and behold, it worked just fine. That was a boring story… Every good story has to have an antagonist, right? Well, when you picked up the phone to dial out, it was screened on caller ID as a number from the old DID block.

I tried just manipulating the Outbound CID section. I set it to what the new DID is, but it still didn’t do the trick.

After futzing with that for a while I put in a support ticket. Support told me to put in a subaccount.

A subaccount creates a new set of trunk credentials for one to use. You also associate a caller ID with the new subaccount, which will, supposedly, screen the number properly.

Since we have a new set of trunk credentials, we have to create a new trunk in our asterisk server. My box is a trixbox ce server.

I basically used my existing trunk settings, but with the new username/password.

You then need to create a new outbound route that uses that new trunk.

This route is identical to my default route save for the trunk selected at the bottom.

Now I associate my specific user inside with this new outside route…wait…what? In Cisco callmanager, you have partitions. Partitions are logical groupings of extensions. You can put route patterns in specific partitions…which would fix this situation. What does one do in Asterisk? One uses contexts. Contexts are the same construct as partitions. They basically allow you to segregate phones into different groups. When it comes down to it, I’m a GUI guy. I am a GUI guy, because I want other people to be able to use the systems I configure without breaking them. If I change something in config files, I’ll be the only guy from now until forever who can work on those systems. Having said all of that, I’ve found a great little plugin for trixbox/freepbx called custom context. What it allows you to do is EASILY create contexts, add outbound routes to said context and then apply them to users. I’m not going to walk you through that because someone already has in the video below:

I did discover that you have to set “ENTIRE Basic Internal Dialplan” and “All outbound routes” to deny if you want to be able to individually select outbound routes.

Once everything is verified working, you only need to point your 800 number towards your new DID…yeah!


leave a comment
  1. Bobby / Nov 1 2010

    Asterisk could be such a valuable tool for the work I do if it didn’t leave me pulling my hair out half the time; I’ve been installing and programming proprietary PBX’s for 10 years now but configuring an Asterisk platform to try out defeats me as often as not.

  2. Greg / Nov 1 2010


    I wholly agree with you sir! I’m endured more hours of frustration from these asterisk implementations than from anything else I’ve every jacked with. Having said that, they can also be pretty brilliant…hehe. If someone would just come out with a version that could mimic callmanager 4.3, it doesn’t even have to be a new version of callmanager, and have it be $1000…they would have a gold mine on their hands.

Leave a Comment