'hangupsource' in queue

Colleagues, please tell me why the variable ‘hangupsource’ behaves so strangely.

I have a queue that receives calls from a large number of SIP channels and channels E1.
It is important for me to understand who hung up - an external subscriber or an operator in the queue.

For this, I analyze the variable CHANNEL(hangupsource), I don’t know a better way.
Unfortunately, this method is very unstable - in some cases the variable contains an empty value.

More specifically, I have a handler, a subroutine that is declared with hangup_handler_push.
Almost at the beginning, it shows the value of the variable ${CHANNEL(hangupsource)}

exten => s,1,Set(epo_end=${EPOCH})
same  => n,NoOp([${STRFTIME(${epo_end},,%H:%M:%S %d.%m.%Y)}] Call from: '${CALLERID(all)}' (to sub-incall3 ${UNIQ} [${QEHOLDTIME}])
same  => n,NoOp(hangupsource = ${CHANNEL(hangupsource)})

Alas, in some cases, the value is empty. Moreover, this happens both on SIP channels and on DAHDI channels.
Operators are described in the queue as Local/NUM@dialplan, maybe it matters …


there’s an event - HangupRequest in AMI
you can find who hang up with AMI

And from the dialplan I can do?

AGI to an AMI client.

And why does ${CHANNEL(hangupsource)} work not every other time? Asterisk has all the information…

If I understand everything correctly, I must launch an external application through AGI, then this application must connect to the AMI socket every time, and find out which of the subscribers initiated the connection breakdown?

Is there really no simpler, but reliably working way?

I was only explaining how you might carry out one of the suggestions, not commenting on whether it was a good approach.

The CHANNEL(hangupsource) function is relatively recent, and I’ve not used it myself. People used to use the g option on Dial to detect if the calling channel had not been hungup.

Thank you. Maybe continuing the dialplan after Queue() can help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.