From 02a8684f02515d280a212f318ff349100cf077d4 Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 27 Feb 2008 21:22:09 +0000 Subject: [PATCH] Added option for ip_relay in install.pl and keepalive script(and in astguiclient.conf) to be used for blind monitoring of agents. Also, updated conf file generation utility in install.pl and the default conf file examples with the new blind monitoring settings and reduced-complexity multi-server extens git-svn-id: svn://192.168.202.10@785 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/ADMIN_keepalive_ALL.pl | 31 ++++++++++++-- docs/conf_examples/extensions.conf.sample | 16 +++---- docs/conf_examples/extensions.conf.sample-1.4 | 19 ++++----- install.pl | 42 +++++++++++++------ www/agc/vicidial.php | 2 +- 5 files changed, 75 insertions(+), 35 deletions(-) diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index 6107dda8..4ec3f004 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -1,16 +1,17 @@ #!/usr/bin/perl # -# ADMIN_keepalive_ALL.pl version 0.2 +# ADMIN_keepalive_ALL.pl version 2.0.5 # # Designed to keep the astGUIclient processes alive and check every minute # Replaces all other ADMIN_keepalive scripts # Uses /etc/astguiclient.conf file to know which processes to keepalive # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2008 Matt Florell LICENSE: GPLv2 # # # 61011-1348 - first build # 61120-2011 - added option 7 for AST_VDauto_dial_FILL.pl +# 80227-1526 - added option 8 for ip_relay # $DB=0; # Debug flag @@ -83,6 +84,7 @@ foreach(@conf) # 5 - AST_VDadapt (If multi-server system, this must only be on one server)\n"; # 6 - FastAGI_log\n"; # 7 - AST_VDauto_dial_FILL\n"; +# 8 - ip_relay for blind monitoring\n"; if ($VARactive_keepalives =~ /X/) { @@ -97,6 +99,7 @@ $AST_VDremote_agents=0; $AST_VDadapt=0; $FastAGI_log=0; $AST_VDauto_dial_FILL=0; +$ip_relay=0; $runningAST_update=0; $runningAST_send=0; $runningAST_listen=0; @@ -105,6 +108,7 @@ $runningAST_VDremote_agents=0; $runningAST_VDadapt=0; $runningFastAGI_log=0; $runningAST_VDauto_dial_FILL=0; +$runningip_relay=0; if ($VARactive_keepalives =~ /1/) { @@ -141,6 +145,11 @@ if ($VARactive_keepalives =~ /7/) $AST_VDauto_dial_FILL=1; if ($DB) {print "AST_VDauto_dial_FILL set to keepalive\n";} } +if ($VARactive_keepalives =~ /8/) + { + $ip_relay=1; + if ($DB) {print "ip_relay set to keepalive\n";} + } $REGhome = $PATHhome; $REGhome =~ s/\//\\\//gi; @@ -208,6 +217,11 @@ if ($DBX) {print "$i|$psoutput[$i]| \n";} $runningAST_VDauto_dial_FILL++; if ($DB) {print "AST_VDauto_dial_FILL RUNNING: |$psline[1]|\n";} } + if ($psoutput[$i] =~ / ip_relay /) + { + $runningip_relay++; + if ($DB) {print "ip_relay RUNNING: |$psoutput[$i]|\n";} + } $i++; } @@ -276,7 +290,8 @@ if ( ( ($AST_VDremote_agents > 0) && ($runningAST_VDremote_agents < 1) ) || ( ($AST_VDadapt > 0) && ($runningAST_VDadapt < 1) ) || ( ($FastAGI_log > 0) && ($runningFastAGI_log < 1) ) || - ( ($AST_VDauto_dial_FILL > 0) && ($runningAST_VDauto_dial_FILL < 1) ) + ( ($AST_VDauto_dial_FILL > 0) && ($runningAST_VDauto_dial_FILL < 1) ) || + ( ($ip_relay > 0) && ($runningip_relay < 1) ) ) { @@ -338,6 +353,11 @@ foreach (@psoutput2) $runningAST_VDauto_dial_FILL++; if ($DB) {print "AST_VDauto_dial_FILL RUNNING: |$psline[1]|\n";} } + if ($psoutput2[$i] =~ / ip_relay /) + { + $runningip_relay++; + if ($DB) {print "ip_relay RUNNING: |$psoutput2[$i]|\n";} + } $i++; } @@ -390,6 +410,11 @@ if ( ($AST_VDauto_dial_FILL > 0) && ($runningAST_VDauto_dial_FILL < 1) ) # add a '-L' to the command below to activate logging `/usr/bin/screen -d -m -S ASTVDautoFILL $PATHhome/AST_VDauto_dial_FILL.pl`; } +if ( ($ip_relay > 0) && ($runningip_relay < 1) ) + { + if ($DB) {print "starting ip_relay through relay_control...\n";} + `$PATHhome/ip_relay/relay_control start 2>/dev/null 1>&2`; + } } diff --git a/docs/conf_examples/extensions.conf.sample b/docs/conf_examples/extensions.conf.sample index a3ca677c..1cb97ed6 100644 --- a/docs/conf_examples/extensions.conf.sample +++ b/docs/conf_examples/extensions.conf.sample @@ -10,6 +10,9 @@ TRUNKIAX=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface TRUNKIAX1=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface TRUNKBINFONE=IAX2/1112223333:PASSWORD@iax.binfone.com ; IAX trunk interface SIPtrunk=SIP/1234:PASSWORD@sip.provider.net ; SIP trunk +TRUNKloop = IAX2/ASTloop:test@127.0.0.1:40569 +TRUNKblind = IAX2/ASTblind:test@127.0.0.1:41569 + [default] ; Example phone extensions @@ -304,18 +307,15 @@ exten => _*NXXNXXXXXX*3429,4,Answer exten => _*NXXNXXXXXX*3429,5,Dial,sip/spa2000&sip/spa2001|30|to exten => _*NXXNXXXXXX*3429,6,Voicemail,u2000 -; BE SURE TO CHANGE THESE FOR YOUR IP ADDRESS! -exten => _010*010*010*015*8600XXX,1,Goto(default,${EXTEN:16},1) -exten => _010*010*010*015*78600XXX,1,Goto(default,${EXTEN:16},1) +; BE SURE TO CHANGE THIS LINE FOR YOUR IP ADDRESS! exten => _010*010*010*015*.,1,Goto(default,${EXTEN:16},1) exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) +; Local blind monitoring +exten => _08600XXX,1,Dial(${TRUNKblind}/6${EXTEN:1},55,o) -; ### server 2 extens: -; exten => _010*010*010*016*8600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) -; exten => _010*010*010*016*8600XXX,2,Hangup -; exten => _010*010*010*016*8600XXX*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) -; exten => _010*010*010*016*8600XXX*.,2,Hangup +; ### server 2 exten: +; exten => _010*010*010*016*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) ; parameters for agi-VDAD_ALL_inbound.agi (9 fields separated by five dashes "-----"): diff --git a/docs/conf_examples/extensions.conf.sample-1.4 b/docs/conf_examples/extensions.conf.sample-1.4 index f7c0f781..1e584f66 100644 --- a/docs/conf_examples/extensions.conf.sample-1.4 +++ b/docs/conf_examples/extensions.conf.sample-1.4 @@ -10,6 +10,9 @@ TRUNKIAX=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface TRUNKIAX1=IAX2/ASTtest1:test@10.10.10.16:4569 ; IAX trunk interface TRUNKBINFONE=IAX2/1112223333:PASSWORD@iax.binfone.com ; IAX trunk interface SIPtrunk=SIP/1234:PASSWORD@sip.provider.net ; SIP trunk +TRUNKloop = IAX2/ASTloop:test@127.0.0.1:40569 +TRUNKblind = IAX2/ASTblind:test@127.0.0.1:41569 + [default] ; Example phone extensions @@ -303,19 +306,15 @@ exten => _*NXXNXXXXXX*3429,4,Answer exten => _*NXXNXXXXXX*3429,5,Dial,sip/spa2000&sip/spa2001|30|to exten => _*NXXNXXXXXX*3429,6,Voicemail,u2000 -; BE SURE TO CHANGE THESE FOR YOUR IP ADDRESS! -exten => _010*010*010*015*8600XXX,1,Goto(default,${EXTEN:16},1) -exten => _010*010*010*015*8600XXX*.,1,Goto(default,${EXTEN:16},1) -exten => _010*010*010*015*78600XXX,1,Goto(default,${EXTEN:16},1) -exten => _010*010*010*015*78600XXX*.,1,Goto(default,${EXTEN:16},1) +; BE SURE TO CHANGE THIS LINE FOR YOUR IP ADDRESS! +exten => _010*010*010*015*.,1,Goto(default,${EXTEN:16},1) exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi) exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi) +; Local blind monitoring +exten => _08600XXX,1,Dial(${TRUNKblind}/6${EXTEN:1},55,o) -; ### server 2 extens: -; exten => _010*010*010*016*8600XXX,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) -; exten => _010*010*010*016*8600XXX,2,Hangup -; exten => _010*010*010*016*8600XXX*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) -; exten => _010*010*010*016*8600XXX*.,2,Hangup +; ### server 2 exten: +; exten => _010*010*010*016*.,1,Dial(${TRUNKIAX1}/${EXTEN:16},55,o) ; parameters for agi-VDAD_ALL_inbound.agi (9 fields separated by five dashes "-----"): diff --git a/install.pl b/install.pl index 5e91c23b..a36721b2 100644 --- a/install.pl +++ b/install.pl @@ -1,8 +1,8 @@ #!/usr/bin/perl -# install.pl +# install.pl version 2.0.5 # -# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2008 Matt Florell LICENSE: GPLv2 # # CHANGES @@ -12,6 +12,7 @@ # 80107-2341 - Added --build_multiserver_conf flag to generate dynamic multi-server conf sections # 80115-1426 - Added ip_relay scripts for port forwarding # 80122-0320 - Added build_phones_conf flag to generate phones conf entries from phones table records +# 80227-1536 - Added ip_relay to keepalive list # ############################################ @@ -44,7 +45,7 @@ $VARDB_user = 'cron'; $VARDB_pass = '1234'; $VARDB_port = '3306'; # default keepalive processes: -$VARactive_keepalives = '123456'; +$VARactive_keepalives = '1234568'; # default recording FTP archive variables: $VARFTP_host = '10.0.0.4'; $VARFTP_user = 'cron'; @@ -160,6 +161,7 @@ if (length($ARGV[0])>1) print " 5 - AST_VDadapt (If multi-server system, this must only be on one server)\n"; print " 6 - FastAGI_log\n"; print " 7 - AST_VDauto_dial_FILL (only for multi-server, this must only be on one server)\n"; + print " 8 - ip_relay (used for blind agent monitoring)\n"; print " [--copy_sample_conf_files] = copies the sample conf files to /etc/asterisk/\n"; print " [--FTP_host=192.168.0.2] = define recording archive server IP address at runtime\n"; print " [--FTP_user=cron] = define archive server name at runtime\n"; @@ -657,18 +659,20 @@ if (length($ARGV[0])>1) } $ext = "\nAdd the following lines to your extensions.conf file:\n"; + $ext .= "TRUNKloop = IAX2/ASTloop:test\@127.0.0.1:40569\n"; + $ext .= "TRUNKblind = IAX2/ASTblind:test\@127.0.0.1:41569\n"; $iax = "\nAdd the following lines to your iax.conf file:\n"; - $iax .= "#register => ASTloop:test\@$server_ip:40569\n"; + $iax .= "register => ASTloop:test\@127.0.0.1:40569\n"; + $iax .= "register => ASTblind:test\@127.0.0.1:41569\n"; $Lext = "\n"; $Lext .= "# Local Server: $server_ip\n"; - $Lext .= "exten => _$VARremDIALstr*8600XXX,1,Goto(default,\${EXTEN:16},1)\n"; - $Lext .= "exten => _$VARremDIALstr*8600XXX*.,1,Goto(default,\${EXTEN:16},1)\n"; - $Lext .= "exten => _$VARremDIALstr*78600XXX,1,Goto(default,\${EXTEN:16},1)\n"; - $Lext .= "exten => _$VARremDIALstr*78600XXX*.,1,Goto(default,\${EXTEN:16},1)\n"; + $Lext .= "exten => _$VARremDIALstr*.,1,Goto(default,\${EXTEN:16},1)\n"; $Lext .= "exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n"; $Lext .= "exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n"; + $Lext .= "# Local blind monitoring\n"; + $Lext .= "exten => _08600XXX,1,Dial(\${TRUNKblind}/6\${EXTEN:1},55,o)\n"; $Liax .= "\n"; $Liax .= "[ASTloop]\n"; @@ -683,6 +687,19 @@ if (length($ARGV[0])>1) $Liax .= "allow=ulaw\n"; $Liax .= "qualify=yes\n"; + $Liax .= "\n"; + $Liax .= "[ASTblind]\n"; + $Liax .= "type=friend\n"; + $Liax .= "accountcode=IAXASTblind\n"; + $Liax .= "context=default\n"; + $Liax .= "auth=plaintext\n"; + $Liax .= "host=dynamic\n"; + $Liax .= "permit=0.0.0.0/0.0.0.0\n"; + $Liax .= "secret=test\n"; + $Liax .= "disallow=all\n"; + $Liax .= "allow=ulaw\n"; + $Liax .= "qualify=yes\n"; + ##### Get the server_id for this server's server_ip ##### $stmtA = "SELECT server_id FROM servers where server_ip='$server_ip';"; print "$stmtA\n"; @@ -723,10 +740,7 @@ if (length($ARGV[0])>1) $iax .= "register => $server_id:test\@$server_ip[$i]:4569\n"; $Lext .= "# Remote Server VDAD extens: $server_id[$i] $server_ip[$i]\n"; - $Lext .= "exten => _$VARremDIALstr*8600XXX,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n"; - $Lext .= "exten => _$VARremDIALstr*8600XXX*.,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n"; - $Lext .= "exten => _$VARremDIALstr*78600XXX,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n"; - $Lext .= "exten => _$VARremDIALstr*78600XXX*.,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n"; + $Lext .= "exten => _$VARremDIALstr*.,1,Dial(\${TRUNK$server_id[$i]}/\${EXTEN:16},55,o)\n"; $Liax .= "\n"; $Liax .= "[$server_id[$i]]\n"; @@ -1544,6 +1558,7 @@ else print " 5 - AST_VDadapt (If multi-server system, this must only be on one server)\n"; print " 6 - FastAGI_log\n"; print " 7 - AST_VDauto_dial_FILL (only for multi-server, this must only be on one server)\n"; + print " 8 - ip_relay (used for blind agent monitoring)\n"; print "Enter active keepalives or press enter for default: [$VARactive_keepalives] "; $PROMPTactive_keepalives = ; chomp($PROMPTactive_keepalives); @@ -2041,7 +2056,7 @@ print conf "VARDB_pass => $VARDB_pass\n"; print conf "VARDB_port => $VARDB_port\n"; print conf "\n"; print conf "# Alpha-Numeric list of the astGUIclient processes to be kept running\n"; -print conf "# (value should be listing of characters with no spaces: 123456)\n"; +print conf "# (value should be listing of characters with no spaces: 1234568)\n"; print conf "# X - NO KEEPALIVE PROCESSES (use only if you want none to be keepalive)\n"; print conf "# 1 - AST_update\n"; print conf "# 2 - AST_send_listen\n"; @@ -2050,6 +2065,7 @@ print conf "# 4 - AST_VDremote_agents\n"; print conf "# 5 - AST_VDadapt (If multi-server system, this must only be on one server)\n"; print conf "# 6 - FastAGI_log\n"; print conf "# 7 - AST_VDauto_dial_FILL (only for multi-server, this must only be on one server)\n"; +print conf "# 8 - ip_relay (used for blind agent monitoring)\n"; print conf "VARactive_keepalives => $VARactive_keepalives\n"; print conf "\n"; print conf "# FTP recording archive connection information\n"; diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index ae271bff..69b46604 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -2364,7 +2364,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { var chan_name_color = 'log_text'; } - if ( (HidEMonitoRSessionS==1) && (channelfieldA.match(/68600/)) ) + if ( (HidEMonitoRSessionS==1) && (channelfieldA.match(/ASTblind/)) ) { var hide_channel=1; }