[Asterisk-Users] AGI script sample using bash shell script

Sunny Woo sunnywoo at yahoo.com
Sat Jul 12 22:13:48 MST 2003


faizan at tilizone.com,

During development of the bash script, I have problem reading the whole
string from the STDIN and I notice the next command won't get executed.

Notice the "case statements" that I have to implement to handle the read
line. This is because normally Asterisk will return one line "200 ...".
However, if the command is not properly written, like "SAY NUMBER"
instead of "SAY NUMBER 123 \"\" ", then Asterisk will return multiline
usage information back ... something like 

520-blah blah blah\n
blah blah blah blah\n
...
520 End of ...\n

The next command will not get executed until you read the last line.

Suggestions, play around with this:

echo "SAY NUMBER 123 \"\""   <---- Asterisk says 123
read line                    <---- Asterisk return 200
echo "SAY NUMBER 123"
read line                    <---- Asterisk return usage info.
                                   but we only read one line
echo "SAY NUMBER 345 \"\""   <---- this will not be executed
read line

Hope this helps,

Sunny Woo
Solutions Consultant
Avantnix


> Hey does that mean that whole perl script won execute or the next AGI command 
> wont execute. Cuz may be I get this problem too.
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users





More information about the asterisk-users mailing list