diff --git a/agc_2-X/trunk/bin/AST_DB_optimize.pl b/agc_2-X/trunk/bin/AST_DB_optimize.pl index 5e4d3259..9f7f1521 100644 --- a/agc_2-X/trunk/bin/AST_DB_optimize.pl +++ b/agc_2-X/trunk/bin/AST_DB_optimize.pl @@ -13,6 +13,7 @@ # 60717-1242 - changed to DBI by Marin Blu # 60718-1645 - changed to use /etc/astguiclient.conf for configs # 71030-2020 - Added deletions of stats and inbound live agents +# 71109-1725 - fixed vicidial_campaign_stats bug # # default path to astguiclient configuration file: @@ -247,7 +248,8 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA $sthA->finish(); } - $stmtA = "delete from vicidial_campaign_stats;"; + + $stmtA = "UPDATE vicidial_campaign_stats SET dialable_leads='0', calls_today='0', answers_today='0', drops_today='0', drops_today_pct='0', drops_answers_today_pct='0', calls_hour='0', answers_hour='0', drops_hour='0', drops_hour_pct='0', calls_halfhour='0', answers_halfhour='0', drops_halfhour='0', drops_halfhour_pct='0', calls_fivemin='0', answers_fivemin='0', drops_fivemin='0', drops_fivemin_pct='0', calls_onemin='0', answers_onemin='0', drops_onemin='0', drops_onemin_pct='0', differential_onemin='0', agents_average_onemin='0', balance_trunk_fill='0', status_category_count_1='0', status_category_count_2='0', status_category_count_3='0', status_category_count_4='0', ;"; if($DB){print STDERR "\n|$stmtA|\n";} if (!$T) { $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; diff --git a/agc_2-X/trunk/bin/AST_DB_tz_divide.pl b/agc_2-X/trunk/bin/AST_DB_tz_divide.pl index 016231d3..77d57a21 100644 --- a/agc_2-X/trunk/bin/AST_DB_tz_divide.pl +++ b/agc_2-X/trunk/bin/AST_DB_tz_divide.pl @@ -12,8 +12,45 @@ # # CHANGES # 71106-0250 - first build +# 71106-1235 - fixed bugs and made debug function properly # +### begin parsing run-time options ### +if (length($ARGV[0])>1) +{ + $i=0; + while ($#ARGV >= $i) + { + $args = "$args $ARGV[$i]"; + $i++; + } + + if ($args =~ /--help/i) + { + print "allowed run time options:\n [-t] = test\n [-debug] = verbose debug messages\n\n"; + } + else + { + if ($args =~ /-debug/i) + { + $DB=1; # Debug flag, set to 0 for no debug messages, On an active system this will generate hundreds of lines of output per minute + } + if ($args =~ /-t/i) + { + $TEST=1; + $T=1; + } + } +} +else +{ +print "no command line options set\n"; + $loop_delay = '2500'; + $DB=1; +} +### end parsing run-time options ### + + # default path to astguiclient configuration file: $PATHconf = '/etc/astguiclient.conf'; @@ -71,23 +108,15 @@ else {$TZmove = "'-7.00','-8.00','-9.00','-10.00','-11.00'";} $stmtA = "UPDATE vicidial_list set list_id='222' where list_id='111' and gmt_offset_now IN($TZmove);"; if($DB){print STDERR "\n|$stmtA|\n";} if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} } $stmtA = "UPDATE vicidial_list set list_id='12021' where list_id='11315' and gmt_offset_now IN($TZmove);"; if($DB){print STDERR "\n|$stmtA|\n";} if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} } $secX = time(); @@ -117,23 +146,15 @@ if ($Tsec < 10) {$Tsec = "0$Tsec";} $stmtA = "UPDATE vicidial_list set list_id='999999' where list_id IN('11315','12021','111','222') and entry_date < \"$XDSQLdate\";"; if($DB){print STDERR "\n|$stmtA|\n";} if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} } $stmtA = "DELETE from vicidial_list WHERE list_id='999999' and entry_date < \"$TDSQLdate\";"; if($DB){print STDERR "\n|$stmtA|\n";} if (!$T) { - $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; - $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; - $sthArows=$sthA->rows; - @aryA = $sthA->fetchrow_array; - if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} - $sthA->finish(); + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows records changed|\n";} } diff --git a/agc_2-X/trunk/docs/BASE_INSTALL.txt b/agc_2-X/trunk/docs/BASE_INSTALL.txt index 88b9db0d..7838f442 100644 --- a/agc_2-X/trunk/docs/BASE_INSTALL.txt +++ b/agc_2-X/trunk/docs/BASE_INSTALL.txt @@ -31,16 +31,16 @@ PHASE 1: INSTALLING ASTERISK 1. follow these command line steps: mkdir /usr/src/asterisk cd /usr/src/asterisk -wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.18.tar.gz -wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.16.tar.gz -wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.4.tar.gz -gunzip asterisk-1.2.18.tar.gz -tar xvf asterisk-1.2.18.tar -gunzip zaptel-1.2.16.tar.gz -tar xvf zaptel-1.2.16.tar -gunzip libpri-1.2.4.tar.gz -tar xvf libpri-1.2.4.tar -cd ./zaptel-1.2.16 +wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz +wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz +wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz +gunzip asterisk-1.2.24.tar.gz +tar xvf asterisk-1.2.24.tar +gunzip zaptel-1.2.21.tar.gz +tar xvf zaptel-1.2.21.tar +gunzip libpri-1.2.5.tar.gz +tar xvf libpri-1.2.5.tar +cd ./zaptel-1.2.21 wget http://www.freedomphones.net/files/newt-0.51.6.tar.gz gunzip newt-0.51.6.tar.gz tar xvf newt-0.51.6.tar @@ -54,11 +54,11 @@ make clean make zttool make make install -cd ../libpri-1.2.4 +cd ../libpri-1.2.5 make clean make make install -cd ../asterisk-1.2.18 +cd ../asterisk-1.2.24 (1.2 tree) If you want to include Answering Machine Detection ability you will need to download app_amd.c and amd.conf and alter the apps/Makefile to compile it properly @@ -73,7 +73,7 @@ cd ../asterisk-1.2.18 wget http://www.eflo.net/files/amd2.conf mkdir /etc/asterisk mv amd2.conf /etc/asterisk/amd.conf - *OPTIONAL*(1.2.12.1 thru 1.2.18) apply the meetme volume control patch + *OPTIONAL*(1.2.12.1 thru 1.2.24) apply the meetme volume control patch *Different patches available for 1.2.7.1 through 1.2.14 wget http://www.eflo.net/files/meetme_volume_control_1.2.16.patch patch -p1 < ./meetme_volume_control_1.2.16.patch @@ -85,7 +85,7 @@ cd ../asterisk-1.2.18 patch -p1 < ./cli_chan_concise_delimiter.patch - File to patch: cli.c - *OPTIONAL*(1.2.14 thru 1.2.18) rewrite of waitforsilence + *OPTIONAL*(1.2.14 thru 1.2.24) rewrite of waitforsilence wget http://www.eflo.net/files/app_waitforsilence.c mv app_waitforsilence.c apps/app_waitforsilence.c @@ -100,17 +100,6 @@ make make install make samples # this makes sample conf files (only use for new installs) - - (1.2 tree) EXPERIMENTAL AND NOT RECOMMENDED!!! If you want to use - app_conference instead of meetme for VICIDIAL then follow these - instructions: - cd /usr/src/asterisk - wget http://www.eflo.net/files/VD_app_conference_0.6.zip - unzip VD_app_conference_0.6.zip - cd app_conference - make clean - make - make install - modprobe zaptel # this loads the zaptel module - install the module for the digium device that you are using, we are using the T100P single span T1 card so we use: @@ -224,6 +213,26 @@ free for download at the following two sites: cp conf.gsm park.gsm - you are done +If you will be doing native music-on-hold for your inbound calls, you will need +musiconhold audio files to be converted to native formats like GSM, ULAW and ALAW: + + cd /var/lib/asterisk/mohmp3/ + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-sunshine.mp3 > /var/lib/asterisk/mohmp3/fpm-sunshine.raw + sox -r 44100 -w -s -c 1 fpm-sunshine.raw -r 8000 -c 1 fpm-sunshine.wav + sox fpm-sunshine.wav -t gsm -r 8000 -b -c 1 fpm-sunshine.gsm + sox fpm-sunshine.wav -t ul -r 8000 -b -c 1 fpm-sunshine.pcm + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-calm-river.mp3 > /var/lib/asterisk/mohmp3/fpm-calm-river.raw + sox -r 44100 -w -s -c 1 fpm-calm-river.raw -r 8000 -c 1 fpm-calm-river.wav + sox fpm-calm-river.wav -t gsm -r 8000 -b -c 1 fpm-calm-river.gsm + sox fpm-calm-river.wav -t ul -r 8000 -b -c 1 fpm-calm-river.pcm + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-world-mix.mp3 > /var/lib/asterisk/mohmp3/fpm-world-mix.raw + sox -r 44100 -w -s -c 1 fpm-world-mix.raw -r 8000 -c 1 fpm-world-mix.wav + sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm + sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm + rm -f *.raw + mkdir ../orig-mp3 + mv -f *.mp3 ../orig-mp3/ + diff --git a/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt b/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt index 75dcef99..e53d0b50 100644 --- a/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt +++ b/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt @@ -287,11 +287,11 @@ make install mkdir /usr/src/asterisk cd /usr/src/asterisk -wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.23.tar.gz +wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz -gunzip asterisk-1.2.23.tar.gz -tar xvf asterisk-1.2.23.tar +gunzip asterisk-1.2.24.tar.gz +tar xvf asterisk-1.2.24.tar gunzip zaptel-1.2.21.tar.gz tar xvf zaptel-1.2.21.tar gunzip libpri-1.2.5.tar.gz @@ -314,7 +314,7 @@ cd ../libpri-1.2.5 make clean make make install -cd ../asterisk-1.2.23 +cd ../asterisk-1.2.24 cd apps wget http://www.eflo.net/files/app_amd2.c mv app_amd2.c app_amd.c diff --git a/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt b/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt index 4c038c9d..baef6532 100644 --- a/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt +++ b/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt @@ -841,15 +841,15 @@ with the following patch: - mkdir /usr/src/asterisk - cd /usr/src/asterisk A. if you want 1.2 release (reliable with new features): - - wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.17.tar.gz - - wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.16.tar.gz - - wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.4.tar.gz - - gunzip asterisk-1.2.17.tar.gz - - tar xvf asterisk-1.2.17.tar - - gunzip zaptel-1.2.16.tar.gz - - tar xvf zaptel-1.2.16.tar - - gunzip libpri-1.2.4.tar.gz - - tar xvf libpri-1.2.4.tar + - wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz + - wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz + - wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz + - gunzip asterisk-1.2.24.tar.gz + - tar xvf asterisk-1.2.24.tar + - gunzip zaptel-1.2.21.tar.gz + - tar xvf zaptel-1.2.21.tar + - gunzip libpri-1.2.5.tar.gz + - tar xvf libpri-1.2.5.tar B. if you want latest SVN_1.2 version (release tree with new patches) - svn checkout http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-1.2 - svn checkout http://svn.digium.com/svn/zaptel/branches/1.2 zaptel-1.2 @@ -872,15 +872,15 @@ with the following patch: edit this line at the top and just add a hash # in front of it as shown: #PBX_LIBS+=$(shell $(CROSS_COMPILE_BIN)gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so") - - cd ./zaptel-1.2.16 + - cd ./zaptel-1.2.21 - make clean - make - make install - - cd ../libpri-1.2.4 + - cd ../libpri-1.2.5 - make clean - make - make install - - cd ../asterisk-1.2.17 + - cd ../asterisk-1.2.24 - (1.2 tree) If you want to include Answering Machine Detection ability you will need to download app_amd.c and amd.conf and alter the apps/Makefile to compile it properly @@ -895,7 +895,7 @@ with the following patch: - wget http://www.eflo.net/files/amd2.conf - mkdir /etc/asterisk - mv amd2.conf /etc/asterisk/amd.conf - *OPTIONAL*(1.2.12.1 thru 1.2.17) apply the meetme volume control patch + *OPTIONAL*(1.2.12.1 thru 1.2.24) apply the meetme volume control patch *Different patches available for 1.2.7.1 through 1.2.14 - wget http://www.eflo.net/files/meetme_volume_control_1.2.16.patch - patch -p1 < ./meetme_volume_control_1.2.16.patch @@ -907,7 +907,7 @@ with the following patch: - patch -p1 < ./cli_chan_concise_delimiter.patch - File to patch: cli.c - *OPTIONAL*(1.2.14 thru 1.2.18) rewrite of waitforsilence + *OPTIONAL*(1.2.14 thru 1.2.24) rewrite of waitforsilence - wget http://www.eflo.net/files/app_waitforsilence.c - mv app_waitforsilence.c apps/app_waitforsilence.c @@ -923,17 +923,6 @@ with the following patch: - make install - make samples # this makes sample conf files (only use for new installs) - - (1.2 tree) EXPERIMENTAL AND NOT RECOMMENDED!!! If you want to use - app_conference instead of meetme for VICIDIAL then follow these - instructions: - - cd /usr/src/asterisk - - wget http://www.eflo.net/files/VD_app_conference_0.6.zip - - unzip VD_app_conference_0.6.zip - - cd app_conference - - make clean - - make - - make install - - modprobe zaptel # this loads the zaptel module - install the module for the digium device that you are using, we are using the T100P single span T1 card so we use: @@ -961,7 +950,7 @@ them: - If you have chosen a Sangoma T1/E1 or analog card, you will need to follow their instructions for installation of their driver software LATEST Sangoma Wanpipe drivers: - ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-2.3.4-13.tgz + ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-3.2.1.tgz - now your asterisk installation is built and loaded and it's time to configure it. @@ -1000,6 +989,26 @@ NOTE: you can get an X100P through ebay for $10-$30 that will work with Asterisk modprobe zaptel modprobe wcfxo +If you will be doing native music-on-hold for your inbound calls, you will need +musiconhold audio files to be converted to native formats like GSM, ULAW and ALAW: + + cd /var/lib/asterisk/mohmp3/ + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-sunshine.mp3 > /var/lib/asterisk/mohmp3/fpm-sunshine.raw + sox -r 44100 -w -s -c 1 fpm-sunshine.raw -r 8000 -c 1 fpm-sunshine.wav + sox fpm-sunshine.wav -t gsm -r 8000 -b -c 1 fpm-sunshine.gsm + sox fpm-sunshine.wav -t ul -r 8000 -b -c 1 fpm-sunshine.pcm + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-calm-river.mp3 > /var/lib/asterisk/mohmp3/fpm-calm-river.raw + sox -r 44100 -w -s -c 1 fpm-calm-river.raw -r 8000 -c 1 fpm-calm-river.wav + sox fpm-calm-river.wav -t gsm -r 8000 -b -c 1 fpm-calm-river.gsm + sox fpm-calm-river.wav -t ul -r 8000 -b -c 1 fpm-calm-river.pcm + mpg123 -s --rate 44100 --mono /var/lib/asterisk/mohmp3/fpm-world-mix.mp3 > /var/lib/asterisk/mohmp3/fpm-world-mix.raw + sox -r 44100 -w -s -c 1 fpm-world-mix.raw -r 8000 -c 1 fpm-world-mix.wav + sox fpm-world-mix.wav -t gsm -r 8000 -b -c 1 fpm-world-mix.gsm + sox fpm-world-mix.wav -t ul -r 8000 -b -c 1 fpm-world-mix.pcm + rm -f *.raw + mkdir ../orig-mp3 + mv -f *.mp3 ../orig-mp3/ + PHASE 5: CONFIGURING ASTERISK AND YOUR SIP PHONES @@ -1660,7 +1669,7 @@ UPDATE mysql.user set password=OLD_PASSWORD('1234') where user='cron'; use asterisk; -\. /usr/src/astguiclient/MySQL_AST_CREATE_tables.sql +\. /usr/share/astguiclient/MySQL_AST_CREATE_tables.sql or you may need to run this if you get an error: \. /usr/src/astguiclient/trunk/extras/MySQL_AST_CREATE_tables.sql