[Asterisk-Dev] Strange Bug programing an AGI Script and C

Steven Critchfield critch at basesys.com
Fri Sep 10 13:07:18 MST 2004


On Fri, 2004-09-10 at 09:17, Dalabera Rush wrote:
> I'm modifying and old script that was developed in C
> by a coworker , the strange thing is that I have a
> function that set the language to SP and I have to
> call it twice since the first time it always return
> "510 Invalid or unknown command".
> here is a snap of the code:

I am betting you have 1 of 2 problems. The first is you are out of sync
with the result returned and the 510 is for a different command, or you
have leaked something to STDOUT and your first run_command is clearing
it out. Maybe try it with someother not important command in your first
portion to verify.

Also, that was a -user question, not a -dev question unless you have
identified the bug in agi.

> static int setLanguage(void)
> {
>        char *res;
> 	   
> 	   res = run_command("EXEC SETLANGUAGE sp");
> 	          if (!res) {
>                fprintf(stderr, "Failed to execute
> command\n");
>                return -1;
>        }
> 
>        res = run_command("EXEC SETLANGUAGE sp");
> 	          if (!res) {
>                fprintf(stderr, "Failed to execute
> command\n");
>                return -1;
>        }
> return 0;
> }
> 
> static char *run_command(char *command)
> {
> fprintf(stdout, "%s\n", command);
> return wait_result();
> }

-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-dev mailing list