[asterisk-users] broken pipe in perl agi
Danny Nicholas
danny at debsinc.com
Thu Jun 4 14:30:27 CDT 2009
Here's what I got from agi debug:
agi debug
AGI Debugging Enabled
*CLI> AGI Tx >> agi_request: hintcheck.agi
AGI Tx >> agi_channel: SIP/170-081c4ab8
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1244140421.2
AGI Tx >> agi_callerid: 170
AGI Tx >> agi_calleridname: Danny Nicholas
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 102
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: macro-stdexten
AGI Tx >> agi_extension: s
AGI Tx >> agi_priority: 5
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << SET VARIABLE LINESTAT="Idle"
AGI Tx >> 200 result=1
[Jun 4 13:33:42] ERROR[28261]: utils.c:979 ast_carefulwrite: write()
returned error: Broken pipe
status is Idle
== Spawn extension (macro-stdexten, s, 9) exited non-zero on
'SIP/170-081c4ab8' in macro 'stdexten'
== Spawn extension (DLPN_DialPlan1, 102, 1) exited non-zero on
'SIP/170-081c4ab8'
Here is the agi-environment.sh output
debsastdev:/var/lib/asterisk/agi-bin # sh agi-environment.sh hintcheck.agi
102
agi_accountcode:
agi_callerid: 1234567890
agi_calleridname: sedwards
agi_callingani2: 0
agi_callingpres: 0
agi_callingtns: 0
agi_callington: 0
agi_channel: SIP/201-09456478
agi_context: newline
agi_dnid: *
agi_enhanced: 0.0
agi_extension: *
agi_language: en
agi_priority: 1
agi_rdnis: unknown
agi_request: block-ani
agi_type: SIP
agi_uniqueid: 1195070681.28
debsastdev:/var/lib/asterisk/agi-bin # vi hintcheck.agi
debsastdev:/var/lib/asterisk/agi-bin # sh agi-environment.sh | env
--ignore-environment hintcheck.agi 102
SET VARIABLE LINESTAT="Idle"
debsastdev:/var/lib/asterisk/agi-bin # sh agi-environment.sh | env
--ignore-environment hintcheck.agi 102
SET VARIABLE LINESTAT="Idle"
debsastdev:/var/lib/asterisk/agi-bin # sh agi-environment.sh | env
--ignore-environment hintcheck.agi 102
SET VARIABLE LINESTAT="Ringing"
debsastdev:/var/lib/asterisk/agi-bin # sh agi-environment.sh | env
--ignore-environment hintcheck.agi 102
SET VARIABLE LINESTAT="Ringing"
debsastdev:/var/lib/asterisk/agi-bin # sh agi-environment.sh | env
--ignore-environment hintcheck.agi 102
SET VARIABLE LINESTAT="InUse"
debsastdev:/var/lib/asterisk/agi-bin # sh agi-environment.sh | env
--ignore-environment hintcheck.agi 102
SET VARIABLE LINESTAT="Hold"
debsastdev:/var/lib/asterisk/agi-bin # sh agi-environment.sh | env
--ignore-environment hintcheck.agi 102
SET VARIABLE LINESTAT="Hold"
Any other ideas?
-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Steve Edwards
Sent: Thursday, June 04, 2009 2:12 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] broken pipe in perl agi
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
_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list