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 e2f23096..9a4bf6e0 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi @@ -82,7 +82,7 @@ #exten => _99909*.,2,AGI(agi-VDAD_ALL_inbound.agi) #exten => _99909*.,3,Hangup # -# Copyright (C) 2021 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2022 Matt Florell LICENSE: AGPLv2 # # changes: # 70828-0924 - First Build @@ -249,6 +249,7 @@ # 210908-0851 - Added OWNERCUSTOMx options for call_handle_method # 210911-2008 - Added populate_lead_owner in-group option # 211106-1523 - Added in_queue_nanque options +# 221116-1050 - Fix for long in-group dialstring extensions # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -607,33 +608,58 @@ $originalCID = $callerid; if ($call_handle_method =~ /^CLOSER/) { - ### allow for internal PRI/IAX/SIP transfer data string "90009*CL_uk3survy_*8301*10000123*universal*7275551212*1234*" - if ($extension =~ /^900\d\d\*|^9900\d\d\*|^980\d\d\*|^9980\d\d\*/) + ### allow for internal PRI/IAX/SIP transfer data string "90009*CL_uk3survy_*8301*10000123*universal*7275551212*1234*12*" + # LE: 8305888888888888090009*TEST_INGROUP_1234567**1010133**9998885112*12345678901234567890*12345678901234567890**1*8600052 + if ($extension =~ /^900\d\d\*|^9900\d\d\*|^980\d\d\*|^9980\d\d\*|^8305888888888888\d90009|^8305888888888888\d98009/) { - ### BEGIN check for truncated extension ### - $LENGTHextension = length($extension); - $LENGTHcmd_line_b=0; - if ($callerid =~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d|^Y\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) + if ($AGILOG) {$agi_string = "CLOSER checking for long-extension: ($extension)"; &agi_output;} + + if ($extension =~ /\*\*LEXTEN\*\d/) { - $stmtA = "SELECT cmd_line_b FROM vicidial_manager where callerid='$callerid' and action='Originate' and ( (cmd_line_b LIKE \"Exten: 8305888888888888_90009%\") or (cmd_line_b LIKE \"Exten: 8305888888888888_98009%\") ) order by man_id desc limit 1;"; + @LE_vars = split(/\*/, $extension); + $le_id = $LE_vars[3]; # le_id to search for + + $stmtA = "SELECT extension FROM vicidial_long_extensions where le_id='$le_id' and call_date > DATE_SUB(NOW(), interval 1 hour) limit 1;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { - @aryA = $sthA->fetchrow_array; - $cmd_line_b = $aryA[0]; - $cmd_line_b =~ s/^Exten: 8305888888888888\d90009/990009/gi; - $cmd_line_b =~ s/^Exten: 8305888888888888\d98009/998009/gi; - $LENGTHcmd_line_b = length($cmd_line_b); + @aryA = $sthA->fetchrow_array; + if ($AGILOG) {$agi_string = "CLOSER long-extension found: $le_id|($extension <> $aryA[0])"; &agi_output;} + $extension = $aryA[0]; + $extension =~ s/\@.*//gi; } $sthA->finish(); - - if ($LENGTHcmd_line_b > $LENGTHextension) + } + else + { + ### BEGIN check for truncated extension ### + $LENGTHextension = length($extension); + $LENGTHcmd_line_b=0; + if ($callerid =~ /^V\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d|^Y\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d/) { - if ($AGILOG) {$agi_string = "CLOSER extension override: ($LENGTHcmd_line_b <> $LENGTHextension)|$cmd_line_b|"; &agi_output;} - $extension = $cmd_line_b; + $stmtA = "SELECT cmd_line_b FROM vicidial_manager where callerid='$callerid' and action='Originate' and ( (cmd_line_b LIKE \"Exten: 8305888888888888_90009%\") or (cmd_line_b LIKE \"Exten: 8305888888888888_98009%\") ) order by man_id desc limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $cmd_line_b = $aryA[0]; + $cmd_line_b =~ s/^Exten: 8305888888888888\d90009/990009/gi; + $cmd_line_b =~ s/^Exten: 8305888888888888\d98009/998009/gi; + $LENGTHcmd_line_b = length($cmd_line_b); + } + $sthA->finish(); + + if ($LENGTHcmd_line_b > $LENGTHextension) + { + if ($AGILOG) {$agi_string = "CLOSER extension override: ($LENGTHcmd_line_b <> $LENGTHextension)|$cmd_line_b|"; &agi_output;} + $extension = $cmd_line_b; + } } } ### END check for truncated extension ### diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl index 0d5cc9a3..6f3f7104 100644 --- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl +++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl @@ -157,9 +157,10 @@ # 220312-0819 - Added CID Group Auto-Rotate to check for List use # 220526-1444 - Fix for CID auto-rotate functions # 220921-1255 - Added vicidial_user_logins_daily TEOD population +# 221116-1157 - Added vicidial_long_extensions TEOD truncating # -$build = '220921-1255'; +$build = '221116-1157'; $DB=0; # Debug flag $teodDB=0; # flag to log Timeclock End of Day processes to log file @@ -1343,6 +1344,21 @@ if ($timeclock_end_of_day_NOW > 0) if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} $sthA->finish(); + $stmtA = "delete from vicidial_long_extensions where call_date < \"$RMSQLdate\";"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + if($DB){print STDERR "\n|$affected_rows vicidial_long_extensions records deleted|\n";} + if ($teodDB) {$event_string = "vicidial_long_extensions records reset: $affected_rows"; &teod_logger;} + + $stmtA = "optimize table vicidial_long_extensions;"; + if($DBX){print STDERR "\n|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + if ($agents_calls_reset > 0) { $stmtA = "delete from vicidial_live_inbound_agents where last_call_finish < \"$TDSQLdate\";"; diff --git a/agc_2-X/trunk/docs/DISPO_SEND_EMAIL.txt b/agc_2-X/trunk/docs/DISPO_SEND_EMAIL.txt index 7d93104e..bca046ba 100644 --- a/agc_2-X/trunk/docs/DISPO_SEND_EMAIL.txt +++ b/agc_2-X/trunk/docs/DISPO_SEND_EMAIL.txt @@ -1,4 +1,4 @@ -Sending email after agent dispositions a call Started: 2015-08-06 Updated: 2021-09-26 +Sending email after agent dispositions a call Started: 2015-08-06 Updated: 2022-11-15 These instructions will show you how to set up automatic emails to be sent out when an agent dispositions a call with a specific defined "sale status". @@ -43,7 +43,7 @@ VARhttp://192.168.1.1/agc/dispo_send_email.php?container_id=TEST_CONTAINER&lead_ HERE IS AN EXAMPLE SETTINGS CONTAINER(Container ID: "TEST_CONTAINER") TO SEND OUT AN EMAIL AFTER CALL DISPO: - (The four keys you can use are: "email_to", "email_from", "email_subject" and "email_body_begin" will start your message while "email_body_end" will mark the finish of the message. You can use most standard SCRIPT variables in the subject and body fields, and you can use either fixed email addresses or "agent_email" and "customer_email" as variables for the email addresses as shown below. A semi-colon ";" at the beginning of a line will comment out that line and it will not be parsed. If you want to include custom fields values in the email, then you need to put "--A--CF_uses_custom_fields--B--" into the email body somewhere, it will be removed before the email is sent. Then you can put custom fields values in just like you do in a script.) + (The four keys you can use are: "email_to", "email_from", "email_subject" and "email_body_begin" will start your message while "email_body_end" will mark the finish of the message. You can use most standard SCRIPT variables in the subject and body fields, and you can use either fixed email addresses or "agent_email" and "customer_email" as variables for the email addresses as shown below. A semi-colon ";" at the beginning of a line will comment out that line and it will not be parsed. If you want to include custom fields values in the email, then you need to put "--A--CF_uses_custom_fields--B--" into the email body somewhere, it will be removed before the email is sent. Then you can put custom fields values in just like you do in a script. If you have to use the allow_sendmail_bypass option, include "sendmail_bypass" at the very end of the container entry to activate it.) ; destination email (if you want to use more than one email address, you should separate them by a space ' ') ;email_to => vicidialemailtesting@gmail.com 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 09c124f1..442c6e3f 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -4813,6 +4813,14 @@ failed_last_type_today VARCHAR(20) default '', index (user) ) ENGINE=MyISAM; +CREATE TABLE vicidial_long_extensions ( +le_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +extension VARCHAR(1000), +call_date DATETIME default '2001-01-01 00:00:01', +source VARCHAR(20) default '', +index (call_date) +) ENGINE=MyISAM; + ALTER TABLE vicidial_email_list MODIFY message text character set utf8; @@ -5169,4 +5177,4 @@ INSERT INTO `wallboard_reports` VALUES ('AGENTS_AND_QUEUES','Agents and Queues', UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1669',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1670',db_schema_update_date=NOW(),reload_timestamp=NOW(); diff --git a/agc_2-X/trunk/extras/upgrade_2.14.sql b/agc_2-X/trunk/extras/upgrade_2.14.sql index 15149049..3c0c691a 100644 --- a/agc_2-X/trunk/extras/upgrade_2.14.sql +++ b/agc_2-X/trunk/extras/upgrade_2.14.sql @@ -2049,3 +2049,13 @@ ALTER TABLE phones ADD webphone_settings VARCHAR(40) default 'VICIPHONE_SETTINGS INSERT INTO vicidial_settings_containers(container_id,container_notes,container_type,user_group,container_entry) VALUES ('VICIPHONE_SETTINGS','VICIphone WebRTC Extra Settings','WEBPHONE_SETTINGS','---ALL---','# determines if automatic gain control is enabled\nautoGain : 0\n\n# determines if echo cancellation is enabled\nechoCan : 0\n\n# determines if noise suppression is enabled\nnoiseSup :0\n\n# determines if the reg_exten is called upon successful registration\ndialRegExten : 1\n\n# determines the regional sound to use for progress audio\nprogReg : na\n\n# English translation phrases\nlangAttempting:"Attempting"\nlangConnected:"WS Connected"\nlangDisconnected:"WS Disconnected"\nlangExten:"Extension"\nlangIncall:"Incall"\nlangInit:"Initializing..."\nlangRedirect:"Redirect"\nlangRegFailed:"Reg. Failed"\nlangRegistering:"Registering"\nlangRegistered:"Registered"\nlangReject:"Rejected"\nlangRinging:"Ringing"\nlangSend:"Send"\nlangTrying:"Trying"\nlangUnregFailed:"Unreg. Failed"\nlangUnregistered:"Unregistered"\nlangUnregistering:"Unregistering"\nlangWebrtcError:"Something went wrong with WebRTC. Either your browser does not support the necessary WebRTC functions, you did not allow your browser to access the microphone, or there is a configuration issue. Please check your browsers error console for more details. For a list of compatible browsers please vist http://webrtc.org/"'); UPDATE system_settings SET db_schema_version='1669',db_schema_update_date=NOW() where db_schema_version < 1669; + +CREATE TABLE vicidial_long_extensions ( +le_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +extension VARCHAR(1000), +call_date DATETIME default '2001-01-01 00:00:01', +source VARCHAR(20) default '', +index (call_date) +) ENGINE=MyISAM; + +UPDATE system_settings SET db_schema_version='1670',db_schema_update_date=NOW() where db_schema_version < 1670; diff --git a/agc_2-X/trunk/www/VERM/VERM_wallboard_widgets.php b/agc_2-X/trunk/www/VERM/VERM_wallboard_widgets.php index c1b2586a..61945d55 100644 --- a/agc_2-X/trunk/www/VERM/VERM_wallboard_widgets.php +++ b/agc_2-X/trunk/www/VERM/VERM_wallboard_widgets.php @@ -548,7 +548,8 @@ if ($widget_type=="LIVE_QUEUE_INFO") $lost_calls+=$lost_calls_row[0]; } - $lost_calls_pct=sprintf("%.1f", MathZDC((100*$lost_calls), $offered_calls)); + if ($offered_calls < 1) {$lost_calls_pct=0;} + else {$lost_calls_pct=sprintf("%.1f", MathZDC((100*$lost_calls), $offered_calls));} echo "$offered_calls|$offered_calls|$lost_calls_pct|$live_queue"; /* diff --git a/agc_2-X/trunk/www/agc/manager_send.php b/agc_2-X/trunk/www/agc/manager_send.php index bbf2704d..18d2bcfe 100644 --- a/agc_2-X/trunk/www/agc/manager_send.php +++ b/agc_2-X/trunk/www/agc/manager_send.php @@ -151,13 +151,14 @@ # 210825-0911 - Fix for XSS security issue # 220220-0904 - Added allow_web_debug system setting # 220312-0936 - Added vicidial_dial_cid_log logging +# 221116-1051 - Fix for long in-group dialstring extensions # -$version = '2.14-98'; -$build = '220312-0936'; +$version = '2.14-99'; +$build = '221116-1051'; $php_script = 'manager_send.php'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=143; +$mysql_log_count=148; $one_mysql_log=0; $SSagent_debug_logging=0; $startMS = microtime(); @@ -610,7 +611,46 @@ if ($ACTION=="Originate") } else {$variable=''; $account="Variable: $call_variables";} - $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','$account','$variable','','','');"; + + $new_variable=''; + $new_channel=$channel; + $new_exten=$exten; + if ( (preg_match("/^900\d\d\*|^9900\d\d\*|^980\d\d\*|^9980\d\d\*|^8305888888888888\d90009|^8305888888888888\d98009/",$exten)) or (preg_match("/^Local\/900\d\d\*|^Local\/9900\d\d\*|^Local\/980\d\d\*|^Local\/9980\d\d\*|^Local\/8305888888888888\d90009|^Local\/8305888888888888\d98009/",$channel)) ) + { + if (preg_match("/^900\d\d\*|^9900\d\d\*|^980\d\d\*|^9980\d\d\*|^8305888888888888\d90009|^8305888888888888\d98009/",$exten)) + { + $new_source='manager_send_exten'; + $temp_exten = $exten; + + $stmt="INSERT INTO vicidial_long_extensions values('','$temp_exten',NOW(),'$new_source');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02144',$user,$server_ip,$session_name,$one_mysql_log);} + $le_id = mysqli_insert_id($link); + + $new_exten = preg_replace("/\*.*/",'',$exten); + $new_exten .= "**LEXTEN*$le_id"; + $new_variable = "Variable: _new_exten=$new_exten"; + } + if (preg_match("/^Local\/900\d\d\*|^Local\/9900\d\d\*|^Local\/980\d\d\*|^Local\/9980\d\d\*|^Local\/8305888888888888\d90009|^Local\/8305888888888888\d98009/",$channel)) + { + $new_source='manager_send_channel'; + $temp_exten = preg_replace("/^Local\//",'',$channel); + $temp_context = preg_replace("/^.*\@/",'',$channel); + + $stmt="INSERT INTO vicidial_long_extensions values('','$temp_exten',NOW(),'$new_source');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02145',$user,$server_ip,$session_name,$one_mysql_log);} + $le_id = mysqli_insert_id($link); + + $new_channel = preg_replace("/\*.*/",'',$temp_exten); + $new_channel = "Local/$new_channel**LEXTEN*$le_id@$temp_context"; + $new_variable = "Variable: _new_channel=$new_channel"; + } + } + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$queryCID','Channel: $new_channel','Context: $ext_context','Exten: $new_exten','Priority: $ext_priority','Callerid: $outCID','$account','$variable','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02007',$user,$server_ip,$session_name,$one_mysql_log);} @@ -626,7 +666,7 @@ if ($ACTION=="Originate") $stmt = "INSERT INTO vicidial_dial_cid_log SET caller_code='$queryCID',call_date='$NOW_TIME',call_type='MANUAL',call_alt='$agent_dialed_type', outbound_cid='$outbound_cid',outbound_cid_type='AGENT';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02146',$user,$server_ip,$session_name,$one_mysql_log);} if ( (strlen($lead_id) > 0) and (strlen($session_id) > 0) and (preg_match("/^DC/",$queryCID)) ) { @@ -2255,7 +2295,45 @@ if ($ACTION=="Redirect") } if ($channel_live==1) { - $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','','','','','');"; + $new_variable=''; + $new_channel=$channel; + $new_exten=$exten; + if ( (preg_match("/^900\d\d\*|^9900\d\d\*|^980\d\d\*|^9980\d\d\*|^8305888888888888\d90009|^8305888888888888\d98009/",$exten)) or (preg_match("/^Local\/900\d\d\*|^Local\/9900\d\d\*|^Local\/980\d\d\*|^Local\/9980\d\d\*|^Local\/8305888888888888\d90009|^Local\/8305888888888888\d98009/",$channel)) ) + { + if (preg_match("/^900\d\d\*|^9900\d\d\*|^980\d\d\*|^9980\d\d\*|^8305888888888888\d90009|^8305888888888888\d98009/",$exten)) + { + $new_source='manager_send_exten'; + $temp_exten = $exten; + + $stmt="INSERT INTO vicidial_long_extensions values('','$temp_exten',NOW(),'$new_source');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02147',$user,$server_ip,$session_name,$one_mysql_log);} + $le_id = mysqli_insert_id($link); + + $new_exten = preg_replace("/\*.*/",'',$exten); + $new_exten .= "**LEXTEN*$le_id"; + $new_variable = "Variable: _new_exten=$new_exten"; + } + if (preg_match("/^Local\/900\d\d\*|^Local\/9900\d\d\*|^Local\/980\d\d\*|^Local\/9980\d\d\*|^Local\/8305888888888888\d90009|^Local\/8305888888888888\d98009/",$channel)) + { + $new_source='manager_send_channel'; + $temp_exten = preg_replace("/^Local\//",'',$channel); + $temp_context = preg_replace("/^.*\@/",'',$channel); + + $stmt="INSERT INTO vicidial_long_extensions values('','$temp_exten',NOW(),'$new_source');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02148',$user,$server_ip,$session_name,$one_mysql_log);} + $le_id = mysqli_insert_id($link); + + $new_channel = preg_replace("/\*.*/",'',$temp_exten); + $new_channel = "Local/$new_channel**LEXTEN*$le_id@$temp_context"; + $new_variable = "Variable: _new_channel=$new_channel"; + } + } + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $new_channel','Context: $ext_context','Exten: $new_exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02064',$user,$server_ip,$session_name,$one_mysql_log);} 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 56486edf..ea0a9974 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -527,13 +527,14 @@ # 220623-1005 - Added List Dial Prefix Override option # 220625-1630 - Fix for Manual Dial NONE_WITH_ options dialing proper number # 220831-1654 - Added User Group script override option +# 221116-1052 - Fix for long in-group dialstring extensions # -$version = '2.14-420'; -$build = '220831-1654'; +$version = '2.14-421'; +$build = '221116-1052'; $php_script = 'vdc_db_query.php'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=876; +$mysql_log_count=902; $one_mysql_log=0; $DB=0; $VD_login=0; @@ -2322,7 +2323,7 @@ if ($ACTION == 'manDiaLnextCaLL') $UGscript_id=''; $stmt="SELECT script_id FROM vicidial_user_groups where user_group='$user_group';"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00877',$user,$server_ip,$session_name,$one_mysql_log);} $userterr_ct = mysqli_num_rows($rslt); if ($DB) {echo "$userterr_ct|$stmt\n";} if ($userterr_ct > 0) @@ -4612,7 +4613,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt = "SELECT cid_group_type FROM vicidial_cid_groups where cid_group_id='$LIST_cid_group_override';"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00878',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $cidg_ct = mysqli_num_rows($rslt); if ($cidg_ct > 0) @@ -4640,7 +4641,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='$LIST_cid_group_override' and active='Y' order by call_count_today desc limit 100000;"; } $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00879',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $vcca_ct = mysqli_num_rows($rslt); $act=0; @@ -4656,14 +4657,14 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt="UPDATE vicidial_campaign_cid_areacodes SET call_count_today=(call_count_today + 1) where campaign_id='$LIST_cid_group_override' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00880',$user,$server_ip,$session_name,$one_mysql_log);} if ($cid_group_type == 'NONE') { $stmt="UPDATE vicidial_cid_groups SET cid_auto_rotate_calls=(cid_auto_rotate_calls + 1) where cid_group_id='$LIST_cid_group_override';"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00881',$user,$server_ip,$session_name,$one_mysql_log);} } } } @@ -5049,9 +5050,46 @@ if ($ACTION == 'manDiaLnextCaLL') if ($CCID_on) {$CIDstring = "\"$MqueryCID$EAC\" <$CCID>";} else {$CIDstring = "$MqueryCID$EAC";} + $new_variable=''; + $new_channel=$dial_channel; + $new_exten=$Ndialstring; + if ( (preg_match("/^900\d\d\*|^9900\d\d\*|^980\d\d\*|^9980\d\d\*|^8305888888888888\d90009|^8305888888888888\d98009/",$Ndialstring)) or (preg_match("/^Local\/900\d\d\*|^Local\/9900\d\d\*|^Local\/980\d\d\*|^Local\/9980\d\d\*|^Local\/8305888888888888\d90009|^Local\/8305888888888888\d98009/",$dial_channel)) ) + { + if (preg_match("/^900\d\d\*|^9900\d\d\*|^980\d\d\*|^9980\d\d\*|^8305888888888888\d90009|^8305888888888888\d98009/",$Ndialstring)) + { + $new_source='vdc_db_query_exten'; + $temp_exten = $Ndialstring; + + $stmt="INSERT INTO vicidial_long_extensions values('','$temp_exten',NOW(),'$new_source');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00882',$user,$server_ip,$session_name,$one_mysql_log);} + $le_id = mysqli_insert_id($link); + + $new_exten = preg_replace("/\*.*/",'',$Ndialstring); + $new_exten .= "**LEXTEN*$le_id"; + $new_variable = "Variable: _new_exten=$new_exten"; + } + if (preg_match("/^Local\/900\d\d\*|^Local\/9900\d\d\*|^Local\/980\d\d\*|^Local\/9980\d\d\*|^Local\/8305888888888888\d90009|^Local\/8305888888888888\d98009/",$dial_channel)) + { + $new_source='vdc_db_query_channel'; + $temp_exten = preg_replace("/^Local\//",'',$dial_channel); + $temp_context = preg_replace("/^.*\@/",'',$dial_channel); + + $stmt="INSERT INTO vicidial_long_extensions values('','$temp_exten',NOW(),'$new_source');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00883',$user,$server_ip,$session_name,$one_mysql_log);} + $le_id = mysqli_insert_id($link); + + $new_channel = preg_replace("/\*.*/",'',$temp_exten); + $new_channel = "Local/$new_channel**LEXTEN*$le_id@$temp_context"; + $new_variable = "Variable: _new_channel=$new_channel"; + } + } ### insert the call action into the vicidial_manager table to initiate the call # $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $conf_exten','Context: $ext_context','Channel: $local_DEF$Local_out_prefix$phone_code$phone_number$local_AMP$ext_context','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','','','','');"; - $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $Ndialstring','Context: $ext_context','Channel: $dial_channel','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','$account','$variable','','');"; + $stmt = "INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Originate','$MqueryCID','Exten: $new_exten','Context: $ext_context','Channel: $new_channel','Priority: 1','Callerid: $CIDstring','Timeout: $Local_dial_timeout','$account','$variable','','');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00033',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5072,7 +5110,7 @@ if ($ACTION == 'manDiaLnextCaLL') $stmt = "INSERT INTO vicidial_dial_cid_log SET caller_code='$MqueryCID',call_date='$NOW_TIME',call_type='MANUAL',call_alt='$agent_dialed_type', outbound_cid='$CCID',outbound_cid_type='$CCIDtype';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00884',$user,$server_ip,$session_name,$one_mysql_log);} $calls_todaySQL = ",calls_today='$calls_today'"; ### Skip logging and list overrides if dial in-group is used @@ -5716,7 +5754,7 @@ if ($ACTION == 'manDiaLnextCaLL') ##### find if script contains recording fields $stmt="SELECT count(*) FROM vicidial_scripts WHERE script_id='$UGscript_id' and script_text LIKE \"%--A--recording_%\";"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00885',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_vc_ct = mysqli_num_rows($rslt); if ($ug_vc_ct > 0) @@ -6472,7 +6510,7 @@ if ($ACTION == 'manDiaLonly') { $stmt = "SELECT cid_group_type FROM vicidial_cid_groups where cid_group_id='$LIST_cid_group_override';"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00886',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $cidg_ct = mysqli_num_rows($rslt); if ($cidg_ct > 0) @@ -6500,7 +6538,7 @@ if ($ACTION == 'manDiaLonly') $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='$LIST_cid_group_override' and active='Y' order by call_count_today desc limit 100000;"; } $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00887',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $vcca_ct = mysqli_num_rows($rslt); $act=0; @@ -6516,14 +6554,14 @@ if ($ACTION == 'manDiaLonly') $stmt="UPDATE vicidial_campaign_cid_areacodes SET call_count_today=(call_count_today + 1) where campaign_id='$LIST_cid_group_override' and areacode='$temp_ac' and outbound_cid='$temp_vcca';"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00888',$user,$server_ip,$session_name,$one_mysql_log);} if ($cid_group_type == 'NONE') { $stmt="UPDATE vicidial_cid_groups SET cid_auto_rotate_calls=(cid_auto_rotate_calls + 1) where cid_group_id='$LIST_cid_group_override';"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00889',$user,$server_ip,$session_name,$one_mysql_log);} } } } @@ -6890,7 +6928,7 @@ if ($ACTION == 'manDiaLonly') $stmt = "INSERT INTO vicidial_dial_cid_log SET caller_code='$MqueryCID',call_date='$NOW_TIME',call_type='MANUAL',call_alt='$agent_dialed_type', outbound_cid='$CCID',outbound_cid_type='$CCIDtype';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00890',$user,$server_ip,$session_name,$one_mysql_log);} ### 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='',external_pause='',external_dial='',last_state_change='$NOW_TIME',pause_code='',preview_lead_id='0' where user='$user' and server_ip='$server_ip';"; @@ -9762,7 +9800,7 @@ if ($ACTION == 'VDADcheckINCOMING') $UGscript_id=''; $stmt="SELECT script_id FROM vicidial_user_groups where user_group='$user_group';"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00891',$user,$server_ip,$session_name,$one_mysql_log);} $userterr_ct = mysqli_num_rows($rslt); if ($DB) {echo "$userterr_ct|$stmt\n";} if ($userterr_ct > 0) @@ -9964,7 +10002,7 @@ if ($ACTION == 'VDADcheckINCOMING') ##### find if script contains recording fields $stmt="SELECT count(*) FROM vicidial_scripts WHERE script_id='$UGscript_id' and script_text LIKE \"%--A--recording_%\";"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00892',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_vc_ct = mysqli_num_rows($rslt); if ($ug_vc_ct > 0) @@ -10087,7 +10125,7 @@ if ($ACTION == 'VDADcheckINCOMING') ##### find if script contains recording fields $stmt="SELECT count(*) FROM vicidial_scripts WHERE script_id='$UGscript_id' and script_text LIKE \"%--A--recording_%\";"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00893',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_vc_ct = mysqli_num_rows($rslt); if ($ug_vc_ct > 0) @@ -10208,7 +10246,7 @@ if ($ACTION == 'VDADcheckINCOMING') ##### find if script contains recording fields $stmt="SELECT count(*) FROM vicidial_scripts WHERE script_id='$UGscript_id' and script_text LIKE \"%--A--recording_%\";"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00894',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_vc_ct = mysqli_num_rows($rslt); if ($ug_vc_ct > 0) @@ -10337,7 +10375,7 @@ if ($ACTION == 'VDADcheckINCOMING') ##### find if script contains recording fields $stmt="SELECT count(*) FROM vicidial_scripts WHERE script_id='$UGscript_id' and script_text LIKE \"%--A--recording_%\";"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00895',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_vc_ct = mysqli_num_rows($rslt); if ($ug_vc_ct > 0) @@ -11539,7 +11577,7 @@ if ($ACTION == 'VDADcheckINCOMINGother') $UGscript_id=''; $stmt="SELECT script_id FROM vicidial_user_groups where user_group='$user_group';"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00896',$user,$server_ip,$session_name,$one_mysql_log);} $userterr_ct = mysqli_num_rows($rslt); if ($DB) {echo "$userterr_ct|$stmt\n";} if ($userterr_ct > 0) @@ -12662,7 +12700,7 @@ if ($ACTION == 'LeaDSearcHSelecTUpdatE') $UGscript_id=''; $stmt="SELECT script_id FROM vicidial_user_groups where user_group='$user_group';"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00897',$user,$server_ip,$session_name,$one_mysql_log);} $userterr_ct = mysqli_num_rows($rslt); if ($DB) {echo "$userterr_ct|$stmt\n";} if ($userterr_ct > 0) @@ -12882,7 +12920,7 @@ if ($ACTION == 'LeaDSearcHSelecTUpdatE') ##### find if script contains recording fields $stmt="SELECT count(*) FROM vicidial_scripts WHERE script_id='$UGscript_id' and script_text LIKE \"%--A--recording_%\";"; $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00898',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $ug_vc_ct = mysqli_num_rows($rslt); if ($ug_vc_ct > 0) @@ -16749,7 +16787,7 @@ if ($ACTION == 'userLOGout') $stmt="SELECT pause_max_url FROM vicidial_campaigns where campaign_id='$campaign';"; if ($format=='debug') {echo "\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00899',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) { $row=mysqli_fetch_row($rslt); @@ -16763,7 +16801,7 @@ if ($ACTION == 'userLOGout') $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five,full_name,user_group,email from vicidial_users where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00900',$user,$server_ip,$session_name,$one_mysql_log);} $VUC_ct = mysqli_num_rows($rslt); if ($VUC_ct > 0) { @@ -16808,7 +16846,7 @@ if ($ACTION == 'userLOGout') $stmt = "INSERT INTO vicidial_url_log SET uniqueid='$uniqueid',url_date='$NOW_TIME',url_type='pause_max',url='$SQL_log',url_response='';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00901',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysqli_affected_rows($link); $url_id = mysqli_insert_id($link); @@ -16844,7 +16882,7 @@ if ($ACTION == 'userLOGout') $stmt = "UPDATE vicidial_url_log SET response_sec='$URLdiff_sec',url_response='$SCUfile_contents' where url_log_id='$url_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00902',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysqli_affected_rows($link); $stage .= "|SCU|$URLdiff_sec"; diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 86f390b3..1e776a1d 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -705,10 +705,11 @@ # 221020-1651 - Added login_kickall system setting # 221021-1022 - Added webphone_settings phones option # 221112-1638 - Fix for dispo timer issue #1387 +# 221116-1059 - Fix for long in-group dialstring extensions # -$version = '2.14-673c'; -$build = '221112-1638'; +$version = '2.14-674c'; +$build = '221116-1059'; $php_script = 'vicidial.php'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=98; @@ -6676,6 +6677,7 @@ function holiday_display(holiday_name) var XfeR_GrouP = XfeRSelecT.value; if (API_selected_xfergroup.length > 1) {var XfeR_GrouP = API_selected_xfergroup;} + // "90009*$group*CXFER*$lead_id**$phone_number*$user*$agent_only*$seconds*"; tasknum = Ctasknum + "*" + XfeR_GrouP + '*CXFER*' + document.vicidial_form.lead_id.value + '**' + dialed_number + '*' + user + '*' + agentdirect + '*' + VD_live_call_secondS + '*'; if (consult_custom_sent < 1)