Re: [asterisk-users] HELP! AGI AUTOHANGUP does not seem to hangup the channel.

2021-05-27 Thread Steve Edwards

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 
variable


I 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   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] HELP! AGI AUTOHANGUP does not seem to hangup the channel.

2021-05-26 Thread Steve Edwards

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:

AGI Tx >> agi_request: null-agi.php
AGI Tx >> agi_channel: SIP/poly-77a1-02a2
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1622093977.1168
AGI Tx >> agi_version: 13.14.1~dfsg-2+deb9u4
AGI Tx >> agi_callerid: 55
AGI Tx >> agi_calleridname: Steve Edwards
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: *
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: newline
AGI Tx >> agi_extension: *
AGI Tx >> agi_priority: 6
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode: 
AGI Tx >> agi_threadid: 1945654064
AGI Tx >> 
AGI Rx << set autohangup 5

AGI Tx >> 200 result=0
   > 0x73c3dba0 -- Strict RTP learning complete - Locking on source address 
192.168.0.139:2254
(and then after 5 seconds)
-- AGI Script null-agi.php completed, returning 4

--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] HELP! AGI AUTOHANGUP does not seem to hangup the channel.

2021-05-26 Thread Jonathan H
I think I can confidently say, after most of a day and reading the following

https://stackoverflow.com/questions/66768885/why-doesnt-asterisk-17-catch-hangup-request-from-pjsip-client-solved
https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+AGICommand_set+autohangup
https://community.freepbx.org/t/inbound-calls-dont-hang-up/53612
https://community.freepbx.org/t/pjsip-problem-channel-not-closing/65311/7
https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_ENDPOINT
https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Configuration_res_pjsip

... that Asterisk doesn't like mixing autoHangup with AGI, and there
appears to be no way of the ts-agi library I'm using knowing that it
has autoHungup, so it can't close the AGI connection which seems to
release Asterisk to hangup properly.

I had thought that the AGIEXITONHANGUP variable might help, but it
appears to do nothing, although I'm unsure if I'm setting it correctly
as:

Here it says the flag is "1"
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Standard+Channel+Variables

And here it says the flag is "yes"
https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Application_AGI

That said, I wish I could use ARI not AGI but without the current
media offset available on ARI, I need AGI :)

So for now, the workaround is to forget about setting autohangup, and
just hangup the caller manually at the point they don't over-ride the
timeout.

Thanks!

On Wed, 26 May 2021 at 18:01, Joshua C. Colp  wrote:
>
> On Wed, May 26, 2021 at 1:58 PM Jonathan H  wrote:
>>
>> 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-000b' 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-000b'
>> Requested Hangup on channel 'PJSIP/fromvoipfone-206-000a'
>> Requested Hangup on channel 'PJSIP/fromvoipfone-206-0009'
>>
>> ...and wait.. and then...
>>
>> Channel  Location State   Application(Data)
>> PJSIP/fromvoipfone-2 s@test:2 Up  AGI(agi://localhost:3456)
>> PJSIP/fromvoipfone-2 s@test:2 Up  AGI(agi://localhost:3456)
>> PJSIP/fromvoipfone-2 s@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?
>
>
> Is your AGI closing the connection or are you expecting Asterisk to drop it? 
> (I'm not that familiar with FastAGI or AGI these days, just wondering what 
> happens if you drop the connection)
>
> --
> Joshua C. Colp
> Asterisk Technical Lead
> Sangoma Technologies
> Check us out at www.sangoma.com and www.asterisk.org
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at: https://community.asterisk.org/
>
> New to Asterisk? Start here:
>   https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] HELP! AGI AUTOHANGUP does not seem to hangup the channel.

2021-05-26 Thread Joshua C. Colp
On Wed, May 26, 2021 at 1:58 PM Jonathan H  wrote:

> 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-000b' 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-000b'
> Requested Hangup on channel 'PJSIP/fromvoipfone-206-000a'
> Requested Hangup on channel 'PJSIP/fromvoipfone-206-0009'
>
> ...and wait.. and then...
>
> Channel  Location State   Application(Data)
> PJSIP/fromvoipfone-2 s@test:2 Up
> AGI(agi://localhost:3456)
> PJSIP/fromvoipfone-2 s@test:2 Up
> AGI(agi://localhost:3456)
> PJSIP/fromvoipfone-2 s@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?
>

Is your AGI closing the connection or are you expecting Asterisk to drop
it? (I'm not that familiar with FastAGI or AGI these days, just wondering
what happens if you drop the connection)

-- 
Joshua C. Colp
Asterisk Technical Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] HELP! AGI AUTOHANGUP does not seem to hangup the channel.

2021-05-26 Thread Jonathan H
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-000b' 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-000b'
Requested Hangup on channel 'PJSIP/fromvoipfone-206-000a'
Requested Hangup on channel 'PJSIP/fromvoipfone-206-0009'

...and wait.. and then...

Channel  Location State   Application(Data)
PJSIP/fromvoipfone-2 s@test:2 Up  AGI(agi://localhost:3456)
PJSIP/fromvoipfone-2 s@test:2 Up  AGI(agi://localhost:3456)
PJSIP/fromvoipfone-2 s@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  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!

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] HELP! AGI AUTOHANGUP does not seem to hangup the channel.

2021-05-26 Thread Jonathan H
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!

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users