Florian Overkamp
2003-Feb-25 02:01 UTC
[Asterisk-Users] oddness in AGI - a bug in AGI or my own insanity ?
Hi guys, I'm writing an AGI application to handle voicemail in a somewhat intelligent way. However, I'm having trouble. In specific cases it seems AGI gives an error and exit a STREAM FILE command even though the file has not finished yet (and infact it remains to play but the AGI script continues at the same time). See some sample debug output: 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). BTW - This effect is not seen in all cases, but seems to be related to an input command was missed before (i.e. no digits input on a STREAM FILE).. Strange... Suggestions ???? Florian
James Golovich
2003-Feb-25 14:33 UTC
[Asterisk-Users] oddness in AGI - a bug in AGI or my own insanity ?
On Tue, 25 Feb 2003, Florian Overkamp wrote:> Hi guys, > > I'm writing an AGI application to handle voicemail in a somewhat > intelligent way. However, I'm having trouble. In specific cases it seems > AGI gives an error and exit a STREAM FILE command even though the file has > not finished yet (and infact it remains to play but the AGI script > continues at the same time).Well that doesn't seem right. It should always play the whole file. There were some modifications to allow stopping/starting of streaming files I suppose this could be related.> > See some sample debug output: > > 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. James
Florian Overkamp
2003-Feb-26 03:59 UTC
[Asterisk-Users] oddness in AGI - a bug in AGI or my own insanity ?
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