Jonathan H
2021-May-26 16:22 UTC
[asterisk-users] HELP! AGI AUTOHANGUP does not seem to hangup the channel.
https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+AGICommand_set+autohangup "Cause the channel to automatically hangup at time seconds in the future" SET AUTOHANGUP TIME Looks great. Except... it doesn't. It just causes AGI to send "HANGUP" and any audio to stop playing. It does NOT hangup the channel, or even send any SIP event. The line just goes silent. It's been an entire afternoon of profuse googling; I have tried adding and removing hangup handlers, I have even tried setting the AGIEXITONHANGUP flag to "1" as per https://wiki.asterisk.org/wiki/display/AST/Asterisk+Standard+Channel+Variables But this is all that happens (5 seconds is ridiculous, it's just to test). This is with "pjsip set logger on" AGI Rx << SET AUTOHANGUP 5 AGI Tx >> 200 result=0 AGI Rx << SET VARIABLE AGIEXITONHANGUP "1" AGI Tx >> 200 result=1 AGI Tx >> HANGUP << AGI Rx << HANGUP AGI Tx >> 511 Command Not Permitted on a dead channel or intercept routine basically, the next log event is whenever the next REGISTER would normally happen. And of course, if I try and respond to the AGI again, it tells me the channel is dead. So WHY is the "hangup" event not sent to the phone? I cannot use other methods like setting the absolute channel timeout variable, or using a local "dial" with a timeout message because: 1: the system tests whether the next file will push the listener over the 1 hour limit for included calls in UK packages, so the autohangup value has to be dynamic 2: It has to be over-ridable so that the listener can continue past the hour 3: The message that plays out is dynamically generated Everything about it works fine... except the fact that it doesn't actually hangup. Which leaves the possibility that an old person might fall asleep and end up with a large bill, which we don't want!
Jonathan H
2021-May-26 16:57 UTC
[asterisk-users] HELP! AGI AUTOHANGUP does not seem to hangup the channel.
I have also tried configuring pjsip wizard like this. endpoint/rtp_timeout=5 And I see this shortly after the "hangup" command has been sent, so that part is working: [May 26 17:36:37] NOTICE[1276]: res_pjsip_sdp_rtp.c:150 rtp_check_timeout: Disconnecting channel 'PJSIP/fromvoipfone-206-0000000b' for lack of audio RTP activity in 5 seconds But, again, it doesn't disconnect. The line stays open. And yes, my fallthrough after agi is same => n, Hangup() Also, apparently I now have a load of channels, which won't even hangup with channel request hangup all Requested Hangup on channel 'PJSIP/fromvoipfone-206-0000000b' Requested Hangup on channel 'PJSIP/fromvoipfone-206-0000000a' Requested Hangup on channel 'PJSIP/fromvoipfone-206-00000009' ...and wait.. and then... Channel Location State Application(Data) PJSIP/fromvoipfone-2 s at test:2 Up AGI(agi://localhost:3456) PJSIP/fromvoipfone-2 s at test:2 Up AGI(agi://localhost:3456) PJSIP/fromvoipfone-2 s at test:2 Up AGI(agi://localhost:3456) 3 active channels 3 active calls So they just won't die. Asterisk 18.4.0 - worth filing a bug? On Wed, 26 May 2021 at 17:22, Jonathan H <lardconcepts at gmail.com> wrote:> > https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+AGICommand_set+autohangup > > "Cause the channel to automatically hangup at time seconds in the future" > > SET AUTOHANGUP TIME > > Looks great. Except... it doesn't. It just causes AGI to send "HANGUP" > and any audio to stop playing. > It does NOT hangup the channel, or even send any SIP event. The line > just goes silent. > > It's been an entire afternoon of profuse googling; I have tried adding > and removing hangup handlers, I have even tried setting the > AGIEXITONHANGUP flag to "1" as per > https://wiki.asterisk.org/wiki/display/AST/Asterisk+Standard+Channel+Variables > > But this is all that happens (5 seconds is ridiculous, it's just to > test). This is with "pjsip set logger on" > > AGI Rx << SET AUTOHANGUP 5 > AGI Tx >> 200 result=0 > AGI Rx << SET VARIABLE AGIEXITONHANGUP "1" > AGI Tx >> 200 result=1 > AGI Tx >> HANGUP << > AGI Rx << HANGUP > AGI Tx >> 511 Command Not Permitted on a dead channel or intercept routine > > basically, the next log event is whenever the next REGISTER would > normally happen. > > And of course, if I try and respond to the AGI again, it tells me the > channel is dead. So WHY is the "hangup" event not sent to the phone? > > I cannot use other methods like setting the absolute channel timeout > variable, or using a local "dial" with a timeout message because: > > 1: the system tests whether the next file will push the listener over > the 1 hour limit for included calls in UK packages, so the autohangup > value has to be dynamic > 2: It has to be over-ridable so that the listener can continue past the hour > 3: The message that plays out is dynamically generated > > Everything about it works fine... except the fact that it doesn't > actually hangup. > Which leaves the possibility that an old person might fall asleep and > end up with a large bill, which we don't want!
Steve Edwards
2021-May-27 05:52 UTC
[asterisk-users] HELP! AGI AUTOHANGUP does not seem to hangup the channel.
On Wed, 26 May 2021, Jonathan H wrote:> It just causes AGI to send "HANGUP" and any audio to stop playing. It > does NOT hangup the channel, or even send any SIP event. The line just > goes silent.I wouldn't expect the AGI() application to send a SIP event. The AGI() application does not care what technology you use. Receiving 'HANGUP' as text from Asterisk appears to be a FastAGI thing which kind of makes sense -- if your FastAGI server is not localhost, how could Asterisk send it a signal? Are you supposed to close your TCP connection and exit your AGI when you receive the HANGUP text? When I set autohangup in a 'normal' AGI, it looks like this: <SIP/poly-77a1-000002a2>AGI Tx >> agi_request: null-agi.php <SIP/poly-77a1-000002a2>AGI Tx >> agi_channel: SIP/poly-77a1-000002a2 <SIP/poly-77a1-000002a2>AGI Tx >> agi_language: en <SIP/poly-77a1-000002a2>AGI Tx >> agi_type: SIP <SIP/poly-77a1-000002a2>AGI Tx >> agi_uniqueid: 1622093977.1168 <SIP/poly-77a1-000002a2>AGI Tx >> agi_version: 13.14.1~dfsg-2+deb9u4 <SIP/poly-77a1-000002a2>AGI Tx >> agi_callerid: 5555555555 <SIP/poly-77a1-000002a2>AGI Tx >> agi_calleridname: Steve Edwards <SIP/poly-77a1-000002a2>AGI Tx >> agi_callingpres: 0 <SIP/poly-77a1-000002a2>AGI Tx >> agi_callingani2: 0 <SIP/poly-77a1-000002a2>AGI Tx >> agi_callington: 0 <SIP/poly-77a1-000002a2>AGI Tx >> agi_callingtns: 0 <SIP/poly-77a1-000002a2>AGI Tx >> agi_dnid: * <SIP/poly-77a1-000002a2>AGI Tx >> agi_rdnis: unknown <SIP/poly-77a1-000002a2>AGI Tx >> agi_context: newline <SIP/poly-77a1-000002a2>AGI Tx >> agi_extension: * <SIP/poly-77a1-000002a2>AGI Tx >> agi_priority: 6 <SIP/poly-77a1-000002a2>AGI Tx >> agi_enhanced: 0.0 <SIP/poly-77a1-000002a2>AGI Tx >> agi_accountcode: <SIP/poly-77a1-000002a2>AGI Tx >> agi_threadid: 1945654064 <SIP/poly-77a1-000002a2>AGI Tx >> <SIP/poly-77a1-000002a2>AGI Rx << set autohangup 5 <SIP/poly-77a1-000002a2>AGI Tx >> 200 result=0 > 0x73c3dba0 -- Strict RTP learning complete - Locking on source address 192.168.0.139:2254 (and then after 5 seconds) -- <SIP/poly-77a1-000002a2>AGI Script null-agi.php completed, returning 4 -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST https://www.linkedin.com/in/steve-edwards-4244281
Steve Edwards
2021-May-27 06:14 UTC
[asterisk-users] HELP! AGI AUTOHANGUP does not seem to hangup the channel.
On Wed, 26 May 2021, Jonathan H wrote:> AGI Rx << SET AUTOHANGUP 5 > AGI Tx >> 200 result=0 > AGI Tx >> HANGUP <<This does raise a question in my mind... The AGI protocol is: your AGI sends a request (the Rx line) and receives a response (the Tx line). 1 line out, 1 line in. If the 'HANGUP' text can arrive asynchronously, how are you supposed to know it has arrived? Poll (or select) on the file pointer?> I cannot use other methods like setting the absolute channel timeout > variableI don't understand why you can't use the absolute channel timeout. Wherever you 'set autohangup x' just set 'TIMEOUT(absolute)=${EPOCH}+x.' -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST https://www.linkedin.com/in/steve-edwards-4244281