[asterisk-users] Return without Gosub: stack is empty
Richard Mudgett
rmudgett at digium.com
Thu Nov 2 14:06:37 CDT 2017
On Thu, Nov 2, 2017 at 1:25 PM, Dmitriy Serov <serov.d.p at gmail.com> wrote:
> [sub-out-do-dial]
> exten => s,1,NoOp(Dial)
> same => n,NoOp(FirstChannel: ${CHANNEL})
> same => n,Dial(????,60,gF)
> same => n,NoOp(SecondChannel: ${CHANNEL})
> same => n,Return()
>
> [some]
> exten => s,1,GoSub(sub-out-do-dial,s,1)
>
> In case of the destination channel hangs up in log i see:
> ERROR[26570][C-000000e7] app_stack.c: Return without Gosub: stack is empty
>
I think you mean if the calling channel hangs up you get the error message.
>
> Yes. SecondChannel != FirstChannel.
> Is it a wrong way to use Dial(g)+Gosub? Or any Dial in sub?
>
The first channel (calling party) knows about being in the subroutine. It
was the
channel executing dialplan to get into the subroutine. Use of the g option
with this
dialplan is OK as the calling channel knows where the subroutine was called
from.
The second channel (called party) knows nothing about being in a subroutine
so it
cannot return from one. It has not executed any dialplan before. The F
option simply
tells it to start executing dialplan at the priority after the dial
application. This dialplan
needs to be able to distinguish between the two channels and act
accordingly. Using
the F() option with a dialplan location is the simplest way to distinguish
between the
two channels.
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20171102/ca3e4d40/attachment.html>
More information about the asterisk-users
mailing list