RES: [Asterisk-Users] GET DATA and STREAM FILE commands, don´t work

cleviton.araujo at caixa.gov.br cleviton.araujo at caixa.gov.br
Wed May 17 13:00:21 MST 2006


Mr. McAllister,
thanks by the tip. It´s working perfect.

Cleviton.


-----Mensagem original-----
De: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com]Em nome de Josh
McAllister
Enviada em: segunda-feira, 15 de maio de 2006 15:40
Para: Asterisk Users Mailing List - Non-Commercial Discussion
Assunto: RE: [Asterisk-Users] GET DATA and STREAM FILE commands, don´t
work
 

> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com 
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of 
> cleviton.araujo at caixa.gov.br
> Sent: Monday, May 15, 2006 8:19 AM
> To: asterisk-users at lists.digium.com
> 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



More information about the asterisk-users mailing list