[asterisk-users] Problems with AMI connections (Asterisk 1.8.3.2)

Daniel - Asterisk earohuanca at gmail.com
Mon Aug 15 16:48:00 CDT 2011


Could you please share a little sample showing how to get connected to AMI
with php?

Thanks a lot!

Elder

On Mon, Aug 1, 2011 at 3:40 PM, Kevin P. Fleming <kpfleming at digium.com>wrote:

> On 08/01/2011 03:35 PM, Paul Belanger wrote:
>
>> On 11-08-01 04:24 PM, Daniel - Asterisk wrote:
>>
>>> <?php
>>> function ast_claves(){
>>>
>>> $socket =
>>> fsockopen('192.168.25.18','**5038',$errno,$errstr,10);
>>>
>>>
>>> fwrite($socket,"Action: Login\r\n");
>>>
>>> fwrite($socket,"UserName: mark\r\n");
>>>
>>> fwrite($socket,"Secret: mysecret\r\n\r\n");
>>>
>>> fwrite($socket,"Action: DBPut\r\n");
>>>
>>> fwrite($socket,"Family: authenticate/jorge\r\n");
>>>
>>> fwrite($socket,"Key: 123456\r\n");
>>>
>>> fwrite($socket,"Value: pbx-a\r\n");
>>>
>>> fwrite($socket,"Action: Logoff\r\n\r\n");
>>>
>>>
>>> fclose($socket);
>>>
>>> }
>>>
>>> ast_claves();
>>>
>>> ?>
>>>
>>>  You are closing the socket before reading the result of 'Logoff' and
>> Asterisk is complaining.
>>
>
> Well, he's sending DBPut before reading the result of Login as well.
>
> --
> Kevin P. Fleming
> Digium, Inc. | Director of Software Technologies
> Jabber: kfleming at digium.com | SIP: kpfleming at digium.com | Skype: kpfleming
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
> Check us out at www.digium.com & www.asterisk.org
>
>
> --
> ______________________________**______________________________**_________
> -- 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<http://lists.digium.com/mailman/listinfo/asterisk-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110815/8c427dd0/attachment.htm>


More information about the asterisk-users mailing list