[asterisk-users] Asterisk 11 originate errors

Christopher Harrington chris at acsdi.com
Wed Dec 12 15:22:02 CST 2012


I've observed the same behavior. This is what happens when you close the
socket before logoff is completed. You need to wait until the logoff action
is completed before closing the socket (your fclose() call). Alternately,
use a proxy or a daemon that will sit between your script and the AMI and
keep the socket open.


On Wed, Dec 12, 2012 at 12:44 PM, Faheem <faheem_imt at yahoo.com> wrote:

> Hi,
> I'm getting errors while originating a call through AMI.
> [Dec 12 21:18:35] ERROR[8661]: utils.c:1236 ast_careful_fwrite: fwrite()
> returned error: Broken pipe
> [Dec 12 21:18:35] ERROR[8661]: utils.c:1236 ast_careful_fwrite: fwrite()
> returned error: Broken pipe
> [Dec 12 21:18:35] ERROR[8661]: utils.c:1236 ast_careful_fwrite: fwrite()
> returned error: Broken pipe
> Asterisk version 11.0.1
> OS: CentOS release 5.8 (Final)
>
> //manager.conf settings
> [faheem]
> secret =f at xxxxxx
> permit=127.0.0.1/255.255.255.255
> read =
> system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
> write = system,call,agent,user,config,command,reporting,originate
>
> ///AMI script
> <?php
>
> $sys_ip = "127.0.0.1";
> $User_str = "faheem";
> $Secret_str = "f at h33m112xxxxxx";
> $phoneNumb = 1234;
> $dialNumb =  4567;
> $spoofNumb = 786;
> $context = "xxxxx-xxxxx";
>
> $oSocket = fsockopen($sys_ip, 5038, $errnum, $errdesc) or die("Connection
> to host failed");
> fputs($oSocket, "Action: login\r\n");
> fputs($oSocket, "Username: $User_str\r\n");
> fputs($oSocket, "Secret: $Secret_str\r\n\r\n");
> fputs($oSocket, "Events: off\r\n\r\n");
> fputs($oSocket, "Action: originate\r\n");
> fputs($oSocket, "Channel: SIP/testTrunk/$phoneNumb\r\n");
> fputs($oSocket, "Exten: $dialNumb\r\n");
> fputs($oSocket, "Context: $context\r\n");
> fputs($oSocket, "Priority: 1\r\n\r\n");
> fputs($oSocket, "Timeout: 10000\r\n");
> fputs($oSocket, "CallerId: $spoofNumb\r\n");
> fputs($oSocket, "Async: false\r\n");
> fputs($oSocket, "Action: Logoff\r\n\r\n");
> echo "originate executed";
> fclose($oSocket);
>
> ?>
>
>
> Can any one please help me over it.
> Thank you!
>
> Muhammad Faheem
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
-Chris Harrington
ACSDi Office: 763.559.5800
Mobile Phone: 612.326.4248
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20121212/0e1a55c8/attachment.htm>


More information about the asterisk-users mailing list