[Asterisk-Users] oddness in AGI - a bug in AGI or my own insanity ?

Florian Overkamp florian at obsimref.com
Wed Feb 26 02:59:34 MST 2003


Hi,

At 15:33 25-2-2003 -0500, you wrote:
> > Entering state: instruct
> > write: STREAM FILE snt/tenalletijde0 0
> > read: 510 Invalid or unknown command
> > Entering state: hoofdmenu
> > for snt message: Hoofdmenu opgevraagd
> > write: STREAM FILE snt/hoofdmenu 1234560*
> >
> > Now, I would _love_ to know what that 510 invalid error means - it is
> > causing me major headaches. At first I thought it was related to the WAIT
> > FOR DIGIT, but it doesn't seem to be (I wrote a wrapper to fake WAIT FOR
> > DIGIT using STREAM FILE and a silent gsm file).
>
>the 510 Invalid error is generated by app_agi when find_command does not
>return a valid command.  Now "STREAM FILE" is a valid command so it should
>find that, so would it be possible that you are sending an extra return so
>app_agi thinks you are sending an empty command?
>
>You could modify app_agi.c so that find_command prints some extra
>debugging of the command it is trying to find.

Alright, I'm debugging now. I've confirmed this problem occurs _only_ if a 
previous command (like a WAIT FOR DIGIT) did _not_ get any digits.

Okay - spotted. The problem lays in a combination of my own AGI code and 
the way Asterisk appears to handle commands.

There was a bug in my code which caused some warnings to be thrown at 
Asterisk. Asterisk could not find these in its command list (ofcourse) and 
bugs on this. However, since it was unexpected output, there is also no 
expected input from Asterisk as far as the AGI script is concerned. Which 
in turn causes many other commands to fail.

It seems a bit weird that AGI allows commands to overlap, i.e. STREAM FILE 
can be followed by other commands. Current behaviour is that these commands 
are honoured, even though there was no result for the STREAM FILE yet. The 
STREAM FILE continues to play, even though my script now expects it to be 
finished and starts throwing other commands at Asterisk.

I think it would be better if commands in AGI were not honoured at all 
untill the current command loop has finished in a normal fashion (either by 
timeout or user input).

Florian





More information about the asterisk-users mailing list