All pastes #54777 Raw Edit

Mine

public text v1 · immutable
#54777 ·published 2006-05-10 15:44 UTC
rendered paste body
The Problem:

i have 2 outgoing trunks and 1 dial plan, i want to alternate my trunks based on the context the person is coming in on
i have 2 globals
[globals]
Trunk1=SIP/12345/
Trunk2=Zap/g1/

then 2 incoming contexts leve1 user and level2 user

[Level1]
include => dialout


[Level2]
include => dialout

then the dialout context for the call
[dialout]
exten _.,1,Dial(${DefaultRoute}${Exten})


what i want do to is something like

[Level1]
DefaultRoute=${Trunk1}
include => dialout

[Level2]
DefaultRoute=${Trunk2}
include => dialout

is there a way to do this other than making a _. extension  becauase it takes out my #1 rule in the dialout context e.g.

[Level2]
exten _.,1,Set(DefaultRoute=${Trunk1})
include => dialout

and because dialout also is #1 in the dial plan it skips it 
could be solved by changing dialout to a 2 priority but then it's hard to follow