问题
Here is my dial plan in asterisk:
[main-context]
exten => s,1,Gosub(subcontext,s,1)
exten => s,n,NoOp(End Main)
[subcontext]
exten => s,1,NoOp(Start subcontext)
exten => s,1,NoOp(End subcontext)
The problem is that when subcontext finishes, execution doesn't return to main-context and exten => s,n,NoOp(End Main) doesn't execute. How can I solve this?
回答1:
As Karadous posted above: a GoSub routine must have a matching Return() application call.
[main-context]
exten => s,1,Gosub(subcontext,s,1)
same => n,NoOp(End Main)
[subcontext]
exten => s,1,NoOp(Start subcontext)
same => n,NoOp(End subcontext)
same => n,Return()
来源:https://stackoverflow.com/questions/11101151/how-to-call-a-context-and-return-to-the-main-context-in-asterisk