If hang up at Bridge

Hi,

I’m doing the live session of two channels. And I use Bridge to connect two channels. Everything works well but only one problem. If one of them or both of them hang up directly at Bridge, instead of pressing ‘#’ key to end the live, I cannot get the duration of their live session to update their status and call logs .

Code in features.conf:

[applicationmap] exitbyself=>#,self/caller,macro,disconnectlive exitbyparty=>#,peer/callee,macro,disconnectlive
Some code of connection:

Once two channels are connected, the caller channel will be changed to a Zombie channel, for example “SIP/123456-000001” will be changed to “Bridge/SIP/123456-000001”. And this Zombie channel will run the code below:

exten => h,1(mainhangup),NoOp(--------------------Hangup--------------------) exten => h,n,Gotoif($["${CHANNEL:0:6}" = "Bridge"]?hangup) exten => h,n(hangup),hangup()
If they end the live by pressing “#” key, their channels will be redirect to livecomplete, and I will count their live duration.

[macro-disconnectlive] exten => s,1,NoOp(!!!!!!!!!!!!!!!!!!!partychannel: ${partychannel}!!!!!!!!!!!!!!!!!!!!!!!) exten => s,n,NoOp(!!!!!!!!!!!!!!!!!!!CHANNEL: ${CHANNEL}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!) exten => s,n,Set(c1=${CHANNEL}) exten => s,n,NoOp(!!!!!!!!!!!!!!!!!partyusername: ${partyusername}!!!!!!!!!!!!!!!!!!!!!) exten => s,n,Execif($["${partychannel}"=""]?Set(partychannel=${${cap}liveonline_getchannel(${partyusername})})) exten => s,n,NoOp(~ ~ ~ ~ ~ ~ ~ ~ ${partychannel} ~ ~ ~ ~ ~ ~ ~) exten => s,n,Execif($["${poke}"="y"]?ChannelRedirect(SIP/${partyusername},livechat,h,hangup):ChannelRedirect(${partychannel},livechat,s,livecomplete)) exten => s,n,ChannelRedirect(${c1},livechat,s,livecomplete)

;livecomplete exten => s,n(livecomplete),NoOp( ~ ~ ~ ~ ~ live complete ~ ~ ~ ~ ~ ) exten => s,n,ControlPlayback(${ichat}/liveprompts/${Lang}/livesessionend,,,,1||2||3||4||5||6||7||8||9||0||*||#) exten => s,n,Set(Sliveonline_update(status)=online) exten => s,n,AGI(livesession_update_Live.agi,${Username},${partyusername},${refno},${lsid},${cap}) exten => s,n,Set(${cap}request_updatelive(channel_usr2)=${CHANNEL}) exten => s,n,Set(${cap}request_updatelive(ServNum_usr2)=${servicenum}) exten => s,n,Set(${cap}request_update(progress)=complete) exten => s,n,Set(totalsecs=${Srequest_checkdursecs()})) exten => s,n,Set(${cap}liveonline_update(status)=online) exten => s,n,Set(GLOBAL(poke)=n) exten => s,n,NoOp(^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ${partyusername} ^ ^ ^ ^ ^ ^ ^ ^ ^ ^) exten => s,n(completemenu),Read(cmopt,${ichat}/liveprompts/${Lang}/completemenu,1,,3,4)

But if the caller hang up directly after talking, I cannot get anything data of their live session. And all data of the caller cannot be updated. When I use write code to check the caller’s original channel on callee side, it said there is no such channel.
So far I only can count the live duration on callee side to update their data. But if callee hang up first, what can I do ?

Is it possible that reconvert zombie channel to the original channel after caller hang up at bridge?

Can anybody help me? Or does anybody have a better way to solve it?

Thanks a lot!!!

This isn’t a support forum.

The use of Macro (Subroutine and Goto) in features is clearly documented as unsupported.

Macros are deprecated (although maybe less likely to break when attempted in features).

Your h extension does nothing useful and running the last step only on a live extension is confusing.

ChannelRedirect needs the name of a channel instance, not a / dial string.

Zombie channels exist only for internal reasons and it is probably an error that dialplan is even being run on on one. Zombie channels have no device channel associated with them and there is no mechanism to restore that channel to them. Channels get turned into zombies when a new thread needs to take over control of them. They allow the old thread to detect the situation at a convenient point in its processing. They are always as having been hungup, and the the old thread is expected to bury them as quickly as possible once it detects the combination of that hangup and the zombie state.

[quote=“david55”]This isn’t a support forum.

The use of Macro (Subroutine and Goto) in features is clearly documented as unsupported.

Macros are deprecated (although maybe less likely to break when attempted in features).

Your h extension does nothing useful and running the last step only on a live extension is confusing.

ChannelRedirect needs the name of a channel instance, not a / dial string.

Zombie channels exist only for internal reasons and it is probably an error that dialplan is even being run on on one. Zombie channels have no device channel associated with them and there is no mechanism to restore that channel to them. Channels get turned into zombies when a new thread needs to take over control of them. They allow the old thread to detect the situation at a convenient point in its processing. They are always as having been hungup, and the the old thread is expected to bury them as quickly as possible once it detects the combination of that hangup and the zombie state.[/quote]

Thanks for your replying.
The [macro-disconnectlive] is just a extension name, it is in the same .conf file with other code of live session.

As you said, h extension is confusing when jump to the last line from elsewhere, do you have any solutions to solve this problem? If don’t jump to h extension when bridge starts, is there any other session I can jump to? Or got any code that do nothing and wait for next step/order?

Thank you!