Hello my èxtensions_conf`, this is a queue;
exten => 1,1,NoOp(call for call center)
same => n,Set(__OTHERCHANNEL=${CHANNEL})
;same => n,Set(CHANNEL(hangup_handler_push)=call-center,csh,1(args))
same => n,Dial(SIP/trunk/XXXXXXXXX,,tTG(msg,1))
exten => msg,1,Goto(anum,1)
exten => msg,2,Goto(cnum,1)
exten => anum,1,BridgeWait()
exten => anum,n,NoOp("after bridgewait")
exten => cnum,1,Playback(hello)
exten => cnum,n,Set(CHANNEL(hangup_handler_wipe)=call-center,csh,1(args))
exten => cnum,n,WaitExten(100)
exten => csh,1,Verbose(0)
same => n,AGI(test.py,${ORIGCHANNEL},${OTHERCHANNEL})
same => n,Return()
;same => n,AGI(test.py,${ORIGCHANNEL})
exten => #,1,NoOp(press #)
same => n,Bridge(${ORIGCHANNEL})
exten => 9,1,AGI(test.py,${ORIGCHANNEL})
same => n,Hangup()
My test.py
;
#!/usr/bin/env python3
import sys
from asterisk.agi import AGI
agi = AGI()
if sys.argv[2]:
agi.env['agi_channel'] = sys.argv[2]
agi.hangup(channel=sys.argv[1])
I want to when answered press 9
key hangup answered and caller channel. This works fine. But when answered hangup phone, my agi script running in hangup handler does not hangup the caller's channel. Give me RESULT_LINE: 511 Command Not Permitted on a dead channel or intercept routine
error. I can try change to àgi_channel`but this not work. How to can fix this problem. How to hangup caller after hangup answered. Thanks for reply.
Since DeadAGI and AGI is now same application, that behavour is normal one.
You are responsible for detect channel is hanguped, for example you can check Dial command response code or issue CHANNEL(state) check.