> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Monday, May 15, 2006 8:19 AM
> To: [email protected]
> Subject: [Asterisk-Users] GET DATA and STREAM FILE commands, 
> don´t work
> 
...
> 
> Now, below is my script in bash shell, scriptTest.bsh:
> 
> #!/bin/bash
> #echo -e "Testing the working GET DATA and STREAM FILE\n" >&2 
> echo -e "STREAM FILE demo-instruct \"\"\n"
> echo -e "GET DATA myprompt 4000 6\n"
> read getDigits
> echo -e "My Digits are: $getDigits\n" >&2 echo -e "HUNGUP\n"

The first thing asterisk does once it starts an AGI process is to send various 
details about the caller to your script's STDIN. You need to read all that in 
before issuing any commands.

Add the following to the top of your script:

declare -a array
while read -e ARG && [ "$ARG" ] ; do
        array=(` echo $ARG | sed -e 's/://'`)
        export ${array[0]}=${array[1]}
done

This will export various ENV variables containing the info asterisk is sending.

For more info look at the BASH resources on the Asterisk AGI page of 
voip-info.org. (http://www.voip-info.org/wiki-Asterisk+AGI)

Josh McAllister
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to