Reputation: 11
[contextall]
include => context5xx
include => context8xx
[context5xx]
exten => _5xx,1,Verbose(3,Call in context5xx)
same => n,Hangup()
exten => h,1,Verbose(3,Executing hangup in 5xx)
[context8xx]
exten => _8xx,1,Verbose(3,Call in context5xx)
same => n,Hangup()
exten => h,1,Verbose(3,Executing hangup in 8xx)
When I call any extension in 5xx
series, it executes 5xx
hangup priorities and call is disconnected which is intended.
But when I call any extension in 8xx
series it again executes 5xx
hangup priorities and the call is disconnected, while I want to execute the hangup priority of the same context i.e. context8xx
Am I doing something wrong?
Upvotes: 0
Views: 919
Reputation: 15247
Yes, you not understand how include works.
All above is same as following:
[contextall]
exten => _5xx,1,Verbose(3,Call in context5xx)
same => n,Hangup()
exten => _8xx,1,Verbose(3,Call in context5xx)
same => n,Hangup()
exten => h,1,Verbose(3,Executing hangup in 5xx)
exten => h,1,Verbose(3,Executing hangup in 8xx)
So yes, it will execute first included h-extension. If you want it work as you describe you have start it with goto
[context8xx]
exten => _8xx,1,Goto(${EXTEN},2)
same => n,Verbose(3,Call in context5xx)
same => n,Hangup()
exten => h,1,Verbose(3,Executing hangup in 8xx)
But really correct way - rewrite dialplan to be asterisk-way. You just thinking wrong way.
Upvotes: 1