On 12-05-03 03:47 PM, Paul Belanger wrote:
Heh, apparently this is the asterisk-user list. Sorry, dealing with a new mail client and misread my folder labels.On 12-05-03 01:45 PM, Mike Diehl wrote:Hi all. I've got a perl script that connects to Asterisk's management interface using Asterisk::AMI. So far, its proven to be very useful. I'm hoping to use this to detect and respond to asterisk restarts and sip reloads. However, my script gets disconnected quite frequently, causing false alarms in my monitoring. Here's what the code looks like: ========================================================= while ($more) { $change = 0; while (!$ami->connected(5)) { Event::Shutdown(Event=>"Shutdown"); send_to_subscribers( {"Event" => "Shutdown", "customer_id" => 0}, "Connection to Asterisk lost on $server"); $change++; sleep(1); ami_connect(); next; } $watchdog = 10; while ($ami->get_event(1)&& $watchdog--) { if ($watchdog< 2) { print "Watchdog timer too short.\n"; } $change++; } Do other stuff from here. if ($change == 0) { sleep(2); } } exit 1; ========================================================= When this scrip disconnects, the asterisk console simply says that the manager logged off from 127.0.0.1 and got logged back on. No reall error indication given. Any suggestions on how to make this script keep it's connection?This belongs on the asterisk-users list. However, something like StarPY (Python) has this functionality by using the Twisted. It simply monitors events on the AMI, and if the connect break, can be setup to re-connect.
-- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belanger@xxxxxxxxxxxxxx | IRC: pabelanger (Freenode) |Github: https://github.com/pabelanger | Twitter: https://twitter.com/pabelanger
--
_____________________________________________________________________
-- 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
[Gnu Gatekeeper] [IETF Sipping] [Info Cyrus] [ALSA User] [Fedora Linux Users] [DCCP] [Gimp] [100% Free Online Dating] [Yosemite News] [Arts & Crafts] [Yosemite Photos] [Deep Creek Hot Springs] [Yosemite Campsites] [ISDN Cause Codes]
![]() |
![]() |