[asterisk-bugs] [JIRA] (ASTERISK-30102) Hangup_handler not invoked

Kevin Harwell (JIRA) noreply at issues.asterisk.org
Thu Jun 9 13:30:49 CDT 2022


    [ https://issues.asterisk.org/jira/browse/ASTERISK-30102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=259469#comment-259469 ] 

Kevin Harwell commented on ASTERISK-30102:
------------------------------------------

Unless I misunderstand it appears the hangup handler for me remains. I'm using the following dialplan. I've based it off or your's, but modified it some to make it easier for me to see what channel is hanging up and where:
{noformat}
[default]
exten => 940,1,NoOp()
	same => n,Answer()
	same => n,Playback(demo-congrats)
	same => n,Hangup()

exten => 150,1,NoOp()
	same => n,Answer()
	same => n,Verbose(0, Answered: ${CHANNEL})
	same => n,Set(GLOBAL(Channel1)=${CHANNEL})
	same => n,Verbose(0, Add hangup handler to: ${CHANNEL})
	same => n,Set(CHANNEL(hangup_handler_push)=ChannelHungup1,s,1())
	same => n,Echo()
	same => n,Hangup()

exten => 151,1,NoOp()
	same => n,Answer()
	same => n,Verbose(0, Answered: ${CHANNEL})
	same => n,Set(GLOBAL(Channel2)=${CHANNEL})
	same => n,Verbose(0, Add hangup handler to: ${CHANNEL})
	same => n,Set(CHANNEL(hangup_handler_push)=ChannelHungup2,s,1())
	same => n,Echo()
	same => n,Hangup()

[ChannelHungup1]
exten => s,1,Verbose(0, Hangup1: ${CHANNEL})
	same => n,Return()

[ChannelHungup2]
exten => s,1,Verbose(0, Hangup2: ${CHANNEL})
	same => n,Return()

[BridgeHungup1]
exten => s,1,Verbose(0, BridgeHungUp1: ${CHANNEL})
	same => n,Return()

[BridgeHungup2]
exten => s,1,Verbose(0, BridgeHungUp2: ${CHANNEL})
	same => n,Return()

[BridgeChannels]
exten => s,1,NoOp()
	same => n,Verbose(0, Bridge Channels: ${CHANNEL} and ${Channel1})
	same => n,Bridge(${Channel1},F(bridgedEnd,s,1))
	same => n,Verbose(0, Bridge Exit - BRIDGERESULT = ${BRIDGERESULT})
	same => n,HangUp()
exten => h,1,Goto(BridgeHungUp1,s,1)

[bridgedEnd]
exten => s,1,Verbose(0, Bridge End: ${CHANNEL})
	same => n,HangUp()
exten => h,1,Goto(BridgeHungUp2,s,1)
{noformat}
I then issued the following (Channel1):
{noformat}
*CLI> originate Local/940 extension 150
Answered: Local/940 at default-00000001;1
Add hangup handler to: Local/940 at default-00000001;1
{noformat}
And similarly (Channel2):
{noformat}
*CLI> originate Local/940 extension 151
Answered: Local/940 at default-00000002;1
Add hangup handler to: Local/940 at default-00000002;1
{noformat}
At this point there are two channels playing back demo-congrats and each have their own hangup handlers specified. I then sent a redirect via AMI, bridging the Channel2 (bridger) with Channel1 (bridgee):
{noformat}
Action: Redirect
Channel: Local/940 at default-00000002;1
Context: BridgeChannels
Exten: s
Priority: 1
{noformat}
{noformat}
Bridge Channels: Local/940 at default-00000002;1 and Local/940 at default-00000001;1
{noformat}
Since Channel1 (bridgee) was started first it'll hangup first when Playback ends. Once it hung up here's the output I got:
{noformat}
Hangup1: Local/940 at default-00000001;1
Bridge Exit - BRIDGERESULT = SUCCESS
Hangup2: Local/940 at default-00000002;1
{noformat}
As you can see both channel's hang up handlers were called, so I'm missing something, or maybe something else is going on aside from a handler being dropped during a redirection? Or did you mean the BridgeEnd handler specified using the {{F}} option was not invoked vs. a channel's?

> Hangup_handler not invoked
> --------------------------
>
>                 Key: ASTERISK-30102
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-30102
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Bridges/bridge_simple
>    Affects Versions: 18.0.1
>         Environment: Hosted in Azure
>            Reporter: Morten Sølvberg
>            Assignee: Unassigned
>
> I am recording calls with MixMonitor, and I am using "hangup_handler_push" on all calls I crate/receive, to make sure that the calls are always sent to the same location in the dialplan where I move the recording to a mounted drive.
> This usually works fine, but I see that when I use the Bridge application, then the hangup_handler is removed for the *Briged* party. 
> I assume that this happens due to the masquerade functionality in Asterisk, and that the hangup_handler isn't copied to the new channel. 
> I can see the hangup_handler being invoked on the Surrogate channel, but not on the actual one.
> Luckily I can use the F option in the Bridge application, so the *Bridged* party is sent to defined place in the dialplan when the *Bridger* hangs up.
> This also works fine.
> However if the *Bridged* party hangs up, then the channel is not sent to the defined localion in the dialplan.
> I have an h extension in all the the contexts that the channel has been in, but it does not hit any of these either.
> Is this a known issue and/or can you think of a workaround?



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list