From b77eef4a62898157bfcc8ca38169c413754aab6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sun, 30 Dec 2012 13:07:24 -0800 Subject: [PATCH] asterisk: handle more gracefully errors on the asterisk_channels path. --- plugins/asterisk/asterisk | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/asterisk/asterisk b/plugins/asterisk/asterisk index fe507b97..b6d6bd14 100755 --- a/plugins/asterisk/asterisk +++ b/plugins/asterisk/asterisk @@ -165,7 +165,8 @@ $socket->print("Action: command\nCommand: core show channels\n\n"); #2 active channels #1 active call #--END COMMAND-- -my $shown_channels = readreply $socket; +my $channels_response = readreply $socket; +$channels_response = undef if $channels_response =~ /Response: Error/; $socket->print("Action: command\nCommand: voicemail show users\n\n"); #Response: Follows @@ -180,7 +181,7 @@ $voicemail_response = undef if $voicemail_response =~ /Response: Error/; $socket->close(); my $active_channels = 'U'; -$active_channels = $1 if $shown_channels =~ /\n([0-9]+) active channels/; +$active_channels = $1 if $channels_response =~ /\n([0-9]+) active channels/; print <