Do Subroutines Need Their Own H Extension?

Home » Asterisk Users » Do Subroutines Need Their Own H Extension?
Asterisk Users 1 Comment

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

One thought on - Do Subroutines Need Their Own H Extension?

  • 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.

    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