Error with swift.agi file

Hi, Iam developing a ragi application. In order to make use of the speak_text method, i added the swift.agi file in /var/lib/asterisk/agi-bin directory.

I give all read/write permission to the file. when i try to call the extension i get the following error:

[color=red]Lauched AGI script /var/lib/asterisk/agi-bin /swift.agi
/var/lib/asterisk/agi-bin /swift.agi: Line 2: text: command not found
/var/lib/asterisk/agi-bin /swift.agi: Line 3: stdin: command not found
/var/lib/asterisk/agi-bin /swift.agi: Line 20: syntax error: unexpected end of file[/color]

my swift.agi file is as given below: the line #2, #3 and @20 are in bold

#!/bin/sh
text = echo $*
stdin = “0”

while “$stdin” != ""
do
read stdin
if “$stdin” != ""
then
stdin2=echo $stdin | sed -e 's/: /=/' -e 's/"//g' -e 's/$/"/' -e 's/=/="/ '
eval echo $stdin2
fi
done

calleridnum=echo $agi_callerid | cut -f2 -d\< | cut -f1 -d\>
calleridname=echo $agi_callerid | cut -f1 -d\<

/usr/local/bin/swift -o /tmp/$agi_uniqueid.wav -p audio/channels=1,audio/sampling-rate=8000 " $text "

echo “stream file /tmp/$agi_uniqueid #”

read stream
rm /tmp/$agi_uniqueid.wav

exit 0

–Please suggest me on this errors. How should i resolve them.

could resolve the first 2 errors by removing spaces before and after the ‘=’ sign. But still could not find out the cause for the error at line 20, which says unexpected end of file.

i get the same problem with swift.agi
i have not yet solved the problem
did you cut and paste the file from the web ?

I could get the error done. If you are using AsteriskNow then it wont work. I installed Asterisk 1.4.9 version on my linux machine and now it doesnt give me that error.

If you are coping the swift.agi file from the web, please use the brackets in the 4th and 7th line like this:

while [ “$stdin” != “” ]
do
read stdin
if [ “$stdin” != “” ]

As this will again give an error say “does not exist in any format”.