Custom context help needed

I have a user ( extension 5115 in my system ) that I want outgoing calls to AUTOMATICALLY use a different trunk than the rest of the system. For example, I have:

TrunkA ( 972-xxx-xxxx ) ( primary trunk )
TrunkB ( 817-xxx-xxxx ) ( secondary trunk )
Extension 5110 - 5114 need to dial out using TrunkA by default.
Extension 5115 needs to dial out using TrunkB by default.

I can NOT set my outgoing caller id ( providers do not allow ) and when user at extension 5115 calls out… they need to be on the 817 ( trunkB ) trunk so that the correct callerid is setup for them.

I have read that custom context is the way to go… but I’ve installed that and can’t get it to work. I created a ‘custom context’ and assigned that to extension 5115 but when it calls out… it still uses TrunkA.

Is there an easier way than using a custom context for this… or can someone give me the exact things I need to enter in the custom context fields for this to work?

Thanks - jack

You don’t need a custom context for this, just a dedicated outbound route. The trick is to add a new route that matches 5115 in the callerID field; then simply point it to direct the call out Trunk B. If you have multiple routing patterns setup right now, you’ll have to add all of them to the new route (or add multiple new routes), but just make sure you add the 5115 in the CID field of each pattern.

sounds good…

but still not good enough for me. :wink: I removed the custom context module…

I went to my outbound route and added the 5115 extention to the
CID field in the Dial Patterns that will use this Route routes.

I made sure that extenion 5115 has a CID of 5115.

My log shows:
Executing [[email protected]:28] Set(“SIP/5115-0000000b”, “CDR(cnum)=5115”) in new stack

Executing [[email protected]:5] Macro(“SIP/5115-0000000b”, “dialout-trunk,2,18887781234,off”) in new stack

Executing [[email protected]:1] Set(“SIP/5115-0000000b”, “DIAL_TRUNK=2”) in new stack

… that TRUNK=2 is not the correct one… where I set the CID in
the match pattern.

I applied my changes, restatrted asterisk, etc.

what else do I need to look at?


You have to create a separate outbound trunk that targets the desired trunk only. It probably needs to be at or near the top of your trunk list.


I have 3 trunks defined.


and 3 outbound routes defined:


I can recive calls from all 3 trunks and route them to the apporpriate extensions. When I do a normal dial… it uses the first ( GoogleVoice1 ) trunk which is normally fine.

My issue is that I want one of my extenions to use the 3rd trunk ( GoogleVoice2 ) as it’s ‘trunk’ when making an outgoing call so that the correct callerid is used on that call.

I’ve tried assinging a CID for my GoogleVoice2 Trunk/Route/extenions but when that extension makes an outgoing call, it uses the normal call routing and goes out the GoogleVoice1 Trunk and not the GoogleVoice2 trunk that I want it to use.

I am not 100% sure where to specify the correct CID so that my GoogleVocice2 trunk is chosen my the extension that I want to associate with that trunk.


The Extension Routing Module do the trick…