From ea1ab3b7f412b686c60df6e4ee767beb9d42cc11 Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 4 Nov 2008 08:27:55 +0000 Subject: [PATCH] added option for 3way calling dial prefix to campaigns added full mysql error logging to vicidial agent web interface git-svn-id: svn://192.168.202.10@995 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 2 + agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi | 59 +++-- agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi | 59 +++-- agc_2-X/trunk/bin/AST_VDauto_dial.pl | 23 +- .../docs/conf_examples/extensions.conf.sample | 6 + .../conf_examples/extensions.conf.sample-1.4 | 6 + .../trunk/extras/MySQL_AST_CREATE_tables.sql | 5 +- agc_2-X/trunk/extras/upgrade_2.0.5.sql | 4 + .../TO_BE_TRANSLATED_2.0.5.txt | 2 + agc_2-X/trunk/www/agc/conf_exten_check.php | 42 +++- agc_2-X/trunk/www/agc/manager_send.php | 114 ++++++++- agc_2-X/trunk/www/agc/vdc_db_query.php | 236 ++++++++++++++++-- agc_2-X/trunk/www/agc/vicidial.php | 101 ++++++-- agc_2-X/trunk/www/vicidial/admin.php | 21 +- 14 files changed, 603 insertions(+), 77 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index cc264fd4..9318fe43 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -210,6 +210,8 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom statistics to the agent performance detail report. Also added an option to force agents to enter a pause code(this is a campaign option) +47. Added full MySQL error logging to vicidial agent web interface. Logs are + written to the webserver. diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi index eec3102b..b6fbf3d4 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi @@ -87,6 +87,7 @@ # 81020-0237 - Added term_reason logging for all possible exits of the script # 81021-2315 - Changed and add queue_log logging # 81024-0006 - Changed LOOKUP to insert new lead if phone_number < 3 digits, changed queue_sec calculation +# 81104-0301 - Changed code to alter callerIDnumber for remote agents to the number of the caller # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -1045,9 +1046,9 @@ if ($agent_search_method =~ /^SO|^LO/) { @aryA = $sthA->fetchrow_array; - $VDADconf_exten = "$aryA[0]"; - $VDADuser = "$aryA[1]"; - $VDADextension = "$aryA[2]"; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; } $sthA->finish(); @@ -1087,9 +1088,9 @@ if ($agent_search_method =~ /^SO|^LO/) { @aryA = $sthA->fetchrow_array; - $VDADconf_exten = "$aryA[0]"; - $VDADuser = "$aryA[1]"; - $VDADextension = "$aryA[2]"; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; $cbc++; } @@ -1188,6 +1189,21 @@ if ($agent_search_method =~ /^SO|^LO/) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + if ($VDADextension =~ /^R\//) + { + ### set the callerid to the ACQS value(calleridname) + ## use these two lines for Asterisk 1.2 tree + $newcallerid = "\"$callerid <$phone_number>\""; + $AGI->set_callerid($newcallerid); + ## use these two lines for Asterisk 1.0 tree + # print "SET CALLERID \"$calleridname\" <0000000000>\n"; + # print "SET CALLERIDNAME \"$calleridname\"\n"; + + print STDERR "Setting CID \"$newcallerid\"\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: \"$callerid\" \<$phone_number\>"; &agi_output;} + } + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$insert_lead_id' and call_date='$SQLdate';"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|$insert_close_id|\n|$stmtA|"; &agi_output;} @@ -1326,10 +1342,10 @@ if ($agent_search_method =~ /^LO|^LB/) { @aryA = $sthA->fetchrow_array; - $VDADconf_exten = "$aryA[0]"; - $VDADuser = "$aryA[1]"; - $VDADextension = "$aryA[2]"; - $VDADserver_ip = "$aryA[3]"; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $VDADserver_ip = "$aryA[3]"; } $sthA->finish(); @@ -1369,10 +1385,10 @@ if ($agent_search_method =~ /^LO|^LB/) while ($sthArows > $cbc) { @aryA = $sthA->fetchrow_array; - $VDADconf_exten = "$aryA[0]"; - $VDADuser = "$aryA[1]"; - $VDADextension = "$aryA[2]"; - $VDADserver_ip = "$aryA[3]"; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $VDADserver_ip = "$aryA[3]"; $cbc++; } $sthA->finish(); @@ -1480,6 +1496,21 @@ if ($agent_search_method =~ /^LO|^LB/) if ($min < 10) {$min = "0$min";} if ($sec < 10) {$sec = "0$sec";} + if ($VDADextension =~ /^R\//) + { + ### set the callerid to the ACQS value(calleridname) + ## use these two lines for Asterisk 1.2 tree + $newcallerid = "\"$callerid <$phone_number>\""; + $AGI->set_callerid($newcallerid); + ## use these two lines for Asterisk 1.0 tree + # print "SET CALLERID \"$calleridname\" <0000000000>\n"; + # print "SET CALLERIDNAME \"$calleridname\"\n"; + + print STDERR "Setting CID \"$newcallerid\"\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: \"$callerid\" \<$phone_number\>"; &agi_output;} + } + $stmtA = "UPDATE vicidial_closer_log set queue_seconds='$drop_timer' where lead_id = '$insert_lead_id' and call_date='$SQLdate';"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi index fc0a8383..6adc0e70 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_outbound.agi @@ -56,6 +56,7 @@ # 80831-0353 - Added logging of alt_dial field # 80909-0603 - Added campaign-specific dnc option for outbound survey # 81020-0235 - Fixed Drop hangup bug and other small bugs +# 81104-0255 - Changed code to alter callerIDnumber for remote agents to the number of the caller # $script = 'agi-VDAD_ALL_outbound.agi'; @@ -907,9 +908,9 @@ if ($agent_search_method =~ /^SO|^LO/) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $VDADconf_exten = "$aryA[0]"; - $VDADuser = "$aryA[1]"; - $VDADextension = "$aryA[2]"; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; $rec_count++; } $sthA->finish(); @@ -933,9 +934,9 @@ if ($agent_search_method =~ /^SO|^LO/) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $VDADconf_exten = "$aryA[0]"; - $VDADuser = "$aryA[1]"; - $VDADextension = "$aryA[2]"; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; $rec_count++; } $sthA->finish(); @@ -944,6 +945,21 @@ if ($agent_search_method =~ /^SO|^LO/) } } + if ($VDADextension =~ /^R\//) + { + ### set the callerid to the ACQS value(calleridname) + ## use these two lines for Asterisk 1.2 tree + $newcallerid = "\"$calleridname <$VDADphone>\""; + $AGI->set_callerid($newcallerid); + ## use these two lines for Asterisk 1.0 tree + # print "SET CALLERID \"$calleridname\" <0000000000>\n"; + # print "SET CALLERIDNAME \"$calleridname\"\n"; + + print STDERR "Setting CID \"$newcallerid\"\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: \"$calleridname\" \<$VDADphone\>"; &agi_output;} + } + $stmtA = "UPDATE vicidial_auto_calls set status='XFER', stage='XFER-$drop_timer' where callerid='$callerid';"; $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDAD XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} @@ -1059,10 +1075,10 @@ if ($rec_countWAITrem < $concurrent_transfers) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $VDADconf_exten = "$aryA[0]"; - $VDADuser = "$aryA[1]"; - $VDADextension = "$aryA[2]"; - $VDADserver_ip = "$aryA[3]"; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $VDADserver_ip = "$aryA[3]"; $rec_count++; } $sthA->finish(); @@ -1086,10 +1102,10 @@ if ($rec_countWAITrem < $concurrent_transfers) while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; - $VDADconf_exten = "$aryA[0]"; - $VDADuser = "$aryA[1]"; - $VDADextension = "$aryA[2]"; - $VDADserver_ip = "$aryA[3]"; + $VDADconf_exten = "$aryA[0]"; + $VDADuser = "$aryA[1]"; + $VDADextension = "$aryA[2]"; + $VDADserver_ip = "$aryA[3]"; $rec_count++; } $sthA->finish(); @@ -1102,6 +1118,21 @@ if ($rec_countWAITrem < $concurrent_transfers) $affected_rows = $dbhA->do($stmtA); if ($AGILOG) {$agi_string = "-- VDAD XFER REMOTE: |$affected_rows|update of vac table: $callerid\n|$stmtA|"; &agi_output;} + if ($VDADextension =~ /^R\//) + { + ### set the callerid to the ACQS value(calleridname) + ## use these two lines for Asterisk 1.2 tree + $newcallerid = "\"$calleridname <$VDADphone>\""; + $AGI->set_callerid($newcallerid); + ## use these two lines for Asterisk 1.0 tree + # print "SET CALLERID \"$calleridname\" <0000000000>\n"; + # print "SET CALLERIDNAME \"$calleridname\"\n"; + + print STDERR "Setting CID \"$newcallerid\"\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: \"$calleridname\" \<$VDADphone\>"; &agi_output;} + } + $dbhA->disconnect(); if ($enable_queuemetrics_logging > 0) diff --git a/agc_2-X/trunk/bin/AST_VDauto_dial.pl b/agc_2-X/trunk/bin/AST_VDauto_dial.pl index 332ec2ff..4b05f6a2 100644 --- a/agc_2-X/trunk/bin/AST_VDauto_dial.pl +++ b/agc_2-X/trunk/bin/AST_VDauto_dial.pl @@ -953,7 +953,7 @@ while($one_day_interval > 0) { if (length($KLserver_ip[$kill_vac]) > 7) { - $end_epoch=0; $CLuniqueid=''; $start_epoch=0; + $end_epoch=0; $CLuniqueid=''; $start_epoch=0; $CLlast_update_time=0; $KLcalleridCHECK[$kill_vac]=$KLcallerid[$kill_vac]; $KLcalleridCHECK[$kill_vac] =~ s/\W//gi; @@ -997,7 +997,7 @@ while($one_day_interval > 0) $CLlead_id=''; $auto_call_id=''; $CLstatus=''; $CLcampaign_id=''; $CLphone_number=''; $CLphone_code=''; - $stmtA = "SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,call_type FROM vicidial_auto_calls where callerid='$KLcallerid[$kill_vac]'"; + $stmtA = "SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,call_type,UNIX_TIMESTAMP(last_update_time) FROM vicidial_auto_calls where callerid='$KLcallerid[$kill_vac]'"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -1015,6 +1015,7 @@ while($one_day_interval > 0) $CLalt_dial = "$aryA[6]"; $CLstage = "$aryA[7]"; $CLcall_type = "$aryA[8]"; + $CLlast_update_time = "$aryA[9]"; $rec_count++; } $sthA->finish(); @@ -1089,7 +1090,7 @@ while($one_day_interval > 0) &event_logger; } - $stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where callerid='$KLcallerid[$kill_vac]';"; + $stmtA = "UPDATE vicidial_live_agents set status='PAUSED',random_id='10' where callerid='$KLcallerid[$kill_vac]';"; $affected_rows = $dbhA->do($stmtA); $event_string = "| dead call vla agent PAUSED $affected_rows|$CLlead_id|$CLphone_number|$CLstatus|"; @@ -1372,8 +1373,20 @@ while($one_day_interval > 0) } else { - $event_string = "| dead call vac XFERd do nothing|$CLlead_id|$CLphone_number|$CLstatus|"; - &event_logger; + if ( ($KLcallerid[$kill_vac] =~ /^M\d\d\d\d\d\d\d\d\d\d/) && ($CLlast_update_time < $TDtarget) ) + { + $stmtA = "DELETE from vicidial_auto_calls where auto_call_id='$auto_call_id'"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = "| M dead call vac deleted|$auto_call_id|$CLlead_id|$KLcallerid[$kill_vac]|$end_epoch|$affected_rows|$KLchannel[$kill_vac]|$CLcall_type|$CLlast_update_time < $XDtarget|"; + &event_logger; + + } + else + { + $event_string = "| dead call vac XFERd do nothing|$CLlead_id|$CLphone_number|$CLstatus|"; + &event_logger; + } } } else diff --git a/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample b/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample index dfb3801b..ded2ac6c 100644 --- a/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample +++ b/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample @@ -147,6 +147,12 @@ exten => _9727NXXXXXX,3,Hangup exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) exten => _91NXXNXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},,To) exten => _91NXXNXXXXXX,3,Hangup + +; This is a loopback dialaround to allow for hearing of ringing for 3way calls +exten => _881NXXNXXXXXX,1,Answer +exten => _881NXXNXXXXXX,2,Dial(${TRUNKloop}/9${EXTEN:2},,To) +exten => _881NXXNXXXXXX,3,Hangup + ; dial a long distance outbound number through BINFONE ; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) ; exten => _91NXXNXXXXXX,2,Dial(${TRUNKIAX}/${EXTEN:1},55,To) diff --git a/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-1.4 b/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-1.4 index 871db35d..b16a2734 100644 --- a/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-1.4 +++ b/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-1.4 @@ -147,6 +147,12 @@ exten => _9727NXXXXXX,3,Hangup exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) exten => _91NXXNXXXXXX,2,Dial(${TRUNKX}/${EXTEN:1},,To) exten => _91NXXNXXXXXX,3,Hangup + +; This is a loopback dialaround to allow for hearing of ringing for 3way calls +exten => _881NXXNXXXXXX,1,Answer +exten => _881NXXNXXXXXX,2,Dial(${TRUNKloop}/9${EXTEN:2},,To) +exten => _881NXXNXXXXXX,3,Hangup + ; dial a long distance outbound number through BINFONE ; exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) ; exten => _91NXXNXXXXXX,2,Dial(${TRUNKIAX}/${EXTEN:1},55,To) diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index f14c3880..83c52232 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -594,7 +594,8 @@ manual_dial_filter VARCHAR(50) default 'NONE', agent_clipboard_copy VARCHAR(50) default 'NONE', agent_extended_alt_dial ENUM('Y','N') default 'N', use_campaign_dnc ENUM('Y','N') default 'N', -three_way_call_cid ENUM('CAMPAIGN','CUSTOMER','AGENT_PHONE') default 'CAMPAIGN' +three_way_call_cid ENUM('CAMPAIGN','CUSTOMER','AGENT_PHONE') default 'CAMPAIGN', +three_way_dial_prefix VARCHAR(20) default '' ); CREATE TABLE vicidial_lists ( @@ -1345,7 +1346,7 @@ CREATE INDEX phone_number on vicidial_xfer_log (phone_number); CREATE INDEX phone_number on vicidial_closer_log (phone_number); CREATE INDEX date_user on vicidial_closer_log (call_date,user); -UPDATE system_settings SET db_schema_version='1115'; +UPDATE system_settings SET db_schema_version='1116'; GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/agc_2-X/trunk/extras/upgrade_2.0.5.sql b/agc_2-X/trunk/extras/upgrade_2.0.5.sql index f257884e..59987bd5 100644 --- a/agc_2-X/trunk/extras/upgrade_2.0.5.sql +++ b/agc_2-X/trunk/extras/upgrade_2.0.5.sql @@ -522,3 +522,7 @@ UPDATE system_settings SET db_schema_version='1114'; ALTER TABLE vicidial_campaigns MODIFY agent_pause_codes_active ENUM('Y','N','FORCE') default 'N'; UPDATE system_settings SET db_schema_version='1115'; + +ALTER TABLE vicidial_campaigns ADD three_way_dial_prefix VARCHAR(20) default ''; + +UPDATE system_settings SET db_schema_version='1116'; diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt index faad4270..d0515fae 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt @@ -334,6 +334,8 @@ To disable the On Hold Prompt, set the interval to 0|| 3-Way Call Outbound CallerID:|| INBOUND_MAN allows the agent to place manual dial calls from a campaign list while being able to take inbound calls between manual dial calls|| FORCE will force the agents to choose a PAUSE code if they click on the PAUSE button|| +3-Way Call Dial Prefix -<\/B> This defines what is used as the dial prefix for 3-way calls, default is empty so the campaign dial prefix is used, passthru so you can hear ringing is 88|| +3-Way Call Dial Prefix|| ############################################################ CLIENT diff --git a/agc_2-X/trunk/www/agc/conf_exten_check.php b/agc_2-X/trunk/www/agc/conf_exten_check.php index e79a2824..651528af 100644 --- a/agc_2-X/trunk/www/agc/conf_exten_check.php +++ b/agc_2-X/trunk/www/agc/conf_exten_check.php @@ -38,8 +38,14 @@ # 80424-0442 - Added non_latin lookup from system_settings # 80519-1425 - Added calls-in-queue tally # 80703-1106 - Added API functionality for Hangup and Dispo +# 81104-0229 - Added mysql error logging capability # +$version = '2.0.4-14'; +$build = '81104-0229'; +$mysql_error_logging=1; +$mysql_log_count=13; + require("dbconnect.php"); ### If you have globals turned off uncomment these lines @@ -75,6 +81,7 @@ header ("Pragma: no-cache"); // HTTP/1.0 ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03001',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -102,8 +109,6 @@ $Alogin='N'; $RingCalls='N'; $DiaLCalls='N'; -$version = '2.0.4-12'; -$build = '71122-0205'; $StarTtime = date("U"); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -116,6 +121,7 @@ $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' a if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03002',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $auth=$row[0]; @@ -137,6 +143,7 @@ $auth=$row[0]; $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03002',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $SNauth=$row[0]; if($SNauth==0) @@ -185,6 +192,7 @@ echo " $stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03003',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $Acount=$row[0]; @@ -193,6 +201,7 @@ echo " $stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03004',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $Astatus=$row[0]; } @@ -209,6 +218,7 @@ echo " $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03005',$VD_login,$server_ip,$session_name);} if ($campagentstdisp == 'YES') { @@ -216,6 +226,7 @@ echo " $stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03006',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $Alogin=$row[0]; $Acampaign=$row[1]; @@ -227,6 +238,7 @@ echo " $stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03007',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $RingCalls=$row[0]; if ($RingCalls > 0) {$RingCalls = "Calls in Queue: $RingCalls";} @@ -236,6 +248,7 @@ echo " $stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03008',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $DiaLCalls=$row[0]; @@ -257,6 +270,7 @@ echo " $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03009',$VD_login,$server_ip,$session_name);} } @@ -264,6 +278,7 @@ echo " $stmt="SELECT external_hangup,external_status from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03010',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $external_hangup = $row[0]; $external_status = $row[1]; @@ -279,6 +294,7 @@ echo " $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03011',$VD_login,$server_ip,$session_name);} if ($rslt) {$sip_list = mysql_num_rows($rslt);} # echo "$sip_list|"; $loop_count=0; @@ -292,6 +308,7 @@ echo " $stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03012',$VD_login,$server_ip,$session_name);} if ($rslt) {$channels_list = mysql_num_rows($rslt);} # echo "$channels_list|"; $loop_count=0; @@ -334,6 +351,7 @@ echo " $stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'03013',$VD_login,$server_ip,$session_name);} } echo "Conference $conf_exten has been registered to $exten\n"; } @@ -350,4 +368,24 @@ if ($format=='debug') exit; + +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,$query_id,$user,$server_ip,$session_name) +{ +$NOW_TIME = date("Y-m-d H:i:s"); +# mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00001',$user,$server_ip,$session_name); +$errno=''; $error=''; +if ($mysql_error_logging > 0) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mysql_error_logging > 1) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } +} + ?> diff --git a/agc_2-X/trunk/www/agc/manager_send.php b/agc_2-X/trunk/www/agc/manager_send.php index 4e469b97..74cb31a8 100644 --- a/agc_2-X/trunk/www/agc/manager_send.php +++ b/agc_2-X/trunk/www/agc/manager_send.php @@ -77,8 +77,14 @@ # 80915-1755 - Rewrote leave-3way functions for external calling # 81011-1404 - Fixed bugs in leave3way when transferring a manual dial call # 81020-1459 - Fixed bugs in queue_log logging +# 81104-0203 - Added mysql error logging capability # +$version = '2.0.5-35'; +$build = '81104-0203'; +$mysql_error_logging=1; +$mysql_log_count=82; + require("dbconnect.php"); ### These are variable assignments for PHP globals off @@ -161,6 +167,7 @@ header ("Pragma: no-cache"); // HTTP/1.0 ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02001',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -185,8 +192,6 @@ if (!isset($ACTION)) {$ACTION="Originate";} if (!isset($format)) {$format="alert";} if (!isset($ext_priority)) {$ext_priority="1";} -$version = '2.0.5-34'; -$build = '81020-1459'; $StarTtime = date("U"); $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -197,6 +202,7 @@ $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' a if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02002',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $auth=$row[0]; @@ -218,6 +224,7 @@ $auth=$row[0]; $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02003',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $SNauth=$row[0]; if($SNauth==0) @@ -267,6 +274,7 @@ if ($ACTION=="SysCIDOriginate") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02004',$VD_login,$server_ip,$session_name);} echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; } } @@ -294,6 +302,7 @@ if ($ACTION=="OriginateName") $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02005',$VD_login,$server_ip,$session_name);} $name_count = mysql_num_rows($rslt); if ($name_count>0) { @@ -323,6 +332,7 @@ if ($ACTION=="OriginateNameVmail") $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02006',$VD_login,$server_ip,$session_name);} $name_count = mysql_num_rows($rslt); if ($name_count>0) { @@ -363,6 +373,7 @@ if ($ACTION=="Originate") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $outCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02007',$VD_login,$server_ip,$session_name);} echo "Originate command sent for Exten $exten Channel $channel on $server_ip\n"; } } @@ -390,12 +401,14 @@ if ($ACTION=="HangupConfDial") $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02008',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row > 0) { $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02009',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); $channel=$rowx[0]; $ACTION="Hangup"; @@ -414,6 +427,7 @@ if ($ACTION=="Hangup") $stmt="UPDATE vicidial_live_agents SET external_hangup='0' where user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02010',$VD_login,$server_ip,$session_name);} $row=''; $rowx=''; $channel_live=1; @@ -447,6 +461,7 @@ $rslt=mysql_query($stmt, $link); $stmt="SELECT count(*) FROM vicidial_auto_calls where channel='$channel' and callerid='$CalLCID';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02011',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -455,6 +470,7 @@ $rslt=mysql_query($stmt, $link); $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel' and extension LIKE \"%$exten\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02012',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0]==0) { @@ -474,6 +490,7 @@ $rslt=mysql_query($stmt, $link); { $stmt="SELECT count(*) FROM vicidial_auto_calls where callerid='$CalLCID';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02013',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); if ($format=='debug') {echo "\n";} if ($rowx[0] > 0) @@ -482,6 +499,7 @@ $rslt=mysql_query($stmt, $link); ##### START QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02014',$VD_login,$server_ip,$session_name);} if ($format=='debug') {echo "\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -505,6 +523,7 @@ $rslt=mysql_query($stmt, $link); $stmt="SELECT count(*) from queue_log where call_id='$CalLCID' and verb='CONNECT';"; $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'02015',$VD_login,$server_ip,$session_name);} $VAC_cn_ct = mysql_num_rows($rslt); if ($VAC_cn_ct > 0) { @@ -517,6 +536,7 @@ $rslt=mysql_query($stmt, $link); ### grab call lead information needed for QM logging $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where callerid='$CalLCID' order by call_time limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02016',$VD_login,$server_ip,$session_name);} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) { @@ -539,6 +559,7 @@ $rslt=mysql_query($stmt, $link); $stmt="SELECT count(*) from queue_log where call_id='$CalLCID' and verb='COMPLETECALLER' and queue='$CLcampaign_id';"; $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'02017',$VD_login,$server_ip,$session_name);} $VAC_cc_ct = mysql_num_rows($rslt); if ($VAC_cc_ct > 0) { @@ -552,6 +573,7 @@ $rslt=mysql_query($stmt, $link); $time_id=0; $stmt="SELECT time_id from queue_log where call_id='$CalLCID' and verb='ENTERQUEUE' and queue='$CLcampaign_id';"; $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'02018',$VD_login,$server_ip,$session_name);} $VAC_eq_ct = mysql_num_rows($rslt); if ($VAC_eq_ct > 0) { @@ -565,6 +587,7 @@ $rslt=mysql_query($stmt, $link); if ($format=='debug') {echo "\n";} $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='1',serverid='$queuemetrics_log_id';"; $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'02019',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); if ($format=='debug') {echo "\n";} } @@ -576,6 +599,7 @@ $rslt=mysql_query($stmt, $link); $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Hangup','$queryCID','Channel: $channel','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02020',$VD_login,$server_ip,$session_name);} echo "Hangup command sent for Channel $channel on $call_server_ip\n"; } } @@ -610,24 +634,28 @@ if ($ACTION=="RedirectVD") $stmt = "select count(*) from vicidial_campaigns where campaign_id='$campaign' and campaign_allow_inbound='Y';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02021',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0] > 0) { $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where lead_id='$lead_id' order by start_epoch desc limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02022',$VD_login,$server_ip,$session_name);} } if ($auto_dial_level < 1) { $stmt = "UPDATE vicidial_log set end_epoch='$StarTtime', length_in_sec='$secondS',status='XFER' where uniqueid='$uniqueid';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02023',$VD_login,$server_ip,$session_name);} } else { $stmt = "DELETE from vicidial_auto_calls where uniqueid='$uniqueid';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02024',$VD_login,$server_ip,$session_name);} } $ACTION="Redirect"; } @@ -654,6 +682,7 @@ if ($ACTION=="RedirectToPark") $stmt = "INSERT INTO parked_channels values('$channel','$server_ip','','$extenName','$parkedby','$NOW_TIME');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02025',$VD_login,$server_ip,$session_name);} $ACTION="Redirect"; } } @@ -677,6 +706,7 @@ if ($ACTION=="RedirectFromPark") $stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02026',$VD_login,$server_ip,$session_name);} $ACTION="Redirect"; } } @@ -699,6 +729,7 @@ if ($ACTION=="RedirectName") $stmt="SELECT dialplan_number FROM phones where server_ip = '$server_ip' and extension='$extenName';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02027',$VD_login,$server_ip,$session_name);} $name_count = mysql_num_rows($rslt); if ($name_count>0) { @@ -728,6 +759,7 @@ if ($ACTION=="RedirectNameVmail") $stmt="SELECT voicemail_id FROM phones where server_ip = '$server_ip' and extension='$extenName';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02028',$VD_login,$server_ip,$session_name);} $name_count = mysql_num_rows($rslt); if ($name_count>0) { @@ -778,16 +810,19 @@ if ($ACTION=="RedirectXtraCXNeW") $stmtA="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtA, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtA,'02029',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0] > 1) { $stmtB="UPDATE vicidial_conferences set extension='$protocol/$extension$NOWnum', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtB, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtB,'02030',$VD_login,$server_ip,$session_name);} $stmtC="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and extension='$protocol/$extension$NOWnum' and conf_exten != '$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtC, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtC,'02031',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $exten = $row[0]; @@ -799,25 +834,30 @@ if ($ACTION=="RedirectXtraCXNeW") $stmtD="UPDATE vicidial_conferences set extension='$protocol/$extension' where server_ip='$server_ip' and conf_exten='$exten' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtD, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtD,'02032',$VD_login,$server_ip,$session_name);} $stmtE="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime='$NOW_TIME', extension='3WAY_$user' where server_ip='$server_ip' and conf_exten='$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtE, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtE,'02033',$VD_login,$server_ip,$session_name);} $queryCID = "CXAR24$NOWnum"; $stmtF="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $agentchannel','Context: $ext_context','Exten: $exten','Priority: 1','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtF, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtF,'02034',$VD_login,$server_ip,$session_name);} $stmtG="UPDATE vicidial_live_agents set conf_exten='$exten' where server_ip='$server_ip' and user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtG, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtG,'02035',$VD_login,$server_ip,$session_name);} if ($auto_dial_level < 1) { $stmtH = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and callerid LIKE \"M%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtH, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtH,'02036',$VD_login,$server_ip,$session_name);} } // $fp = fopen ("./vicidial_debug_3way.txt", "a"); @@ -842,12 +882,14 @@ if ($ACTION=="RedirectXtraCXNeW") $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02037',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0]==0) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02038',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -859,12 +901,14 @@ if ($ACTION=="RedirectXtraCXNeW") $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02039',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0]==0) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02040',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -878,6 +922,7 @@ if ($ACTION=="RedirectXtraCXNeW") $stmt="SELECT count(*) FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02041',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); if ($rowx[0] < 1) { @@ -890,6 +935,7 @@ if ($ACTION=="RedirectXtraCXNeW") $stmt="SELECT server_ip,conf_exten,user FROM vicidial_live_agents where lead_id='$lead_id' and user!='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02042',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); $dest_server_ip = $rowx[0]; $dest_session_id = $rowx[1]; @@ -910,10 +956,12 @@ if ($ACTION=="RedirectXtraCXNeW") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02043',$VD_login,$server_ip,$session_name);} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','$queryCID','Channel: $extrachannel','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02044',$VD_login,$server_ip,$session_name);} echo "RedirectXtraCX command sent for Channel $channel on $call_server_ip and \nHungup $extrachannel on $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel on $call_server_ip, Hungup $extrachannel on $server_ip";} @@ -989,41 +1037,49 @@ if ($ACTION=="RedirectXtraNeW") $stmt="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02045',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0] > 1) { $stmt="UPDATE vicidial_conferences set extension='$protocol/$extension$NOWnum', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) and conf_exten != '$session_id' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02046',$VD_login,$server_ip,$session_name);} $stmt="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and extension='$protocol/$extension$NOWnum' and conf_exten != '$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02047',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $exten = $row[0]; $stmt="UPDATE vicidial_conferences set extension='$protocol/$extension' where server_ip='$server_ip' and conf_exten='$exten' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02048',$VD_login,$server_ip,$session_name);} $stmt="UPDATE vicidial_conferences set leave_3way='1', leave_3way_datetime='$NOW_TIME', extension='3WAY_$user' where server_ip='$server_ip' and conf_exten='$session_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02049',$VD_login,$server_ip,$session_name);} $queryCID = "CXAR23$NOWnum"; $stmtB="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $agentchannel','Context: $ext_context','Exten: $exten','Priority: 1','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmtB, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02050',$VD_login,$server_ip,$session_name);} $stmt="UPDATE vicidial_live_agents set conf_exten='$exten' where server_ip='$server_ip' and user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02051',$VD_login,$server_ip,$session_name);} if ($auto_dial_level < 1) { $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and callerid LIKE \"M%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02052',$VD_login,$server_ip,$session_name);} } echo "NeWSessioN|$exten|\n"; @@ -1044,12 +1100,14 @@ if ($ACTION=="RedirectXtraNeW") $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02053',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02054',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -1061,12 +1119,14 @@ if ($ACTION=="RedirectXtraNeW") $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02055',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02056',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -1082,6 +1142,7 @@ if ($ACTION=="RedirectXtraNeW") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02057',$VD_login,$server_ip,$session_name);} echo "RedirectXtra command sent for Channel $channel and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten on $server_ip";} @@ -1103,10 +1164,12 @@ if ($ACTION=="RedirectXtraNeW") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02058',$VD_login,$server_ip,$session_name);} $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02059',$VD_login,$server_ip,$session_name);} echo "RedirectXtra command sent for Channel $channel on $call_server_ip and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} @@ -1443,12 +1506,14 @@ if ($ACTION=="Redirect") $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02060',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row > 0) { $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$hangup_channel_prefix%\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02061',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); $channel=$rowx[0]; $channel = eregi_replace("1$","2",$channel); @@ -1475,12 +1540,14 @@ if ($ACTION=="Redirect") $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02062',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0]==0) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02063',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -1493,6 +1560,7 @@ if ($ACTION=="Redirect") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02064',$VD_login,$server_ip,$session_name);} echo "Redirect command sent for Channel $channel on $server_ip\n"; } @@ -1523,12 +1591,14 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02065',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0]==0) { $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$channel';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02066',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); if ($rowx[0]==0) { @@ -1541,15 +1611,18 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','$ACTION','$queryCID','Channel: $channel','$SQLfile','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02067',$VD_login,$server_ip,$session_name);} if ($ACTION=="Monitor") { $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02068',$VD_login,$server_ip,$session_name);} $stmt="SELECT recording_id FROM recording_log where filename='$filename'"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02069',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); $recording_id = $row[0]; @@ -1558,6 +1631,7 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) { $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02070',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $rec_count = mysql_num_rows($rslt); if ($rec_count>0) @@ -1572,6 +1646,7 @@ if ( ($ACTION=="Monitor") || ($ACTION=="StopMonitor") ) $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' where filename='$filename'"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02071',$VD_login,$server_ip,$session_name);} } } @@ -1609,10 +1684,12 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$filename','Channel: $channel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','Callerid: $filename','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02072',$VD_login,$server_ip,$session_name);} $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user) values('$channel','$server_ip','$exten','$NOW_TIME','$StarTtime','$filename','$lead_id','$user')"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02073',$VD_login,$server_ip,$session_name);} $RLaffected_rows = mysql_affected_rows($link); if ($RLaffected_rows > 0) { @@ -1625,6 +1702,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $VLA_inOUT='NONE'; $stmt="SELECT comments FROM vicidial_live_agents where user='$user' order by last_update_time desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02074',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VLA_inOUT_ct = mysql_num_rows($rslt); if ($VLA_inOUT_ct > 0) @@ -1645,6 +1723,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt="SELECT uniqueid FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id';"; } $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02075',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VM_mancall_ct = mysql_num_rows($rslt); if ($VM_mancall_ct > 0) @@ -1655,6 +1734,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt = "UPDATE recording_log SET vicidial_id='$VDvicidial_id' where recording_id='$recording_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02076',$VD_login,$server_ip,$session_name);} } } } @@ -1669,6 +1749,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) ### find the value to put in the vicidial_id field if this was an inbound call $stmt="SELECT closecallid from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02077',$VD_login,$server_ip,$session_name);} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) { @@ -1684,6 +1765,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt="SELECT recording_id,start_epoch FROM recording_log where filename='$filename'"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02078',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $rec_count = mysql_num_rows($rslt); if ($rec_count>0) @@ -1698,12 +1780,14 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt = "UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' $uniqueidSQL where filename='$filename'"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02079',$VD_login,$server_ip,$session_name);} } # find and hang up all recordings going on in this conference # and extension = '$exten' $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$channel%\" and channel LIKE \"%,1\";"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02080',$VD_login,$server_ip,$session_name);} # $rec_count = intval(mysql_num_rows($rslt) / 2); $rec_count = mysql_num_rows($rslt); $h=0; @@ -1719,6 +1803,7 @@ if ( ($ACTION=="MonitorConf") || ($ACTION=="StopMonitorConf") ) $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$i','Channel: $HUchannel[$i]','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02081',$VD_login,$server_ip,$session_name);} $i++; } @@ -1754,6 +1839,7 @@ if ($ACTION=="VolumeControl") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $volume_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'02082',$VD_login,$server_ip,$session_name);} echo "Volume command sent for Conference $exten, Stage $stage Channel $channel on $server_ip\n"; } } @@ -1776,9 +1862,23 @@ if ($format=='debug') {echo "\n\n\n";} exit; + +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,$query_id,$user,$server_ip,$session_name) +{ +# mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00001',$user,$server_ip,$session_name); +$errno=''; $error=''; +if ($mysql_error_logging > 0) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mysql_error_logging > 1) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|manager_send|$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } +} + ?> - - - - - diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index 81d2a724..2d66eb40 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -167,10 +167,13 @@ # 81010-1048 - Added support for hangup of all channels except for agent channel after attempting a 3way call # 81011-1404 - Fixed bugs in leave3way when transferring a manual dial call # 81020-1459 - Fixed bugs in queue_log logging +# 81104-0134 - Added mysql error logging capability # -$version = '2.0.5-85'; -$build = '81020-1459'; +$version = '2.0.5-86'; +$build = '81104-0134'; +$mysql_error_logging=1; +$mysql_log_count=180; require("dbconnect.php"); @@ -326,10 +329,20 @@ header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 +$txt = '.txt'; +$StarTtime = date("U"); +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$CIDdate = date("mdHis"); +$ENTRYdate = date("YmdHis"); +$MT[0]=''; +$agents='@agents'; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00001',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -355,16 +368,7 @@ $phone_number = ereg_replace("[^0-9]","",$phone_number); if (!isset($format)) {$format="text";} if ($format == 'debug') {$DB=1;} if (!isset($ACTION)) {$ACTION="refresh";} - -$txt = '.txt'; -$StarTtime = date("U"); -$NOW_DATE = date("Y-m-d"); -$NOW_TIME = date("Y-m-d H:i:s"); -$CIDdate = date("mdHis"); -$ENTRYdate = date("YmdHis"); if (!isset($query_date)) {$query_date = $NOW_DATE;} -$MT[0]=''; -$agents='@agents'; if ($ACTION == 'LogiNCamPaigns') { @@ -376,6 +380,7 @@ else if ($DB) {echo "|$stmt|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00002',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $auth=$row[0]; @@ -396,6 +401,7 @@ else $stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00003',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $SNauth=$row[0]; if($SNauth==0) @@ -445,6 +451,7 @@ if ($ACTION == 'LogiNCamPaigns') $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass'"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00004',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $VU_user_group=$row[0]; @@ -452,6 +459,7 @@ if ($ACTION == 'LogiNCamPaigns') $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00005',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ( (!eregi("ALL-CAMPAIGNS",$row[0])) ) { @@ -462,6 +470,7 @@ if ($ACTION == 'LogiNCamPaigns') $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00006',$user,$server_ip,$session_name);} $camps_to_print = mysql_num_rows($rslt); $o=0; @@ -498,6 +507,7 @@ if ($ACTION == 'regCLOSER') { $stmt="SELECT closer_campaigns FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00007',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); $closer_choice =$row[0]; @@ -505,25 +515,30 @@ if ($ACTION == 'regCLOSER') $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00008',$user,$server_ip,$session_name);} } else { $stmt="UPDATE vicidial_live_agents set closer_campaigns='$closer_choice' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00009',$user,$server_ip,$session_name);} $stmt="UPDATE vicidial_users set closer_campaigns='$closer_choice' where user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00010',$user,$server_ip,$session_name);} } $stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$campaign',event_date='$NOW_TIME',blended='$closer_blended',closer_campaigns='$closer_choice';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00011',$user,$server_ip,$session_name);} $stmt="DELETE FROM vicidial_live_inbound_agents where user='$user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00012',$user,$server_ip,$session_name);} $in_groups_pre = preg_replace('/-$/','',$closer_choice); $in_groups = explode(" ",$in_groups_pre); @@ -535,6 +550,7 @@ if ($ACTION == 'regCLOSER') { $stmt="SELECT group_weight,calls_today FROM vicidial_inbound_group_agents where user='$user' and group_id='$in_groups[$k]';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00013',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $viga_ct = mysql_num_rows($rslt); if ($viga_ct > 0) @@ -551,6 +567,7 @@ if ($ACTION == 'regCLOSER') $stmt="INSERT INTO vicidial_live_inbound_agents set user='$user',group_id='$in_groups[$k]',group_weight='$group_weight',calls_today='$calls_today',last_call_time='$NOW_TIME',last_call_finish='$NOW_TIME';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00014',$user,$server_ip,$session_name);} } $k++; } @@ -583,6 +600,7 @@ if ($ACTION == 'manDiaLnextCaLL') ##### grab number of calls today in this campaign and increment $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00015',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $vla_cc_ct = mysql_num_rows($rslt); if ($vla_cc_ct > 0) @@ -603,6 +621,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "UPDATE vicidial_callbacks set status='INACTIVE' where callback_id='$callback_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00016',$user,$server_ip,$session_name);} } else { @@ -612,6 +631,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00017',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); @@ -622,6 +642,7 @@ if ($ACTION == 'manDiaLnextCaLL') } $stmt="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$phone_number' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00018',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); @@ -635,6 +656,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT list_id,active from vicidial_lists where campaign_id='$campaign'"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00019',$user,$server_ip,$session_name);} $lists_to_parse = mysql_num_rows($rslt); $camp_lists=''; $o=0; @@ -649,6 +671,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt="SELECT count(*) FROM vicidial_list where phone_number='$phone_number' and list_id IN($camp_lists);"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00020',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); @@ -662,6 +685,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00021',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $man_leadID_ct = mysql_num_rows($rslt); if ($man_leadID_ct > 0) @@ -677,6 +701,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00022',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); $lead_id = mysql_insert_id($link); $CBleadIDset=1; @@ -688,6 +713,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00023',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); $lead_id = mysql_insert_id($link); $CBleadIDset=1; @@ -699,6 +725,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='$user' where campaign_id='$campaign' and status='READY' order by priority desc,hopper_id LIMIT 1"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00024',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); } } @@ -710,6 +737,7 @@ if ($ACTION == 'manDiaLnextCaLL') ##### grab the lead_id of the reserved user in vicidial_hopper $stmt="SELECT lead_id FROM vicidial_hopper where campaign_id='$campaign' and status='QUEUE' and user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00025',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $hopper_leadID_ct = mysql_num_rows($rslt); if ($hopper_leadID_ct > 0) @@ -722,6 +750,7 @@ if ($ACTION == 'manDiaLnextCaLL') ##### grab the data from vicidial_list for the lead_id $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00026',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $list_lead_ct = mysql_num_rows($rslt); if ($list_lead_ct > 0) @@ -763,6 +792,7 @@ if ($ACTION == 'manDiaLnextCaLL') ##### check if system is set to generate logfile for transfers $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00027',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $enable_agc_xfer_log_ct = mysql_num_rows($rslt); if ($enable_agc_xfer_log_ct > 0) @@ -795,6 +825,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00028',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $cb_record_ct = mysql_num_rows($rslt); if ($cb_record_ct > 0) @@ -809,6 +840,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00029',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $server_ct = mysql_num_rows($rslt); if ($server_ct > 0) @@ -831,6 +863,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='$called_since_last_reset', called_count='$called_count',user='$user',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00030',$user,$server_ip,$session_name);} if (!$CBleadIDset) { @@ -838,11 +871,13 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "DELETE FROM vicidial_hopper where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00031',$user,$server_ip,$session_name);} } $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id',comments='MANUAL' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00032',$user,$server_ip,$session_name);} ### if preview dialing, do not send the call if ( (strlen($preview)<1) || ($preview == 'NO') ) @@ -879,25 +914,30 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00033',$user,$server_ip,$session_name);} $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00034',$user,$server_ip,$session_name);} ### update the agent status to INCALL in vicidial_live_agents $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today',external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00035',$user,$server_ip,$session_name);} ### update calls_today count in vicidial_campaign_agents $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00036',$user,$server_ip,$session_name);} ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00037',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -923,18 +963,21 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00038',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); # ENTERQUEUE $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='ENTERQUEUE',data2='$phone_number',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00039',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); # CONNECT $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00040',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -1013,6 +1056,7 @@ if ($ACTION == 'alt_phone_change') $stmt = "UPDATE vicidial_list_alt_phones set active='$stage' where lead_id='$lead_id' and phone_number='$phone_number' and alt_phone_count='$called_count';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00041',$user,$server_ip,$session_name);} echo "ALT PHONE NUMBER STATUS CHANGED\n"; } @@ -1042,6 +1086,7 @@ if ($ACTION == 'manDiaLskip') $stmt = "UPDATE vicidial_list set status='$stage', called_count='$called_count',user='$user' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00042',$user,$server_ip,$session_name);} echo "LEAD REVERTED\n"; @@ -1070,6 +1115,7 @@ if ($ACTION == 'manDiaLonly') ##### grab number of calls today in this campaign and increment $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00043',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $vla_cc_ct = mysql_num_rows($rslt); if ($vla_cc_ct > 0) @@ -1112,19 +1158,23 @@ if ($ACTION == 'manDiaLonly') $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $local_DEF$conf_exten$local_AMP$ext_context$Local_persist','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00044',$user,$server_ip,$session_name);} $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('$server_ip','$campaign','XFER','$lead_id','$MqueryCID','$phone_code','$phone_number','$NOW_TIME','OUT')"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00045',$user,$server_ip,$session_name);} ### update the agent status to INCALL in vicidial_live_agents $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',callerid='$MqueryCID',lead_id='$lead_id',comments='MANUAL',calls_today='$calls_today',external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); - + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00046',$user,$server_ip,$session_name);} + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00047',$user,$server_ip,$session_name);} echo "$MqueryCID\n"; @@ -1132,6 +1182,7 @@ if ($ACTION == 'manDiaLonly') ##### START QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00048',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -1157,18 +1208,21 @@ if ($ACTION == 'manDiaLonly') $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00049',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); # ENTERQUEUE $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='ENTERQUEUE',data2='$phone_number',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00050',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); # CONNECT $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00051',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -1197,6 +1251,7 @@ else ##### look for the channel in the UPDATED vicidial_manager record of the call initiation $stmt="SELECT uniqueid,channel FROM vicidial_manager where callerid='$MDnextCID' and server_ip='$server_ip' and status='UPDATED' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00052',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VM_mancall_ct = mysql_num_rows($rslt); if ($VM_mancall_ct > 0) @@ -1210,6 +1265,7 @@ else $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00053',$user,$server_ip,$session_name);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -1219,6 +1275,12 @@ else $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',wait_epoch='$StarTtime',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00054',$user,$server_ip,$session_name);} + + $stmt="UPDATE vicidial_auto_calls set uniqueid='$uniqueid',channel='$channel' where callerid='$MDnextCID';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00055',$user,$server_ip,$session_name);} } else { @@ -1253,6 +1315,7 @@ if ($stage == "start") $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00056',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $ug_record_ct = mysql_num_rows($rslt); if ($ug_record_ct > 0) @@ -1264,6 +1327,7 @@ if ($stage == "start") $stmt="INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group,alt_dial) values('$uniqueid','$lead_id','$list_id','$campaign','$NOW_TIME','$StarTtime','INCALL','$phone_code','$phone_number','$user','MANUAL','N','$user_group','$alt_dial');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00057',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) @@ -1279,6 +1343,7 @@ if ($stage == "start") $stmt = "UPDATE vicidial_auto_calls SET uniqueid='$uniqueid' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00058',$user,$server_ip,$session_name);} # ##### insert log into call_log for manual VICIDiaL call # $stmt = "INSERT INTO call_log (uniqueid,channel,server_ip,extension,number_dialed,caller_code,start_time,start_epoch) values('$uniqueid','$channel','$server_ip','$exten','$phone_code$phone_number','MD $user $lead_id','$NOW_TIME','$StarTtime')"; @@ -1303,6 +1368,7 @@ if ($stage == "end") $VLA_inOUT='NONE'; $stmt="SELECT comments FROM vicidial_live_agents where user='$user' order by last_update_time desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00059',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VLA_inOUT_ct = mysql_num_rows($rslt); if ($VLA_inOUT_ct > 0) @@ -1344,6 +1410,7 @@ if ($stage == "end") $VDIDselect = "VDL_UIDLID $uniqueid $lead_id"; } $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00060',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VM_mancall_ct = mysql_num_rows($rslt); if ($VM_mancall_ct > 0) @@ -1369,6 +1436,7 @@ if ($stage == "end") ##### start epoch in the vicidial_log table, couldn't find one in vicidial_closer_log $stmt="SELECT start_epoch,term_reason,campaign_id FROM vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00061',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VM_mancall_ct = mysql_num_rows($rslt); if ($VM_mancall_ct > 0) @@ -1396,6 +1464,7 @@ if ($stage == "end") $stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00062',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { @@ -1413,6 +1482,7 @@ if ($stage == "end") ##### START QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00063',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -1440,6 +1510,7 @@ if ($stage == "end") ### check to see if campaign has alt_dial enabled $stmt="SELECT auto_alt_dial FROM vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00064',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VAC_mancall_ct = mysql_num_rows($rslt); if ($VAC_mancall_ct > 0) @@ -1458,6 +1529,7 @@ if ($stage == "end") $alt_dial_skip=0; $stmt="SELECT alt_phone,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00065',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VAC_mancall_ct = mysql_num_rows($rslt); if ($VAC_mancall_ct > 0) @@ -1475,6 +1547,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$alt_phone';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtA,'00066',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VLAP_dnc_ct = mysql_num_rows($rslt); if ($VLAP_dnc_ct > 0) @@ -1488,6 +1561,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$alt_phone' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtA,'00067',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VLAP_cdnc_ct = mysql_num_rows($rslt); if ($VLAP_cdnc_ct > 0) @@ -1502,6 +1576,7 @@ if ($stage == "end") $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00068',$user,$server_ip,$session_name);} } else {$alt_dial_skip=1;} @@ -1517,6 +1592,7 @@ if ($stage == "end") $addr3_dial_skip=0; $stmt="SELECT address3,gmt_offset_now,state FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00069',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VAC_mancall_ct = mysql_num_rows($rslt); if ($VAC_mancall_ct > 0) @@ -1534,6 +1610,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$address3';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtA,'00070',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VLAP_dnc_ct = mysql_num_rows($rslt); if ($VLAP_dnc_ct > 0) @@ -1547,6 +1624,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$address3' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtA,'00071',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VLAP_cdnc_ct = mysql_num_rows($rslt); if ($VLAP_cdnc_ct > 0) @@ -1561,6 +1639,7 @@ if ($stage == "end") $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00072',$user,$server_ip,$session_name);} } else {$addr3_dial_skip=1;} @@ -1586,6 +1665,7 @@ if ($stage == "end") $stmt="SELECT gmt_offset_now,state,list_id FROM vicidial_list where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00073',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VL_deailts_ct = mysql_num_rows($rslt); if ($VL_deailts_ct > 0) @@ -1598,6 +1678,7 @@ if ($stage == "end") $alt_dial_phones_count=0; $stmt="SELECT count(*) FROM vicidial_list_alt_phones where lead_id='$lead_id';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00074',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VLAP_ct = mysql_num_rows($rslt); if ($VLAP_ct > 0) @@ -1610,6 +1691,7 @@ if ($stage == "end") $Xlast++; $stmt="SELECT alt_phone_id,phone_number,active FROM vicidial_list_alt_phones where lead_id='$lead_id' and alt_phone_count='$Xlast';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00075',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VLAP_detail_ct = mysql_num_rows($rslt); if ($VLAP_detail_ct > 0) @@ -1628,6 +1710,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_dnc where phone_number='$VD_altdial_phone';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtA,'00076',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VLAP_dnc_ct = mysql_num_rows($rslt); if ($VLAP_dnc_ct > 0) @@ -1641,6 +1724,7 @@ if ($stage == "end") { $stmtA="SELECT count(*) FROM vicidial_campaign_dnc where phone_number='$VD_altdial_phone' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmtA,'00077',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VLAP_cdnc_ct = mysql_num_rows($rslt); if ($VLAP_cdnc_ct > 0) @@ -1656,6 +1740,7 @@ if ($stage == "end") $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$EA_list_id',gmt_offset_now='$EA_gmt_offset_now',state='$EA_state',alt_dial='X$Xlast',user='',priority='15';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00078',$user,$server_ip,$session_name);} $Xlast=9999999999; } } @@ -1668,6 +1753,7 @@ if ($stage == "end") ### grab call lead information needed for QM logging $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id' order by call_time limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00079',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) @@ -1690,6 +1776,7 @@ if ($stage == "end") $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETECALLER' and queue='$VDcampaign_id';"; $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00080',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VAC_cc_ct = mysql_num_rows($rslt); if ($VAC_cc_ct > 0) @@ -1713,10 +1800,12 @@ if ($stage == "end") $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$VDcampaign_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00081',$user,$server_ip,$session_name);} $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00082',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { @@ -1725,6 +1814,7 @@ if ($stage == "end") $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00083',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); } } @@ -1736,6 +1826,7 @@ if ($stage == "end") ### check to see if lead should be alt_dialed $stmt="SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='$lead_id' order by call_time desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00084',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) @@ -1759,17 +1850,20 @@ if ($stage == "end") $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00085',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); } - # $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and campaign_id='$campaign' and uniqueid='$uniqueid';"; - $stmt = "DELETE from vicidial_auto_calls lead_id='$lead_id' and campaign_id='$VDcampaign_id' and callerid LIKE \"M%\";"; + # $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$campaign' and uniqueid='$uniqueid';"; + $stmt = "DELETE from vicidial_auto_calls where lead_id='$lead_id' and campaign_id='$VDcampaign_id' and callerid LIKE \"M%\";"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00086',$user,$server_ip,$session_name);} $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='$NOW_TIME',comments='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00087',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { @@ -1778,6 +1872,7 @@ if ($stage == "end") $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00088',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); } } @@ -1792,6 +1887,7 @@ if ($stage == "end") ### check to see if lead should be alt_dialed $stmt="SELECT term_reason,uniqueid from vicidial_log where uniqueid='$uniqueid' and lead_id='$lead_id' order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00089',$user,$server_ip,$session_name);} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) { @@ -1814,6 +1910,7 @@ if ($stage == "end") $stmt="UPDATE vicidial_log set $SQLterm end_epoch='$StarTtime', length_in_sec='$length_in_sec' where uniqueid='$uniqueid' and lead_id='$lead_id' and user='$user' order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00090',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) @@ -1835,6 +1932,7 @@ if ($stage == "end") ### check to see if lead should be alt_dialed $stmt="SELECT term_reason,closecallid from vicidial_closer_log where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00091',$user,$server_ip,$session_name);} $VAC_qm_ct = mysql_num_rows($rslt); if ($VAC_qm_ct > 0) { @@ -1858,12 +1956,14 @@ if ($stage == "end") $stmt="UPDATE vicidial_closer_log set $SQLterm where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by call_date desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00092',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); if ( (strlen($QL_term) > 0) and ($leaving_threeway > 0) ) { $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETEAGENT' and queue='$VDcampaign_id';"; $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00093',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VAC_cc_ct = mysql_num_rows($rslt); if ($VAC_cc_ct > 0) @@ -1876,6 +1976,7 @@ if ($stage == "end") $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00094',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); } } @@ -1897,6 +1998,7 @@ if ($stage == "end") $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten' order by channel desc;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00095',$user,$server_ip,$session_name);} if ($rslt) {$rec_list = mysql_num_rows($rslt);} while ($rec_list>$loop_count) { @@ -1934,6 +2036,7 @@ if ($stage == "end") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','CH12346$StarTtime$loop_count','Channel: $hangup_channels[$loop_count]','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00096',$user,$server_ip,$session_name);} } $loop_count++; } @@ -1945,6 +2048,7 @@ if ($stage == "end") $stmt="SELECT cmd_line_f FROM vicidial_manager where server_ip='$server_ip' and action='Originate' and cmd_line_b = 'Channel: $local_DEF$conf_silent_prefix$conf_exten$local_AMP$ext_context' order by entry_date desc limit $total_rec;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00097',$user,$server_ip,$session_name);} if ($rslt) {$recFN_list = mysql_num_rows($rslt);} while ($recFN_list>$loop_count) { @@ -1963,6 +2067,7 @@ if ($stage == "end") $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','RH12345$StarTtime$loop_count','Channel: $rec_channels[$loop_count]','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00098',$user,$server_ip,$session_name);} echo "REC_STOP|$rec_channels[$loop_count]|$filename[$loop_count]|"; if (strlen($filename)>2) @@ -1970,6 +2075,7 @@ if ($stage == "end") $stmt="SELECT recording_id,start_epoch,vicidial_id,lead_id FROM recording_log where filename='$filename[$loop_count]'"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00099',$user,$server_ip,$session_name);} if ($rslt) {$fn_count = mysql_num_rows($rslt);} if ($fn_count) { @@ -2002,6 +2108,7 @@ if ($stage == "end") $stmt="UPDATE recording_log set end_time='$NOW_TIME',end_epoch='$StarTtime',length_in_sec=$length_in_sec,length_in_min='$length_in_min' $vidSQL $lidSQL where filename='$filename[$loop_count]' and end_epoch is NULL;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00100',$user,$server_ip,$session_name);} echo "$recording_id|$length_in_min|"; @@ -2024,6 +2131,7 @@ if ($stage == "end") $stmt = "select talk_epoch,talk_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00101',$user,$server_ip,$session_name);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -2033,6 +2141,7 @@ if ($stage == "end") $stmt="UPDATE vicidial_agent_log set talk_sec='$talk_sec',talk_epoch='$StarTtime',dispo_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00102',$user,$server_ip,$session_name);} } } @@ -2061,6 +2170,7 @@ if ($ACTION == 'VDADREcheckINCOMING') $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00103',$user,$server_ip,$session_name);} $queue_leadID_ct = mysql_num_rows($rslt); if ($queue_leadID_ct > 0) @@ -2110,6 +2220,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip,comments FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign' and status='QUEUE';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00104',$user,$server_ip,$session_name);} $queue_leadID_ct = mysql_num_rows($rslt); if ($queue_leadID_ct > 0) @@ -2128,6 +2239,7 @@ if ($ACTION == 'VDADcheckINCOMING') ##### grab number of calls today in this campaign and increment $stmt="SELECT calls_today FROM vicidial_live_agents WHERE user='$user' and campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00105',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $vla_cc_ct = mysql_num_rows($rslt); if ($vla_cc_ct > 0) @@ -2143,14 +2255,17 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='$NOW_TIME',calls_today='$calls_today',external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00106',$user,$server_ip,$session_name);} $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00107',$user,$server_ip,$session_name);} ##### grab the data from vicidial_list for the lead_id $stmt="SELECT * FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00108',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $list_lead_ct = mysql_num_rows($rslt); if ($list_lead_ct > 0) @@ -2195,6 +2310,7 @@ if ($ACTION == 'VDADcheckINCOMING') { $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00109',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $cb_record_ct = mysql_num_rows($rslt); if ($cb_record_ct > 0) @@ -2211,11 +2327,13 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00110',$user,$server_ip,$session_name);} ### update the log status to INCALL $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00111',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $ug_record_ct = mysql_num_rows($rslt); if ($ug_record_ct > 0) @@ -2228,6 +2346,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "select campaign_id,phone_number,alt_dial,call_type from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00112',$user,$server_ip,$session_name);} $VDAC_cid_ct = mysql_num_rows($rslt); if ($VDAC_cid_ct > 0) { @@ -2252,10 +2371,12 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "UPDATE vicidial_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00113',$user,$server_ip,$session_name);} $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00114',$user,$server_ip,$session_name);} $VDIG_cid_ct = mysql_num_rows($rslt); if ($VDIG_cid_ct > 0) { @@ -2272,6 +2393,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "select phone_number,alt_dial from vicidial_auto_calls where callerid = '$callerid' order by call_time desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00115',$user,$server_ip,$session_name);} $VDAC_cid_ct = mysql_num_rows($rslt); if ($VDAC_cid_ct > 0) { @@ -2293,6 +2415,7 @@ if ($ACTION == 'VDADcheckINCOMING') if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00116',$user,$server_ip,$session_name);} $VLAP_ct = mysql_num_rows($rslt); if ($VLAP_ct > 0) { @@ -2311,10 +2434,12 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "UPDATE vicidial_closer_log set user='$user', comments='AUTO', list_id='$list_id', status='INCALL', user_group='$user_group' where lead_id='$lead_id' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00117',$user,$server_ip,$session_name);} $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00118',$user,$server_ip,$session_name);} $VDL_cid_ct = mysql_num_rows($rslt); if ($VDL_cid_ct > 0) { @@ -2325,6 +2450,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "select group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename from vicidial_inbound_groups where group_id='$VDADchannel_group';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00119',$user,$server_ip,$session_name);} $VDIG_cid_ct = mysql_num_rows($rslt); if ($VDIG_cid_ct > 0) { @@ -2347,6 +2473,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "UPDATE vicidial_live_agents set comments='INBOUND' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00120',$user,$server_ip,$session_name);} $Ctype = 'I'; } @@ -2355,6 +2482,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number from vicidial_campaigns where campaign_id='$VDADchannel_group';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00121',$user,$server_ip,$session_name);} $VDIG_cid_ct = mysql_num_rows($rslt); if ($VDIG_cid_ct > 0) { @@ -2375,6 +2503,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00122',$user,$server_ip,$session_name);} $VDU_cid_ct = mysql_num_rows($rslt); if ($VDU_cid_ct > 0) { @@ -2438,6 +2567,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00123',$user,$server_ip,$session_name);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -2447,6 +2577,7 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt="UPDATE vicidial_agent_log set wait_sec='$wait_sec',talk_epoch='$StarTtime',lead_id='$lead_id' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00124',$user,$server_ip,$session_name);} ### If CALLBK, change vicidial_callback record to INACTIVE if (eregi("CALLBK|CBHOLD", $dispo)) @@ -2454,11 +2585,13 @@ if ($ACTION == 'VDADcheckINCOMING') $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00125',$user,$server_ip,$session_name);} } ##### check if system is set to generate logfile for transfers $stmt="SELECT enable_agc_xfer_log FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00126',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $enable_agc_xfer_log_ct = mysql_num_rows($rslt); if ($enable_agc_xfer_log_ct > 0) @@ -2506,6 +2639,7 @@ else $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00127',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $ug_record_ct = mysql_num_rows($rslt); if ($ug_record_ct > 0) @@ -2517,6 +2651,7 @@ else $stmt="INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$user','LOGOUT','$campaign','$NOW_TIME','$StarTtime','$user_group');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00128',$user,$server_ip,$session_name);} $vul_insert = mysql_affected_rows($link); if ($no_delete_sessions < 1) @@ -2525,6 +2660,7 @@ else $stmt="UPDATE vicidial_conferences set extension='' where server_ip='$server_ip' and conf_exten='$conf_exten';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00129',$user,$server_ip,$session_name);} $vc_remove = mysql_affected_rows($link); } @@ -2532,24 +2668,28 @@ else $stmt="DELETE from vicidial_live_agents where server_ip='$server_ip' and user ='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00130',$user,$server_ip,$session_name);} $vla_delete = mysql_affected_rows($link); ##### Delete the vicidial_live_inbound_agents records for this session $stmt="DELETE from vicidial_live_inbound_agents where user ='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00131',$user,$server_ip,$session_name);} $vlia_delete = mysql_affected_rows($link); ##### Delete the web_client_sessions $stmt="DELETE from web_client_sessions where server_ip='$server_ip' and session_name ='$session_name';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00132',$user,$server_ip,$session_name);} $wcs_delete = mysql_affected_rows($link); ##### Hangup the client phone $stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$extension%\" order by channel desc;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00133',$user,$server_ip,$session_name);} if ($rslt) { $row=mysql_fetch_row($rslt); @@ -2558,6 +2698,7 @@ else $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','ULGH3459$StarTtime','Channel: $agent_channel','','','','','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00134',$user,$server_ip,$session_name);} } if ($LogouTKicKAlL > 0) @@ -2570,12 +2711,14 @@ else $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $kick_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','$channel','$exten');"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00135',$user,$server_ip,$session_name);} } $pause_sec=0; $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00136',$user,$server_ip,$session_name);} $VDpr_ct = mysql_num_rows($rslt); if ( ($VDpr_ct > 0) and (strlen($row[3]<5)) and (strlen($row[4]<5)) ) { @@ -2585,6 +2728,7 @@ else $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00137',$user,$server_ip,$session_name);} } if ($vla_delete > 0) @@ -2593,6 +2737,7 @@ else ##### START QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00138',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -2629,6 +2774,7 @@ else $stmt = "SELECT time_id FROM queue_log where agent='Agent/$user' and verb='AGENTLOGIN' order by time_id desc limit 1;"; $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00139',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} echo "$stmt\n"; $li_conf_ct = mysql_num_rows($rslt); @@ -2646,6 +2792,7 @@ else $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='AGENTLOGOFF',data1='$user$agents',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00140',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -2676,26 +2823,31 @@ if ($ACTION == 'updateDISPO') $stmt = "UPDATE vicidial_live_agents set lead_id='',external_hangup=0,external_status='' where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00141',$user,$server_ip,$session_name);} $stmt="UPDATE vicidial_list set status='$dispo_choice', user='$user' where lead_id='$lead_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00142',$user,$server_ip,$session_name);} $stmt = "select count(*) from vicidial_inbound_groups where group_id='$stage';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00143',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0] > 0) { $stmt = "UPDATE vicidial_closer_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by closecallid desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00144',$user,$server_ip,$session_name);} } else { $stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' order by uniqueid desc limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00145',$user,$server_ip,$session_name);} } if ( ($use_internal_dnc=='Y') and ($dispo_choice=='DNC') ) @@ -2703,9 +2855,11 @@ if ($ACTION == 'updateDISPO') $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00146',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00147',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} } if ( ($use_campaign_dnc=='Y') and ($dispo_choice=='DNC') ) @@ -2713,9 +2867,11 @@ if ($ACTION == 'updateDISPO') $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00148',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $stmt="INSERT INTO vicidial_campaign_dnc (phone_number,campaign_id) values('$row[0]','$campaign');"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00149',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} } } @@ -2725,6 +2881,7 @@ if ($ACTION == 'updateDISPO') $stmt = "select dispo_epoch,dispo_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00150',$user,$server_ip,$session_name);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -2734,10 +2891,12 @@ if ($ACTION == 'updateDISPO') $stmt="UPDATE vicidial_agent_log set dispo_sec='$dispo_sec',dispo_epoch='$StarTtime',status='$dispo_choice' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00151',$user,$server_ip,$session_name);} $user_group=''; $stmt="SELECT user_group FROM vicidial_users where user='$user' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00152',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $ug_record_ct = mysql_num_rows($rslt); if ($ug_record_ct > 0) @@ -2749,6 +2908,7 @@ if ($ACTION == 'updateDISPO') $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group) values('$user','$server_ip','$NOW_TIME','$campaign','$StarTtime','0','$StarTtime','$user_group');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00153',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); $agent_log_id = mysql_insert_id($link); @@ -2758,10 +2918,12 @@ if ($ACTION == 'updateDISPO') $stmt="INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group) values('$lead_id','$list_id','$campaign','ACTIVE','$NOW_TIME','$CallBackDatETimE','$user','$recipient','$comments','$user_group');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00154',$user,$server_ip,$session_name);} } $stmt="SELECT auto_alt_dial_statuses from vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00155',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$row[0])) ) @@ -2769,6 +2931,7 @@ if ($ACTION == 'updateDISPO') $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00156',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0] > 0) @@ -2776,6 +2939,7 @@ if ($ACTION == 'updateDISPO') $stmt="UPDATE vicidial_hopper set status='READY' where lead_id='$lead_id' and status='HOLD' limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00157',$user,$server_ip,$session_name);} } } else @@ -2783,12 +2947,14 @@ if ($ACTION == 'updateDISPO') $stmt="DELETE from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00158',$user,$server_ip,$session_name);} } ############################################# ##### START QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00159',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -2816,6 +2982,7 @@ if ($ACTION == 'updateDISPO') $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$dispo_choice',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00160',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -2844,6 +3011,7 @@ if ($ACTION == 'updateLEAD') $stmt = "SELECT disable_alter_custdata,disable_alter_custphone FROM vicidial_campaigns where campaign_id='$campaign'"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00161',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $dac_conf_ct = mysql_num_rows($rslt); $i=0; @@ -2867,6 +3035,7 @@ if ($ACTION == 'updateLEAD') } $stmt = "SELECT alter_custdata_override,alter_custphone_override FROM vicidial_users where user='$user'"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00162',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $aco_conf_ct = mysql_num_rows($rslt); $i=0; @@ -2903,12 +3072,14 @@ if ($ACTION == 'updateLEAD') $stmt="UPDATE vicidial_list set vendor_lead_code='" . mysql_real_escape_string($vendor_lead_code) . "', title='" . mysql_real_escape_string($title) . "', first_name='" . mysql_real_escape_string($first_name) . "', middle_initial='" . mysql_real_escape_string($middle_initial) . "', last_name='" . mysql_real_escape_string($last_name) . "', address1='" . mysql_real_escape_string($address1) . "', address2='" . mysql_real_escape_string($address2) . "', address3='" . mysql_real_escape_string($address3) . "', city='" . mysql_real_escape_string($city) . "', state='" . mysql_real_escape_string($state) . "', province='" . mysql_real_escape_string($province) . "', postal_code='" . mysql_real_escape_string($postal_code) . "', country_code='" . mysql_real_escape_string($country_code) . "', gender='" . mysql_real_escape_string($gender) . "', date_of_birth='" . mysql_real_escape_string($date_of_birth) . "', alt_phone='" . mysql_real_escape_string($alt_phone) . "', email='" . mysql_real_escape_string($email) . "', security_phrase='" . mysql_real_escape_string($security_phrase) . "', comments='" . mysql_real_escape_string($comments) . "' $phoneSQL where lead_id='$lead_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00163',$user,$server_ip,$session_name);} } $random = (rand(1000000, 9999999) + 10000000); $stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00164',$user,$server_ip,$session_name);} } echo "Lead $lead_id information has$DO_NOT_UPDATE_text been updated\n"; @@ -2934,10 +3105,12 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $stmt="UPDATE vicidial_live_agents set uniqueid=0,callerid='',channel='', random_id='$random',comments='' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00165',$user,$server_ip,$session_name);} $stmt="UPDATE vicidial_live_agents set status='$stage' where user='$user' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00166',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { @@ -2945,6 +3118,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) ##### START QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00167',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -2971,6 +3145,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00168',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -2985,6 +3160,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00169',$user,$server_ip,$session_name);} $VDpr_ct = mysql_num_rows($rslt); if ($VDpr_ct > 0) { @@ -3005,12 +3181,14 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $stmt="UPDATE vicidial_agent_log set pause_sec='$pause_sec',wait_epoch='$StarTtime' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00170',$user,$server_ip,$session_name);} } if ($ACTION == 'VDADpause') { $stmt="UPDATE vicidial_agent_log set pause_epoch='$StarTtime',wait_sec='$wait_sec' where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00171',$user,$server_ip,$session_name);} } } } @@ -3035,6 +3213,7 @@ if ($ACTION == 'UpdatEFavoritEs') $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00172',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0] > 0) @@ -3042,12 +3221,14 @@ if ($ACTION == 'UpdatEFavoritEs') $stmt="UPDATE phone_favorites set extensions_list=\"$favorites_list\" where extension='$exten' and server_ip='$server_ip';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00173',$user,$server_ip,$session_name);} } else { $stmt="INSERT INTO phone_favorites values('$exten','$server_ip',\"$favorites_list\");"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00174',$user,$server_ip,$session_name);} } } echo "Favorites list has been updated to $favorites_list for $exten\n"; @@ -3070,6 +3251,7 @@ if ($ACTION == 'PauseCodeSubmit') $stmt="UPDATE vicidial_agent_log set sub_status=\"$status\" where agent_log_id='$agent_log_id';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00175',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); if ($affected_rows > 0) { @@ -3077,6 +3259,7 @@ if ($ACTION == 'PauseCodeSubmit') ##### START QUEUEMETRICS LOGGING LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00176',$user,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -3107,6 +3290,7 @@ if ($ACTION == 'PauseCodeSubmit') $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$campaign',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'00177',$user,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); mysql_close($linkB); @@ -3125,6 +3309,7 @@ if ($ACTION == 'CalLBacKLisT') $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00178',$user,$server_ip,$session_name);} if ($rslt) {$callbacks_count = mysql_num_rows($rslt);} echo "$callbacks_count\n"; $loop_count=0; @@ -3146,6 +3331,7 @@ $loop_count=0; $stmt = "select first_name,last_name,phone_number from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00179',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); echo "$row[0] ~$row[1] ~$row[2] ~$callback_id[$loop_count] ~$lead_id[$loop_count] ~$campaign_id[$loop_count] ~$status[$loop_count] ~$entry_time[$loop_count] ~$callback_time[$loop_count] ~$comments[$loop_count]\n"; @@ -3163,6 +3349,7 @@ if ($ACTION == 'CalLBacKCounT') $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' and campaign_id='$campaign' and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00180',$user,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; @@ -3182,4 +3369,25 @@ echo "\n\n\n"; exit; + + + + +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,$query_id,$user,$server_ip,$session_name) +{ +# mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00001',$user,$server_ip,$session_name); +$errno=''; $error=''; +if ($mysql_error_logging > 0) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mysql_error_logging > 1) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|vdc_db_query|$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } +} ?> diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 50636ec9..74696964 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -201,10 +201,14 @@ # 81020-1501 - Fixed bugs in queue_log logging # 81023-0411 - Added compatibility for dial-in agents using AGI, bug fixes # 81030-0403 - Added option to force Pause Codes on PAUSE +# 81103-1427 - Added 3way call dial prefix +# 81104-0140 - Added mysql error logging capability # -$version = '2.0.5-180'; -$build = '81030-0403'; +$version = '2.0.5-182'; +$build = '81104-0140'; +$mysql_error_logging = 1; # Mysql error log logging for on the web server +$mysql_log_count=51; require("dbconnect.php"); @@ -278,6 +282,7 @@ $random = (rand(1000000, 9999999) + 10000000); ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01001',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -397,11 +402,13 @@ if ($relogin == 'YES') $stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass'"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01002',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $VU_user_group=$row[0]; $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01003',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ( (!eregi("ALL-CAMPAIGNS",$row[0])) ) { @@ -414,6 +421,7 @@ if ($relogin == 'YES') $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01004',$VD_login,$server_ip,$session_name);} $camps_to_print = mysql_num_rows($rslt); $o=0; @@ -578,6 +586,7 @@ if ($user_login_first == 1) $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01005',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $phone_login=$row[0]; $phone_pass=$row[1]; @@ -663,6 +672,7 @@ $VDloginDISPLAY=0; $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0;"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01006',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $auth=$row[0]; @@ -673,6 +683,7 @@ $VDloginDISPLAY=0; ##### grab the full name of the agent $stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override from vicidial_users where user='$VD_login' and pass='$VD_pass'"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01007',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $LOGfullname=$row[0]; $user_level=$row[1]; @@ -699,6 +710,7 @@ $VDloginDISPLAY=0; $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01008',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $LOGallowed_campaigns =$row[0]; @@ -731,6 +743,7 @@ $VDloginDISPLAY=0; $stmt="SELECT count(*) FROM vicidial_campaigns where campaign_id='$VD_campaign' and active='Y';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01009',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $CAMPactive=$row[0]; if($CAMPactive>0) @@ -742,6 +755,7 @@ $VDloginDISPLAY=0; ##### grab the statuses that can be used for dispositioning by an agent $stmt="SELECT status,status_name FROM vicidial_statuses WHERE $selectableSQL status != 'NEW' order by status limit 50;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01010',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VD_statuses_ct = mysql_num_rows($rslt); $i=0; @@ -756,8 +770,9 @@ $VDloginDISPLAY=0; } ##### grab the campaign-specific statuses that can be used for dispositioning by an agent - $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 50;"; + $stmt="SELECT status,status_name FROM vicidial_campaign_statuses WHERE $selectableSQL status != 'NEW' and campaign_id='$VD_campaign' order by status limit 80;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01011',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VD_statuses_camp = mysql_num_rows($rslt); $j=0; @@ -778,6 +793,7 @@ $VDloginDISPLAY=0; ##### grab the campaign-specific HotKey statuses that can be used for dispositioning by an agent $stmt="SELECT hotkey,status,status_name FROM vicidial_campaign_hotkeys WHERE selectable='Y' and status != 'NEW' and campaign_id='$VD_campaign' order by hotkey limit 9;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01012',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $HK_statuses_camp = mysql_num_rows($rslt); $w=0; @@ -806,8 +822,9 @@ $VDloginDISPLAY=0; $HKstatusnames = substr("$HKstatusnames", 0, -1); ##### grab the campaign settings - $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01013',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); $park_ext = $row[0]; @@ -850,6 +867,7 @@ $VDloginDISPLAY=0; $use_campaign_dnc = $row[37]; $three_way_call_cid = $row[38]; $dial_method = $row[39]; + $three_way_dial_prefix = $row[40]; if ( (!ereg('DISABLED',$VU_vicidial_recording_override)) and ($VU_vicidial_recording > 0) ) { @@ -862,6 +880,8 @@ $VDloginDISPLAY=0; {$campaign_recording='NEVER';} if ($VU_alter_custphone_override=='ALLOW_ALTER') {$disable_alter_custphone='N';} + if (strlen($three_way_dial_prefix) < 1) + {$three_way_dial_prefix = $dial_prefix ;} if ($alt_number_dialing=='Y') {$alt_phone_dialing='1';} else @@ -883,6 +903,7 @@ $VDloginDISPLAY=0; ##### grab the pause codes for this campaign $stmt="SELECT pause_code,pause_code_name FROM vicidial_pause_codes WHERE campaign_id='$VD_campaign' order by pause_code limit 50;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01014',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $VD_pause_codes = mysql_num_rows($rslt); $j=0; @@ -908,6 +929,7 @@ $VDloginDISPLAY=0; $VARingroups=''; $stmt="select group_id from vicidial_inbound_groups where active = 'Y' and group_id IN($closer_campaigns) order by group_id limit 60;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01015',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $closer_ct = mysql_num_rows($rslt); $INgrpCT=0; @@ -931,6 +953,7 @@ $VDloginDISPLAY=0; $VARxfergroups=''; $stmt="select group_id,group_name from vicidial_inbound_groups where active = 'Y' and group_id IN($xfer_groups) order by group_id limit 60;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01016',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $xfer_ct = mysql_num_rows($rslt); $XFgrpCT=0; @@ -949,6 +972,7 @@ $VDloginDISPLAY=0; ##### grab the number of leads in the hopper for this campaign $stmt="SELECT count(*) FROM vicidial_hopper where campaign_id = '$VD_campaign' and status='READY';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01017',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); $campaign_leads_to_call = $row[0]; @@ -1014,6 +1038,7 @@ $VDloginDISPLAY=0; $alias_found=0; $stmt="select count(*) from phones_alias where alias_id = '$phone_login';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01018',$VD_login,$server_ip,$session_name);} $alias_ct = mysql_num_rows($rslt); if ($alias_ct > 0) { @@ -1024,6 +1049,7 @@ if ($alias_found > 0) { $stmt="select alias_name,logins_list from phones_alias where alias_id = '$phone_login' limit 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01019',$VD_login,$server_ip,$session_name);} $alias_ct = mysql_num_rows($rslt); if ($alias_ct > 0) { @@ -1055,6 +1081,7 @@ $authphone=0; $stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01020',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $authphone=$row[0]; if (!$authphone) @@ -1106,27 +1133,28 @@ else if ($DB) {echo "|$stmtx|\n";} if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmtx, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01021',$VD_login,$server_ip,$session_name);} $rowx=mysql_fetch_row($rslt); ### get number of agents logged in to each server $stmt="SELECT count(*) from vicidial_live_agents where server_ip = '$rowx[0]';"; if ($DB) {echo "|$stmt|\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01022',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); ### find out whether the server is set to active $stmt="SELECT count(*) from servers where server_ip = '$rowx[0]' and active='Y';"; if ($DB) {echo "|$stmt|\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01023',$VD_login,$server_ip,$session_name);} $rowy=mysql_fetch_row($rslt); ### find out whether the server_updater is running $stmt="SELECT count(*) from server_updater where server_ip = '$rowx[0]' and last_update > '$past_minutes_date';"; if ($DB) {echo "|$stmt|\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01024',$VD_login,$server_ip,$session_name);} $rowz=mysql_fetch_row($rslt); $pb_log .= "$phones_auto[$pb]|$rowx[0]|$row[0]|$rowy[0]|$rowz[0]| "; @@ -1148,6 +1176,7 @@ else $stmt="SELECT * from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01025',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $extension=$row[0]; $dialplan_number=$row[1]; @@ -1218,16 +1247,16 @@ else { $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; if ($DB) {echo "|$stmt|\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01026',$VD_login,$server_ip,$session_name);} } } if ($PhoneSComPIP == '2') { $stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';"; if ($DB) {echo "|$stmt|\n";} - if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01027',$VD_login,$server_ip,$session_name);} } if ($clientDST) { @@ -1248,6 +1277,7 @@ else $stmt="SELECT asterisk_version from servers where server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01028',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $asterisk_version=$row[0]; @@ -1301,10 +1331,12 @@ else $stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'vicidial';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01029',$VD_login,$server_ip,$session_name);} $stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','vicidial','$NOW_TIME','$session_name');"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01030',$VD_login,$server_ip,$session_name);} if ( ($campaign_allow_inbound == 'Y') || ($campaign_leads_to_call > 0) || (ereg('Y',$no_hopper_leads_logins)) ) { @@ -1312,10 +1344,12 @@ else $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('$VD_login','LOGIN','$VD_campaign','$NOW_TIME','$StarTtimE','$VU_user_group')"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01031',$VD_login,$server_ip,$session_name);} ##### check to see if the user has a conf extension already, this happens if they previously exited uncleanly $stmt="SELECT conf_exten FROM vicidial_conferences where extension='$SIP_user' and server_ip = '$server_ip' LIMIT 1;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01032',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $prev_login_ct = mysql_num_rows($rslt); $i=0; @@ -1333,16 +1367,19 @@ else $stmt="SELECT count(*) FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null));"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01033',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); if ($row[0] > 0) { $stmt="UPDATE vicidial_conferences set extension='$SIP_user', leave_3way='0' where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01034',$VD_login,$server_ip,$session_name);} $stmt="SELECT conf_exten from vicidial_conferences where server_ip='$server_ip' and ( (extension='$SIP_user') or (extension='$user') );"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01035',$VD_login,$server_ip,$session_name);} $row=mysql_fetch_row($rslt); $session_id = $row[0]; } @@ -1353,24 +1390,28 @@ else $stmt="UPDATE vicidial_list set status='ERI', user='' where status IN('QUEUE','INCALL') and user ='$VD_login';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01036',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); print "\n"; $stmt="DELETE from vicidial_hopper where status IN('QUEUE','INCALL','DONE') and user ='$VD_login';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01037',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); print "\n"; $stmt="DELETE from vicidial_live_agents where user ='$VD_login';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01038',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); print "\n"; $stmt="DELETE from vicidial_live_inbound_agents where user ='$VD_login';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01039',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); print "\n"; @@ -1384,6 +1425,7 @@ else ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,vicidial_agent_disable,allow_sipsak_messages FROM system_settings;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01040',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; @@ -1415,6 +1457,7 @@ else $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$SIqueryCID','Channel: $SIP_user_DiaL','Context: $ext_context','Exten: $session_id','Priority: 1','Callerid: $SIqueryCID','','','','','');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01041',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); print "\n"; @@ -1425,6 +1468,7 @@ else ##### grab the campaign_weight and number of calls today on that campaign for the agent $stmt="SELECT campaign_weight,calls_today FROM vicidial_campaign_agents where user='$VD_login' and campaign_id = '$VD_campaign';"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01042',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $vca_ct = mysql_num_rows($rslt); if ($vca_ct > 0) @@ -1441,6 +1485,7 @@ else $stmt="INSERT INTO vicidial_campaign_agents (user,campaign_id,campaign_rank,campaign_weight,calls_today) values('$VD_login','$VD_campaign','0','0','$calls_today');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01043',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); print "\n"; } @@ -1448,6 +1493,7 @@ else $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,closer_campaigns,user_level,campaign_weight,calls_today) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$closer_chooser_string','$user_level','$campaign_weight','$calls_today');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01044',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); print "\n"; @@ -1459,12 +1505,14 @@ else $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'01045',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); print "\n"; $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'01046',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); print "\n"; @@ -1485,6 +1533,7 @@ else $stmt="INSERT INTO vicidial_live_agents (user,server_ip,conf_exten,extension,status,lead_id,campaign_id,uniqueid,callerid,channel,random_id,last_call_time,last_update_time,last_call_finish,user_level) values('$VD_login','$server_ip','$session_id','$SIP_user','PAUSED','','$VD_campaign','','','','$random','$NOW_TIME','$tsNOW_TIME','$NOW_TIME','$user_level');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01047',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); print "\n"; @@ -1496,12 +1545,14 @@ else $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='AGENTLOGIN',data1='$VD_login@agents',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'01048',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); print "\n"; $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$linkB,$mysql_error_logging,$stmt,'01049',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($linkB); print "\n"; @@ -1576,6 +1627,7 @@ else $stmt="INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status) values('$VD_login','$server_ip','$NOW_TIME','$VD_campaign','$StarTtimE','0','$StarTtimE','$VU_user_group','LOGIN');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01050',$VD_login,$server_ip,$session_name);} $affected_rows = mysql_affected_rows($link); $agent_log_id = mysql_insert_id($link); print "\n"; @@ -1595,6 +1647,7 @@ else ##### grab the datails of all active scripts in the system $stmt="SELECT script_id,script_name,script_text FROM vicidial_scripts WHERE active='Y' order by script_id limit 100;"; $rslt=mysql_query($stmt, $link); + if ($mysql_error_logging > 0) {mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'01051',$VD_login,$server_ip,$session_name);} if ($DB) {echo "$stmt\n";} $MM_scripts = mysql_num_rows($rslt); $e=0; @@ -1886,6 +1939,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var starting_dial_level = ''; var dial_timeout = ''; var dial_prefix = ''; + var three_way_dial_prefix = ''; var campaign_cid = ''; var campaign_vdad_exten = ''; var campaign_leads_to_call = ''; @@ -2261,8 +2315,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { if (document.vicidial_form.xferoverride.checked==false) { - if (dial_prefix == 'X') {var temp_dial_prefix = '';} - else {var temp_dial_prefix = dial_prefix;} + if (three_way_dial_prefix == 'X') {var temp_dial_prefix = '';} + else {var temp_dial_prefix = three_way_dial_prefix;} if (omit_phone_code == 'Y') {var temp_phone_code = '';} else {var temp_phone_code = document.vicidial_form.phone_code.value;} @@ -2883,8 +2937,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { if (document.vicidial_form.xferoverride.checked==false) { - if (dial_prefix == 'X') {var temp_dial_prefix = '';} - else {var temp_dial_prefix = dial_prefix;} + if (three_way_dial_prefix == 'X') {var temp_dial_prefix = '';} + else {var temp_dial_prefix = three_way_dial_prefix;} if (omit_phone_code == 'Y') {var temp_phone_code = '';} else {var temp_phone_code = document.vicidial_form.phone_code.value;} @@ -3149,7 +3203,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } if (xmlhttp) { - manDiaLlog_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLlogCaLL&stage=" + taskMDstage + "&uniqueid=" + document.vicidial_form.uniqueid.value + + manDiaLlog_query = "format=text&server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLlogCaLL&stage=" + taskMDstage + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&lead_id=" + document.vicidial_form.lead_id.value + "&list_id=" + document.vicidial_form.list_id.value + @@ -3165,7 +3219,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { var MDlogResponse = null; - // alert(xmlhttp.responseText); + // alert(xmlhttp.responseText); MDlogResponse = xmlhttp.responseText; var MDlogResponse_array=MDlogResponse.split("\n"); MDlogLINE = MDlogResponse_array[0]; @@ -7772,6 +7826,23 @@ else exit; +##### MySQL Error Logging ##### +function mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,$query_id,$user,$server_ip,$session_name) +{ +# mysql_error_logging($NOW_TIME,$link,$mysql_error_logging,$stmt,'00001',$user,$server_ip,$session_name); +$errno=''; $error=''; +if ($mysql_error_logging > 0) + { + $errno = mysql_errno($link); + if ( ($errno > 0) or ($mysql_error_logging > 1) ) + { + $error = mysql_error($link); + $efp = fopen ("./vicidial_mysql_errors.txt", "a"); + fwrite ($efp, "$NOW_TIME|vicidial |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); + fclose($efp); + } + } +} ?> diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index adabfe09..9b15bd7d 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -845,6 +845,8 @@ if (isset($_GET["delete_inbound_dids"])) {$delete_inbound_dids=$_GET["delete_i elseif (isset($_POST["delete_inbound_dids"])) {$delete_inbound_dids=$_POST["delete_inbound_dids"];} if (isset($_GET["three_way_call_cid"])) {$three_way_call_cid=$_GET["three_way_call_cid"];} elseif (isset($_POST["three_way_call_cid"])) {$three_way_call_cid=$_POST["three_way_call_cid"];} +if (isset($_GET["three_way_dial_prefix"])) {$three_way_dial_prefix=$_GET["three_way_dial_prefix"];} + elseif (isset($_POST["three_way_dial_prefix"])) {$three_way_dial_prefix=$_POST["three_way_dial_prefix"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -1093,6 +1095,7 @@ $survey_no_response_action = ereg_replace("[^0-9a-zA-Z]","",$survey_no_response_ $survey_ni_status = ereg_replace("[^0-9a-zA-Z]","",$survey_ni_status); $qc_get_record_launch = ereg_replace("[^0-9a-zA-Z]","",$qc_get_record_launch); $agent_pause_codes_active = ereg_replace("[^0-9a-zA-Z]","",$agent_pause_codes_active); +$three_way_dial_prefix = ereg_replace("[^0-9a-zA-Z]","",$three_way_dial_prefix); ### DIGITS and Dots $server_ip = ereg_replace("[^\.0-9]","",$server_ip); @@ -1461,11 +1464,12 @@ $survey_camp_record_dir = ereg_replace(";","",$survey_camp_record_dir); # 81012-1725 - Added INBOUND_MAN dial method allowing for manual list dialing with inbound calls # 81030-0348 - Added campaign pause code force option # 81030-2228 - Fixed DIDs creation issue +# 81103-1408 - Added 3way call dial prefix option # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.0.5-147'; -$build = '81030-2228'; +$admin_version = '2.0.5-148'; +$build = '81103-1408'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -2941,6 +2945,11 @@ echo "\n"; + echo "\n"; + + if ($campaign_allow_inbound == 'Y') { echo "
3-Way Call Outbound CallerID - This defines what is sent out as the outbound callerID number from 3-way calls placed by the agent, CAMPAIGN uses the custom campaign callerID, CUSTOMER uses the number of the customer that is active on the agents screen and AGENT_PHONE uses the callerID for the phone that the agent is logged into. +
+ +
+3-Way Call Dial Prefix - This defines what is used as the dial prefix for 3-way calls, default is empty so the campaign dial prefix is used, passthru so you can hear ringing is 88. +

