From 17e43e95f186be723eed5505130b3a689620aad9 Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 1 Jul 2009 02:05:47 +0000 Subject: [PATCH] Added pre-Answer handling of Sangoma CPD events, also new netborder 1.4 patch Added back-end processes for process triggers git-svn-id: svn://192.168.202.10@1175 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 11 +++- agi/agi-VDAD_ALL_outbound.agi | 25 +++++--- bin/ADMIN_keepalive_ALL.pl | 62 ++++++++++++++++++- bin/ADMIN_update_server_ip.pl | 6 ++ bin/AST_VDauto_dial.pl | 58 ++++++++++++++---- bin/FastAGI_log.pl | 46 +++++++++++++-- docs/Sangoma_Netborder_CPD_Walkthrough.txt | 23 +++++++- docs/VICIDIAL_statuses.txt | 14 +++++ extras/MySQL_AST_CREATE_tables.sql | 25 +++++++- extras/netborder-cpd-1.4.patch | 69 ++++++++++++++++++++++ extras/upgrade_2.2.0.sql | 25 ++++++++ install.pl | 4 +- www/vicidial/admin.php | 2 + 13 files changed, 338 insertions(+), 32 deletions(-) create mode 100644 extras/netborder-cpd-1.4.patch diff --git a/UPGRADE b/UPGRADE index 3bf5ecbd..9fc031e4 100644 --- a/UPGRADE +++ b/UPGRADE @@ -62,7 +62,7 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom allowing you to lock out agent phone in a call center from dialing out. 14. Added option to login as an agent with no phone. Must create a phones entry - called nophone with dialplan number of 8300. + called 'nophone' with dialplan number of 8300. 15. Added live monitoring of calls and retrieval of recorded calls through the QueueMetrics interface @@ -117,8 +117,13 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom for the campaign. 31. Added Multiple Campaign Drop Rate Groups to allow campaigns to share a drop - percentage. This allows you to to run multiple smaller campaigns at once - and more easily control your drop rate. + percentage. This allows you to to run multiple smaller campaigns at one + time and more easily control your drop rate. + +32. Added pre-Answer statuses and processing for the Sangoma CPD(Call Progress + Detection) proxy as well as a new netborder sip patch: + netborder-cpd-1.4.patch + diff --git a/agi/agi-VDAD_ALL_outbound.agi b/agi/agi-VDAD_ALL_outbound.agi index 909ea306..ab611328 100644 --- a/agi/agi-VDAD_ALL_outbound.agi +++ b/agi/agi-VDAD_ALL_outbound.agi @@ -63,6 +63,7 @@ # 90214-0831 - Added CPD Fax detection option # 90410-1645 - Added SURVEYCAMPCEP call handling method and cleaned up formatting # 90628-1138 - Added more variable options for Cepstral TTS generation +# 90630-2250 - Added more Sangoma CDP statuses # $script = 'agi-VDAD_ALL_outbound.agi'; @@ -672,7 +673,7 @@ if ($call_handle_method =~ /REMIND/) ############# BEGIN CPD AMD SECTION ############################ if ($cpd_amd_action =~ /DISPO|MESSAGE/) { - $stmtA = "SELECT count(*) FROM vicidial_cpd_log where callerid='$callerid' and result IN('Answering-Machine','Fax') and status='NEW';"; + $stmtA = "SELECT count(*) FROM vicidial_cpd_log where callerid='$callerid' and result NOT IN('Voice','Unknown','???','') and status='NEW';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -713,7 +714,7 @@ if ($call_handle_method =~ /SURVEY/) ############# BEGIN CPD AMD SECTION ############################ if ($cpd_amd_action =~ /DISPO|MESSAGE/) { - $stmtA = "SELECT count(*) FROM vicidial_cpd_log where callerid='$callerid' and result IN('Answering-Machine','Fax') and status='NEW';"; + $stmtA = "SELECT count(*) FROM vicidial_cpd_log where callerid='$callerid' and result NOT IN('Voice','Unknown','???','') and status='NEW';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -1287,7 +1288,7 @@ while ($drop_timer <= $DROP_TIME) ############# BEGIN CPD AMD SECTION ############################ if ($cpd_amd_action =~ /DISPO|MESSAGE/) { - $stmtA = "SELECT count(*) FROM vicidial_cpd_log where callerid='$callerid' and result IN('Answering-Machine','Fax') and status='NEW';"; + $stmtA = "SELECT count(*) FROM vicidial_cpd_log where callerid='$callerid' and result NOT IN('Voice','Unknown','???','') and status='NEW';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -1980,10 +1981,20 @@ sub cpd_end_call $cpd_result = "$aryA[0]"; } $sthA->finish(); - if ($cpd_result =~ /Fax/i) - {$vdad_result='AFAX';} - else - {$vdad_result='AA';} + $CPDfound=0; + if ($cpd_result =~ /Busy/i) {$vdad_result='CPDB'; $CPDfound++;} + if ($cpd_result =~ /All-Trunks-Busy/i) {$vdad_result='CPDATB'; $CPDfound++;} + if ($cpd_result =~ /No-Answer/i) {$vdad_result='CPDNA'; $CPDfound++;} + if ($cpd_result =~ /Reject/i) {$vdad_result='CPDREJ'; $CPDfound++;} + if ($cpd_result =~ /Invalid-Number/i) {$vdad_result='CPDINV'; $CPDfound++;} + if ($cpd_result =~ /Service-Unavailable/i) {$vdad_result='CPDSUA'; $CPDfound++;} + if ($cpd_result =~ /Sit-Intercept/i) {$vdad_result='CPDSI'; $CPDfound++;} + if ($cpd_result =~ /Sit-No-Circuit/i) {$vdad_result='CPDSNC'; $CPDfound++;} + if ($cpd_result =~ /Sit-Reorder/i) {$vdad_result='CPDSR'; $CPDfound++;} + if ($cpd_result =~ /Sit-Unknown/i) {$vdad_result='CPDSUK'; $CPDfound++;} + if ($cpd_result =~ /Sit-Vacant/i) {$vdad_result='CPDSV'; $CPDfound++;} + if ($cpd_result =~ /Fax|Modem/i) {$vdad_result='AFAX'; $CPDfound++;} + if ($CPDfound < 1) {$vdad_result='AA';} if ($AGILOG) {$agi_string = "CALL CPD AMD Detected $channel $callerid|$drop_timer|$cpd_result"; &agi_output;} diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index 4326ecf6..e02769f7 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -28,6 +28,7 @@ # 90621-0823 - Added phones conf file secret field use # 90621-1425 - Added tracking group for call menus # 90622-2146 - Added 83047777777777 for dynamic agent alert extension +# 90630-2259 - Added vicidial_process_triggers functionality # $DB=0; # Debug flag @@ -1435,8 +1436,6 @@ if ( ($active_asterisk_server =~ /Y/) && ( ($sounds_update =~ /Y/) || ($upload_a `/usr/bin/screen -d -m -S AudioStore $PATHhome/ADMIN_audio_store_sync.pl $upload_flag 2>/dev/null 1>&2`; } } - - ################################################################################ ##### END Audio Store sync ################################################################################ @@ -1446,6 +1445,65 @@ if ( ($active_asterisk_server =~ /Y/) && ( ($sounds_update =~ /Y/) || ($upload_a +################################################################################ +##### BEGIN process triggers +################################################################################ +$stmtA = "SELECT trigger_id,user,trigger_lines FROM vicidial_process_triggers where server_ip='$server_ip' and trigger_run='1' and trigger_time < NOW() order by trigger_time limit 1;"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthBrows=$sthA->rows; +if ($sthBrows > 0) + { + @aryA = $sthA->fetchrow_array; + $trigger_id = "$aryA[0]"; + $user = "$aryA[1]"; + $trigger_lines = "$aryA[2]"; + } +$sthA->finish(); + +if ($sthBrows > 0) + { + $stmtA="UPDATE vicidial_process_triggers SET trigger_run='0' where trigger_id='$trigger_id';"; + $affected_rows = $dbhA->do($stmtA); + + $MT[0]=''; + $trigger_results=''; + if ($DB) {print "running process trigger: $trigger_id\n";} + @triggers = split(/\|/,$trigger_lines); + $i=0; + foreach(@triggers) + { + $trigger_results .= "$triggers[$i]\n"; + @output=@MT; + @output = `$triggers[$i]`; + $m=0; + foreach(@output) + { + $trigger_results .= "$output[$m]"; + $m++; + } + + $i++; + } + if ($DB) {print "DONE\n";} + if ($DB) {print "$trigger_results\n";} + + $trigger_lines =~ s/;|\\|\"//gi; + $trigger_results =~ s/;|\\|\"//gi; + + $stmtA="INSERT INTO vicidial_process_trigger_log SET trigger_id='$trigger_id',user='$user',trigger_time=NOW(),server_ip='$server_ip',trigger_lines='$trigger_lines',trigger_results='$trigger_results';"; + $Iaffected_rows = $dbhA->do($stmtA); + if ($DB) {print "FINISHED: $affected_rows|$Iaffected_rows";} + + } +################################################################################ +##### END process triggers +################################################################################ + + + + + if ($DB) {print "DONE\n";} exit; diff --git a/bin/ADMIN_update_server_ip.pl b/bin/ADMIN_update_server_ip.pl index 966b1406..5fd564d8 100644 --- a/bin/ADMIN_update_server_ip.pl +++ b/bin/ADMIN_update_server_ip.pl @@ -12,6 +12,7 @@ # 71205-2144 - Added display of extensions.conf example for call routing # 80321-0220 - Updated for new settings # 90211-1247 - Added asterisk version +# 90630-2256 - vicidial_process_triggers # # default path to astguiclient configuration file: $PATHconf = '/etc/astguiclient.conf'; @@ -438,6 +439,11 @@ $stmtA = "UPDATE vicidial_inbound_dids SET server_ip='$VARserver_ip' where serve $affected_rows = $dbhA->do($stmtA); if ($DB) {print " |$affected_rows|$stmtA|\n";} +print " Updating vicidial_process_triggers table...\n"; +$stmtA = "UPDATE vicidial_process_triggers SET server_ip='$VARserver_ip' where server_ip='$VARold_server_ip';"; +$affected_rows = $dbhA->do($stmtA); +if ($DB) {print " |$affected_rows|$stmtA|\n";} + print " Setting servers to rebuild conf files...\n"; $stmtA="UPDATE servers SET rebuild_conf_files='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y';"; $affected_rows = $dbhA->do($stmtA); diff --git a/bin/AST_VDauto_dial.pl b/bin/AST_VDauto_dial.pl index 3138829e..9b30842c 100644 --- a/bin/AST_VDauto_dial.pl +++ b/bin/AST_VDauto_dial.pl @@ -76,7 +76,8 @@ # 90202-0203 - Added outbound_autodial_active option to halt all dialing # 90306-1845 - Added configurable calls-per-second option # 90611-0554 - Bug fix for Manual dial calls and logging -# 90619-1948 - format fixing +# 90619-1948 - Format fixing +# 90630-2252 - Added Sangoma CDP pre-Answer call processing # @@ -1051,16 +1052,16 @@ while($one_day_interval > 0) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $auto_call_id = "$aryA[0]"; - $CLlead_id = "$aryA[1]"; - $CLphone_number = "$aryA[2]"; - $CLstatus = "$aryA[3]"; - $CLcampaign_id = "$aryA[4]"; - $CLphone_code = "$aryA[5]"; - $CLalt_dial = "$aryA[6]"; - $CLstage = "$aryA[7]"; - $CLcall_type = "$aryA[8]"; - $CLlast_update_time = "$aryA[9]"; + $auto_call_id = "$aryA[0]"; + $CLlead_id = "$aryA[1]"; + $CLphone_number = "$aryA[2]"; + $CLstatus = "$aryA[3]"; + $CLcampaign_id = "$aryA[4]"; + $CLphone_code = "$aryA[5]"; + $CLalt_dial = "$aryA[6]"; + $CLstage = "$aryA[7]"; + $CLcall_type = "$aryA[8]"; + $CLlast_update_time = "$aryA[9]"; $rec_count++; } $sthA->finish(); @@ -1153,6 +1154,41 @@ while($one_day_interval > 0) $sthA->finish(); } + ############################################################## + ### BEGIN - CPD Look for result for NA/B/DC calls + ############################################################## + $stmtA = "SELECT result FROM vicidial_cpd_log where callerid='$KLcallerid[$kill_vac]' order by cpd_id desc limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $cpd_result = "$aryA[0]"; + $sthA->finish(); + $CPDfound=0; + if ($cpd_result =~ /Busy/i) {$CLnew_status='CPDB'; $CPDfound++;} + if ($cpd_result =~ /Unknown/i) {$CLnew_status='CPDUK'; $CPDfound++;} + if ($cpd_result =~ /All-Trunks-Busy/i) {$CLnew_status='CPDATB'; $CPDfound++;} + if ($cpd_result =~ /No-Answer/i) {$CLnew_status='CPDNA'; $CPDfound++;} + if ($cpd_result =~ /Reject/i) {$CLnew_status='CPDREJ'; $CPDfound++;} + if ($cpd_result =~ /Invalid-Number/i) {$CLnew_status='CPDINV'; $CPDfound++;} + if ($cpd_result =~ /Service-Unavailable/i) {$CLnew_status='CPDSUA'; $CPDfound++;} + if ($cpd_result =~ /Sit-Intercept/i) {$CLnew_status='CPDSI'; $CPDfound++;} + if ($cpd_result =~ /Sit-No-Circuit/i) {$CLnew_status='CPDSNC'; $CPDfound++;} + if ($cpd_result =~ /Sit-Reorder/i) {$CLnew_status='CPDSR'; $CPDfound++;} + if ($cpd_result =~ /Sit-Unknown/i) {$CLnew_status='CPDSUK'; $CPDfound++;} + if ($cpd_result =~ /Sit-Vacant/i) {$CLnew_status='CPDSV'; $CPDfound++;} + if ($cpd_result =~ /\?\?\?/i) {$CLnew_status='CPDERR'; $CPDfound++;} + if ($cpd_result =~ /Fax|Modem/i) {$CLnew_status='AFAX'; $CPDfound++;} + if ($cpd_result =~ /Answering-Machine/i) {$CLnew_status='AA'; $CPDfound++;} + } + + ############################################################## + ### END - CPD Look for result for NA/B/DC calls + ############################################################## + $end_epoch = ($now_date_epoch + 1); if ($insertVLcount < 1) { diff --git a/bin/FastAGI_log.pl b/bin/FastAGI_log.pl index 8ed49845..6b20d6ff 100644 --- a/bin/FastAGI_log.pl +++ b/bin/FastAGI_log.pl @@ -46,6 +46,7 @@ # 81029-0522 - Changed to disallow queue_log logging of IVR calls # 90604-1044 - Fixed formatting, added DAHDI support, added carrier hangup code logging # 90608-0316 - Changed hangup code dispos B and DC to AB and ADC to separate Agent dispos from Auto +# 90630-2253 - Added Sangoma CDP pre-Answer call processing # @@ -633,10 +634,47 @@ sub process_request if ($channel =~ /^Local/) { - if ( ($PRI =~ /^PRI$/) && ($callerid =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) && ( ($dialstatus =~ /BUSY/) || ( ($dialstatus =~ /CHANUNAVAIL/) && ($hangup_cause =~ /^1$|^28$/) ) ) ) + $CPDfound=0; + ############################################################## + ### BEGIN - CPD Look for result for B/DC calls + ############################################################## + $stmtA = "SELECT result FROM vicidial_cpd_log where callerid='$callerid' and result NOT IN('Voice','Unknown','???','') order by cpd_id desc limit 1;"; + if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) { - if ($dialstatus =~ /BUSY/) {$VDL_status = 'AB'; $VDAC_status = 'BUSY';} - if ($dialstatus =~ /CHANUNAVAIL/) {$VDL_status = 'ADC'; $VDAC_status = 'DISCONNECT';} + @aryA = $sthA->fetchrow_array; + $cpd_result = "$aryA[0]"; + $sthA->finish(); + if ($cpd_result =~ /Busy/i) {$VDL_status='CPDB'; $VDAC_status='BUSY'; $CPDfound++;} + if ($cpd_result =~ /Unknown/i) {$VDL_status='CPDUK'; $VDAC_status='NA'; $CPDfound++;} + if ($cpd_result =~ /All-Trunks-Busy/i) {$VDL_status='CPDATB'; $VDAC_status='CONGESTION'; $CPDfound++;} + if ($cpd_result =~ /No-Answer/i) {$VDL_status='CPDNA'; $VDAC_status='NA'; $CPDfound++;} + if ($cpd_result =~ /Reject/i) {$VDL_status='CPDREJ'; $VDAC_status='DISCONNECT'; $CPDfound++;} + if ($cpd_result =~ /Invalid-Number/i) {$VDL_status='CPDINV'; $VDAC_status='DISCONNECT'; $CPDfound++;} + if ($cpd_result =~ /Service-Unavailable/i) {$VDL_status='CPDSUA'; $VDAC_status='CONGESTION'; $CPDfound++;} + if ($cpd_result =~ /Sit-Intercept/i) {$VDL_status='CPDSI'; $VDAC_status='DISCONNECT'; $CPDfound++;} + if ($cpd_result =~ /Sit-No-Circuit/i) {$VDL_status='CPDSNC'; $VDAC_status='CONGESTION'; $CPDfound++;} + if ($cpd_result =~ /Sit-Reorder/i) {$VDL_status='CPDSR'; $VDAC_status='CONGESTION'; $CPDfound++;} + if ($cpd_result =~ /Sit-Unknown/i) {$VDL_status='CPDSUK'; $VDAC_status='CONGESTION'; $CPDfound++;} + if ($cpd_result =~ /Sit-Vacant/i) {$VDL_status='CPDSV'; $VDAC_status='CONGESTION'; $CPDfound++;} + if ($cpd_result =~ /\?\?\?/i) {$VDL_status='CPDERR'; $VDAC_status='NA'; $CPDfound++;} + if ($cpd_result =~ /Fax|Modem/i) {$VDL_status='AFAX'; $VDAC_status='FAX'; $CPDfound++;} + if ($cpd_result =~ /Answering-Machine/i) {$VDL_status='AA'; $VDAC_status='AMD'; $CPDfound++;} + } + ############################################################## + ### END - CPD Look for result for B/DC calls + ############################################################## + + if ( ($PRI =~ /^PRI$/) && ($callerid =~ /\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) && ( ( ($dialstatus =~ /BUSY/) || ( ($dialstatus =~ /CHANUNAVAIL/) && ($hangup_cause =~ /^1$|^28$/) ) ) || ($CPDfound > 0) )) + { + if ($CPDfound < 1) + { + if ($dialstatus =~ /BUSY/) {$VDL_status = 'AB'; $VDAC_status = 'BUSY';} + if ($dialstatus =~ /CHANUNAVAIL/) {$VDL_status = 'ADC'; $VDAC_status = 'DISCONNECT';} + } $stmtA = "UPDATE vicidial_list set status='$VDL_status' where lead_id = '$CIDlead_id';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} @@ -656,8 +694,6 @@ sub process_request if ($AGILOG) {$agi_string = "-- VDAD vicidial_log update: |$VDLaffected_rows|$uniqueid|$VDACuniqueid|"; &agi_output;} sleep(1); - - $dbhA->disconnect(); } else { diff --git a/docs/Sangoma_Netborder_CPD_Walkthrough.txt b/docs/Sangoma_Netborder_CPD_Walkthrough.txt index a5e71340..0e5cd8cc 100644 --- a/docs/Sangoma_Netborder_CPD_Walkthrough.txt +++ b/docs/Sangoma_Netborder_CPD_Walkthrough.txt @@ -51,7 +51,7 @@ Step 17. Change the line that reads "#paraxip.net.primaryIPAddress=x.x.x.x" to " Section 2. Patching and recompiling Asterisk. Step 1. On the Linux console of your VICIDIAL system change to the Asterisk source code directory (on a VICIbox Server installation this is located at /usr/src/asterisk-1.2.30.4). The command to do so will look something like this "cd /usr/src/asterisk-1.2.30.4". -Step 2. Copy the version (1.2 or 1.4) of the paraxip patch that matches the version of Asterisk which is installed on your VICIDIAL system from the extras directory of the VICIDIAL source code (on a VICIbox Server installation this is the 1.2 version and it is located in the /usr/src/astguiclient/extras/ directory) to the asterisk source code directory. The command to do so will look something like this "cp /usr/src/astguiclient/extras/vicidial_paraxip_chan_sip-1.2.patch ." Adjust this command according to the location of your VICIDIAL source code and the version of asterisk that you are using. +Step 2. Copy the version (1.2 or 1.4) of the paraxip patch that matches the version of Asterisk which is installed on your VICIDIAL system from the extras directory of the VICIDIAL source code (on a VICIbox Server installation this is the 1.2 version and it is located in the /usr/src/astguiclient/extras/ directory) to the asterisk source code directory. The command to do so will look something like this "cp /usr/src/astguiclient/extras/vicidial_paraxip_chan_sip-1.2.patch ." Adjust this command according to the location of your VICIDIAL source code and the version of asterisk that you are using(new version for Asterisk 1.4: netborder-cpd-1.4.patch). Step 3. Patch the chan_sip.c file in the channels directory. The command to do so will look something like this "patch channels/chan_sip.c -p1 < vicidial_paraxip_chan_sip-1.2.patch". If you are using 1.4 asterisk be sure to adjust this command accordingly. Step 4. Now it is time to recompile asterisk. If you are using 1.2 Asterisk the command to do so is this "make clean && make all && make install". If you are using 1.4 asterisk the command to do so is this "./configure && make clean && make all && make install". This process will take some time. What ever you do, do NOT run "make samples" as this will wipe out your existing asterisk configurations. @@ -89,3 +89,24 @@ Step 8. Got back to the Paraxip NetBorder section of the Start menu and click th Congratulations! The free trial of NetBorder CPA Analysis and Vicidial are now successfully integrated. The free trial has a limit of 30 concurrent channels. If you try and dial more than this your calls will fail. Also keep an eye on the CPU load on the windows system. If the load gets higher than 60% Paraxip will not be able to react in time. You might get choppy audio or a higher rate of false positives or false negatives. + + + + + +VICIDIAL Additional statuses for pre-Answer results: + +INSERT INTO vicidial_statuses values('CPDATB','CPD All-Trunks-Busy','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDB','CPD Busy','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDNA','CPD No-Answer','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDREJ','CPD Reject','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDINV','CPD Invalid-Number','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDSUA','CPD Service-Unavailable','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDSI','CPD Sit-Intercept','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDSNC','CPD Sit-No-Circuit','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDSR','CPD Sit-Reorder','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDSUK','CPD Sit-Unknown','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDSV','CPD Sit-Vacant','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDUK','CPD Unknown','N','N','UNDEFINED','N','N','N','N','N'); +INSERT INTO vicidial_statuses values('CPDERR','CPD Error','N','N','UNDEFINED','N','N','N','N','N'); + diff --git a/docs/VICIDIAL_statuses.txt b/docs/VICIDIAL_statuses.txt index 9eb94223..c94c3745 100644 --- a/docs/VICIDIAL_statuses.txt +++ b/docs/VICIDIAL_statuses.txt @@ -27,6 +27,7 @@ PU - Call Picked Up - Status that a call is changed to as soon as the carrier ha PM - Played Message - outbound broadcast or SURVEY campaign status for when a message has been played to the customer XFER - Call Transferred - Call has been sent from an agent to a Closer agent ERI - Agent Error - An agent has closed their browser before dispositioning a lead +DONEM - Agent placed a manual dial phone call and then closed their browser before dispositioning a lead SVYEXT - Survey sent to Extension - Survey outbound campaign status only SVYVM - Survey sent to Voicemail - Survey outbound campaign status only SVYHU - Survey Hungup - Survey outbound campaign status only @@ -34,3 +35,16 @@ SVYREC - Survey sent to Record - Survey outbound campaign status only HXFER - Hold Recall Transfer to another in-group HOLDTO - Hold time option call termination on inbound call QVMAIL - Queue Abandon Voicemail Left +CPDATB - Sangoma Call Progress Detection CPD All-Trunks-Busy +CPDB - Sangoma Call Progress Detection CPD Busy +CPDNA - Sangoma Call Progress Detection CPD No-Answer +CPDREJ - Sangoma Call Progress Detection CPD Reject +CPDINV - Sangoma Call Progress Detection CPD Invalid-Number +CPDSUA - Sangoma Call Progress Detection CPD Service-Unavailable +CPDSI - Sangoma Call Progress Detection CPD Sit-Intercept +CPDSNC - Sangoma Call Progress Detection CPD Sit-No-Circuit +CPDSR - Sangoma Call Progress Detection CPD Sit-Reorder +CPDSUK - Sangoma Call Progress Detection CPD Sit-Unknown +CPDSV - Sangoma Call Progress Detection CPD Sit-Vacant +CPDUK - Sangoma Call Progress Detection CPD Unknown +CPDERR - Sangoma Call Progress Detection CPD Error diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 7dae91c9..bac4bb03 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -1577,6 +1577,27 @@ drops_today_pct VARCHAR(6) default '0', drops_answers_today_pct VARCHAR(6) default '0' ); +CREATE TABLE vicidial_process_triggers ( +trigger_id VARCHAR(20) PRIMARY KEY NOT NULL, +trigger_name VARCHAR(100), +server_ip VARCHAR(15) NOT NULL, +trigger_time DATETIME, +trigger_run ENUM('0','1') default '0', +user VARCHAR(20), +trigger_lines TEXT +); + +CREATE TABLE vicidial_process_trigger_log ( +trigger_id VARCHAR(20) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +trigger_time DATETIME, +user VARCHAR(20), +trigger_lines TEXT, +trigger_results TEXT, +index (trigger_id), +index (trigger_time) +); + ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP; @@ -1676,6 +1697,8 @@ INSERT INTO vicidial_drop_rate_groups SET group_id='108'; INSERT INTO vicidial_drop_rate_groups SET group_id='109'; INSERT INTO vicidial_drop_rate_groups SET group_id='110'; +INSERT INTO vicidial_process_triggers SET trigger_id='LOAD_LEADS',server_ip='10.10.10.15',trigger_name='Load Leads',trigger_time='2009-01-01 00:00:00',trigger_run='0',trigger_lines='/usr/share/astguiclient/VICIDIAL_IN_new_leads_file.pl'; + UPDATE system_settings SET qc_last_pull_time=NOW(); CREATE INDEX country_postal_code on vicidial_postal_codes (country_code,postal_code); @@ -1696,7 +1719,7 @@ CREATE INDEX phone_number on vicidial_closer_log (phone_number); CREATE INDEX date_user on vicidial_closer_log (call_date,user); CREATE INDEX comment_a on live_inbound_log (comment_a); -UPDATE system_settings SET db_schema_version='1159'; +UPDATE system_settings SET db_schema_version='1160'; GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/netborder-cpd-1.4.patch b/extras/netborder-cpd-1.4.patch new file mode 100644 index 00000000..c967ff1e --- /dev/null +++ b/extras/netborder-cpd-1.4.patch @@ -0,0 +1,69 @@ +--- channels/chan_sip.c.old 2009-06-23 12:13:57.000000000 -0400 ++++ channels/chan_sip.c 2009-06-23 11:26:25.000000000 -0400 +@@ -1454,6 +1454,7 @@ + static void sip_send_all_registers(void); + + /*--- Parsing SIP requests and responses */ ++static int check_cpd_results(struct sip_pvt *p, struct sip_request *req); + static void append_date(struct sip_request *req); /* Append date to SIP packet */ + static int determine_firstline_parts(struct sip_request *req); + static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype); +@@ -4247,6 +4248,29 @@ + + return _default; + } ++/*! \brief Check for a CPD-Result ++ This looks for a CPD-Result in the sip_request ++ and throws a manager event if it finds one ++ */ ++static int check_cpd_results(struct sip_pvt *p, struct sip_request *req) { ++ const char *cpdr = get_header(req, "CPD-Result");\ ++ /* See if NetBorder had anything to say */ ++ if (!(ast_strlen_zero(cpdr))) { ++ /* If so throw a manager event with the result */ ++ char cpd_result[SIPBUFSIZE]; ++ ast_copy_string(cpd_result, get_header(req, "CPD-Result"), sizeof(cpd_result)); ++ manager_event( ++ EVENT_FLAG_SYSTEM, ++ "CPD-Result", ++ "ChannelDriver: SIP\r\nChannel: %s\r\nCallerIDName: %s\r\nUniqueid: %s\r\nResult: %s\r\n", ++ p->owner->name, ++ p->owner->cid.cid_name, ++ p->owner->uniqueid, ++ cpd_result ++ ); ++ } ++ return 0; ++} + + static const char *__get_header(const struct sip_request *req, const char *name, int *start) + { +@@ -6964,6 +6988,7 @@ + char tmp2[SIPBUFSIZE/2]; + const char *l = NULL, *n = NULL; + const char *urioptions = ""; ++ const char *netbordercpd = ";cpd=on"; /* string used to enable NetBorder's CPD */ + + if (ast_test_flag(&p->flags[0], SIP_USEREQPHONE)) { + const char *s = p->username; /* being a string field, cannot be NULL */ +@@ -7050,6 +7075,9 @@ + if (p->options && !ast_strlen_zero(p->options->uri_options)) + ast_build_string(&invite, &invite_max, ";%s", p->options->uri_options); + ++ /* Tell NetBorder to enable CPD */ ++ ast_build_string(&invite, &invite_max, "%s", netbordercpd); ++ + ast_string_field_set(p, uri, invite_buf); + + if (sipmethod == SIP_NOTIFY && !ast_strlen_zero(p->theirtag)) { +@@ -12740,6 +12768,10 @@ + gettag(req, "To", tag, sizeof(tag)); + ast_string_field_set(p, theirtag, tag); + } ++ ++ /* Check if NetBorder had anything to say */ ++ check_cpd_results(p, req); ++ + if (p->relatedpeer && p->method == SIP_OPTIONS) { + /* We don't really care what the response is, just that it replied back. + Well, as long as it's not a 100 response... since we might diff --git a/extras/upgrade_2.2.0.sql b/extras/upgrade_2.2.0.sql index 9d696d69..14b73ae3 100644 --- a/extras/upgrade_2.2.0.sql +++ b/extras/upgrade_2.2.0.sql @@ -261,3 +261,28 @@ INSERT INTO vicidial_drop_rate_groups SET group_id='110'; ALTER TABLE vicidial_campaigns ADD drop_rate_group VARCHAR(20) default 'DISABLED'; UPDATE system_settings SET db_schema_version='1159'; + +CREATE TABLE vicidial_process_triggers ( +trigger_id VARCHAR(20) PRIMARY KEY NOT NULL, +trigger_name VARCHAR(100), +server_ip VARCHAR(15) NOT NULL, +trigger_time DATETIME, +trigger_run ENUM('0','1') default '0', +user VARCHAR(20), +trigger_lines TEXT +); + +CREATE TABLE vicidial_process_trigger_log ( +trigger_id VARCHAR(20) NOT NULL, +server_ip VARCHAR(15) NOT NULL, +trigger_time DATETIME, +user VARCHAR(20), +trigger_lines TEXT, +trigger_results TEXT, +index (trigger_id), +index (trigger_time) +); + +INSERT INTO vicidial_process_triggers SET trigger_id='LOAD_LEADS',server_ip='10.10.10.15',trigger_name='Load Leads',trigger_time='2009-01-01 00:00:00',trigger_run='0',trigger_lines='/usr/share/astguiclient/VICIDIAL_IN_new_leads_file.pl'; + +UPDATE system_settings SET db_schema_version='1160'; diff --git a/install.pl b/install.pl index ee2bd0d4..f52b1224 100644 --- a/install.pl +++ b/install.pl @@ -52,7 +52,7 @@ $VARDB_port = '3306'; # default keepalive processes: $VARactive_keepalives = '1234568'; # default Asterisk version: -$VARasterisk_version = '1.2'; +$VARasterisk_version = '1.4'; # default recording FTP archive variables: $VARFTP_host = '10.0.0.4'; $VARFTP_user = 'cron'; @@ -1606,7 +1606,7 @@ else print "Enter asterisk version or press enter for default: [$VARasterisk_version] "; $PROMPTasterisk_version = ; chomp($PROMPTasterisk_version); - if (length($PROMPTasterisk_version)>0) + if (length($PROMPTasterisk_version)>2) { $PROMPTasterisk_version =~ s/ |\n|\r|\t|\/$//gi; $VARasterisk_version=$PROMPTasterisk_version; diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 8b359603..a5a9797f 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -21404,6 +21404,8 @@ if ($ADD==1500) echo "\n"; $o=0; + $menu_id = $MT; + while ($menus_to_print > $o) { $row=mysql_fetch_row($rslt);