AGI Timeout Option

Home » Asterisk Users » AGI Timeout Option
Asterisk Users 7 Comments

Hello list, Hope you all doing well!

Recently, I had an issue with a FastAGI PHP script, which under some specific situation would run into an infinity loop, consuming all CPU
resources. This also was preventing Asterisk to terminated the call properly because it was waiting for the AGI to return… The application uses AGIspeedy to process the AGI calls, not sure if this can be affecting this situation somehow…. Due to this problem I started looking for some option to timeout the AGI
call and return to the dialplan after XYZ seconds and so this would protect Asterisk preventing the dialplan to get stuck due to some external script problem that is actually outside of Asterisk control. Does Asterisk provide some control of this sort? I searched around and could not find any….. Any idea is appreciated!

Kind regards Patrick Wakano

7 thoughts on - AGI Timeout Option

  • Hello;

    I’ve been using AGISpeedy for Perl for years. I just works, and it works really well. I’m a Perl programmer, not a PHP programmer, but it seems to me that you need the PHP equivalent of Perl’s ‘alarm’ command. Just a thought.

    Regards;

    John V.

    From: asterisk-users [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Patrick Wakano Sent: Thursday, September 13, 2018 09:05 PM
    To: Asterisk Users Mailing List – Non-Commercial Discussion
    Subject: [asterisk-users] AGI timeout option

    Hello list,

    Hope you all doing well!

    Recently, I had an issue with a FastAGI PHP script, which under some specific situation would run into an infinity loop, consuming all CPU resources. This also was preventing Asterisk to terminated the call properly because it was waiting for the AGI to return… The application uses AGIspeedy to process the AGI calls, not sure if this can be affecting this situation somehow….

    Due to this problem I started looking for some option to timeout the AGI call and return to the dialplan after XYZ seconds and so this would protect Asterisk preventing the dialplan to get stuck due to some external script problem that is actually outside of Asterisk control. Does Asterisk provide some control of this sort? I searched around and could not find any…..

    Any idea is appreciated!

    Kind regards

    Patrick Wakano

  • I don’t know AGIspeedy, but I have some PHP scripts where I set a connect timeout using streams.

    Example using https, but should be easily adaptable to non-s http.:

    $pbxsh_bin = @file_get_contents(“https://blah.blah.blah”, FALSE,
    @stream_context_create(array(‘https’ => array(‘timeout’ => 5,
    “verify_peer”=>false, “verify_peer_name”=>false))));


    http://help.nyigc.net/

  • Thanks everyone for the answers!
    I did explored some options at the PHP level and probably will do something in this direction, but in fact what I was really looking was something in the Asterisk side, not in the script side. Because in my opinion regardless of the language or AGI type, Asterisk itself should be able to timeout a long running script and return to the dialplan. However looks like there is nothing of this sort…..

    Kind regards, Patrick Wakano

  • Please can i ask you i want to know which code can help me to provide the taxation of voip/toip services in asterisk

    Le mar. 18 sept. 2018 à 01:36, Patrick Wakano a écrit :

  • Hey,

    I would suggest starting a new thread with this question instead of inserting this into another existing thread like this.

    Matthew Fredrickson

  • Sorry you know i’m student and i’m the end of my studies i must present a memory on taxing voip services

    Le mar. 18 sept. 2018 à 19:11, Matthew Fredrickson a
    écrit :