[asterisk-users] Do subroutines need their own h extension?
mjordan at digium.com
Tue Oct 14 11:26:50 CDT 2014
On Tue, Oct 14, 2014 at 9:57 AM, Daniel Gonzalez <gonvaled at gonvaled.com> wrote:
> Hi all,
> According to the documentation
> 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
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:
> 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
(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:
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
More information about the asterisk-users