Set timeout when call AGI in file extension.conf

Dear all,
I defined when calling AGI in file extension.conf as follows:

[ADVERTISE]
exten => s,1,Answer()
exten => s,n,NoOp(params=${params})
exten => s,n,Agi(agi://127.0.0.1:4573/IVR.BASIC?params=${params}&shortCode=${CALLERID(number)})
exten => s,n,Hangup()

Some time AGI at IP: 127.0.0.1 port 4573 have proplem then Asterisk gave a warning:

[Oct 21 17:30:08] WARNING[21358]: chan_sip.c:4411 __sip_autodestruct: Autodestruct on dialog '5c70afc3363c6f9503abb21c29e08cdb@10.226.39.49' with owner SIP/trunk_GMSC22-00000013 in place (Method: BYE). Rescheduling destruction for 10000 ms

After timeout , the system will disconnect that call.

 -- <SIP/trunk_GMSC22-00000013>AGI Script agi://127.0.0.1:4573/IVR.SUB.MPS?params=1573_120_67076714574_3_184_SUBSCRIBEMPS_2_2&shortCode=184 completed, returning 4
  == Spawn extension (SUBSCRIBEMPS, s, 4) exited non-zero on 'SIP/trunk_GMSC22-00000013'

I want to set timeout =30 second when call AGI. What can i do?

Thanks,

You are not expected to have long running operations in hangup handlers and h extension. However, the timer used for the rescheduling of the destruction has nothing to do with your AGI. It is operating at the SIP dialogue level, not the channel level. Here it is just indicating that your h extension is rather long running.

If you want to apply a timeout on the AGI, you need to do that within the script itself.

Thanks David551,

Help me to more detail. I am using Asterisk 16

Thanks,

It’s a question for the OS and your scripting language, not for Asterisk.

  1. You could set the ‘absolute timeout’ of the channel before calling the AGI.

  2. As david551 suggests, set a timer in your AGI. I usually write AGIs in C so it looks something like this:

// trap SIGALRM -- the process is taking too long
        signal(SIGALRM, (void (*)(int))(long int)hung_process);

// set an alarm
        alarm(recording_limit * 2);

Where ‘hung_process()’ is a function in my AGI that:

  1. Syslog()'s a message.
  2. Sends me an email.
  3. Closes the database connection.
  4. Exits.

I prefer to handle this in the AGI so I have greater control over what happens.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.