cleviton.araujo@caixa.gov.br
2006-May-15 07:18 UTC
[Asterisk-Users] GET DATA and STREAM FILE commands, don´t work
Hi,
I have been written an small script for test the use these commands. I had done
massive test with commands, but I didn?t get success
it. Any of the cases, I don?t listen nothing on channel that call 2100
extension. I dial 2100 extension through an cisco phone 7912 with SIP, also I
dialed through ATA SIP (Linksys PAP-2).
I?m using Asterisk 1.2.7.1 and ztdummy driver, linux kernel 2.6.11.4. I also
have been done exhausting testing another Asterisk functionalities and all had
worked very well, perfectly well. But, some AGI commands not.
I would like get help upon it. Somebody already faced this before?
Following, my dialplan that call agi script:
exten=>2100,1,Answer()
exten=>2100,2,Agi(scriptTest.bsh)
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"
I changed some times the path, put full path (/var/lib/asterisk/sounds) to the
demo-instruct and mypromt files, but didn?t work. I entered all the command
arguments, but it didn?t.
Regards,
Cleviton Araujo
Below, follow the console verbose of the several attempts. Sorry by bit
verboses, but think be need at the detail of the problem:
Connected to Asterisk 1.2.7.1 currently running on linux (pid = 19044)
Verbosity is at least 18
-- Executing AGI("SIP/8070-609b", "teste.bsh") in new
stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/teste.bsh
AGI Tx >> agi_request: teste.bsh
AGI Tx >> agi_channel: SIP/8070-609b
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1147466306.21
AGI Tx >> agi_callerid: 8070
AGI Tx >> agi_calleridname: Michely Germano
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 2100
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: test
AGI Tx >> agi_extension: 2100
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << GET DATA /var/lib/asterisk/sounds/demo-instruct ""
-- Playing '/var/lib/asterisk/sounds/demo-instruct' (language
'en')
AGI Rx <<
AGI Tx >> 510 Invalid or unknown command
AGI Rx << HANGUP
AGI Tx >> 200 result=1
AGI Rx <<
AGI Tx >> 510 Invalid or unknown command
-- AGI Script teste.bsh completed, returning 0
linux*CLI>
Connected to Asterisk 1.2.7.1 currently running on linux (pid = 19044)
Verbosity is at least 18
-- Executing AGI("SIP/8070-5638", "teste.bsh") in new
stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/teste.bsh
AGI Tx >> agi_request: teste.bsh
AGI Tx >> agi_channel: SIP/8070-5638
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1147466526.25
AGI Tx >> agi_callerid: 8070
AGI Tx >> agi_calleridname: Michely Germano
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 2100
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: test
AGI Tx >> agi_extension: 2100
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << GET DATA demo-instruct 4000 5
-- Playing 'demo-instruct' (language 'en')
AGI Rx <<
AGI Tx >> 510 Invalid or unknown command
AGI Rx << HANGUP
AGI Tx >> 200 result=1
AGI Rx <<
AGI Tx >> 510 Invalid or unknown command
-- AGI Script teste.bsh completed, returning 0
linux*CLI>
Connected to Asterisk 1.2.7.1 currently running on linux (pid = 19044)
Verbosity is at least 18
-- Executing AGI("SIP/8070-7f33", "teste.bsh") in new
stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/teste.bsh
AGI Tx >> agi_request: teste.bsh
AGI Tx >> agi_channel: SIP/8070-7f33
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1147466745.27
AGI Tx >> agi_callerid: 8070
AGI Tx >> agi_calleridname: Michely Germano
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 2100
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: test
AGI Tx >> agi_extension: 2100
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << Testing the working GET DATA and STREAM FILE
AGI Tx >> 510 Invalid or unknown command
AGI Rx <<
AGI Tx >> 510 Invalid or unknown command
AGI Rx << GET OPTION demo-instruct "#2"
-- Playing 'demo-instruct' (escape_digits=#2) (timeout 5000)
AGI Rx <<
AGI Tx >> 510 Invalid or unknown command
AGI Rx << HANGUP
AGI Tx >> 200 result=1
== Spawn extension (test, 2100, 1) exited non-zero on 'SIP/8070-7f33'
linux*CLI>
linux:/var/lib/asterisk/agi-bin #
Connected to Asterisk 1.2.7.1 currently running on linux (pid = 19044)
Verbosity is at least 18
-- Executing AGI("SIP/8070-3abb", "teste.bsh") in new
stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/teste.bsh
AGI Tx >> agi_request: teste.bsh
AGI Tx >> agi_channel: SIP/8070-3abb
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1147467069.29
AGI Tx >> agi_callerid: 8070
AGI Tx >> agi_calleridname: Michely Germano
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 2100
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: test
AGI Tx >> agi_extension: 2100
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << Testing the working GET DATA and STREAM FILE
AGI Tx >> 510 Invalid or unknown command
AGI Rx <<
AGI Tx >> 510 Invalid or unknown command
AGI Rx << STREAM FILE demo-instruct "#2"
AGI Rx <<
AGI Tx >> 510 Invalid or unknown command
AGI Rx << HANGUP
AGI Tx >> 200 result=1
== Spawn extension (test, 2100, 1) exited non-zero on 'SIP/8070-3abb'
linux*CLI>
================ In Perl ==============Connected to Asterisk 1.2.7.1 currently
running on linux (pid = 19044)
Verbosity is at least 18
-- Executing AGI("SIP/8070-c98e", "teste.bsh") in new
stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/teste.bsh
AGI Tx >> agi_request: teste.bsh
AGI Tx >> agi_channel: SIP/8070-c98e
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1147468848.45
AGI Tx >> agi_callerid: 8070
AGI Tx >> agi_calleridname: Michely Germano
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 2100
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: test
AGI Tx >> agi_extension: 2100
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << GET DATA demo-instruct ""
-- Playing 'demo-instruct' (language 'en')
-- AGI Script teste.bsh completed, returning 0
May 12 15:20:58 WARNING[19479]: pbx.c:2412 __ast_pbx_run: Timeout, but no rule
't' in context 'test'
linux*CLI>
Josh McAllister
2006-May-15 11:40 UTC
RE: [Asterisk-Users] GET DATA and STREAM FILE commands, don´t work
> -----Original Message----- > From: asterisk-users-bounces@lists.digium.com > [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of > cleviton.araujo@caixa.gov.br > Sent: Monday, May 15, 2006 8:19 AM > To: asterisk-users@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