Added code to deal with Asterisk Manager API logoff timeout changes in several scripts.

git-svn-id: svn://192.168.202.10@1460 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2010-06-25 19:41:54 +00:00
parent 0b7ea3878d
commit 910d685dcb
6 changed files with 47 additions and 24 deletions
+5 -2
View File
@@ -1,10 +1,10 @@
#!/usr/bin/perl
#
# AST_conf_update.pl version 2.0.5 *DBI-version*
# AST_conf_update.pl version 2.4
#
# This script checks if there are channels in reserved conferences
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# 50810-1532 - Added database server variable definitions lookup
# 50823-1456 - Added commandline arguments for debug at runtime
@@ -13,6 +13,7 @@
# 80506-1055 - Added check for vicidial_conferences in 3WAY
# 80914-1533 - Added kickall for leave-3way calls after one hour
# 81008-0937 - Added kickall from vicidial_conferences if only one participant
# 100625-1220 - Added waitfors after logout to fix broken pipe errors in asterisk <MikeC>
#
# constants
@@ -313,6 +314,7 @@ foreach(@PTextensions)
$t->buffer_empty;
@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/");
$t->buffer_empty;
$t->waitfor(Match => '/Message:.*\n\n/', Timeout => 10);
$ok = $t->close;
@@ -421,6 +423,7 @@ foreach(@PTextensions)
$t->buffer_empty;
@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/");
$t->buffer_empty;
$t->waitfor(Match => '/Message:.*\n\n/', Timeout => 10);
$ok = $t->close;
$dbhA->disconnect();
+3
View File
@@ -33,6 +33,7 @@
# 60906-1714 - added updating for special vicidial conference calls
# 71129-2004 - Fixed SQL error
# 100416-0635 - Added fix for extension append feature
# 100625-1220 - Added waitfors after logout to fix broken pipe errors in asterisk <MikeC>
#
# constants
@@ -661,6 +662,8 @@ while($one_day_interval > 0)
@hangup = $tn->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/", Errmode => Return, Timeout => 1);
$tn->buffer_empty;
$tn->waitfor(Match => '/Message:.*\n\n/', Timeout => 10);
$ok = $tn->close;
$one_day_interval--;
+5 -2
View File
@@ -1,13 +1,14 @@
#!/usr/bin/perl
#
# AST_phone_update.pl version 2.0.5 *DBI-version*
# AST_phone_update.pl version 2.4
#
# DESCRIPTION:
# checks the registered IP address of the phone and updates the phones table
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# 70521-1529 - first build
# 100625-1220 - Added waitfors after logout to fix broken pipe errors in asterisk <MikeC>
#
# constants
@@ -217,6 +218,7 @@ foreach(@PTextensions)
$t->buffer_empty;
@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/");
$t->buffer_empty;
$t->waitfor(Match => '/Message:.*\n\n/', Timeout => 10);
$ok = $t->close;
############# END SIP SECTION ################################################
@@ -304,6 +306,7 @@ foreach(@PTextensions)
$t->buffer_empty;
@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/");
$t->buffer_empty;
$t->waitfor(Match => '/Message:.*\n\n/', Timeout => 10);
$ok = $t->close;
############# END IAX2 SECTION ################################################
+24 -15
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_send_action_child.pl version 2.0.5 *DBI-version
# AST_send_action_child.pl version 2.4
#
# Part of the Asterisk Central Queue System (ACQS)
#
@@ -14,24 +14,30 @@
# to be executed. connect to the manager interface, send the action and logoff
# then exit.
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 50810-1547 - Added database server variable definitions lookup
# 50823-1527 - Altered commandline debug options with debug printouts
# 50902-1032 - Changed default logging to fulllog
# 60718-0909 - changed to DBI by Marin Blu
# 60718-1024 - changed to use /etc/astguiclient.conf for configs
# 60814-1720 - added option for no logging to file
# 60817-1244 - removed all DB calls and config file open to reduce footprint
# 61004-1728 - added ability to parse volume control and lookup meetme IDs
# 61220-1720 - optimize and clean code, lc.
# 61221-1942 - additional modification to structure, lc.
# 80418-0927 - added man_id to logging output for better tracking, raised sleep times
# 60718-0909 - Changed to DBI by Marin Blu
# 60718-1024 - Changed to use /etc/astguiclient.conf for configs
# 60814-1720 - Added option for no logging to file
# 60817-1244 - Removed all DB calls and config file open to reduce footprint
# 61004-1728 - Added ability to parse volume control and lookup meetme IDs
# 61220-1720 - Optimize and clean code <LottC>
# 61221-1942 - Additional modification to structure <LottC>
# 80418-0927 - Added man_id to logging output for better tracking, raised sleep times
# 100625-1141 - Added waitfors after orginate and logout to fix broken pipe errors in asterisk <MikeC>
# 100625-1206 - Use strict is a performance hit and should only be uncommented for debugging <MikeC>
#
$|++;
use strict;
# use strict is a performance hit and should only be uncommented for debugging
#use strict;
#
use Getopt::Long;
use Net::Telnet;
@@ -223,8 +229,9 @@ if ($action) {
my @list_channels = $tn->cmd(String => $originate_command,
Prompt => '/.*/');
sleep(4);
$tn->waitfor(Match => '/Response:.*\n/', Timeout => 10);
$tn->waitfor(Match => '/Message:.*\n\n/', Timeout => 10);
my $data1; # ? Useless ?
if ($FULL_LOG and $SYSLOG) {
my $event_string = $man_id . "|1|" . $data1 . "|";
@@ -239,8 +246,10 @@ if ($action) {
$tn->buffer_empty;
#@hangup = $tn->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/");
$tn->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/");
sleep(3);
$tn->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/");
$tn->buffer_empty;
$tn->waitfor(Match => '/Message:.*\n\n/', Timeout => 10);
if ($FULL_LOG and $SYSLOG) {
my $event_string = $man_id . "|2|" . $data1 . "|";
+6 -3
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_update.pl version 2.0.5 *DBI-version*
# AST_update.pl version 2.4
#
# DESCRIPTION:
# uses the Asterisk Manager interface and Net::MySQL to update the live_channels
@@ -30,7 +30,7 @@
#
# It is recommended that you run this program on the local Asterisk machine
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# version changes:
# 41228-1659 - modified to compensate for manager output response hiccups
@@ -58,9 +58,10 @@
# 80111-1850 - fixed server_updater record missing bug
# 90307-1932 - Added servers table stats updating, reformatted code to match standard
# 90604-1127 - Added support for DAHDI channels
# 100625-1220 - Added waitfors after logout to fix broken pipe errors in asterisk <MikeC>
#
$build = '90604-1127';
$build = '100625-1220';
# constants
$SYSPERF=0; # system performance logging to MySQL server_performance table every 5 seconds
@@ -1044,6 +1045,8 @@ while($one_day_interval > 0)
@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/");
$t->buffer_empty;
$t->waitfor(Match => '/Message:.*\n\n/', Timeout => 10);
$ok = $t->close;
$one_day_interval--;
+4 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# AST_vm_update.pl version 2.2.0 *DBI-version*
# AST_vm_update.pl version 2.4
#
# DESCRIPTION:
# uses the Asterisk Manager interface to update the count of voicemail messages
@@ -12,13 +12,14 @@
# more than this either change the cron when this script is run or change the
# wait interval below
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# 50823-1422 - Added database server variable definitions lookup
# 50823-1452 - Added commandline arguments for debug at runtime
# 60717-1204 - Changed to DBI by Marin Blu
# 60715-2301 - Changed to use /etc/astguiclient.conf for configs
# 90919-1739 - Added other voicemail checking from vicidial_voicemail table
# 100625-1220 - Added waitfors after logout to fix broken pipe errors in asterisk <MikeC>
#
# constants
@@ -299,6 +300,7 @@ if ($active_voicemail_server > 0)
$t->buffer_empty;
@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/");
$t->buffer_empty;
$t->waitfor(Match => '/Message:.*\n\n/', Timeout => 10);
$ok = $t->close;