Hi gang, 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; [macro-stdexten] exten => s,1,Set(__DYNAMIC_FEATURES=${FEATURES}) exten => s,n,GotoIf($[${FOLLOWME_${ARG1}} = 1]?5:3) exten => s,n,Noop(dial $ARG1 after checking sippeer) exten => s,n,Set(LINESTAT=Idle) exten => s,n,AGI(hintcheck.agi|${ARG1}) exten => s,n,Wait(3) exten => s,n,Verbose(status is ${LINESTAT}) exten => s,n,Gotoif($["${LINESTAT}" != "Idle"]?inuse) exten => s,n,Dial(${ARG2},${RINGTIME},${DIALOPTIONS}) exten => s,n,Goto(s-${DIALSTATUS},1) exten => s,n,Macro(stdexten-followme,${ARG1},${ARG2}) exten => s,n,Background(vm-goodbye) exten => s,n,Hangup exten => s,n(inuse),Voicemail(${ARG1}) exten => s,n,Followme(${ARG1},${FOLLOWMEOPTIONS}) exten => s,n,Voicemail(${ARG1},u) exten => s-NOANSWER,1,Voicemail(${ARG1},u) exten => s-NOANSWER,2,Goto(default,s,1) exten => s-BUSY,1,Voicemail(${ARG1},b) exten => s-BUSY,2,Goto(default,s,1) exten => _s-.,1,Goto(s-NOANSWER,1) exten => a,1,VoicemailMain(${ARG1}) Any ideas? TIA Danny Nicholas -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090604/ecb19432/attachment.htm
Danny Nicholas schrieb:> 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.Sounds like $SIG{'PIPE'} = 'IGNORE'; is what you need. http://perldoc.perl.org/perlipc.html#Signals Philipp Kempgen -- AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied -> http://www.amooma.de Gesch?ftsf?hrer: Stefan Wintermeyer, Handelsregister: Neuwied B14998 Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de Videos of the AMOOCON VoIP conference 2009 -> http://www.amoocon.de --
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
Reasonably Related Threads
- [1.4.39.1/AGI] ast_carefulwrite: write() returned error: Broken pipe
- carefulwrite: write() returned error: Broken pipe
- Broken Pipe error while using UpdateConfig command
- callforward with asterisk-gui.problem with stdexten
- Asterisk 1.8 AGI error ast_carefulwrite: write() returned error