Daniel Gonzalez
2014-Oct-14 14:57 UTC
[asterisk-users] Do subroutines need their own h extension?
Hi all, According to the documentation ( http://www.voip-info.org/wiki/view/Asterisk+h+extension): Be aware: Macros require their own h extension as they do not make use of the calling context's h extension! Does this apply to subroutines too? I am unable to find the corresponding explanation. If not: what happens when a call is hanged-up during the execution of a subroutine? Is the h extension in the parent triggered? And also: what happens if, in a stack of subroutines, each calling subroutine has an h extension, like this: sub1,h sub2,h sub3,h If we are in sub3 and the call is hanged up, will all h extensions for the calling stack be triggered? Thanks and regards, Daniel Gonzalez -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20141014/e445bddd/attachment.html>
Matthew Jordan
2014-Oct-14 16:26 UTC
[asterisk-users] Do subroutines need their own h extension?
On Tue, Oct 14, 2014 at 9:57 AM, Daniel Gonzalez <gonvaled at gonvaled.com> wrote:> Hi all, > > According to the documentation > (http://www.voip-info.org/wiki/view/Asterisk+h+extension): > > Be aware: Macros require their own h extension as they do not make use of > the calling context's h extension! > > Does this apply to subroutines too? I am unable to find the corresponding > explanation.No. A channel that is hung up within a subroutine is treated exactly the same as if it was hung up in any other extension, i.e., the channel will execute the 'h' extension in the context that the subroutine is in.> > If not: what happens when a call is hanged-up during the execution of a > subroutine? Is the h extension in the parent triggered? > > And also: what happens if, in a stack of subroutines, each calling > subroutine has an h extension, like this: > > sub1,h > sub2,h > sub3,h > > If we are in sub3 and the call is hanged up, will all h extensions for the > calling stack be triggered?No. There is no unraveling of the stack when a channel is hung up. A hang up cancels the execution of standard dialplan and does two things: (1) Executes the 'h' extension in the current context, if available (2) Executes any hang up handler subroutines that were attached to the channel For more information on the latter, see the documentation on Hangup Handlers: https://wiki.asterisk.org/wiki/display/AST/Hangup+Handlers Matt -- Matthew Jordan Digium, Inc. | Engineering Manager 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at: http://digium.com & http://asterisk.org