[asterisk-users] AMI perl daemon

vip killa vipkilla at gmail.com
Tue May 17 07:12:34 CDT 2011


is there a simple way to receive a response from an action such as a "Ping"
?

On Mon, May 16, 2011 at 4:21 PM, Alex Balashov <abalashov at evaristesys.com>wrote:

> On 05/16/2011 04:17 PM, vip killa wrote:
>
>  forgive me for i am very new to asterisk and perl. but how could you
>>  detect if you were disconnected from AMI?
>>
>
> if(defined($mgr_sock)) would evaluate to false.  That's all you need to do
> with the plain vanilla blocking I/O you're using now.
>
> Down the road, if non-blocking I/O is set, there are other strategies. The
> traditional way was an ioctl() FIONREAD that returned 0 for the bytes value,
> though the ioctl() call did not fail:
>
>   require 'sys/ioctl.ph';
>
>   ...
>
>   my $bytes_waiting = pack("L", 0);
>
>   ioctl($mgr_sock, FIONREAD(), $bytes_wating);
>
>   $bytes_waiting = unpack("L", $bytes_waiting);
>
>   if($bytes_waiting == 0) {
>      # Far-end disconnected.
>
>      close($mgr_sock);
>      return;
>
>   }
>
> --
> Alex Balashov - Principal
> Evariste Systems LLC
> 260 Peachtree Street NW
> Suite 2200
> Atlanta, GA 30303
> Tel: +1-678-954-0670
> Fax: +1-404-961-1892
> Web: http://www.evaristesys.com/
>
> --
> _____________________________________________________________________
> -- 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110517/88fb3b87/attachment.htm>


More information about the asterisk-users mailing list