Home » Asterisk Users » AGI HANGUP PROBLEM
Asterisk Users 8 Comments

Hi all,

I need to handle a problem from agi please guide me

in extensions_custom.conf :

exten => s,1,Answer exten => s,n,AGI(hang.php)
exten => s,n,Hangup

in hang.php :

#!/usr/bin/php -q

calling from an extension has no problem but whenever i use landline or mobile it can not hangup the call and the caller has to hangup the call. if the caller does not hangup the call it becomes kind of SPY (the caller can listen DTMF if someone call from an extension)

I am using elastix 2.3.0 which has asterisk .

I really appreciate your sharing.

Regards, Mehdi

8 thoughts on - AGI HANGUP PROBLEM

  • Hello,

    I experience the same problem, and I would really appreciate if someone could give us a hint on that.


    Le 17/09/2012 19:22, Mehdi Rahimi a

  • Hi,

    Just following this thread for few days, I’ve some basic troubleshooting questions for you.
    1- What do you mean by calling from landline? How is your Landline /mobile reaching your asterisk box ? is there a Hardware card ! or a VoIP provider.
    2- Enable SIP traces and keep an eye on the originating BYE request when the agi->hangup() is called. See if that BYE reaches to the caller !

    I suspect its a Hardware card that is not dropping the channel and maintaining the call with server.

    Regards, Sammy

  • ŔźDear Sammy,

    Thank you for your following ,
    1- Land line i mean telco company which is calling to my server , i use FXO VOIP CARD (ATCOM 4 port) and test on a gateway too.
    2-please explain me more about “Enable SIP traces and keep an eye on the originating BYE request”

    Regards, Mehdi

  • In article , Mehdi Rahimi wrote:

    In the UK phone network, and I suspect in many other countries too, for analogue lines it is the caller who holds the call open. For example in a call between two normal analogue phones, the called party can hangup their phone, and then within a short while pick it up again (or another phone on the same line) and the caller is still there. Hanging up the called phone does not clear down the call until after quite a long timeout (a couple of minutes perhaps).

    In your above example with Asterisk connected to an analogue line with an FXO card, Asterisk is the called party, and is therefore unable to clear down the line forcibly. This is not an Asterisk or AGI problem but a PSTN one.

    Cheers Tony

  • Hi,

    So basically the FXO cards configurations need to be tweaked i.e hanguponpolarityinverse=yes etc. Since this is a Hangup request initiated by the SIP client, Asterisk then atleast it should close all the media streams and channel should get deleted. Keeping an eye on BYE : *CLI> “sip set debug on” Then make this call and see if a SIP BYE method is triggered properly and appears on screen. More likely you need to look into you dahdi configs.

    Thanks, Sammy

  • In article , SamyGo wrote:

    I think you are misunderstanding the OP’s issue.

    Hangup on polarity reversal would only apply if Asterisk were making the call to a phone and wanted to me informed if the phone (called party)
    hung up.

    The OP’s situation is different. The extension below is invoked by an INCOMING call to Asterisk, and he is then trying to hang up that call from the Asterisk (called) end.

    If the caller is a SIP phone, that is fine, as either end can hang up.

    Hi problem is that when the incoming call is via his FXO port, the PSTN
    does not drop the call when the Asterisk end hangs up the FXO line. In this scenario there is on SIP involved. The problem is that the PSTN
    will not drop the call when the called party on an analogue line hangs up, until after a long timeout. There is usually no solution to this.

    Cheers Tony

  • Hi Tony,

    Thank you for your attention , and appreciate your contribution . You are right we can not do anything till the caller hangup BUT how can we prevent to hearing DTMF when someone else is trying on another extension ?
    to clearance :
    someone calls (from landlines os mobile , no difference) and our AGI
    has executed and after some processes finish and hangup , but the caller has not hungup yet and till then if i pickup my extension and try to call , that caller who has not hungup the call yet can hear DTMF and that’s a problem and some conflict.

    Regards, Mehdi

  • Yes, that is the way a “calling party disconnects” telephone network works.
    Someone else rang you –> You answered –> You put the phone down –> They didn’t put their phone down –> You will still be connected to them –> If you dial, they will hear your digits; if you speak, they will hear your voice.

    It is a telephone company issue, not an Asterisk issue.

    Asterisk gets around this the only way it can: by not marking an FXO line on which an incoming call has been answered as “free” until the calling party has hung up.