@@ -6254,7 +6263,7 @@ if ($ADD==20) { echo "
CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id\n"; - $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix from vicidial_campaigns where campaign_id='$source_campaign_id';"; $rslt=mysql_query($stmt, $link); $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; @@ -7643,7 +7652,7 @@ if ($ADD==41) if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) {$hopper_level='100';} - $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number',xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',disable_alter_custphone='$disable_alter_custphone',display_queue_count='$display_queue_count',manual_dial_filter='$manual_dial_filter',agent_clipboard_copy='$agent_clipboard_copy',agent_extended_alt_dial='$agent_extended_alt_dial',use_campaign_dnc='$use_campaign_dnc',three_way_call_cid='$three_way_call_cid' where campaign_id='$campaign_id';"; + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number',xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',disable_alter_custphone='$disable_alter_custphone',display_queue_count='$display_queue_count',manual_dial_filter='$manual_dial_filter',agent_clipboard_copy='$agent_clipboard_copy',agent_extended_alt_dial='$agent_extended_alt_dial',use_campaign_dnc='$use_campaign_dnc',three_way_call_cid='$three_way_call_cid',three_way_dial_prefix='$three_way_dial_prefix' where campaign_id='$campaign_id';"; $rslt=mysql_query($stmtA, $link); if ($reset_hopper == 'Y') @@ -11061,6 +11070,7 @@ if ($ADD==31) $agent_extended_alt_dial = $row[94]; $use_campaign_dnc = $row[95]; $three_way_call_cid = $row[96]; + $three_way_dial_prefix = $row[97]; if (ereg("DISABLED",$list_order_mix)) {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} @@ -11492,6 +11502,9 @@ if ($ADD==31) echo "
3-Way Call Outbound CallerID: $NWB#vicidial_campaigns-three_way_call_cid$NWE
3-Way Call Dial Prefix: $NWB#vicidial_campaigns-three_way_dial_prefix$NWE
Allowed Inbound Groups:
";