[asterisk-users] broken pipe in perl agi

Steve Edwards asterisk.org at sedwards.com
Thu Jun 4 14:12:22 CDT 2009


On Thu, 4 Jun 2009, Danny Nicholas wrote:

> Hi gang,

It's not a gang -- it's a club :)

>             Since I'm getting no joy from device_Status or SIPPEER in 
> 1.4.26-rc1, I thought I would do an AGI to read my hints and check for 
> line in use that way.  The AGI works fine from a prompt, but returns the 
> dreaded "utils.c:966 ast_carefulwrite: write() returned error: Broken 
> pipe" when I try to run it from the dialplan.  Here is my dialplan 
> snippet;

Sounds like you have violated the AGI protocol.

1) Does "agi debug' provide any insight?

2) When you run it from the command line are you supplying an AGI 
environment like

 	sh agi-environment.sh\
 		| /var/lib/asterisk/agi-bin/hintcheck.agi foo

where agi-environment.sh looks something like:

# the standard AGI environment variables
         echo "agi_accountcode: "
         echo "agi_callerid: 1234567890"
         echo "agi_calleridname: sedwards"
         echo "agi_callingani2: 0"
         echo "agi_callingpres: 0"
         echo "agi_callingtns: 0"
         echo "agi_callington: 0"
         echo "agi_channel: SIP/201-09456478"
         echo "agi_context: newline"
         echo "agi_dnid: *"
         echo "agi_enhanced: 0.0"
         echo "agi_extension: *"
         echo "agi_language: en"
         echo "agi_priority: 1"
         echo "agi_rdnis: unknown"
         echo "agi_request: block-ani"
         echo "agi_type: SIP"
         echo "agi_uniqueid: 1195070681.28"
         echo ""

#### cruft specific to my AGI

# result for AGI command SET PRIORITY
         echo "200 result=0"

# result for AGI command GET VARIABLE ANI
         echo "200 result=1 (1234567890)"

# result for AGI command GET VARIABLE CARD-NUMBER
         echo "200 result=0"

# result for AGI command GET VARIABLE DATABASE-DATABASE
         echo "200 result=1 (example)"

# result for AGI command GET VARIABLE DATABASE-PASSWORD
         echo "200 result=1 (example)"

# result for AGI command GET VARIABLE DATABASE-SERVER
         echo "200 result=1 (example)"

# result for AGI command GET VARIABLE DATABASE-USER
         echo "200 result=1 (example)"

# various other results
         echo "200 result=0"
         echo "200 result=0"
         echo "200 result=0"
         echo "200 result=0"
         echo "200 result=0"
         echo "200 result=0"
         echo "200 result=0"
         echo "200 result=0"
         echo "200 result=0"
         echo "200 result=0"
         echo "200 result=0"

# (end of agi-environment.sh)

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000



More information about the asterisk-users mailing list