I am wondering if there is an easy way to hangup a channel created with Originate?
What I do is following:
- Call in dialplan triggers Agi;
- Agi starts AMI: Originate with Channel “Local/@queue/n” in Async mode. A variable stores the incoming channel to be used to bridge the call at answer. Dialplan is modified to invoke ‘Dial SIP/’;
- Agi plays announcements with streamFile;
Now the extension rings and the announcement is played to the calling party. At answer I can bridge the channels. But, if the calling party leaves the call before the call is answered, I would like to stop the outgoing call. When I send AMI Hangup with Channel “Local/@default”, an error is returned stating the channel is not found. The CLI trace shows:
-- Executing [queue@queue:9] Dial("Local/xxx@queue-00000031;2", "SIPfirstname.lastname@example.org,,eA()M(queueAnswer)t") in new stack
== Using SIP RTP CoS mark 5
– Called SIPemail@example.com
– Playing ‘/usr/opensips/sounds/netzws/id_1_wartezeit_ueberschritten’ (escape_digits=) (sample_offset 0)
– SIP/aaa.bbb.com-000000d9 is ringing
[May 24 13:38:58] NOTICE: manager.c:3312 action_hangup: !!! Can’t find channel to hang up!
I am aware that asterisk extends the channel name with an id (-00000031) and therefore there is no match on the channel name. The only solution I have atm is to send an CoreShowChannels action to asterisk and filter out the channel I would like to hangup, but I was hoping that there is a simpler solution…
Thanks in advance!