Problems with AMI connections (Asterisk 1.8.3.2)

Home » Asterisk Users » Problems with AMI connections (Asterisk 1.8.3.2)
Asterisk Users 1 Comment

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: Loginrn”);
>
> fwrite($socket,”UserName: markrn”);
>
> fwrite($socket,”Secret: mysecretrnrn”);
>
> fwrite($socket,”Action: DBPutrn”);
>
> fwrite($socket,”Family: authenticate/jorgern”);
>
> fwrite($socket,”Key: 123456rn”);
>
> fwrite($socket,”Value: pbx-arn”);
>
> fwrite($socket,”Action: Logoffrnrn”);
>
>
> fclose($socket);
>
> }
>
> ast_claves();
>
> ?>
>
You are closing the socket before reading the result of ‘Logoff’ and
Asterisk is complaining.

One thought on - Problems with AMI connections (Asterisk 1.8.3.2)

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

    Thanks a lot!

    Elder