[asterisk-users] [1.4.39.2] Simple AGI doesn't reply

Gilles codecomplete at free.fr
Thu Feb 24 04:56:25 CST 2011


Hello

The following, dead simple Bash script ran as AGI doesn't reply to
Asterisk:

============= extensions.conf
[from_fxo]
exten => s,1,Wait(2)
exten => s,n,Set(CID=${CALLERID(num)})
exten => s,n,AGI(/var/tmp/basic.agi)
exten => s,n,Hangup()
============= /var/tmp/basic.agi
#!/bin/bash

#Ripped from
#http://lists.digium.com/pipermail/asterisk-users/2003-July/008554.html

while read -e ARG && [ "$ARG" ] ; do
done

echo "NOOP Here"
while read line
do
============= CLI
centos*CLI>
    -- Starting simple switch on 'DAHDI/1-1'
    -- Executing [s at from_fxo:1] Wait("DAHDI/1-1", "2") in new stack
    -- Executing [s at from_fxo:2] Set("DAHDI/1-1", "CID=123456") in new
stack
    -- Executing [s at from_fxo:3] AGI("DAHDI/1-1", "/var/tmp/basic.agi")
in new stack
    -- Launched AGI Script /var/tmp/basic.agi
AGI Tx >> agi_request: /var/tmp/basic.agi
AGI Tx >> agi_channel: DAHDI/1-1
AGI Tx >> agi_language: en
AGI Tx >> agi_type: DAHDI
AGI Tx >> agi_uniqueid: 1298544498.10
AGI Tx >> agi_callerid: 123456
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: unknown
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: from_fxo
AGI Tx >> agi_extension: s
AGI Tx >> agi_priority: 3
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
    -- AGI Script /var/tmp/basic.agi completed, returning 0
    -- Executing [s at from_fxo:4] Hangup("DAHDI/1-1", "") in new stack
  == Spawn extension (from_fxo, s, 4) exited non-zero on 'DAHDI/1-1'
    -- Hungup 'DAHDI/1-1'
=============

As you can see, the AGI script doesn't reply to Asterisk: Does CentOS
and/or Asterisk require some tweaking so that an AGI script can read
data from stdin?

FWIW, before using this Bash script, I could successfully run
Asterisk's agi-test.agi successfully.

Thank you.




More information about the asterisk-users mailing list