Dialplan execution

Dear all,

this is a very simple dialplan:

[employees]

exten => _100,1,Dial(SIP/100,20,t)
exten => _100,n,Hangup()

exten => _200,1,Dial(SIP/200,20,t)
exten => _200,n,Hangup()

If i call 100 Asterisk evaluates and matches the first two line, otherwise if i call 200 Asterisk matches the second part of Dialpan.
Now, my question is: is it possibile to write some general instructions that Asterisk executes before evaluating the context?

[employees]

exten => always,1,Macro(checkoutboundtrunk)
exten => always,n,Hangup()

exten => _100,1,Dial(SIP/100,20,t)
exten => _100,n,Hangup()

exten => _200,1,Dial(SIP/200,20,t)
exten => _200,n,Hangup()

What i means is, always the first two lines are executed and then Asterisk proceed with the evaluation and matching of dialplan.
I know that my request is a little “crazy” but i will solve a big problem i have…

Thanks,
Davide

The easiest way is to use a subroutine.

You could do:

exten => _X.,1,…

exten => 100,n,Dial
exten => 200,same,Dial
exten = _X.,n,Hangup

However, resetting the priority number becomes more difficult if there is more than one priority.

Note that Hangup doesn’t do anything useful here, as just dropping off the end will do the same.

Also, although making the device name the same as the extension violates the security guidelines, if you do do this, you can use:

exten => _X.,n Dial(SIP/${EXTEN}…)

Thank you for your reply!
I have to understand how to use in my dialplan

Davide

Please note that the subroutine is a much more general solution than relying on dialplans with different patterns for different priorities.