diff --git a/agc_2-X/trunk/bin/AST_inbound_email_parser.pl b/agc_2-X/trunk/bin/AST_inbound_email_parser.pl index 956adf71..5250afe2 100644 --- a/agc_2-X/trunk/bin/AST_inbound_email_parser.pl +++ b/agc_2-X/trunk/bin/AST_inbound_email_parser.pl @@ -1070,6 +1070,13 @@ while (@row=$rslt->fetchrow_array) { die "No valid protocol specified for this program: ($VARemail_protocol) is the current protocol - needs to be IMAP or POP3.\n"; } } +else + { + if ($DB > 0) + { + print " NO-CHECK - MIN: $minutes FREQ: $VARemail_frequency \n"; + } + } } ### calculate time to run script ### diff --git a/agc_2-X/trunk/bin/AST_update.pl b/agc_2-X/trunk/bin/AST_update.pl index f2e0237c..21fb566f 100644 --- a/agc_2-X/trunk/bin/AST_update.pl +++ b/agc_2-X/trunk/bin/AST_update.pl @@ -68,9 +68,10 @@ # 170329-2125 - Updated system load stats collection for Linux kernel 2.6+ # 170406-1528 - Fix for stats calculation # 170809-2144 - Fix for Cross-Cluster phones where phone_type has "trunk" in it +# 171208-1543 - Added code to handle more gracefully frozen connections to Asterisk port # -$build = '170809-2144'; +$build = '171208-1543'; # constants $SYSPERF=0; # system performance logging to MySQL server_performance table every 5 seconds @@ -252,6 +253,7 @@ $server_ip = $VARserver_ip; # Asterisk server IP &get_time_now; if (!$UPLOGfile) {$UPLOGfile = "$PATHlogs/update.$year-$mon-$mday";} +if (!$UPERRfile) {$UPERRfile = "$PATHlogs/updateERROR.$year-$mon-$mday";} if (!$VARDB_port) {$VARDB_port='3306';} $event_string='PROGRAM STARTED||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||'; @@ -446,19 +448,22 @@ if ($run_check > 0) } } -$one_day_interval = 12; # 2 hour loops for one day +$one_day_interval = 12000; # 2 hour loops for one day +$error_counter=0; while($one_day_interval > 0) { $event_string="STARTING NEW MANAGER TELNET CONNECTION||ATTEMPT|ONE DAY INTERVAL:$one_day_interval|"; &event_logger; if (!$telnet_port) {$telnet_port = '5038';} + $UPtelnetlog = "$PATHlogs/update_telnet_log".$filedate.".txt"; ### connect to asterisk manager through telnet $t = new Net::Telnet (Port => $telnet_port, Prompt => '/.*[\$%#>] $/', - Output_record_separator => '',); - #$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log + Output_record_separator => '', + Timeout => 3,); +# $fh = $t->dump_log("$UPtelnetlog"); # uncomment for telnet log if (length($ASTmgrUSERNAMEupdate) > 3) {$telnet_login = $ASTmgrUSERNAMEupdate;} else {$telnet_login = $ASTmgrUSERNAME;} $t->open("$telnet_host"); @@ -482,7 +487,9 @@ while($one_day_interval > 0) &get_current_channels; &validate_parked_channels; - + + $modechange = $t->errmode('return'); + $t->buffer_empty; if ($show_channels_format < 1) { @@ -497,6 +504,43 @@ while($one_day_interval > 0) @list_channels = $t->cmd(String => "Action: Command\nCommand: core show channels concise\n\n", Prompt => '/--END COMMAND-.*/'); } + $error_string = $t->errmsg; + if (length($error_string)>0) + { + $error_counter++; + $error_string = "$error_counter|".$error_string; + &error_logger; + } + else + {$error_counter=0;} + + if ($error_counter > 1) + { + $event_string="ERROR LIMIT REACHED, KILLING CONNECTION: $error_counter"; + &event_logger; + + # end this connection and start new one + $ok = $t->close; + + ### connect to asterisk manager through telnet + $t = new Net::Telnet (Port => $telnet_port, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '', + Timeout => 3,); + # $fh = $t->dump_log("$UPtelnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEupdate) > 3) {$telnet_login = $ASTmgrUSERNAMEupdate;} + else {$telnet_login = $ASTmgrUSERNAME;} + $t->open("$telnet_host"); + $t->waitfor('/[0123]\n$/'); # print login + $t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); + $t->waitfor('/Authentication accepted/'); # waitfor auth accepted + + $event_string="STARTED NEW MANAGER TELNET CONNECTION|$telnet_login|CONFIRMED CONNECTION|ONE DAY INTERVAL:$one_day_interval|"; + &event_logger; + } + + $modechange = $t->errmode('die'); + ##### TEST CHANNELS ZAP/IAX2/Local TO SEE IF THERE WAS A LARGE HICCUP IN OUTPUT FROM PREVIOUS OUTPUT @test_channels=@list_channels; $test_zap_count=0; @@ -1085,7 +1129,7 @@ while($one_day_interval > 0) @hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); $t->buffer_empty; - $t->waitfor(Match => '/Message:.*\n\n/', Timeout => 10); + $t->waitfor(Match => '/Message:.*\n\n/', Timeout => 5); $ok = $t->close; $one_day_interval--; @@ -1314,6 +1358,7 @@ sub get_time_now $now_date_epoch = time(); $now_date = "$year-$mon-$mday $hour:$min:$sec"; + $filedate = "$year$mon$mday$hour$min$sec"; } @@ -1337,6 +1382,20 @@ sub event_logger } +sub error_logger + { + if ($SYSLOG) + { + open(Eout, ">>$UPERRfile") + || die "Can't open $UPERRfile: $!\n"; + print Eout "$now_date|$error_string|\n"; + close(Eout); + } + print "ERROR: $now_date|$error_string|\n"; + $error_string=''; + } + + sub get_cpu_percent { 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 b3fa7473..76e7a8b4 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -756,7 +756,7 @@ campaign_rec_exten VARCHAR(20) default '8309', campaign_recording ENUM('NEVER','ONDEMAND','ALLCALLS','ALLFORCE') default 'ONDEMAND', campaign_rec_filename VARCHAR(50) default 'FULLDATE_CUSTPHONE', campaign_script VARCHAR(20), -get_call_launch ENUM('NONE','SCRIPT','WEBFORM','WEBFORMTWO','WEBFORMTHREE','FORM') default 'NONE', +get_call_launch ENUM('NONE','SCRIPT','WEBFORM','WEBFORMTWO','WEBFORMTHREE','FORM','PREVIEW_WEBFORM','PREVIEW_WEBFORMTWO','PREVIEW_WEBFORMTHREE') default 'NONE', am_message_exten VARCHAR(100) default 'vm-goodbye', amd_send_to_vmx ENUM('Y','N') default 'N', xferconf_a_dtmf VARCHAR(50), @@ -4100,4 +4100,4 @@ INSERT INTO vicidial_settings_containers(container_id,container_notes,container_ UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1527',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1528',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 e0d6449d..ceafb93c 100644 --- a/agc_2-X/trunk/extras/upgrade_2.14.sql +++ b/agc_2-X/trunk/extras/upgrade_2.14.sql @@ -445,3 +445,7 @@ UPDATE system_settings SET db_schema_version='1526',db_schema_update_date=NOW() ALTER TABLE vicidial_campaigns ADD agent_screen_time_display ENUM('DISABLED','ENABLED_BASIC','ENABLED_FULL','ENABLED_BILL_BREAK_LUNCH_COACH') default 'DISABLED'; UPDATE system_settings SET db_schema_version='1527',db_schema_update_date=NOW() where db_schema_version < 1527; + +ALTER TABLE vicidial_campaigns MODIFY get_call_launch ENUM('NONE','SCRIPT','WEBFORM','WEBFORMTWO','WEBFORMTHREE','FORM','PREVIEW_WEBFORM','PREVIEW_WEBFORMTWO','PREVIEW_WEBFORMTHREE') default 'NONE'; + +UPDATE system_settings SET db_schema_version='1528',db_schema_update_date=NOW() where db_schema_version < 1528; diff --git a/agc_2-X/trunk/www/agc/dispo_send_email.php b/agc_2-X/trunk/www/agc/dispo_send_email.php index 3f2a9675..c38f154e 100644 --- a/agc_2-X/trunk/www/agc/dispo_send_email.php +++ b/agc_2-X/trunk/www/agc/dispo_send_email.php @@ -61,6 +61,8 @@ if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];} @@ -136,6 +138,7 @@ $call_id = preg_replace('/[^-_0-9a-zA-Z]/', '', $call_id); $lead_id = preg_replace('/[^_0-9]/', '', $lead_id); $container_id = preg_replace('/[^-_0-9a-zA-Z]/', '', $container_id); $call_notes=preg_replace("/\\\\/","",$call_notes); +$stage = preg_replace('/[^-_0-9a-zA-Z]/', '', $stage); $additional_notes=preg_replace("/\\\\/","",$additional_notes); $email_attachment_1=preg_replace("/\\\\/","",$email_attachment_1); $email_attachment_2=preg_replace("/\\\\/","",$email_attachment_2); @@ -247,12 +250,17 @@ if ($match_found > 0) if ($auth_message == 'GOOD') {$auth=1;} - $stmt="SELECT count(*) from vicidial_live_agents 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,'60004',$user,$server_ip,$session_name,$one_mysql_log);} - $row=mysqli_fetch_row($rslt); - $authlive=$row[0]; + if ($stage == 'offline') + {$authlive=1;} + else + { + $stmt="SELECT count(*) from vicidial_live_agents 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,'60004',$user,$server_ip,$session_name,$one_mysql_log);} + $row=mysqli_fetch_row($rslt); + $authlive=$row[0]; + } } if ( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ($authlive==0)) diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index b6479643..e4c3258e 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -573,10 +573,11 @@ # 171124-1459 - Added manual_auto_next_options options # 171126-1140 - Added ability to use EMAILinbound_message script variable # 171130-0226 - Added agent_screen_time_display option +# 171214-2018 - Added PREVIEW_ get_call_launch options # -$version = '2.14-543c'; -$build = '171130-0226'; +$version = '2.14-544c'; +$build = '171214-2018'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=87; $one_mysql_log=0; @@ -8037,17 +8038,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) FormPanelToFront(); } - if (CalL_AutO_LauncH == 'WEBFORM') + if ( (CalL_AutO_LauncH == 'WEBFORM') || (CalL_AutO_LauncH == 'PREVIEW_WEBFORM') ) { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform1'); } - if (CalL_AutO_LauncH == 'WEBFORMTWO') + if ( (CalL_AutO_LauncH == 'WEBFORMTWO') || (CalL_AutO_LauncH == 'PREVIEW_WEBFORMTWO') ) { window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform2'); } - if (CalL_AutO_LauncH == 'WEBFORMTHREE') + if ( (CalL_AutO_LauncH == 'WEBFORMTHREE') || (CalL_AutO_LauncH == 'PREVIEW_WEBFORMTHREE') ) { window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform3'); @@ -9450,17 +9451,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) CustomerChatPanelToFront(); } - if (get_call_launch == 'WEBFORM') + if ( (get_call_launch == 'WEBFORM') || (get_call_launch == 'PREVIEW_WEBFORM') ) { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform1'); } - if (get_call_launch == 'WEBFORMTWO') + if ( (get_call_launch == 'WEBFORMTWO') || (get_call_launch == 'PREVIEW_WEBFORMTWO') ) { window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform2'); } - if (get_call_launch == 'WEBFORMTHREE') + if ( (get_call_launch == 'WEBFORMTHREE') || (get_call_launch == 'PREVIEW_WEBFORMTHREE') ) { window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform3'); @@ -9486,6 +9487,22 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } } reselect_preview_dial = 1; + + if (get_call_launch == 'PREVIEW_WEBFORM') + { + window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform1'); + } + if (get_call_launch == 'PREVIEW_WEBFORMTWO') + { + window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform2'); + } + if (get_call_launch == 'PREVIEW_WEBFORMTHREE') + { + window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + webform_click_log('Awebform3'); + } } } } @@ -10942,17 +10959,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) EmailPanelToFront(); } - if (CalL_AutO_LauncH == 'WEBFORM') + if ( (CalL_AutO_LauncH == 'WEBFORM') || (CalL_AutO_LauncH == 'PREVIEW_WEBFORM') ) { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform1'); } - if (CalL_AutO_LauncH == 'WEBFORMTWO') + if ( (CalL_AutO_LauncH == 'WEBFORMTWO') || (CalL_AutO_LauncH == 'PREVIEW_WEBFORMTWO') ) { window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform2'); } - if (CalL_AutO_LauncH == 'WEBFORMTHREE') + if ( (CalL_AutO_LauncH == 'WEBFORMTHREE') || (CalL_AutO_LauncH == 'PREVIEW_WEBFORMTHREE') ) { window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform3'); @@ -11698,17 +11715,17 @@ function set_length(SLnumber,SLlength_goal,SLdirection) CustomerChatPanelToFront(); } - if (CalL_AutO_LauncH == 'WEBFORM') + if ( (CalL_AutO_LauncH == 'WEBFORM') || (CalL_AutO_LauncH == 'PREVIEW_WEBFORM') ) { window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform1'); } - if (CalL_AutO_LauncH == 'WEBFORMTWO') + if ( (CalL_AutO_LauncH == 'WEBFORMTWO') || (CalL_AutO_LauncH == 'PREVIEW_WEBFORMTWO') ) { window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform2'); } - if (CalL_AutO_LauncH == 'WEBFORMTHREE') + if ( (CalL_AutO_LauncH == 'WEBFORMTHREE') || (CalL_AutO_LauncH == 'PREVIEW_WEBFORMTHREE') ) { window.open(TEMP_VDIC_web_form_address_three, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); webform_click_log('Awebform3'); diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index d1123586..17a5717f 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -4213,12 +4213,13 @@ else # 171124-1349 - Added manual_auto_next_options campaign setting # 171126-1413 - Changes to allow for Email groups to display script tab on get_call_launch # 171130-0036 - Added agent_screen_time_display campaign setting +# 171214-2045 - Added PREVIEW_ options for get_call_launch # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.14-644a'; -$build = '171130-0036'; +$admin_version = '2.14-645a'; +$build = '171214-2045'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -6360,15 +6361,15 @@ if ($ADD==11) $eswHTML=''; $cfwHTML=''; if ($SSenable_second_webform > 0) - {$eswHTML = "";} + {$eswHTML .= "";} if ($SSenable_third_webform > 0) - {$eswHTML = "";} + {$eswHTML .= "";} if ($SScustom_fields_enabled > 0) - {$cfwHTML = "";} + {$cfwHTML .= "";} if ($SSallow_emails > 0) - {$aemHTML = "";} + {$aemHTML .= "";} if ($SSallow_chats > 0) - {$achHTML = "";} + {$achHTML .= "";} echo "