How long Asterisk wait for an AGI call?

1.4k Views Asked by At

I have a simple dialplan in Asterisk 13

exten => 800,1,Answer()
 ;AGI do something and return AUDIO_FILE tobe played
 same => n,Agi(agi://localhost:1000/doAlotOfThing.agi)
 same => n,Playback(${AUDIO_FILE}
 same => n,Hangup()

I was expect Asterisk will wait for AGI until it done processing the command then return AUDIO_FILE variable (about 20 seconds). But the actual is Asterisk just wait about few seconds, and even Agi is not done yet, it still passing it and playing AUDIO_FILE (which not be initialized) So the question is: How i can change the AGI timeout setting in Asterisk?

1

There are 1 best solutions below

1
On BEST ANSWER

AGI interface is simple.

If you do instead of agi file something like

while(1){
 sleep(1)
}

then it will wait until caller hangup(actualy even some more time after hangup, but that not granted, so you have AVOID such agi).

If asterisk go via dialplan to next destination, that mean your agi closed input stream or issued exit(0) or similar command.