[asterisk-users] Looking for sample hangup_handler_pop and _wipe using vars

Richard Mudgett rmudgett at digium.com
Tue Feb 4 11:16:09 CST 2020


>From the indicated wiki page:

*Pop a hangup handler off a channel and optionally push a replacement*

same => n,Set(CHANNEL(hangup_handler_pop)=[[[context,]exten,]priority[(arg1[,...][,argN])]]);

*Pop all hangup handlers off a channel and optionally push a replacement*

same => n,Set(CHANNEL(hangup_handler_wipe)=[[[context,]exten,]priority[(arg1[,...][,argN])]]);


What the syntax above is indicating is that the value to assign is
*optional*.  Thus to only pop or wipe hangup handlers you *do not* provide
a new handler to push.

[hdlr1]
exten = s,1,NoOp()
same = n,Return()

[hdlr2]
exten = s,1,NoOp()
same = n,Return()

[hdlr3]
exten = s,1,NoOp()
same = n,Return()

[my_new_handler_context]
exten = my_new_handler_exten,3,NoOp()
same = n,Return()

[my_current_context]
...
; This wipes all set hangup handlers because we are not providing an
optional replacement handler to push onto the empty stack.
same = n,NoOp() ; <-- At this point we may or may not have hangup handlers
set on the channel
same = n,Set(CHANNEL(hangup_handler_wipe)=)
same = n,NoOp() ; <-- At this point we have no hangup handlers on the
channel

; This wipes all set hangup handlers and pushes a new one onto the empty
stack.
same = n,NoOp() ; <-- At this point we may or may not have hangup handlers
set on the channel
same =
n,Set(CHANNEL(hangup_handler_wipe)=my_new_handler_context,my_new_handler_exten,3)
same = n,NoOp() ; <-- At this point we have only the one hangup handler we
just pushed: my_new_handler_context,my_new_handler_exten,3

; Hangup handler test dialplan
exten = 101,1,NoOp()
same = n,Set(CHANNEL(hangup_handler_push)=hdlr1,s,1)
same = n,Set(CHANNEL(hangup_handler_push)=hdlr2,s,1)
same = n,Set(CHANNEL(hangup_handler_push)=hdlr3,s,1)
; What is the hangup handler stack when the channel is in the Echo
application?
same = n,Echo()
same = n,Hangup()

exten = 102,1,NoOp()
same = n,Set(CHANNEL(hangup_handler_push)=hdlr1,s,1)
same = n,Set(CHANNEL(hangup_handler_push)=hdlr2,s,1)
same = n,Set(CHANNEL(hangup_handler_push)=hdlr3,s,1)
same =
n,Set(CHANNEL(hangup_handler_pop)=my_new_handler_context,my_new_handler_exten,3)
; What is the hangup handler stack when the channel is in the Echo
application?
same = n,Echo()
same = n,Hangup()

exten = 103,1,NoOp()
same = n,Set(CHANNEL(hangup_handler_push)=hdlr1,s,1)
same = n,Set(CHANNEL(hangup_handler_push)=hdlr2,s,1)
same = n,Set(CHANNEL(hangup_handler_push)=hdlr3,s,1)
same =
n,Set(CHANNEL(hangup_handler_pop)=my_new_handler_context,my_new_handler_exten,3)
; What is the hangup handler stack when the channel is in the Echo
application?
same = n,Echo()
same = n,Hangup()

You can enter the test dialplan portion above.  Then call the test
extensions to see what is on the channel's hangup handler stack while the
channel is in the Echo application by using the command line commands
mentioned on the wiki page.

Richard

On Mon, Feb 3, 2020 at 7:26 PM David P <davidswalkabout at gmail.com> wrote:

> Please point me to samples of popping and wiping hangup handlers. I don't
> need to use the values returned; I just need to clear any handlers before I
> push a new one.
>
> It's not clear at
> https://wiki.asterisk.org/wiki/display/AST/Hangup+Handlers+Specification how
> to provide vars on the right-hand side.
>
> Cheers,
> David
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at:
> https://community.asterisk.org/
>
> New to Asterisk? Start here:
>       https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20200204/9db238d0/attachment.html>


More information about the asterisk-users mailing list