diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 64eb0266..a6126b0b 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -253,6 +253,20 @@ OTHER CHANGES: ready and waiting for phone calls from listed In-Groups before allowing outbound auto-dialing. +67. Added new PRESS_CALLBACK_QUEUE option to Hold Time and Wait Time In-Group + settings, allowing for a customer to retain their place in line in the + queue and be called back when their turn is reached. + +68. Added new Closed Time features to In-Groups that allow all calls in queue + to be presented with an option when the in-group closing time for the + day has been reached. Also, an option was added to manually force the + end of all queueing of calls for an in-group for the day. + +69. Added dial_ingroup option to Agent API external_dial function. + +70. Added In-Group option to look up timezone of customer when a new lead is + added during the routing of the call. + 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 44a748cd..f4c18ce6 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) 2017 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2018 Matt Florell LICENSE: AGPLv2 # # changes: # 70828-0924 - First Build @@ -219,7 +219,8 @@ # 170930-0913 - Added extension append options # 171011-1312 - Bug fix for on-hook agents using Asterisk 1.8 & 11 # 171124-1159 - Added max_inbound_calls_outcome options -# +# 180204-0120 - Added PRESS_CALLBACK_QUEUE feature, and Closing-Time feature, and add-lead-timezone-lookup feature +# $script = 'agi-VDAD_ALL_inbound.agi'; $dtmf_silent_prefix = '7'; @@ -230,7 +231,7 @@ $wait_prompt_runs=0; $at='@'; $S='*'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=222; +$mysql_log_count=247; $one_mysql_log=0; $dial_ingroup_flag=0; $called_count=1; @@ -339,6 +340,7 @@ while ($sthArows > $rec_count) @aryA = $sthA->fetchrow_array; $DBagi_output = $aryA[0]; $local_gmt = $aryA[1]; + if ($isdst) {$local_gmt++;} if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';} if ($DBagi_output =~ /FILE/) {$AGILOG = '2';} if ($DBagi_output =~ /BOTH/) {$AGILOG = '3';} @@ -735,6 +737,13 @@ while ($sthArows > $cbc) if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} if ($asterisk_version) {$AST_ver = $asterisk_version;} if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;} + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + + if ($isdst) {$LOCAL_GMT_OFF++;} + if ($DB) {print "SEED TIME $now_date_epoch : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} + $cbc++; } $sthA->finish(); @@ -747,7 +756,7 @@ $affected_rows = $dbhA->do($stmtA); ### Grab inbound groups values from the database $cbc=0; -$stmtA = "SELECT call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,drop_call_seconds,drop_action,drop_exten,next_agent_call,voicemail_ext,queue_priority,drop_inbound_group,afterhours_xfer_group,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,no_agent_no_queue,no_agent_action,no_agent_action_value,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,active,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,ingroup_recording_override,ingroup_rec_filename,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,max_calls_method,max_calls_count,max_calls_action,populate_lead_ingroup,na_call_url,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,routing_initiated_recordings,on_hook_cid_number,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit FROM vicidial_inbound_groups where group_id = '$channel_group';"; +$stmtA = "SELECT call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,drop_call_seconds,drop_action,drop_exten,next_agent_call,voicemail_ext,queue_priority,drop_inbound_group,afterhours_xfer_group,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,no_agent_no_queue,no_agent_action,no_agent_action_value,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,active,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,ingroup_recording_override,ingroup_rec_filename,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,max_calls_method,max_calls_count,max_calls_action,populate_lead_ingroup,na_call_url,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,routing_initiated_recordings,on_hook_cid_number,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,closing_time_action,closing_time_now_trigger,closing_time_filename,closing_time_end_filename,closing_time_lead_reset,closing_time_option_exten,closing_time_option_callmenu,closing_time_option_voicemail,closing_time_option_xfer_group,closing_time_option_callback_list_id,add_lead_timezone FROM vicidial_inbound_groups where group_id = '$channel_group';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -856,6 +865,17 @@ if ($sthArows > 0) $inbound_survey = $aryA[91]; $inbound_survey_filename = $aryA[92]; $inbound_survey_accept_digit = $aryA[93]; + $closing_time_action = $aryA[94]; + $closing_time_now_trigger = $aryA[95]; + $closing_time_filename = $aryA[96]; + $closing_time_end_filename = $aryA[97]; + $closing_time_lead_reset = $aryA[98]; + $closing_time_option_exten = $aryA[99]; + $closing_time_option_callmenu = $aryA[100]; + $closing_time_option_voicemail = $aryA[101]; + $closing_time_option_xfer_group = $aryA[102]; + $closing_time_option_callback_list_id = $aryA[103]; + $add_lead_timezone = $aryA[104]; $custom_call_id=''; if ($uniqueid_status_display =~ /ENABLED/) @@ -1085,6 +1105,8 @@ if ($call_handle_method =~ /LOOKUP/) $populate_provinceA=''; $populate_provinceB=''; if ($populate_lead_province =~ /did/) {&populate_lead_province_process;} + if ($add_lead_timezone =~ /PHONE_CODE_AREACODE/) + {&lead_timezone_process;} ### insert a record into the vicidial_list table $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments$entry_list_idSQLa$INSERTstateSQLa$INSERTpostal_codeSQLa$populate_provinceA) values('$SQLdate','$tsSQLdate','INBND','$fronter','$vendor_id','VDCL','$list_id','Y','$phone_code','$phone_number','$ingroup_insert','$called_count','$local_gmt','$VLcomments'$entry_list_idSQLb$INSERTstateSQLb$INSERTpostal_codeSQLb$populate_provinceB);"; $affected_rows = $dbhA->do($stmtA); @@ -1240,6 +1262,8 @@ if ($call_handle_method =~ /LOOKUP/) $populate_provinceA=''; $populate_provinceB=''; if ($populate_lead_province =~ /did/i) {&populate_lead_province_process;} + if ($add_lead_timezone =~ /PHONE_CODE_AREACODE/) + {&lead_timezone_process;} ### insert a record into the vicidial_list table $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments$entry_list_idSQLa$INSERTstateSQLa$INSERTpostal_codeSQLa$populate_provinceA) values('$SQLdate','$tsSQLdate','INBND','$fronter','$vendor_id','VDCL','$list_id','Y','$phone_code','$phone_number','$ingroup_insert','$called_count','$local_gmt','$VLcomments'$entry_list_idSQLb$INSERTstateSQLb$INSERTpostal_codeSQLb$populate_provinceB);"; $affected_rows = $dbhA->do($stmtA); @@ -1329,8 +1353,10 @@ else $populate_provinceA=''; $populate_provinceB=''; if ($populate_lead_province =~ /did/i) {&populate_lead_province_process;} + if ($add_lead_timezone =~ /PHONE_CODE_AREACODE/) + {&lead_timezone_process;} ### insert a record into the vicidial_list table if no record was found above - $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments$entry_list_idSQLa$INSERTstateSQLa$INSERTpostal_codeSQLa$populate_provinceA) values('$SQLdate','$tsSQLdate','INBND','$fronter','$vendor_id','VDCL','$list_id','Y','$phone_code','$phone_number','$ingroup_insert','$called_count','-5.00','$VLcomments'$entry_list_idSQLb$INSERTstateSQLb$INSERTpostal_codeSQLb$populate_provinceB);"; + $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments$entry_list_idSQLa$INSERTstateSQLa$INSERTpostal_codeSQLa$populate_provinceA) values('$SQLdate','$tsSQLdate','INBND','$fronter','$vendor_id','VDCL','$list_id','Y','$phone_code','$phone_number','$ingroup_insert','$called_count','$local_gmt','$VLcomments'$entry_list_idSQLb$INSERTstateSQLb$INSERTpostal_codeSQLb$populate_provinceB);"; $affected_rows = $dbhA->do($stmtA); $dbhP=$dbhA; $mysql_count='02014'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; $cbc=0; @@ -2181,7 +2207,7 @@ if ($call_handle_method =~ /CLOSER|DIGITID$/) $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; + $dbhP=$dbhA; $mysql_count='02223'; $MEL_aff_rows=$sthArows; &mysql_error_logging; if ($sthArows > 0) { @aryA = $sthA->fetchrow_array; @@ -2476,7 +2502,7 @@ if ($populate_lead_province =~ /OW_did/i) $stmtA = "UPDATE vicidial_list set modify_date=NOW() $populate_provinceUPDATE $UPDATEstateSQL where lead_id = '$insert_lead_id';"; $affected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='02224'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- PROVINCE update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} } @@ -2485,8 +2511,45 @@ if ($populate_lead_province =~ /OW_did/i) ############################################ ### Loop to try to send call to an agent ### -while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override < 1) ) +$closing_check=0; +while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override < 1) && ($closing_check < 1) ) { + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $hm = "$hour$min"; + $hm = ($hm + 0); + if ($closing_time_action !~ /DISABLED/) + { + if ($ct_default_stop =~ /$hm$/) + {$closing_check++;} + else + { + $stmtA = "SELECT closing_time_now_trigger FROM vicidial_inbound_groups where group_id='$channel_group';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsTRIG=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02225'; $MEL_aff_rows=$sthArowsTRIG; &mysql_error_logging; + if ($sthArowsTRIG > 0) + { + @aryA = $sthA->fetchrow_array; + $closing_time_now_trigger = $aryA[0]; + } + $sthA->finish(); + if ($closing_time_now_trigger =~ /Y/) + {$closing_check++;} + } + if ($closing_check > 0) + { + if ($AGILOG) {$agi_string = "CLOSING CHECK TRIGGER! ($hm <> $ct_default_stop) |$closing_time_now_trigger|$channel_group|"; &agi_output;} + } + } + $channel_status = $AGI->channel_status("$channel"); if ($channel_status < 1) { @@ -2597,7 +2660,23 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $sthA->finish(); if ($AGILOG) {$agi_string = "$rec_countWAITrem|$AGENTgrab|$stmtA|"; &agi_output;} - if ( ($rec_countWAITrem < 1) || ($AGENTgrab > 0) ) + $rec_countWAITqueue=0; + ### Get count of number of calls in the callback-queue for this group that are ahead of this call + $stmtA = "SELECT count(*) FROM vicidial_inbound_callback_queue where icbq_status IN('LIVE','SENDING') and group_id='$channel_group' and call_date < \"$SQLdateBEGIN\" and lead_id != '$insert_lead_id' and queue_priority >= '$queue_priority';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02226'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAITqueue = $aryA[0]; + $cbc++; + } + $sthA->finish(); + if ($AGILOG) {$agi_string = "$rec_countWAITqueue|$stmtA|"; &agi_output;} + + if ( ( ($rec_countWAITrem < 1) && ($rec_countWAITqueue < 1) ) || ($AGENTgrab > 0) ) { $qp_countWAIT=0; ### Get count of number of waiting calls in higher priority groups than this call or the same priority with longer wait time @@ -2614,21 +2693,36 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $sthA->finish(); if ($AGILOG) {$agi_string = "$qp_countWAIT|$stmtA|"; &agi_output;} + $qp_countWAITqueue=0; + ### Get count of number of waiting calls in higher priority groups than this call or the same priority with longer wait time + $stmtA = "SELECT count(*) FROM vicidial_inbound_callback_queue where icbq_status IN('LIVE','SENDING') and lead_id != '$insert_lead_id' and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_date < \"$SQLdateBEGIN\") );"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02227'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $qp_countWAITqueue = $aryA[0]; + } + $sthA->finish(); + if ($AGILOG) {$agi_string = "$qp_countWAITqueue|$stmtA|"; &agi_output;} + $qp_groupWAIT=''; $qp_groupWAIT_SQL=''; $qp_groupWAIT_aco=''; $qp_groupWAIT_aco_SQL=''; $qp_groupWAIT_camp_SQL=''; - if ( ($qp_countWAIT > 0) && ($AGENTgrab < 1) ) + if ( ( ($qp_countWAIT > 0) || ($qp_countWAITqueue > 0) ) && ($AGENTgrab < 1) ) { ### Get group/campaign ids of calls in higher priority groups than this call or the same priority with longer wait time + $qp_groupWAIT=''; $stmtA = "SELECT distinct campaign_id FROM vicidial_auto_calls where status = 'LIVE' and lead_id != '$insert_lead_id' $ADfindSQL and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_time < \"$SQLdateBEGIN\") );"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; $dbhP=$dbhA; $mysql_count='02056'; $MEL_aff_rows=$sthArows; &mysql_error_logging; $dbc=0; - $qp_groupWAIT=''; while ($sthArows > $dbc) { @aryA = $sthA->fetchrow_array; @@ -2640,6 +2734,26 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $qp_groupWAIT .= "closer_campaigns NOT LIKE \"% $aryA[0] %\" "; $dbc++; } + + $stmtA = "SELECT distinct group_id FROM vicidial_inbound_callback_queue where icbq_status IN('LIVE','SENDING') and lead_id != '$insert_lead_id' $ADfindSQL and ( (queue_priority > '$queue_priority') or (queue_priority = '$queue_priority' and call_date < \"$SQLdateBEGIN\") );"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02247'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + $dbcQ=0; + while ($sthArows > $dbcQ) + { + @aryA = $sthA->fetchrow_array; + $qp_groupWAIT_aco .= "'$aryA[0]',"; + if ($dbc > 0) + { + $qp_groupWAIT .= "and "; + } + $qp_groupWAIT .= "closer_campaigns NOT LIKE \"% $aryA[0] %\" "; + $dbc++; + $dbcQ++; + } + if (length($qp_groupWAIT_aco)>2) {chop($qp_groupWAIT_aco);} else @@ -4718,6 +4832,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override # - PRESS_CALLMENU # - PRESS_CID_CALLBACK # - PRESS_INGROUP + # - PRESS_CALLBACK_QUEUE if ($wait_time_option_SETTING =~ /PRESS_/) { @@ -4794,6 +4909,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($wait_time_option_SETTING =~ /PRESS_CALLMENU/) {$wait_time_option = 'CALL_MENU'; $HT_status='WAITTO';} if ($wait_time_option_SETTING =~ /PRESS_CID_CALLBACK/) {$wait_time_option = 'CALLERID_CALLBACK'; $HT_status='WAITTO';} if ($wait_time_option_SETTING =~ /PRESS_INGROUP/) {$wait_time_option = 'IN_GROUP'; $HT_status='WAITTO';} + if ($wait_time_option_SETTING =~ /PRESS_CALLBACK_QUEUE/) {$wait_time_option = 'CALLBACK_QUEUE'; $HT_status='WAITTO';} } if ($pin =~ /2/) { @@ -4804,6 +4920,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($wait_time_second_option =~ /PRESS_CALLMENU/) {$wait_time_option = 'CALL_MENU'; $HT_status='WAITTO';} if ($wait_time_second_option =~ /PRESS_CID_CALLBACK/) {$wait_time_option = 'CALLERID_CALLBACK'; $HT_status='WAITTO';} if ($wait_time_second_option =~ /PRESS_INGROUP/) {$wait_time_option = 'IN_GROUP'; $HT_status='WAITTO';} + if ($wait_time_second_option =~ /PRESS_CALLBACK_QUEUE/) {$wait_time_option = 'CALLBACK_QUEUE'; $HT_status='WAITTO';} } if ($pin =~ /3/) { @@ -4814,6 +4931,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($wait_time_third_option =~ /PRESS_CALLMENU/) {$wait_time_option = 'CALL_MENU'; $HT_status='WAITTO';} if ($wait_time_third_option =~ /PRESS_CID_CALLBACK/) {$wait_time_option = 'CALLERID_CALLBACK'; $HT_status='WAITTO';} if ($wait_time_third_option =~ /PRESS_INGROUP/) {$wait_time_option = 'IN_GROUP'; $HT_status='WAITTO';} + if ($wait_time_third_option =~ /PRESS_CALLBACK_QUEUE/) {$wait_time_option = 'CALLBACK_QUEUE'; $HT_status='WAITTO';} } if ($AGILOG) {$agi_string = "WAIT TIME OPTION PRESSED $pin: $wait_time_option|$HT_status"; &agi_output;} @@ -4961,6 +5079,8 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $populate_provinceA=''; $populate_provinceB=''; if ($populate_lead_province =~ /did/i) {&populate_lead_province_process;} + if ($add_lead_timezone =~ /PHONE_CODE_AREACODE/) + {&lead_timezone_process;} ### insert a record into the vicidial_list table $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments$entry_list_idSQLa$INSERTstateSQLa$INSERTpostal_codeSQLa$populate_provinceA) values('$SQLdate','$tsSQLdate','INBND','$fronter','$vendor_id','VDCL','$wait_time_option_callback_list_id','N','$phone_code','$phone_number','$ingroup_insert','$called_count','$local_gmt','$VLcomments'$entry_list_idSQLb$INSERTstateSQLb$INSERTpostal_codeSQLb$populate_provinceB);"; $affected_rows = $dbhA->do($stmtA); @@ -5009,7 +5129,40 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override { $wait_in_queue = 2; #continue waiting } - + } + if ($wait_time_option =~ /CALLBACK_QUEUE/) + { + if (length($wait_time_option_exten)>0) + {$DROPexten = "$wait_time_option_exten";} + # if callerid is not valid do not execute + if ( ( length($phone_number) > 6 ) && ( $phone_number > 0) ) + { + ### insert a record into the vicidial_inbound_callback_queue table + $stmtA = "INSERT INTO vicidial_inbound_callback_queue SET icbq_date=NOW(),icbq_status='NEW',icbq_phone_number='$phone_number',icbq_phone_code='$phone_code',icbq_nextday_choice='U',lead_id='$insert_lead_id',group_id='$channel_group',queue_priority='$queue_priority',call_date='$SQLdateBEGIN',gmt_offset_now='$local_gmt';"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02228'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02229'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $CALLBACK_insert_icbq_id = $aryA[0]; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "VDAD vicidial_inbound_callback_queue insert |$CALLBACK_insert_icbq_id|$stmtA|"; &agi_output;} + + $DROPexten = "8300"; + + $play_post_press_audio=1; + } + else + { + $wait_in_queue = 2; #continue waiting + } } if ($AGILOG) {$agi_string = "-- VDCL WAIT TIME OPT: |$wait_time_option|$DROPexten|$wait_in_queue|"; &agi_output;} @@ -5173,6 +5326,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override # - PRESS_CALLMENU # - PRESS_CID_CALLBACK # - PRESS_INGROUP + # - PRESS_CALLBACK_QUEUE ### BEGIN hold time option press-123 options ### if ($hold_time_option_SETTING =~ /PRESS_/) @@ -5250,6 +5404,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($hold_time_option_SETTING =~ /PRESS_CALLMENU/) {$hold_time_option = 'CALL_MENU'; $HT_status='WAITTO';} if ($hold_time_option_SETTING =~ /PRESS_CID_CALLBACK/) {$hold_time_option = 'CALLERID_CALLBACK'; $HT_status='WAITTO';} if ($hold_time_option_SETTING =~ /PRESS_INGROUP/) {$hold_time_option = 'IN_GROUP'; $HT_status='WAITTO';} + if ($hold_time_option_SETTING =~ /PRESS_CALLBACK_QUEUE/) {$hold_time_option = 'CALLBACK_QUEUE'; $HT_status='WAITTO';} } if ($pin =~ /2/) { @@ -5260,6 +5415,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($hold_time_second_option =~ /PRESS_CALLMENU/) {$hold_time_option = 'CALL_MENU'; $HT_status='WAITTO';} if ($hold_time_second_option =~ /PRESS_CID_CALLBACK/) {$hold_time_option = 'CALLERID_CALLBACK'; $HT_status='WAITTO';} if ($hold_time_second_option =~ /PRESS_INGROUP/) {$hold_time_option = 'IN_GROUP'; $HT_status='WAITTO';} + if ($hold_time_second_option =~ /PRESS_CALLBACK_QUEUE/) {$hold_time_option = 'CALLBACK_QUEUE'; $HT_status='WAITTO';} } if ($pin =~ /3/) { @@ -5270,6 +5426,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override if ($hold_time_third_option =~ /PRESS_CALLMENU/) {$hold_time_option = 'CALL_MENU'; $HT_status='WAITTO';} if ($hold_time_third_option =~ /PRESS_CID_CALLBACK/) {$hold_time_option = 'CALLERID_CALLBACK'; $HT_status='WAITTO';} if ($hold_time_third_option =~ /PRESS_INGROUP/) {$hold_time_option = 'IN_GROUP'; $HT_status='WAITTO';} + if ($hold_time_third_option =~ /PRESS_CALLBACK_QUEUE/) {$hold_time_option = 'CALLBACK_QUEUE'; $HT_status='WAITTO';} } if ($AGILOG) {$agi_string = "HOLD TIME OPTION PRESSED $pin: $hold_time_option|$HT_status"; &agi_output;} @@ -5418,6 +5575,8 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $populate_provinceA=''; $populate_provinceB=''; if ($populate_lead_province =~ /did/i) {&populate_lead_province_process;} + if ($add_lead_timezone =~ /PHONE_CODE_AREACODE/) + {&lead_timezone_process;} ### insert a record into the vicidial_list table $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments$entry_list_idSQLa$INSERTstateSQLa$INSERTpostal_codeSQLa$populate_provinceA) values('$SQLdate','$tsSQLdate','INBND','$fronter','$vendor_id','VDCL','$hold_time_option_callback_list_id','N','$phone_code','$phone_number','$ingroup_insert','$called_count','$local_gmt','$VLcomments'$entry_list_idSQLb$INSERTstateSQLb$INSERTpostal_codeSQLb$populate_provinceB);"; $affected_rows = $dbhA->do($stmtA); @@ -5460,6 +5619,40 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $DROPexten = "8300"; + $play_post_press_audio=1; + } + else + { + $wait_in_queue = 2; #continue waiting + } + } + if ($hold_time_option =~ /CALLBACK_QUEUE/) + { + if (length($hold_time_option_exten)>0) + {$DROPexten = "$hold_time_option_exten";} + # if callerid is not valid do not execute + if ( ( length($phone_number) > 6 ) && ( $phone_number > 0) ) + { + ### insert a record into the vicidial_inbound_callback_queue table + $stmtA = "INSERT INTO vicidial_inbound_callback_queue SET icbq_date=NOW(),icbq_status='NEW',icbq_phone_number='$phone_number',icbq_phone_code='$phone_code',icbq_nextday_choice='U',lead_id='$insert_lead_id',group_id='$channel_group',queue_priority='$queue_priority',call_date='$SQLdateBEGIN',gmt_offset_now='$local_gmt';"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02230'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02231'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $CALLBACK_insert_icbq_id = $aryA[0]; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "VDAD vicidial_inbound_callback_queue insert |$CALLBACK_insert_icbq_id|$stmtA|"; &agi_output;} + + $DROPexten = "8300"; + $play_post_press_audio=1; } else @@ -5672,6 +5865,429 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override } } + + +################################################### +### BEGIN final Closing-Now process options ### +################################################### +if ($closing_check > 0) + { + $pin=''; + $DROPexten = ''; + $exitwithkey=0; + $play_post_press_audio=0; + $closing_time_action_SETTING = $closing_time_action; + + ### Available Closing-Time options: + # - PRESS_VMAIL + # - PRESS_VMAIL_NO_INST + # - PRESS_EXTEN + # - PRESS_CALLMENU + # - PRESS_CID_CALLBACK + # - PRESS_INGROUP + # - PRESS_CALLBACK_QUEUE + # - VMAIL + # - VMAIL_NO_INST + # - EXTEN + # - CALLMENU + # - INGROUP + + if ($closing_time_action_SETTING =~ /PRESS_/) + { + $now_date_epoch = time(); + $HTO_no_block_SQL = ''; + $NBDtarget = $now_date_epoch; + ($NBsec,$NBmin,$NBhour,$NBmday,$NBmon,$NByear,$NBwday,$NByday,$NBisdst) = localtime($NBDtarget); + $NByear = ($NByear + 1900); + $NBmon++; + if ($NBmon < 10) {$NBmon = "0$NBmon";} + if ($NBmday < 10) {$NBmday = "0$NBmday";} + if ($NBhour < 10) {$NBhour = "0$NBhour";} + if ($NBmin < 10) {$NBmin = "0$NBmin";} + if ($NBsec < 10) {$NBsec = "0$NBsec";} + $NB_SQLdate = "$NByear-$NBmon-$NBmday $NBhour:$NBmin:$NBsec"; + $HTO_no_block_SQL = ",call_time='$NB_SQLdate'"; + + $FDtarget = ($now_date_epoch + 60); + ($Fsec,$Fmin,$Fhour,$Fmday,$Fmon,$Fyear,$Fwday,$Fyday,$Fisdst) = localtime($FDtarget); + $Fyear = ($Fyear + 1900); + $Fmon++; + if ($Fmon < 10) {$Fmon = "0$Fmon";} + if ($Fmday < 10) {$Fmday = "0$Fmday";} + if ($Fhour < 10) {$Fhour = "0$Fhour";} + if ($Fmin < 10) {$Fmin = "0$Fmin";} + if ($Fsec < 10) {$Fsec = "0$Fsec";} + $FDtsSQLdate = "$Fyear$Fmon$Fmday$Fhour$Fmin$Fsec"; + + $stmtA = "UPDATE vicidial_auto_calls set last_update_time='$FDtsSQLdate' $HTO_no_block_SQL where callerid='$callerid' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02232'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + if ($AGILOG) {$agi_string = "-- VDAC posttime record for Closing-Time: |$affected_rows|$FDtsSQLdate|$callerid|$HTO_no_block_SQL|"; &agi_output;} + + $AGI->stream_file('sip-silence'); # stop music-on-hold process + $AGI->stream_file('sip-silence'); # stop music-on-hold process + $AGI->stream_file('sip-silence'); # stop music-on-hold process + + $HTO_digits="1"; + $HTO_filename=$closing_time_filename; + + &press_one_hold_time_option_prompt; + + if ($pin =~ /1/) + { + $now_date_epoch = time(); + $drop_timer = ($now_date_epoch - $start_epoch); + + if ($pin =~ /1/) + { + if ($closing_time_action_SETTING =~ /PRESS_VMAIL/) {$closing_time_action = 'VOICEMAIL'; $HT_status='QVMAIL';} + if ($closing_time_action_SETTING =~ /PRESS_VMAIL_NO_INST/) {$closing_time_action = 'VMAIL_NO_INST'; $HT_status='QVMAIL';} + if ($closing_time_action_SETTING =~ /PRESS_EXTEN/) {$closing_time_action = 'EXTENSION'; $HT_status='CLOSOP';} + if ($closing_time_action_SETTING =~ /PRESS_CALLMENU/) {$closing_time_action = 'CALL_MENU'; $HT_status='CLOSOP';} + if ($closing_time_action_SETTING =~ /PRESS_CID_CALLBACK/) {$closing_time_action = 'CALLERID_CALLBACK'; $HT_status='CLOSOP';} + if ($closing_time_action_SETTING =~ /PRESS_INGROUP/) {$closing_time_action = 'IN_GROUP'; $HT_status='CLOSOP';} + if ($closing_time_action_SETTING =~ /PRESS_CALLBACK_QUEUE/) {$closing_time_action = 'CALLBACK_QUEUE'; $HT_status='CLOSOP';} + } + + if ($AGILOG) {$agi_string = "CLOSING TIME OPTION PRESSED $pin: $closing_time_action|$HT_status"; &agi_output;} + + if ($closing_time_action !~ /STAY_IN_QUEUE/) + { + $play_post_press_audio=1; + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + $place=0; + if ($rec_countWAIT > 0) {$place = $rec_countWAIT;} + if ($rec_countWAITrem > 0) {$place = $rec_countWAITrem;} + $place++; + + $stmtB = "INSERT INTO queue_log SET `partition`='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='EXITWITHKEY',data1='1',data2='$place',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + $dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02233'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging; + + $stmtB = "INSERT INTO queue_log SET `partition`='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='CALLSTATUS',data1='QVMAIL',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + $dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02234'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging; + + $exitwithkey++; + + $dbhB->disconnect(); + } + } + } + } + ### END closing-time option press 1 options ### + + if ($closing_time_action =~ /EXTENSION/) + { + if (length($closing_time_option_exten)>0) + { + $DROPexten = "$closing_time_option_exten"; + + if ( ($channel_group =~ /AGENTDIRECT/i) && (length($agent_only) > 1) && ($DROPexten =~ /AGENTEXT/) ) + { + ### Grab user's custom_five field from the database + $stmtA = "SELECT custom_five FROM vicidial_users where user='$agent_only';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02246'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $DROPexten = $aryA[0]; + } + $sthA->finish(); + } + + $newcallerid = "\"$callerid <$transfer_cid>\""; + $AGI->set_callerid($newcallerid); + print STDERR "Setting CID \"$newcallerid\"\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: \"$callerid\" \<$transfer_cid\>"; &agi_output;} + } + } + + if ($closing_time_action =~ /VOICEMAIL|VMAIL_NO_INST/) + { + if ( ($channel_group =~ /AGENTDIRECT/i) && (length($agent_only) > 1) && ($closing_time_option_voicemail =~ /AGENTVMAIL/) ) + { + ### Grab user's voicemail ID from the database + $stmtA = "SELECT voicemail_id FROM vicidial_users where user='$agent_only';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02235'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $closing_time_option_voicemail = $aryA[0]; + } + $sthA->finish(); + } + $newcallerid = "\"$VCcallerid <$transfer_cid>\""; + $AGI->set_callerid($newcallerid); + print STDERR "Setting CID \"$newcallerid\"\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $newcallerid"; &agi_output;} + if ($closing_time_action =~ /VMAIL_NO_INST/) + {$voicemail_dump_exten = $voicemail_dump_exten_no_inst;} + if (length($closing_time_option_voicemail)>0) + {$DROPexten = "$voicemail_dump_exten$closing_time_option_voicemail";} + } + if ($closing_time_action =~ /CALL_MENU/) + { + $newcallerid = "\"$VCcallerid <$transfer_cid>\""; + if ($action_xfer_cid =~ /CLOSER/) + {$newcallerid = "\"$XXqueryCID <$transfer_cid>\"";} + $AGI->set_callerid($newcallerid); + print STDERR "Setting CID \"$newcallerid\"\n"; + checkresult($result); + if ($AGILOG) {$agi_string = "callerID changed: $newcallerid"; &agi_output;} + if ( (length($closing_time_option_callmenu)>0) && ($closing_time_option_callmenu !~ /---NONE---/) ) + { + $DROPexten = "s"; + $ext_context = "$closing_time_option_callmenu"; + + if ($enable_queuemetrics_logging > 0) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO QM DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $stmtB = "INSERT INTO queue_log SET `partition`='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='NONE',agent='NONE',verb='INFO',data1='IVRSTART',data2='$phone_number',data3='$channel_group',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + $dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02236'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging; + } + } + } + if ($closing_time_action =~ /IN_GROUP/) + { # 90009*CL_uk3survy_*8301*10000123*universal*7275551212*1234*" + $DROPexten = "90009*$closing_time_option_xfer_group$S$S$insert_lead_id$S$S$phone_number$S$fronter$S"; + } + if ($closing_time_action =~ /CALLERID_CALLBACK/) + { + if (length($closing_time_option_exten)>0) + {$DROPexten = "$closing_time_option_exten";} + # if callerid is not valid do not execute + if ( ( length($phone_number) > 6 ) && ( $phone_number > 0) ) + { + $entry_list_idSQLa=''; $entry_list_idSQLb=''; + if ( ($enable_did_entry_list_id > 0) && ($entry_list_id > 0) ) + { + $entry_list_idSQLa=',entry_list_id'; + $entry_list_idSQLb=",'$entry_list_id'"; + } + $ingroup_insert = $channel_group; + if ($populate_lead_ingroup =~ /DISABLED/) {$ingroup_insert='';} + $populate_provinceA=''; $populate_provinceB=''; + if ($populate_lead_province =~ /did/i) + {&populate_lead_province_process;} + if ($add_lead_timezone =~ /PHONE_CODE_AREACODE/) + {&lead_timezone_process;} + ### insert a record into the vicidial_list table + $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments$entry_list_idSQLa$INSERTstateSQLa$INSERTpostal_codeSQLa$populate_provinceA) values('$SQLdate','$tsSQLdate','INBND','$fronter','$vendor_id','VDCL','$closing_time_option_callback_list_id','N','$phone_code','$phone_number','$ingroup_insert','$called_count','$local_gmt','$VLcomments'$entry_list_idSQLb$INSERTstateSQLb$INSERTpostal_codeSQLb$populate_provinceB);"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02237'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02238'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $CALLBACK_insert_lead_id = $aryA[0]; + } + $sthA->finish(); + + ### BEGIN the Add-Lead-URL get process + if (length($add_lead_url) > 5) + { + $launch = $PATHhome . "/AST_send_URL.pl"; + $launch .= " --SYSLOG" if ($SYSLOG); + $launch .= " --lead_id=" . $CALLBACK_insert_lead_id; + $launch .= " --phone_number=" . $phone_number; + $launch .= " --user="; + $launch .= " --call_type=IN"; + $launch .= " --campaign=" . $channel_group; + $launch .= " --uniqueid=" . $uniqueid; + $launch .= " --call_id=" . $callerid; + $launch .= " --list_id=" . $closing_time_option_callback_list_id; + $launch .= " --alt_dial=MAIN"; + $launch .= " --function=INGROUP_ADD_LEAD_URL"; + + system($launch . ' &'); + + if ($AGILOG) {$agi_string = "$launch|"; &agi_output;} + } + ### END the Add-Lead-URL get process + + if ($AGILOG) {$agi_string = "VDAD vicidial_list insert |$CALLBACK_insert_lead_id|$stmtA|"; &agi_output;} + + $DROPexten = "8300"; + + $play_post_press_audio=1; + } + } + if ($closing_time_action =~ /CALLBACK_QUEUE/) + { + if (length($closing_time_option_exten)>0) + {$DROPexten = "$closing_time_option_exten";} + # if callerid is not valid do not execute + if ( ( length($phone_number) > 6 ) && ( $phone_number > 0) ) + { + ### insert a record into the vicidial_inbound_callback_queue table + $stmtA = "INSERT INTO vicidial_inbound_callback_queue SET icbq_date=NOW(),icbq_status='NEW',icbq_phone_number='$phone_number',icbq_phone_code='$phone_code',icbq_nextday_choice='U',lead_id='$insert_lead_id',group_id='$channel_group',queue_priority='$queue_priority',call_date='$SQLdateBEGIN',gmt_offset_now='$local_gmt';"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02239'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $stmtB = "SELECT LAST_INSERT_ID() LIMIT 1;"; + $sthA = $dbhA->prepare($stmtB) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $stmtA=$stmtB; $mysql_count='02240'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $CALLBACK_insert_icbq_id = $aryA[0]; + } + $sthA->finish(); + + if ($AGILOG) {$agi_string = "VDAD vicidial_inbound_callback_queue insert |$CALLBACK_insert_icbq_id|$stmtA|"; &agi_output;} + + $DROPexten = "8300"; + + $play_post_press_audio=1; + } + } + + if ($AGILOG) {$agi_string = "-- VDCL CLOSING-TIME OPT: |$closing_time_action|$DROPexten|"; &agi_output;} + + if (length($DROPexten)>0) + { ### if DROP extension is defined then send the dropped call there instead of hangup + + ### use STDOUT to send call to proper DROP location + $VHqueryCID = "VH$CIDdate$VDADconf_exten"; + + if ($no_delay_call_route =~ /N/) + { + $AGI->stream_file('sip-silence'); # stop music-on-hold process + $AGI->stream_file('sip-silence'); + ### sleep for 99 hundredths of a second + usleep(1*990*1000); + } + + $now_date_epoch = time(); + + $stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' and server_ip='$VARserver_ip' order by call_time desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02241'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + if ($AGILOG) {$agi_string = "-- VDCL vac record deleted: |$affected_rows| $channel_group|"; &agi_output;} + + $called_since_last_resetSQL=''; + if ( ($closing_time_action =~ /VOICEMAIL|HANGUP|MESSAGE|VMAIL_NO_INST/) && ($closing_time_lead_reset =~ /Y/) ) + {$called_since_last_resetSQL = ",called_since_last_reset='N'";} + + $populate_provinceUPDATE=''; + if ($populate_lead_province =~ /OW_did/i) + {&populate_lead_province_process;} + $stmtA = "UPDATE vicidial_list set status='CLOSOP' $populate_provinceUPDATE $UPDATEstateSQL $called_since_last_resetSQL where lead_id = '$insert_lead_id';"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02242'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + if ($AGILOG) {$agi_string = "-- VDCL vl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} + + if ($drop_seconds < 1) {$drop_seconds = $drop_timer;} + + if (length($HT_status)<1) {$HT_status='CLOSOP';} + $stmtA = "UPDATE vicidial_closer_log set status='$HT_status',end_epoch='$now_date_epoch',length_in_sec='$drop_seconds',queue_seconds='$drop_seconds',term_reason='CLOSETIME' where lead_id = '$insert_lead_id' order by closecallid desc limit 1;"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02243'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + if ($AGILOG) {$agi_string = "-- VDCL vcl update: |$affected_rows|$insert_lead_id|\n|$stmtA|"; &agi_output;} + + if ($enable_drop_lists > 0) + { + $stmtA="INSERT IGNORE INTO vicidial_drop_log SET uniqueid='$uniqueid',server_ip='$VARserver_ip',drop_date=NOW(),lead_id='$insert_lead_id',campaign_id='$VD_campaign_id',status='$HT_status',phone_code='$phone_code',phone_number='$phone_number';"; + $VDDLaffected_rows = $dbhA->do($stmtA); + if ($AGILOG) {$agi_string = "-- vicidial_drop_log insert: |$VDDLaffected_rows|$uniqueid|$insert_lead_id|$HT_status|"; &agi_output;} + } + + if ( ($enable_queuemetrics_logging > 0) && ($exitwithkey < 1) ) + { + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + + $place=0; + if ($rec_countWAIT > 0) {$place = $rec_countWAIT;} + if ($rec_countWAITrem > 0) {$place = $rec_countWAITrem;} + $place++; + + $stmtB = "INSERT INTO queue_log SET `partition`='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='EXITWITHKEY',data1='2',data2='$place',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + $dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02244'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging; + + $stmtB = "INSERT INTO queue_log SET `partition`='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='NONE',verb='CALLSTATUS',data1='CLOSOP',serverid='$queuemetrics_log_id';"; + $Baffected_rows = $dbhB->do($stmtB); + $dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02245'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging; + + $dbhB->disconnect(); + } + + $AGI->stream_file('sip-silence'); + $AGI->stream_file('sip-silence'); + + if ( (length($closing_time_end_filename) > 0) && ($play_post_press_audio > 0) ) + { + $AGI->stream_file('sip-silence'); # stop music-on-hold process + $AGI->stream_file('sip-silence'); # stop music-on-hold process + if ($closing_time_end_filename =~ /\|/) + { + @closing_time_end_filename_array = split(/\|/,$closing_time_end_filename); + $w=0; + foreach(@closing_time_end_filename_array) + { + if (length($closing_time_end_filename_array[$w])>0) + { + $AGI->stream_file("$closing_time_end_filename_array[$w]"); + } + $w++; + } + } + else + {$AGI->stream_file("$closing_time_end_filename");} + } + + $AGI->stream_file('sip-silence'); + $AGI->stream_file('sip-silence'); + + if ($AGILOG) {$agi_string = "exiting the VDAD app at Closing-Time, transferring call to $DROPexten"; &agi_output;} + print "SET CONTEXT $ext_context\n"; + $result = ; + checkresult($result); + print "SET EXTENSION $DROPexten\n"; + $result = ; + checkresult($result); + print "SET PRIORITY 1\n"; + $result = ; + checkresult($result); + + $dbhA->disconnect(); + + exit; + } + } +################################################### +### END final Closing-Now process options ### +################################################### + + + ################################################### ### End of Loop to try to send call to an agent ### ### Time to figure out where to drop the call ### @@ -6280,6 +6896,826 @@ sub populate_lead_province_process {if ($AGILOG) {$agi_string = "No DID record found($uniqueid)|"; &agi_output;}} } +sub lead_timezone_process + { + $USarea = substr($phone_number, 0, 3); + + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =~ /^1$/) + { + $stmtA = "SELECT country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + 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; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### MEXICO ### + if ($phone_code =~ /^52$/) + { + $stmtA = "SELECT country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + 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; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### AUSTRALIA ### + if ($phone_code =~ /^61$/) + { + $stmtA = "SELECT country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + 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; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $stmtA = "SELECT country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + 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; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $gmt_offset = $aryA[4]; $gmt_offset =~ s/\+| //gi; + $dst = $aryA[5]; + $dst_range = $aryA[6]; + $PC_processed++; + $rec_count++; + } + $sthA->finish(); + } + + ### Find out if DST to raise the gmt offset ### + $now_date_epoch = time(); + $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); + $AC_localtime = ($now_date_epoch + (3600 * $AC_GMT_diff)); + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); + $year = ($year + 1900); + $mon++; + if ($mon < 10) {$mon = "0$mon";} + if ($mday < 10) {$mday = "0$mday";} + if ($hour < 10) {$hour = "0$hour";} + if ($min < 10) {$min = "0$min";} + if ($sec < 10) {$sec = "0$sec";} + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + + if ( (!$AC_processed) && ($dst_range =~ /SSM-FSN/) ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + &USACAN_dstcalc; + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSA-LSO/) ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + &NA_dstcalc; + if ($DBX) {print " DST: $NA_DST\n";} + if ($NA_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSM-LSO/) ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + &GBR_dstcalc; + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /LSO-LSM/) ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + &AUS_dstcalc; + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-LSM/) ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + &AUST_dstcalc; + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-FSA/) ) + { + if ($DBX) {print " First Sunday October to First Sunday April\n";} + &AUSE_dstcalc; + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + &NZL_dstcalc; + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($area_GMT_method =~ /LSS-FSA/) ) + { + if ($DBX) {print " Last Sunday September to First Sunday April\n";} + &NZLN_dstcalc; + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$area_GMT++;} + $AC_processed++; + } + if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + &BZL_dstcalc; + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + if ($AGILOG) {$agi_string = "Timezone not found, using server timezone: $local_gmt"; &agi_output;} + } + else + { + if ($AGILOG) {$agi_string = "Timezone found: (LEAD: $gmt_offset SERVER: $local_gmt)"; &agi_output;} + $local_gmt = $gmt_offset; + } + } + + +sub USACAN_dstcalc { +#********************************************************************** +# SSM-FSN +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on Second Sunday March to First Sunday November at 2 am. +# INPUTS: +# mm INTEGER Month. +# dd INTEGER Day of the month. +# ns INTEGER Seconds into the day. +# dow INTEGER Day of week (0=Sunday, to 6=Saturday) +# OPTIONAL INPUT: +# timezone INTEGER hour difference UTC - local standard time +# (DEFAULT is blank) +# make calculations based on UTC time, +# which means shift at 10:00 UTC in April +# and 9:00 UTC in October +# OUTPUT: +# INTEGER 1 = DST, 0 = not DST +# +# S M T W T F S +# 1 2 3 4 5 6 7 +# 8 9 10 11 12 13 14 +#15 16 17 18 19 20 21 +#22 23 24 25 26 27 28 +#29 30 31 +# +# S M T W T F S +# 1 2 3 4 5 6 +# 7 8 9 10 11 12 13 +#14 15 16 17 18 19 20 +#21 22 23 24 25 26 27 +#28 29 30 31 +# +#********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 10) { + $USACAN_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; return 1; + } elsif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $USACAN_DST=0; return 0; + } else { + $USACAN_DST=1; return 1; + } + } + } else { + $USACAN_DST=0; return 0; + } + } elsif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; return 0; + } elsif ($dd < ($dow+1)) { + $USACAN_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; return 1; + } else { + $USACAN_DST=0; return 0; + } + } + } else { + $USACAN_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NA_dstcalc { +#********************************************************************** +# FSA-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in April and last Sunday in October at 2 am. +#********************************************************************** + + $NA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $NA_DST=0; return 0; + } elsif ($mm >= 5 && $mm <= 9) { + $NA_DST=1; return 1; + } elsif ($mm == 4) { + if ($dd > 7) { + $NA_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NA_DST=0; return 0; + } else { + $NA_DST=1; return 1; + } + } + } else { + $NA_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $NA_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $NA_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 7200) { + $NA_DST=1; return 1; + } else { + $NA_DST=0; return 0; + } + } + } else { + $NA_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub GBR_dstcalc { +#********************************************************************** +# LSM-LSO +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in March and last Sunday in October at 1 am. +#********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; return 0; + } elsif ($mm >= 4 && $mm <= 9) { + $GBR_DST=1; return 1; + } elsif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $GBR_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; return 0; + } else { + $GBR_DST=1; return 1; + } + } + } else { + $GBR_DST=1; return 1; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $GBR_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; return 1; + } else { + $GBR_DST=0; return 0; + } + } + } else { + $GBR_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub AUS_dstcalc { +#********************************************************************** +# LSO-LSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUS_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUS_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; return 1; + } else { + $AUS_DST=0; return 0; + } + } + } else { + $AUS_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $AUS_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; return 0; + } else { + $AUS_DST=1; return 1; + } + } + } else { + $AUS_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUST_dstcalc { +#********************************************************************** +# FSO-LSM +# TASMANIA ONLY +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and last Sunday in March at 1 am. +#********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $AUST_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; return 1; + } elsif ($dd < ($dow+25)) { + $AUST_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; return 1; + } else { + $AUST_DST=0; return 0; + } + } + } else { + $AUST_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUST_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUST_DST=0; return 0; + } else { + $AUST_DST=1; return 1; + } + } + } else { + $AUST_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub AUSE_dstcalc { +#********************************************************************** +# FSO-FSA +# 2008+ AUSTRALIA ONLY (country code 61) +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and first Sunday in April at 1 am. +#********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $AUSE_DST=1; return 1; + } elsif ($mm >= 5 && $mm <= 9) { + $AUSE_DST=0; return 0; + } elsif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; return 0; + } else { + $AUSE_DST=0; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $AUSE_DST=1; return 0; + } else { + $AUSE_DST=0; return 1; + } + } + } else { + $AUSE_DST=1; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; return 0; + } else { + $AUSE_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $AUSE_DST=0; return 0; + } else { + $AUSE_DST=1; return 1; + } + } + } else { + $AUSE_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub NZL_dstcalc { +#********************************************************************** +# FSO-TSM +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on first Sunday in October and third Sunday in March at 1 am. +#********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; return 1; + } elsif ($mm >= 4 && $mm <= 9) { + $NZL_DST=0; return 0; + } elsif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; return 1; + } elsif ($dd < ($dow+14)) { + $NZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; return 1; + } else { + $NZL_DST=0; return 0; + } + } + } else { + $NZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd >= 8) { + $NZL_DST=1; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (7200+$timezone*3600)) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } else { + if ($dow == 0 && $ns < 3600) { + $NZL_DST=0; return 0; + } else { + $NZL_DST=1; return 1; + } + } + } else { + $NZL_DST=0; return 0; + } + } # end of month checks +} # end of subroutine dstcalc + + + + +sub NZLN_dstcalc { +#********************************************************************** +# LSS-FSA +# 2007+ NEW ZEALAND (country code 64) +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. +# Based on last Sunday in September and first Sunday in April at 1 am. +#********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; return 1; + } elsif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; return 0; + } elsif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; return 1; + } elsif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; return 0; + } else { + $NZLN_DST=0; return 1; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; return 0; + } else { + $NZLN_DST=0; return 1; + } + } + } else { + $NZLN_DST=1; return 0; + } + } elsif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; return 0; + } elsif ($dd < ($dow+25)) { + $NZLN_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; return 0; + } else { + $NZLN_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; return 0; + } else { + $NZLN_DST=1; return 1; + } + } + } else { + $NZLN_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + + + + +sub BZL_dstcalc { +#********************************************************************** +# TSO-LSF +# This is returns 1 if Daylight Savings Time is in effect and 0 if +# Standard time is in effect. Brazil +# Based on Third Sunday October to Last Sunday February at 1 am. +#********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; return 1; + } elsif ($mm >= 3 && $mm <= 9) { + $BZL_DST=0; return 0; + } elsif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; return 1; + } elsif ($dd < ($dow+22)) { + $BZL_DST=1; return 1; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; return 1; + } else { + $BZL_DST=0; return 0; + } + } + } else { + $BZL_DST=0; return 0; + } + } elsif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; return 0; + } elsif ($dd < ($dow+22)) { + $BZL_DST=0; return 0; + } elsif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; return 0; + } else { + $BZL_DST=1; return 1; + } + } + } else { + $BZL_DST=1; return 1; + } + } # end of month checks +} # end of subroutine dstcalc + + sub checkresult { my ($res) = @_; diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl index 08251f51..4bb9a857 100644 --- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl +++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl @@ -15,7 +15,7 @@ # - Auto reset lists at defined times # - Auto restarts Asterisk process if enabled in servers settings # -# Copyright (C) 2017 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2018 Matt Florell LICENSE: AGPLv2 # # CHANGES # 61011-1348 - First build @@ -126,9 +126,10 @@ # 170920-2214 - Added expired_lists_inactive option, checks once per hour # 171010-2254 - Added process debug with --DebugXXX flag and screen logging # 171221-1628 - Added rolling of vicidial_ingroup_hour_counts records +# 180204-0931 - Added rolling of vicidial_inbound_callback_queue records # -$build = '171221-1628'; +$build = '180204-0931'; $DB=0; # Debug flag $teodDB=0; # flag to log Timeclock End of Day processes to log file @@ -1371,6 +1372,36 @@ if ($timeclock_end_of_day_NOW > 0) $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; } + # roll of SENT/EXPIRED vicidial_inbound_callback_queue records + if (!$Q) {print "\nProcessing vicidial_inbound_callback_queue table...\n";} + $stmtA = "INSERT IGNORE INTO vicidial_inbound_callback_queue_archive SELECT * from vicidial_inbound_callback_queue where icbq_status IN('SENT','EXPIRED','DNCL','DNCC','ORPHAN');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + + $sthArows = $sthA->rows; + if (!$Q) {print "$sthArows rows inserted into vicidial_inbound_callback_queue_archive table \n";} + + $rv = $sthA->err(); + if (!$rv) + { + $stmtA = "DELETE FROM vicidial_inbound_callback_queue WHERE icbq_status IN('SENT','EXPIRED','DNCL','DNCC','ORPHAN');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows = $sthA->rows; + if (!$Q) {print "$sthArows rows deleted from vicidial_inbound_callback_queue table \n";} + + $stmtA = "optimize table vicidial_inbound_callback_queue;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + } + + # reset in-group closing_time_now_trigger trigger flag + $stmtA = "UPDATE vicidial_inbound_groups SET closing_time_now_trigger='N' WHERE closing_time_now_trigger='Y';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows = $sthA->rows; + if (!$Q) {print "$sthArows vicidial_inbound_groups rows closing_time_now_trigger value reset \n";} + ##### BEGIN max stats end of day process ##### # set OPEN max stats records to CLOSING for processing $stmtA = "UPDATE vicidial_daily_max_stats SET stats_flag='CLOSING' where stats_flag='OPEN';"; diff --git a/agc_2-X/trunk/bin/AST_VDadapt.pl b/agc_2-X/trunk/bin/AST_VDadapt.pl index 0c1a4011..e3a9b960 100644 --- a/agc_2-X/trunk/bin/AST_VDadapt.pl +++ b/agc_2-X/trunk/bin/AST_VDadapt.pl @@ -6,7 +6,7 @@ # adjusts the auto_dial_level for vicidial adaptive-predictive campaigns. # gather call stats for campaigns and in-groups # -# Copyright (C) 2017 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2018 Matt Florell LICENSE: AGPLv2 # # CHANGELOG # 60823-1302 - First build from AST_VDhopper.pl @@ -46,6 +46,7 @@ # 161102-1029 - Fixed QM partition problem # 170724-2352 - Added option for cached hour counts for vicidial_log entries per campaign and carrier log totals # 171221-1049 - Added caching of inbound call stats +# 180203-1728 - Added function to check for inbound callback queue calls to be placed # @@ -670,6 +671,882 @@ while ($master_loop < $CLIloops) $diff_ratio_updater = ($diff_ratio_updater + $CLIdelay); $drop_count_updater = ($drop_count_updater + $CLIdelay); + + + ########################################################## + ##### BEGIN check for inbound callback queue entries ##### + ########################################################## + $stmtA = "SELECT count(*) from vicidial_inbound_callback_queue where icbq_status='LIVE';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsICBQ=$sthA->rows; + if ($sthArowsICBQ > 0) + { + @aryA = $sthA->fetchrow_array; + $ICBQcount = $aryA[0]; + } + $sthA->finish(); + + if ($DB) {print "\nLive Inbound Callback Queue Entries: |$ICBQcount|$stat_count|$stmtA|\n";} + + if ($ICBQcount > 0) + { + $now_epoch = time(); + $BDtarget = ($now_epoch - 7); + ($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); + $Byear = ($Byear + 1900); + $Bmon++; + if ($Bmon < 10) {$Bmon = "0$Bmon";} + if ($Bmday < 10) {$Bmday = "0$Bmday";} + if ($Bhour < 10) {$Bhour = "0$Bhour";} + if ($Bmin < 10) {$Bmin = "0$Bmin";} + if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear$Bmon$Bmday$Bhour$Bmin$Bsec"; + + @ICBQicbq_id=@MT; + @ICBQlead_id=@MT; + @ICBQicbq_date=@MT; + @ICBQgroup_id=@MT; + @ICBQcall_date=@MT; + @ICBQqueue_priority=@MT; + @ICBQicbq_phone_number=@MT; + @ICBQicbq_phone_code=@MT; + @ICBQicbq_date_epoch=@MT; + $routed_ingroup_list='|'; + if ( (($stat_count =~ /0$|5$/) || ($stat_count==1)) ) + {$routed_user_list='';} + + $stmtA = "SELECT icbq_id,lead_id,icbq_date,group_id,call_date,queue_priority,icbq_phone_number,icbq_phone_code,UNIX_TIMESTAMP(icbq_date) from vicidial_inbound_callback_queue where icbq_status='LIVE' order by queue_priority desc,call_date limit 1000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsICBQr=$sthA->rows; + $r=0; + while ($sthArowsICBQr > $r) + { + @aryA = $sthA->fetchrow_array; + $ICBQicbq_id[$r] = $aryA[0]; + $ICBQlead_id[$r] = $aryA[1]; + $ICBQicbq_date[$r] = $aryA[2]; + $ICBQgroup_id[$r] = $aryA[3]; + $ICBQcall_date[$r] = $aryA[4]; + $ICBQqueue_priority[$r] = $aryA[5]; + $ICBQicbq_phone_number[$r] = $aryA[6]; + $ICBQicbq_phone_code[$r] = $aryA[7]; + $ICBQicbq_date_epoch[$r] = $aryA[8]; + + $r++; + } + $sthA->finish(); + + $r=0; + while ($sthArowsICBQr > $r) + { + $temp_ingroup = $ICBQgroup_id[$r]; + if ($routed_ingroup_list !~ /\|$temp_ingroup\|/) + { + $routed_ingroup_list .= "$temp_ingroup|"; + if ($DBX) {print "Live Inbound Callback Queue Entry: $r|$ICBQicbq_id[$r]|$ICBQlead_id[$r]|$ICBQgroup_id[$r]|$ICBQcall_date[$r]|\n";} + ### Grab inbound group settings from the database + $stmtA = "SELECT next_agent_call,queue_priority,active,dial_ingroup_cid,icbq_expiration_hours FROM vicidial_inbound_groups where group_id='$ICBQgroup_id[$r]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsIG=$sthA->rows; + if ($sthArowsIG > 0) + { + @aryA = $sthA->fetchrow_array; + $CAMP_callorder = $aryA[0]; + $queue_priority = $aryA[1]; + $ingroup_active = $aryA[2]; + $dial_ingroup_cid = $aryA[3]; + $icbq_expiration_hours = $aryA[4]; + $expire_epoch = ($now_epoch - ($icbq_expiration_hours * 3600)); + } + $sthA->finish(); + + $agent_call_order='order by last_call_finish'; + if ($CAMP_callorder =~ /longest_wait_time/i) {$agent_call_order = 'order by vicidial_live_agents.last_state_change';} + if ($CAMP_callorder =~ /overall_user_level/i) {$agent_call_order = 'order by user_level desc,last_call_finish';} + if ($CAMP_callorder =~ /oldest_call_start/i) {$agent_call_order = 'order by vicidial_live_agents.last_call_time';} + if ($CAMP_callorder =~ /oldest_call_finish/i) {$agent_call_order = 'order by vicidial_live_agents.last_call_finish';} + if ($CAMP_callorder =~ /oldest_inbound_call_start/i) {$agent_call_order = 'order by vicidial_live_agents.last_inbound_call_time';} + if ($CAMP_callorder =~ /oldest_inbound_call_finish/i) {$agent_call_order = 'order by vicidial_live_agents.last_inbound_call_finish';} + if ($CAMP_callorder =~ /random/i) {$agent_call_order = 'order by random_id';} + if ($CAMP_callorder =~ /campaign_rank/i) {$agent_call_order = 'order by campaign_weight desc,last_call_finish';} + if ($CAMP_callorder =~ /fewest_calls_campaign/i) {$agent_call_order = 'order by vicidial_live_agents.calls_today,vicidial_live_agents.last_call_finish';} + if ($CAMP_callorder =~ /inbound_group_rank/i) {$aco_sub=1; $agent_call_order = 'order by group_weight desc,vicidial_live_inbound_agents.last_call_finish';} + if ($CAMP_callorder =~ /ingroup_grade_random/i) {$aco_sub=1; $agent_call_order = 'order by random_id';} + if ($CAMP_callorder =~ /campaign_grade_random/i) {$aco_sub=1; $agent_call_order = 'order by random_id';} + if ($CAMP_callorder =~ /fewest_calls$/i) {$aco_sub=1; $agent_call_order = 'order by vicidial_live_inbound_agents.calls_today,vicidial_live_inbound_agents.last_call_finish';} + if ($CAMP_callorder =~ /ring_all$/i) {$aco_sub=0; $agent_call_order = 'order by vicidial_live_agents.last_state_change';} + + $rec_countWAITrem=0; + ### Get count of number of calls in this group that are ahead of this call + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and campaign_id='$ICBQgroup_id[$r]' and call_time < \"$ICBQcall_date[$r]\" and lead_id != '$ICBQlead_id[$r]' and queue_priority >= '$ICBQqueue_priority[$r]' $ADfindSQL;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAITrem = $aryA[0]; + } + $sthA->finish(); + if ($DBX) {$agi_string = "$rec_countWAITrem|$stmtA|"; print "$agi_string\n";} + + $rec_countWAITqueue=0; + ### Get count of number of calls in the callback-queue for this group that are ahead of this call + $stmtA = "SELECT count(*) FROM vicidial_inbound_callback_queue where icbq_status IN('LIVE','SENDING') and group_id='$ICBQgroup_id[$r]' and call_date < \"$ICBQcall_date[$r]\" and lead_id != '$ICBQlead_id[$r]' and queue_priority >= '$ICBQqueue_priority[$r]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $rec_countWAITqueue = $aryA[0]; + } + $sthA->finish(); + if ($DBX) {$agi_string = "$rec_countWAITqueue|$stmtA|"; print "$agi_string\n";} + + if ( ($rec_countWAITrem < 1) && ($rec_countWAITqueue < 1) ) + { + $sthArowsFA=0; + $qp_countWAIT=0; + ### Get count of number of waiting calls in higher priority groups than this call or the same priority with longer wait time + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and lead_id != '$ICBQlead_id[$r]' $ADfindSQL and ( (queue_priority > '$ICBQqueue_priority[$r]') or (queue_priority = '$ICBQqueue_priority[$r]' and call_time < \"$ICBQcall_date[$r]\") );"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $qp_countWAIT = $aryA[0]; + } + $sthA->finish(); + if ($DBX) {$agi_string = "$qp_countWAIT|$stmtA|"; print "$agi_string\n";} + + $qp_countWAITqueue=0; + ### Get count of number of waiting calls in higher priority groups than this call or the same priority with longer wait time + $stmtA = "SELECT count(*) FROM vicidial_inbound_callback_queue where icbq_status IN('LIVE','SENDING') and lead_id != '$ICBQlead_id[$r]' and ( (queue_priority > '$ICBQqueue_priority[$r]') or (queue_priority = '$ICBQqueue_priority[$r]' and call_date < \"$ICBQcall_date[$r]\") );"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $qp_countWAITqueue = $aryA[0]; + } + $sthA->finish(); + if ($DBX) {$agi_string = "$qp_countWAITqueue|$stmtA|"; print "$agi_string\n";} + + $qp_groupWAIT=''; + $qp_groupWAIT_SQL=''; + $qp_groupWAIT_aco=''; + $qp_groupWAIT_aco_SQL=''; + $qp_groupWAIT_camp_SQL=''; + if ( ($qp_countWAIT > 0) || ($qp_countWAITqueue > 0) ) + { + ### Get group/campaign ids of calls in higher priority groups than this call or the same priority with longer wait time + $qp_groupWAIT=''; + $stmtA = "SELECT distinct campaign_id FROM vicidial_auto_calls where status = 'LIVE' and lead_id != '$ICBQlead_id[$r]' $ADfindSQL and ( (queue_priority > '$ICBQqueue_priority[$r]') or (queue_priority = '$ICBQqueue_priority[$r]' and call_time < \"$ICBQcall_date[$r]\") );"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbc=0; + while ($sthArows > $dbc) + { + @aryA = $sthA->fetchrow_array; + $qp_groupWAIT_aco .= "'$aryA[0]',"; + if ($dbc > 0) + { + $qp_groupWAIT .= "and "; + } + $qp_groupWAIT .= "closer_campaigns NOT LIKE \"% $aryA[0] %\" "; + $dbc++; + } + + $stmtA = "SELECT distinct group_id FROM vicidial_inbound_callback_queue where icbq_status IN('LIVE','SENDING') and lead_id != '$ICBQlead_id[$r]' $ADfindSQL and ( (queue_priority > '$ICBQqueue_priority[$r]') or (queue_priority = '$ICBQqueue_priority[$r]' and call_date < \"$ICBQcall_date[$r]\") );"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbcQ=0; + while ($sthArows > $dbcQ) + { + @aryA = $sthA->fetchrow_array; + $qp_groupWAIT_aco .= "'$aryA[0]',"; + if ($dbc > 0) + { + $qp_groupWAIT .= "and "; + } + $qp_groupWAIT .= "closer_campaigns NOT LIKE \"% $aryA[0] %\" "; + $dbc++; + $dbcQ++; + } + + if (length($qp_groupWAIT_aco)>2) + {chop($qp_groupWAIT_aco);} + else + { + $qp_groupWAIT_aco="''"; + $qp_groupWAIT = "closer_campaigns != ''"; + } + + $qp_groupWAIT_SQL = "and ($qp_groupWAIT)"; + $qp_groupWAIT_aco_SQL = "and vicidial_live_inbound_agents.group_id NOT IN($qp_groupWAIT_aco)"; + $qp_groupWAIT_camp_SQL = "and campaign_id NOT IN($qp_groupWAIT_aco)"; + + if ($DBX) {$agi_string = "$qp_groupWAIT_SQL|$stmtA|"; print "$agi_string\n";} + $sthA->finish(); + } + + $VACagent_grab='|'; + $stmtA = "SELECT agent_grab from vicidial_auto_calls where agent_grab!='';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsGRAB=$sthA->rows; + if ($sthArowsGRAB > 0) + { + @aryA = $sthA->fetchrow_array; + $VACagent_grab .= "$aryA[0]|"; + } + $sthA->finish(); + if ($DBX) {$agi_string = " AGENTS TAKING CALLS CHECK: $sthArowsGRAB|$VACagent_grab|$stmtA|"; print "$agi_string\n";} + + if ($aco_sub > 0) + { + ### BEGIN in-group-rank-based next-agent-call processing ### + $stmtA = "LOCK TABLES vicidial_live_agents WRITE, vicidial_live_inbound_agents WRITE;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + + if (length($qp_groupWAIT_aco)<2) + {$qp_groupWAIT_aco="''";} + ### Get list of users that should take higher priority inbound calls first + $stmtA = "SELECT distinct user from vicidial_live_inbound_agents where group_id IN($qp_groupWAIT_aco);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbc=0; + $vlia_users=''; + while ($sthArows > $dbc) + { + @aryA = $sthA->fetchrow_array; + $vlia_users .= "'$aryA[0]',"; + $dbc++; + } + if (length($vlia_users)>2) + {chop($vlia_users);} + else + {$vlia_users="''";} + + ### if ringing an agent, do not look for one, else, look for one + if ($RING_agent > 0) + {$sthArows=0;} + else + { + ### BEGIN grade random next-agent-call routing ### + if ($CAMP_callorder =~ /grade/) + { + @GRADEuser=@MT; + @GRADEgrade=@MT; + @userGRADEarray=@MT; + $stmtA = "SELECT vicidial_live_agents.user,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$ICBQgroup_id[$r]' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL limit 1000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $gg=0; + $ga=0; + while ($gg < $sthArows) + { + @aryA = $sthA->fetchrow_array; + $GRADEuser[$gg] = $aryA[0]; + if ($CAMP_callorder =~ /ingroup_grade_random/) + {$GRADEgrade[$gg] = $aryA[1];} + else + {$GRADEgrade[$gg] = $aryA[2];} + if ($GRADEgrade[$gg] < 1) + {$GRADEgrade[$gg] = 1;} + $gi=0; + while ($gi < $GRADEgrade[$gg]) + { + $userGRADEarray[$ga] = $GRADEuser[$gg]; + # print STDERR " GRADE ENTRY: $userGRADEarray[$ga]|$ga|$gi|$GRADEgrade[$gg]\n"; + $gi++; + $ga++; + } + $gg++; + } + $sthA->finish(); + + $sthArows=0; + if ($ga > 0) + { + $sthArowsFA=0; + $VDADuser=''; + $GRADErandom = int( rand($ga)); + $userGRADEchosen = $userGRADEarray[$GRADErandom]; + + if ($DBX) {$agi_string = "GRADE RANDOM: $userGRADEchosen|$GRADErandom|$CAMP_callorder|$gg|$ga|$callerid"; print "$agi_string\n";} + + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user,vicidial_live_agents.campaign_id,on_hook_agent,on_hook_ring_time,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user='$userGRADEchosen' and vicidial_live_agents.user NOT IN($routed_user_list'') and status IN('CLOSER','READY') limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsFA=$sthA->rows; + if ($sthArowsFA > 0) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = $aryA[0]; + $VDADuser = $aryA[1]; + $VDADextension = $aryA[2]; + $VDADserver_ip = $aryA[3]; + $VDADgroup_weight = $aryA[4]; + $ra_user = $aryA[5]; + $log_campaign = $aryA[6]; + $VDADon_hook_agent = $aryA[7]; + $VDADon_hook_ring_time = $aryA[8]; + $group_grade = $aryA[9]; + $campaign_grade = $aryA[10]; + } + $sthA->finish(); + } + if ($DBX) {$agi_string = "$VDADuser|$VDADgroup_weight|$stmtA|"; print "$agi_string\n";} + } + ### END grade random next-agent-call routing ### + else + { + $sthArowsFA=0; + $VDADuser=''; + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user,vicidial_live_agents.campaign_id,on_hook_agent,on_hook_ring_time,vicidial_live_inbound_agents.group_grade,vicidial_live_agents.campaign_grade from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$ICBQgroup_id[$r]' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($routed_user_list$vlia_users) and ring_callerid='' $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsFA=$sthA->rows; + if ($sthArowsFA > 0) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = $aryA[0]; + $VDADuser = $aryA[1]; + $VDADextension = $aryA[2]; + $VDADserver_ip = $aryA[3]; + $VDADgroup_weight = $aryA[4]; + $ra_user = $aryA[5]; + $log_campaign = $aryA[6]; + $VDADon_hook_agent = $aryA[7]; + $VDADon_hook_ring_time = $aryA[8]; + $group_grade = $aryA[9]; + $campaign_grade = $aryA[10]; + } + $sthA->finish(); + if ($DBX) {$agi_string = "$VDADuser|$VDADgroup_weight|$stmtA|"; print "$agi_string\n";} + } + } + ### END in-group-rank-based next-agent-call processing ### + } + else + { + ### BEGIN standard next-agent-call processing ### + $stmtA = "LOCK TABLES vicidial_live_agents WRITE;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + + ### if ringing an agent, do not look for one, else, look for one + if ($RING_agent > 0) + {$sthArowsFA=0;} + else + { + $sthArowsFA=0; + $stmtA = "SELECT conf_exten,user,extension,server_ip,last_call_time,ra_user,campaign_id,on_hook_agent,on_hook_ring_time FROM vicidial_live_agents where status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and campaign_id IN($INBOUNDcampsSQL) and closer_campaigns LIKE \"% $ICBQgroup_id[$r] %\" and last_update_time > '$BDtsSQLdate' and user NOT IN($routed_user_list'') $qp_groupWAIT_SQL $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsFA=$sthA->rows; + if ($sthArowsFA > 0) + { + @aryA = $sthA->fetchrow_array; + $VDADconf_exten = $aryA[0]; + $VDADuser = $aryA[1]; + $VDADextension = $aryA[2]; + $VDADserver_ip = $aryA[3]; + $VDADlast_call_time = $aryA[4]; + $ra_user = $aryA[5]; + $log_campaign = $aryA[6]; + $VDADon_hook_agent = $aryA[7]; + $VDADon_hook_ring_time = $aryA[8]; + } + $sthA->finish(); + if ($DBX) {$agi_string = "$VDADuser|$VDADlast_call_time|$stmtA|"; print "$agi_string\n";} + } + ### END standard next-agent-call processing ### + } + + if ( ($sthArowsFA > 0) && (length($VDADuser) > 0) ) + { + $Faffected_rows=0; + if ($VACagent_grab !~ /\|$VDADuser\|/) + { + $stmtA = "UPDATE vicidial_live_agents set external_dial='$ICBQicbq_phone_number[$r]!$ICBQicbq_phone_code[$r]!NO!NO!NO!!$secX!!!$dial_ingroup_cid!!$ICBQlead_id[$r]!!$ICBQgroup_id[$r]' where user='$VDADuser' and status IN('CLOSER','READY');"; + $Faffected_rows = $dbhA->do($stmtA); + + if ($Faffected_rows > 0) + { + ### clear the ringing hold on the ring agents + $stmtB = "UPDATE vicidial_live_agents SET ring_callerid='' where ring_callerid='$callerid';"; + $CRHaffected_rows = $dbhA->do($stmtB); + + $routed_user_list .= "'$VDADuser',"; + } + if ($DBX) {$agi_string = "$Faffected_rows|$stmtA\n$CRHaffected_rows|$stmtB|$routed_user_list|"; print "$agi_string\n";} + } + else + { + if ($DBX) {$agi_string = " SELECTED AGENT GRABBING ANOTHER CALL: $VDADuser $VACagent_grab"; print "$agi_string\n";} + } + } + else + { + $Faffected_rows=0; + } + $found_agents=$Faffected_rows; + + $stmtA = "UNLOCK TABLES;"; + my $LOCKaffected_rows = $dbhA->do($stmtA); + if ($found_agents > 0) + { + ### set the icbq record as SENT + $stmtC = "UPDATE vicidial_inbound_callback_queue SET icbq_status='SENDING' where icbq_id='$ICBQicbq_id[$r]';"; + $ICBQaffected_rows = $dbhA->do($stmtC); + + if ($DBX) {$agi_string = "$ICBQaffected_rows|$stmtC|"; print "$agi_string\n";} + } + } + if ($ICBQicbq_date_epoch[$r] < $expire_epoch) + { + ### set the icbq record as EXPIRED + $stmtC = "UPDATE vicidial_inbound_callback_queue SET icbq_status='EXPIRED' where icbq_id='$ICBQicbq_id[$r]' and icbq_status!='SENT';"; + $ICBQaffected_rowsEXP = $dbhA->do($stmtC); + + if ($DBX) {$agi_string = "$ICBQaffected_rowsEXP|$stmtC|"; print "$agi_string\n";} + } + } + else + { + if ($DBX) {print " Already looked at ICBQ Entry for this In-Group: $r|$ICBQicbq_id[$r]|$ICBQgroup_id[$r]|$ICBQcall_date[$r]| ($routed_ingroup_list)\n";} + } + $r++; + } + } + + $icbq_NEW_ct=0; + $stmtA = "SELECT count(*) from vicidial_inbound_callback_queue where icbq_status='NEW';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsICBQ=$sthA->rows; + if ($sthArowsICBQ > 0) + { + @aryA = $sthA->fetchrow_array; + $icbq_NEW_ct = $aryA[0]; + } + $sthA->finish(); + ########################################################## + ##### END check for inbound callback queue entries ##### + ########################################################## + + + + ########################################################## + ##### BEGIN check if active inbound callback queue records are able to be dialed right now ##### + ########################################################## + if ( ($stat_count =~ /00$|20$|40$|60$|80$/) || ($stat_count==1) || ($icbq_NEW_ct > 0) ) + { + $stmtA = "SELECT count(*) from vicidial_inbound_callback_queue where icbq_status IN('NEW','LIVE','NOCALLTIME');"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsICBQa=$sthA->rows; + if ($sthArowsICBQa > 0) + { + @aryA = $sthA->fetchrow_array; + $ICBQcountA = $aryA[0]; + } + $sthA->finish(); + + if ($DB) {print "\nActive Inbound Callback Queue Entries: |$ICBQcountA|$stmtA|\n";} + + if ($ICBQcountA > 0) + { + @ICBQicbq_id=@MT; + @ICBQlead_id=@MT; + @ICBQgroup_id=@MT; + @ICBQicbq_phone_number=@MT; + @ICBQicbq_phone_code=@MT; + @ICBQgmt_offset_now=@MT; + @ICBQicbq_status=@MT; + + $stmtA = "SELECT icbq_id,group_id,icbq_phone_number,icbq_phone_code,gmt_offset_now,icbq_status,lead_id from vicidial_inbound_callback_queue where icbq_status IN('NEW','LIVE','NOCALLTIME') order by group_id,call_date limit 1000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsICBQr=$sthA->rows; + $r=0; + while ($sthArowsICBQr > $r) + { + @aryA = $sthA->fetchrow_array; + $ICBQicbq_id[$r] = $aryA[0]; + $ICBQgroup_id[$r] = $aryA[1]; + $ICBQicbq_phone_number[$r] = $aryA[2]; + $ICBQicbq_phone_code[$r] = $aryA[3]; + $ICBQgmt_offset_now[$r] = $aryA[4]; + $ICBQicbq_status[$r] = $aryA[5]; + $ICBQlead_id[$r] = $aryA[6]; + + $r++; + } + $sthA->finish(); + + $r=0; + while ($sthArowsICBQr > $r) + { + if ($DBX) {print "Active Inbound Callback Queue Entry: $r|$ICBQicbq_id[$r]|$ICBQicbq_status[$r]|$ICBQgroup_id[$r]|$ICBQicbq_phone_number[$r]|$ICBQicbq_phone_code[$r]|$ICBQgmt_offset_now[$r]|\n";} + + ### Grab inbound group settings from the database + $stmtA = "SELECT icbq_call_time_id,icbq_dial_filter FROM vicidial_inbound_groups where group_id='$ICBQgroup_id[$r]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsIG=$sthA->rows; + if ($sthArowsIG > 0) + { + @aryA = $sthA->fetchrow_array; + $icbq_call_time_id = $aryA[0]; + $icbq_dial_filter = $aryA[1]; + } + $sthA->finish(); + + + ### BEGIN check of call time dialable for this record + $dialable=0; + $now_epoch = time(); + $GMT_now = ($now_epoch - (($LOCAL_GMT_OFF - $ICBQgmt_offset_now[$r]) * 3600)); + ($Gsec,$Gmin,$Ghour,$Gmday,$Gmon,$Gyear,$Gwday,$Gyday,$Gisdst) = localtime($GMT_now); + $Gmon++; + $Gyear = ($Gyear + 1900); + if ($Gmon < 10) {$Gmon = "0$Gmon";} + if ($Gmday < 10) {$Gmday = "0$Gmday";} + if ($Ghour < 10) {$Ghour = "0$Ghour";} + if ($Gmin < 10) {$Gmin = "0$Gmin";} + if ($Gsec < 10) {$Gsec = "0$Gsec";} + $Ghourmin = "$Ghour$Gmin"; + $YMD = "$Gyear-$Gmon-$Gmday"; + + $stmtA = "SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times,ct_holidays FROM vicidial_call_times where call_time_id='$icbq_call_time_id';"; + if ($DBX) {print " |$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $rec_count=0; + while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $Gct_default_start = $aryA[3]; + $Gct_default_stop = $aryA[4]; + $Gct_sunday_start = $aryA[5]; + $Gct_sunday_stop = $aryA[6]; + $Gct_monday_start = $aryA[7]; + $Gct_monday_stop = $aryA[8]; + $Gct_tuesday_start = $aryA[9]; + $Gct_tuesday_stop = $aryA[10]; + $Gct_wednesday_start = $aryA[11]; + $Gct_wednesday_stop = $aryA[12]; + $Gct_thursday_start = $aryA[13]; + $Gct_thursday_stop = $aryA[14]; + $Gct_friday_start = $aryA[15]; + $Gct_friday_stop = $aryA[16]; + $Gct_saturday_start = $aryA[17]; + $Gct_saturday_stop = $aryA[18]; + $Gct_state_call_times = $aryA[19]; + $Gct_holidays = $aryA[20]; + $rec_count++; + } + $sthA->finish(); + ### BEGIN Check for outbound call time holiday ### + $holiday_id = ''; + if (length($Gct_holidays)>2) + { + $Gct_holidaysSQL = $Gct_holidays; + $Gct_holidaysSQL =~ s/^\||\|$//gi; + $Gct_holidaysSQL =~ s/\|/','/gi; + $Gct_holidaysSQL = "'$Gct_holidaysSQL'"; + + $stmtC = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN($Gct_holidaysSQL) and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;"; + if ($DBX) {print " |$stmtC|\n";} + $sthC = $dbhA->prepare($stmtC) or die "preparing: ",$dbhA->errstr; + $sthC->execute or die "executing: $stmtC ", $dbhA->errstr; + $sthCrows=$sthC->rows; + if ($sthCrows > 0) + { + @aryC = $sthC->fetchrow_array; + $holiday_id = $aryC[0]; + $holiday_date = $aryC[1]; + $holiday_name = $aryC[2]; + if ( ($Gct_default_start < $aryC[3]) && ($Gct_default_stop > 0) ) {$Gct_default_start = $aryC[3];} + if ( ($Gct_default_stop > $aryC[4]) && ($Gct_default_stop > 0) ) {$Gct_default_stop = $aryC[4];} + if ( ($Gct_sunday_start < $aryC[3]) && ($Gct_sunday_stop > 0) ) {$Gct_sunday_start = $aryC[3];} + if ( ($Gct_sunday_stop > $aryC[4]) && ($Gct_sunday_stop > 0) ) {$Gct_sunday_stop = $aryC[4];} + if ( ($Gct_monday_start < $aryC[3]) && ($Gct_monday_stop > 0) ) {$Gct_monday_start = $aryC[3];} + if ( ($Gct_monday_stop > $aryC[4]) && ($Gct_monday_stop > 0) ) {$Gct_monday_stop = $aryC[4];} + if ( ($Gct_tuesday_start < $aryC[3]) && ($Gct_tuesday_stop > 0) ) {$Gct_tuesday_start = $aryC[3];} + if ( ($Gct_tuesday_stop > $aryC[4]) && ($Gct_tuesday_stop > 0) ) {$Gct_tuesday_stop = $aryC[4];} + if ( ($Gct_wednesday_start < $aryC[3]) && ($Gct_wednesday_stop > 0) ) {$Gct_wednesday_start = $aryC[3];} + if ( ($Gct_wednesday_stop > $aryC[4]) && ($Gct_wednesday_stop > 0) ) {$Gct_wednesday_stop = $aryC[4];} + if ( ($Gct_thursday_start < $aryC[3]) && ($Gct_thursday_stop > 0) ) {$Gct_thursday_start = $aryC[3];} + if ( ($Gct_thursday_stop > $aryC[4]) && ($Gct_thursday_stop > 0) ) {$Gct_thursday_stop = $aryC[4];} + if ( ($Gct_friday_start < $aryC[3]) && ($Gct_friday_stop > 0) ) {$Gct_friday_start = $aryC[3];} + if ( ($Gct_friday_stop > $aryC[4]) && ($Gct_friday_stop > 0) ) {$Gct_friday_stop = $aryC[4];} + if ( ($Gct_saturday_start < $aryC[3]) && ($Gct_saturday_stop > 0) ) {$Gct_saturday_start = $aryC[3];} + if ( ($Gct_saturday_stop > $aryC[4]) && ($Gct_saturday_stop > 0) ) {$Gct_saturday_stop = $aryC[4];} + if ($DBX) {print " CALL TIME HOLIDAY FOUND! $local_call_time[$i]|$holiday_id|$holiday_date|$holiday_name|$Gct_default_start|$Gct_default_stop|\n";} + } + $sthC->finish(); + } + ### END Check for outbound call time holiday ### + + if ($Gwday==0) #### Sunday local time + { + if (($Gct_sunday_start==0) && ($Gct_sunday_stop==0)) + { + if ( ($Ghourmin>=$Gct_default_start) && ($Ghourmin<$Gct_default_stop) ) + {$dialable++;} + } + else + { + if ( ($Ghourmin>=$Gct_sunday_start) && ($Ghourmin<$Gct_sunday_stop) ) + {$dialable++;} + } + } + if ($Gwday==1) #### Monday local time + { + if (($Gct_monday_start==0) && ($Gct_monday_stop==0)) + { + if ( ($Ghourmin>=$Gct_default_start) && ($Ghourmin<$Gct_default_stop) ) + {$dialable++;} + } + else + { + if ( ($Ghourmin>=$Gct_monday_start) && ($Ghourmin<$Gct_monday_stop) ) + {$dialable++;} + } + } + if ($Gwday==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) && ($Gct_tuesday_stop==0)) + { + if ( ($Ghourmin>=$Gct_default_start) && ($Ghourmin<$Gct_default_stop) ) + {$dialable++;} + } + else + { + if ( ($Ghourmin>=$Gct_tuesday_start) && ($Ghourmin<$Gct_tuesday_stop) ) + {$dialable++;} + } + } + if ($Gwday==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) && ($Gct_wednesday_stop==0)) + { + if ( ($Ghourmin>=$Gct_default_start) && ($Ghourmin<$Gct_default_stop) ) + {$dialable++;} + } + else + { + if ( ($Ghourmin>=$Gct_wednesday_start) && ($Ghourmin<$Gct_wednesday_stop) ) + {$dialable++;} + } + } + if ($Gwday==4) #### Thursday local time + { + if (($Gct_thursday_start==0) && ($Gct_thursday_stop==0)) + { + if ( ($Ghourmin>=$Gct_default_start) && ($Ghourmin<$Gct_default_stop) ) + {$dialable++;} + } + else + { + if ( ($Ghourmin>=$Gct_thursday_start) && ($Ghourmin<$Gct_thursday_stop) ) + {$dialable++;} + } + } + if ($Gwday==5) #### Friday local time + { + if (($Gct_friday_start==0) && ($Gct_friday_stop==0)) + { + if ( ($Ghourmin>=$Gct_default_start) && ($Ghourmin<$Gct_default_stop) ) + {$dialable++;} + } + else + { + if ( ($Ghourmin>=$Gct_friday_start) && ($Ghourmin<$Gct_friday_stop) ) + {$dialable++;} + } + } + if ($Gwday==6) #### Saturday local time + { + if (($Gct_saturday_start==0) && ($Gct_saturday_stop==0)) + { + if ( ($Ghourmin>=$Gct_default_start) && ($Ghourmin<$Gct_default_stop) ) + {$dialable++;} + } + else + { + if ( ($Ghourmin>=$Gct_saturday_start) && ($Ghourmin<$Gct_saturday_stop) ) + {$dialable++;} + } + } + if ($dialable > 0) + {$NEWstatus = 'LIVE';} + else + {$NEWstatus = 'NOCALLTIME';} + if ($DBX) {print " CALL TIME ICBQ DIALABLE CHECK $Ghourmin|$Gwday|$dialable|$NEWstatus|$Gct_default_start|$Gct_default_stop|\n";} + ### END check of call time dialable for this record + + + ### BEGIN check of DNC filtering for this record + $dnc_internal_match=0; + $dnc_campaign_match=0; + if ( ($icbq_dial_filter !~ /NONE/i) && (length($icbq_dial_filter) > 4) ) + { + $alt_areacode=''; + if ($icbq_dial_filter =~ /AREACODE/) + { + $alt_areacode = substr($ICBQicbq_phone_number[$r], 0, 3); + $alt_areacode .= "XXXXXXX"; + $alt_areacode = ",'$alt_areacode'"; + } + if ($icbq_dial_filter =~ /INTERNAL/) + { + $stmtA = "SELECT count(*) FROM vicidial_dnc where phone_number IN('$ICBQicbq_phone_number[$r]'$alt_areacode);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dnc_internal_match = $aryA[0]; + } + $sthA->finish(); + if ($DBX) {print " CALLBACK DIAL FILTER DNC INTERNAL: |$dnc_internal_match|$stmtA|\n";} + } + if ($icbq_dial_filter =~ /CAMPAIGN/) + { + $dnc_campaign_list=''; + $stmtA = "SELECT list_id FROM vicidial_list where lead_id='$ICBQlead_id[$r]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dnc_campaign_list = $aryA[0]; + } + $sthA->finish(); + + if (length($dnc_campaign_list) > 1) + { + $dnc_campaign=''; + $stmtA = "SELECT campaign_id FROM vicidial_lists where list_id='$dnc_campaign_list';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dnc_campaign = $aryA[0]; + } + $sthA->finish(); + + if (length($dnc_campaign) > 0) + { + $stmtA = "SELECT count(*) FROM vicidial_campaign_dnc where campaign_id='$dnc_campaign' and phone_number IN('$ICBQicbq_phone_number[$r]'$alt_areacode);"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $dnc_campaign_match = $aryA[0]; + } + $sthA->finish(); + } + } + if ($DBX) {print " CALLBACK DIAL FILTER DNC CAMPAIGN: |$dnc_campaign_match|$dnc_campaign_list|$stmtA|\n";} + } + + if ($dnc_internal_match > 0) + {$NEWstatus = 'DNCL';} + else + { + if ($dnc_campaign_match > 0) + {$NEWstatus = 'DNCC';} + } + } + ### END check of DNC filtering for this record + + + if ($ICBQicbq_status[$r] !~ /$NEWstatus/) + { + ### set the icbq record to new status + $stmtC = "UPDATE vicidial_inbound_callback_queue SET icbq_status='$NEWstatus' where icbq_id='$ICBQicbq_id[$r]' and icbq_status!='SENT';"; + $ICBQaffected_rowsNEW = $dbhA->do($stmtC); + + if ($DBX) {$agi_string = "$ICBQaffected_rowsNEW|$stmtC|"; print "$agi_string\n";} + } + $r++; + } + } + } + ########################################################## + ##### END check if active inbound callback queue records are able to be dialed right now ##### + ########################################################## + + + + ########################################################## + ##### BEGIN check for stuck SENDING inbound callback queue records ##### + ########################################################## + if ( ($stat_count =~ /00$|10$|20$|30$|40$|50$|60$|70$|80$|90$/) || ($stat_count==1) ) + { + $now_epoch = time(); + $BDtarget = ($now_epoch - 10); + ($Bsec,$Bmin,$Bhour,$Bmday,$Bmon,$Byear,$Bwday,$Byday,$Bisdst) = localtime($BDtarget); + $Byear = ($Byear + 1900); + $Bmon++; + if ($Bmon < 10) {$Bmon = "0$Bmon";} + if ($Bmday < 10) {$Bmday = "0$Bmday";} + if ($Bhour < 10) {$Bhour = "0$Bhour";} + if ($Bmin < 10) {$Bmin = "0$Bmin";} + if ($Bsec < 10) {$Bsec = "0$Bsec";} + $BDtsSQLdate = "$Byear-$Bmon-$Bmday $Bhour:$Bmin:$Bsec"; + + $ICBQcountS=0; + $stmtA = "SELECT count(*) from vicidial_inbound_callback_queue where icbq_status IN('SENDING') and modify_date < \"$BDtsSQLdate\";"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsICBQs=$sthA->rows; + if ($sthArowsICBQs > 0) + { + @aryA = $sthA->fetchrow_array; + $ICBQcountS = $aryA[0]; + } + $sthA->finish(); + + if ($DB) {print "\nOrphan SENDING Inbound Callback Queue Entries: |$ICBQcountS|$stmtA|\n";} + + if ($ICBQcountS > 0) + { + ### set the icbq record to new status + $stmtC = "UPDATE vicidial_inbound_callback_queue SET icbq_status='ORPHAN' where icbq_status IN('SENDING') and modify_date < \"$BDtsSQLdate\";"; + $ICBQaffected_rowsORPHAN = $dbhA->do($stmtC); + + if ($DBX) {$agi_string = "$ICBQaffected_rowsORPHAN|$stmtC|"; print "$agi_string\n";} + } + } + ########################################################## + ##### END check for stuck SENDING inbound callback queue records ##### + ########################################################## + + + usleep($CLIdelay*1000*1000); $stat_count++; diff --git a/agc_2-X/trunk/docs/AGENT_API.txt b/agc_2-X/trunk/docs/AGENT_API.txt index 7d3e3839..5e9f38ef 100644 --- a/agc_2-X/trunk/docs/AGENT_API.txt +++ b/agc_2-X/trunk/docs/AGENT_API.txt @@ -1,4 +1,4 @@ -AGENT API DOCUMENT Started: 2008-07-03 Updated: 2018-01-24 +AGENT API DOCUMENT Started: 2008-07-03 Updated: 2018-02-05 This document describes the functions of an API(Application Programming Interface) for the VICIDIAL Agent screen. This functionality will be rather limited at first @@ -253,6 +253,8 @@ alt_dial - OPTIONAL, if using lead_id you can set this flag to dial the ALT number or the ADDR3 number or SEARCH a phone_number within the lead if SEARCH is used and the phone_number is not matched with the lead's phone_number, alt_phone or address3 field an ERROR will be returned +dial_ingroup - + OPTIONAL, place the call as an in-group outbound calls EXAMPLE URLS: http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_dial&value=7275551212&phone_code=1&search=YES&preview=NO&focus=YES @@ -263,6 +265,7 @@ ERROR: external_dial not valid - 7275551212|1|YES|6666 ERROR: no user found - 6666 ERROR: agent_user is not logged in - 6666 ERROR: agent_user is not allowed to place manual dial calls - 6666 +ERROR: defined dial_ingroup not found - FAKE_INGROUP ERROR: caller_id_number from group_alias is not valid - 6666|TESTING|123 ERROR: group_alias is not valid - 6666|TESTING ERROR: vtiger callback activity does not exist in vtiger system - 12345 diff --git a/agc_2-X/trunk/docs/INBOUND_CALLBACK_QUEUE.txt b/agc_2-X/trunk/docs/INBOUND_CALLBACK_QUEUE.txt new file mode 100644 index 00000000..982a94df --- /dev/null +++ b/agc_2-X/trunk/docs/INBOUND_CALLBACK_QUEUE.txt @@ -0,0 +1,62 @@ +INBOUND CALLBACK QUEUE Started: 2018-01-15 Updated: 2018-02-06 + + +The purpose of this feature is to allow for callers to leave the queue and be called back when their place in line is reached. Included in this new set of features are the new Closed Time features to In-Groups that allow all callers in queue to be presented with a press-1 option when the in-group closing time for the day has been reached. Also, an in-group feature was added to manually force the end of all queueing of calls for an in-group for the rest of the day. + + +REQUIREMENTS: +- svn/trunk revision 2905 or higher +- VICIdial servers should be restarted after performing upgrade +- Campaign must be set to "In-Group Manual Dial" = 'MANUAL_DIAL' or 'BOTH' +- One of the following In-Group options should be set to "PRESS_CALLBACK_QUEUE": 'Wait Time Option(s)','Estimated Hold Time Option(s)','Closing Time Action' +- Read about all of the new settings below so you understand how this complex feature works! + + +The AST_VDadapt.pl script already runs on one server in a cluster, and it has had three new processes added to it to facilitate the monitoring of the callback queued entries, as well as initiating the triggering of the outbound calls once the callers' places in line have been reached. This process also will set the inbound callback queue records that are past the Callback Queue Expire Hours old to EXPIRED status, as well as verifying that the inbound callback queue records are within the set Callbacks Queue Call Time and are not within the Internal and/or Campaign DNC lists, as defined in the In-Group settings. + +The agi-VDAD_ALL_inbound.agi inbound call routing process has also been modified to allow for the insertion of inbound callback queue entries as well as the preservation of the place in line of the callers that choose to enter the callback queue. + +The ADMIN_keepalive_ALL.pl now has an added process to take care of archiving once per day the old inbound callback queue records that are of SENT, EXPIRED and ORPHAN status. This process will also reset the Closing-Time-Now-Trigger if it has been used during the previous day. + +The Real-Time report also has a new "Callback Queue Calls" top header in HTML view mode, so you can see how many LIVE entries there are in the inbound callback queue. If you want to see what in-groups those LIVE records are in, you can click on the "SHOW IN-GROUP STATS" link at the top of the Real-Time report. + + + + +Admin Web page changes: + +Added the following Inbound Group "Hold Time" and "Wait Time" options: + +The PRESS_CALLBACK_QUEUE option will preserve the caller place in line and will call the customer back when their place is the next one to go to an agent, this inbound callback queue entry will last until the call is placed back to the customer or as long as the Callback Queue Expire Hours setting below. + + + +Added the following new Inbound Group Settings: + +Callback Queue Expire Hours - If a Hold Time or Wait Time Option is set to PRESS_CALLBACK_QUEUE, this is the maximum number of hours that an entry can stay in the inbound callback queue before it is removed without dialing it. Default is 96 hours. + +Callback Queue Call Time - For any inbound callback queue outbound calls to be placed, this is the local call time used to determine if the number can be dialed right now or not. + +Callback Queue Dial Filter - This option allows you to remove DNC numbers from your Callback Queue. You can use any combination of: Internal DNC List, Campaign DNC List tied to campaign of the list where the lead is, and Areacode DNC wildcard + +Closing Time Action - This allows you to specify the routing of the call if the closing time of the in-group is reached while the call is still waiting for an agent, Closing time is the end of the Call Time that is defined for this in-group. Default is DISABLED. If one of the PRESS_ options is selected, it will play the Press Filename defined below and give the customer the option to press 1 on their phone to leave the queue and run the selected option. The PRESS_CALLBACK_QUEUE option will preserve the caller place in line and will call the customer back when their place is the next one to go to an agent, this inbound callback queue entry will last until the call is placed back to the customer or as long as the Callback Queue Expire Hours setting above. + +Closing Time Now Trigger - If Closing Time Action is enabled, this flag allows you to send all customers waiting in the queue to the Closing Time Action as defined above, before the actual closing time is reached for the day. + +Closing Time Press Filename - If Closing Time Option is set to one of the PRESS_ options, this is the filename prompt that is played if the in-group has reached the closing time for the day. It is very important that this audio file is 10 seconds or less or there will be problems. + +Closing Time End Filename - If Closing Time Option is set to one of the PRESS_ options or PRESS_CID_CALLBACK or PRESS_CALLBACK_QUEUE, this is the filename prompt that is played after the customer has pressed 1 or the call has been added to the callback list or queue. + +Closing Time Option Lead Reset - This option if set to Y, will set the lead called-since-last-reset field to N when the Closing Time Option is triggered and the call is sent to an action like Message, Voicemail or Hangup. Default is N for disabled. + +Closing Time Option Extension - If Closing Time Option is set to EXTENSION, this is the dialplan extension that the call will be sent to if the Closing Time is reached. For AGENTDIRECT in-groups, you can put AGENTEXT in this field and the system will look up the user custom five field and send the call to that dialplan number. + +Closing Time Option Callmenu - If Closing Time Option is set to CALL_MENU, this is the Call Menu that the call will be sent to if the Closing Time is reached. + +Closing Time Option Voicemail - If Closing Time Option is set to VOICEMAIL, this is the voicemail box that the call will be sent to if the Closing Time is reached. In an AGENTDIRECT in-group, setting this to AGENTVMAIL will select the User voicemail ID to use. + +Closing Time Option Transfer In-Group - If Closing Time Option is set to IN_GROUP, this is the inbound group that the call will be sent to if the Closing Time is reached. + +Closing Time Option Callback List ID - If Closing Time Option is set to CALLERID_CALLBACK, this is the List ID the call is added to as a new lead if the Closing Time is reached. + + diff --git a/agc_2-X/trunk/docs/VICIDIAL_statuses.txt b/agc_2-X/trunk/docs/VICIDIAL_statuses.txt index 93d527e5..83979244 100644 --- a/agc_2-X/trunk/docs/VICIDIAL_statuses.txt +++ b/agc_2-X/trunk/docs/VICIDIAL_statuses.txt @@ -74,3 +74,4 @@ UNKXFR - CPD Unknown result Transfer to Call Menu or In-Group UNKAM - CPD Unknown call sent to a message to be played UNKAL - CPD Unknown call sent to a message and message has been played NVAINS - Default status for new inserted lead on phone NVA call +CLOSOP - In-Group Closing-Time option selected 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 4d67ffc0..368bb45b 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -510,7 +510,7 @@ processed ENUM('Y','N'), queue_seconds DECIMAL(7,2) default '0', user_group VARCHAR(20), xfercallid INT(9) UNSIGNED, -term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','HOLDRECALLXFER','HOLDTIME','NOAGENT','NONE','MAXCALLS','ACFILTER') default 'NONE', +term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','HOLDRECALLXFER','HOLDTIME','NOAGENT','NONE','MAXCALLS','ACFILTER','CLOSETIME') default 'NONE', uniqueid VARCHAR(20) NOT NULL default '', agent_only VARCHAR(20) default '', queue_position SMALLINT(4) UNSIGNED default '1', @@ -1237,7 +1237,21 @@ inbound_survey ENUM('DISABLED','ENABLED') default 'DISABLED', inbound_survey_filename TEXT, inbound_survey_accept_digit VARCHAR(1) default '', inbound_survey_question_filename TEXT, -inbound_survey_callmenu TEXT +inbound_survey_callmenu TEXT, +icbq_expiration_hours SMALLINT(5) default '96', +closing_time_action VARCHAR(30) default 'DISABLED', +closing_time_now_trigger ENUM('Y','N') default 'N', +closing_time_filename TEXT, +closing_time_end_filename TEXT, +closing_time_lead_reset ENUM('Y','N') default 'N', +closing_time_option_exten VARCHAR(20) default '8300', +closing_time_option_callmenu VARCHAR(50) default '', +closing_time_option_voicemail VARCHAR(20) default '', +closing_time_option_xfer_group VARCHAR(20) default '---NONE---', +closing_time_option_callback_list_id BIGINT(14) UNSIGNED default '999', +add_lead_timezone ENUM('SERVER','PHONE_CODE_AREACODE') default 'SERVER', +icbq_call_time_id VARCHAR(20) default '24hours', +icbq_dial_filter VARCHAR(50) default 'NONE' ) ENGINE=MyISAM; CREATE TABLE vicidial_stations ( @@ -3851,6 +3865,22 @@ index (serial_id), index (run_time) ) ENGINE=MyISAM; +CREATE TABLE vicidial_inbound_callback_queue ( +icbq_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +icbq_date DATETIME, +icbq_status VARCHAR(10), +icbq_phone_number VARCHAR(20), +icbq_phone_code VARCHAR(10), +icbq_nextday_choice ENUM('Y','N','U') default 'U', +lead_id INT(9) UNSIGNED NOT NULL, +group_id VARCHAR(20) NOT NULL, +queue_priority TINYINT(2) default '0', +call_date DATETIME, +gmt_offset_now DECIMAL(4,2) DEFAULT '0.00', +modify_date TIMESTAMP, +index (icbq_status) +) ENGINE=MyISAM; + ALTER TABLE vicidial_email_list MODIFY message text character set utf8; @@ -4056,6 +4086,9 @@ ALTER TABLE user_call_log_archive MODIFY user_call_log_id INT(9) UNSIGNED NOT NU CREATE TABLE vicidial_inbound_survey_log_archive LIKE vicidial_inbound_survey_log; CREATE UNIQUE INDEX visla_key on vicidial_inbound_survey_log_archive(uniqueid, call_date, campaign_id, lead_id); +CREATE TABLE vicidial_inbound_callback_queue_archive LIKE vicidial_inbound_callback_queue; +ALTER TABLE vicidial_inbound_callback_queue_archive MODIFY icbq_id INT(9) UNSIGNED NOT NULL; + GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; @@ -4132,4 +4165,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='1533',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1534',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 d30d0263..b12a58ef 100644 --- a/agc_2-X/trunk/extras/upgrade_2.14.sql +++ b/agc_2-X/trunk/extras/upgrade_2.14.sql @@ -70,8 +70,8 @@ areacode VARCHAR(6) NOT NULL, index(group_id) ) ENGINE=MyISAM; -ALTER TABLE vicidial_closer_log MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','HOLDRECALLXFER','HOLDTIME','NOAGENT','NONE','MAXCALLS','ACFILTER') default 'NONE'; -ALTER TABLE vicidial_closer_log_archive MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','HOLDRECALLXFER','HOLDTIME','NOAGENT','NONE','MAXCALLS','ACFILTER') default 'NONE'; +ALTER TABLE vicidial_closer_log MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','HOLDRECALLXFER','HOLDTIME','NOAGENT','NONE','MAXCALLS','ACFILTER','CLOSETIME') default 'NONE'; +ALTER TABLE vicidial_closer_log_archive MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','HOLDRECALLXFER','HOLDTIME','NOAGENT','NONE','MAXCALLS','ACFILTER','CLOSETIME') default 'NONE'; UPDATE system_settings SET db_schema_version='1490',db_schema_update_date=NOW() where db_schema_version < 1490; @@ -501,3 +501,42 @@ ALTER TABLE vicidial_campaigns ADD inbound_no_agents_no_dial_threshold SMALLINT( ALTER TABLE vicidial_settings_containers MODIFY container_type VARCHAR(40) default 'OTHER'; UPDATE system_settings SET db_schema_version='1533',db_schema_update_date=NOW() where db_schema_version < 1533; + +CREATE TABLE vicidial_inbound_callback_queue ( +icbq_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +icbq_date DATETIME, +icbq_status VARCHAR(10), +icbq_phone_number VARCHAR(20), +icbq_phone_code VARCHAR(10), +icbq_nextday_choice ENUM('Y','N','U') default 'U', +lead_id INT(9) UNSIGNED NOT NULL, +group_id VARCHAR(20) NOT NULL, +queue_priority TINYINT(2) default '0', +call_date DATETIME, +gmt_offset_now DECIMAL(4,2) DEFAULT '0.00', +modify_date TIMESTAMP, +index (icbq_status) +) ENGINE=MyISAM; + +CREATE TABLE vicidial_inbound_callback_queue_archive LIKE vicidial_inbound_callback_queue; +ALTER TABLE vicidial_inbound_callback_queue_archive MODIFY icbq_id INT(9) UNSIGNED NOT NULL; + +ALTER TABLE vicidial_inbound_groups ADD icbq_expiration_hours SMALLINT(5) default '96'; +ALTER TABLE vicidial_inbound_groups ADD closing_time_action VARCHAR(30) default 'DISABLED'; +ALTER TABLE vicidial_inbound_groups ADD closing_time_now_trigger ENUM('Y','N') default 'N'; +ALTER TABLE vicidial_inbound_groups ADD closing_time_filename TEXT; +ALTER TABLE vicidial_inbound_groups ADD closing_time_end_filename TEXT; +ALTER TABLE vicidial_inbound_groups ADD closing_time_lead_reset ENUM('Y','N') default 'N'; +ALTER TABLE vicidial_inbound_groups ADD closing_time_option_exten VARCHAR(20) default '8300'; +ALTER TABLE vicidial_inbound_groups ADD closing_time_option_callmenu VARCHAR(50) default ''; +ALTER TABLE vicidial_inbound_groups ADD closing_time_option_voicemail VARCHAR(20) default ''; +ALTER TABLE vicidial_inbound_groups ADD closing_time_option_xfer_group VARCHAR(20) default '---NONE---'; +ALTER TABLE vicidial_inbound_groups ADD closing_time_option_callback_list_id BIGINT(14) UNSIGNED default '999'; +ALTER TABLE vicidial_inbound_groups ADD add_lead_timezone ENUM('SERVER','PHONE_CODE_AREACODE') default 'SERVER'; +ALTER TABLE vicidial_inbound_groups ADD icbq_call_time_id VARCHAR(20) default '24hours'; +ALTER TABLE vicidial_inbound_groups ADD icbq_dial_filter VARCHAR(50) default 'NONE'; + +ALTER TABLE vicidial_closer_log MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','HOLDRECALLXFER','HOLDTIME','NOAGENT','NONE','MAXCALLS','ACFILTER','CLOSETIME') default 'NONE'; +ALTER TABLE vicidial_closer_log_archive MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','HOLDRECALLXFER','HOLDTIME','NOAGENT','NONE','MAXCALLS','ACFILTER','CLOSETIME') default 'NONE'; + +UPDATE system_settings SET db_schema_version='1534',db_schema_update_date=NOW() where db_schema_version < 1534; diff --git a/agc_2-X/trunk/www/agc/api.php b/agc_2-X/trunk/www/agc/api.php index d33f4698..1ddc0766 100644 --- a/agc_2-X/trunk/www/agc/api.php +++ b/agc_2-X/trunk/www/agc/api.php @@ -92,10 +92,11 @@ # 170527-2250 - Fix for rare inbound logging issue #1017, Added variable filtering # 170815-1314 - Added HTTP error code 418 # 180124-1608 - Added calls_in_queue_count function +# 180204-2350 - Added dial_ingroup external_dial option # -$version = '2.14-58'; -$build = '180124-1608'; +$version = '2.14-59'; +$build = '180204-2350'; $startMS = microtime(); @@ -234,6 +235,8 @@ if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} if (isset($_GET["agent_debug"])) {$agent_debug=$_GET["agent_debug"];} elseif (isset($_POST["agent_debug"])) {$agent_debug=$_POST["agent_debug"];} +if (isset($_GET["dial_ingroup"])) {$dial_ingroup=$_GET["dial_ingroup"];} + elseif (isset($_POST["dial_ingroup"])) {$dial_ingroup=$_POST["dial_ingroup"];} header ("Content-type: text/html; charset=utf-8"); @@ -357,6 +360,7 @@ if ($non_latin < 1) $postal_code = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$postal_code); $agent_debug = preg_replace("/[^- \.\:\|\_0-9a-zA-Z]/","",$agent_debug); $status = preg_replace("/[^-\_0-9a-zA-Z]/","",$status); + $dial_ingroup = preg_replace("/[^-\_0-9a-zA-Z]/","",$dial_ingroup); } else { @@ -1618,7 +1622,19 @@ if ($function == 'external_dial') { $agent_ready=1; } - if ($agent_ready > 0) + $stmt = "select count(*) from vicidial_inbound_groups where group_id='$dial_ingroup';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + if ($row[0] < 1) + { + $result = _QXZ("ERROR"); + $result_reason = _QXZ("defined dial_ingroup not found"); + echo "$result: $result_reason - $dial_ingroup\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + $dial_ingroup=''; + } + if ( ($agent_ready > 0) or (strlen($dial_ingroup)>0) ) { $stmt = "select count(*) from vicidial_users where user='$agent_user' and agentcall_manual='1';"; if ($DB) {echo "$stmt\n";} @@ -1829,7 +1845,7 @@ if ($function == 'external_dial') ### If no errors, run the update to place the call ### if ($api_manual_dial=='STANDARD') { - $stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id!$lead_id!$alt_dial' where user='$agent_user';"; + $stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id!$lead_id!$alt_dial!$dial_ingroup' where user='$agent_user';"; $success=1; } else @@ -1840,7 +1856,7 @@ if ($function == 'external_dial') $row=mysqli_fetch_row($rslt); if ($row[0] < 1) { - $stmt="INSERT INTO vicidial_manual_dial_queue set user='$agent_user',phone_number='$value',entry_time=NOW(),status='READY',external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id!$lead_id!$alt_dial';"; + $stmt="INSERT INTO vicidial_manual_dial_queue set user='$agent_user',phone_number='$value',entry_time=NOW(),status='READY',external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id!$lead_id!$alt_dial!$dial_ingroup';"; $success=1; } else 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 0ff6eaf1..99e574fd 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -445,13 +445,14 @@ # 171224-1222 - Added List default_xfer_group override # 180108-2048 - Added next_dial_my_callbacks feature # 180131-1116 - Fixed ereg issue +# 180204-1651 - Added update for inbound callback queue functionality # -$version = '2.14-339'; -$build = '180131-1116'; +$version = '2.14-340'; +$build = '180204-1651'; $php_script = 'vdc_db_query.php'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=708; +$mysql_log_count=709; $one_mysql_log=0; $DB=0; $VD_login=0; @@ -7897,6 +7898,12 @@ if ($ACTION == 'VDADcheckINCOMING') $retry_count++; } + ### update vicidial_inbound_callback_queue record to SENT if one exists in SENDING state for this lead_id + $stmt = "UPDATE vicidial_inbound_callback_queue set icbq_status='SENT' where lead_id='$lead_id' and icbq_status='SENDING' order by icbq_date limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00709',$user,$server_ip,$session_name,$one_mysql_log);} + $stmt = "UPDATE vicidial_campaign_agents set calls_today='$calls_today' where user='$user' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); @@ -9368,7 +9375,7 @@ if ($ACTION == 'VDADcheckINCOMINGother') $row=mysqli_fetch_row($rslt); $get_call_launch = $row[0]; } - if (!preg_match("/EMAIL|SCRIPT/",$get_call_launch)) + if (!preg_match("/EMAIL|SCRIPT|WEBFORM/",$get_call_launch)) {$get_call_launch='EMAIL';} # Change to better suit the output processed by the agent interface echo "1\n" . $lead_id . '|'.$uniqueid.'|' . $email_from . '|' . $get_call_launch . '|' . $email_row_id . '|' . $email_row_id . "|EMAIL\n"; # VDIC_data_VDAC diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 8b9b61bc..3f4d3dd8 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -577,10 +577,11 @@ # 171224-1244 - Added List default_xfer_group override # 180105-1543 - Small javascript fixes, and more debug logging, change to 2018 # 180126-0855 - Added more agent api pause debug output +# 180204-2304 - Added API dial_ingroup option to external_dial # -$version = '2.14-547c'; -$build = '180126-0855'; +$version = '2.14-548c'; +$build = '180204-2304'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=87; $one_mysql_log=0; @@ -5875,6 +5876,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) vtiger_callback_id = APIDiaL_array_detail[10]; document.vicidial_form.MDLeadID.value = APIDiaL_array_detail[11]; document.vicidial_form.MDType.value = APIDiaL_array_detail[12]; + active_ingroup_dial = APIDiaL_array_detail[13]; // alert(APIDiaL_array_detail[1] + "-----" + APIDiaL + "-----" + document.vicidial_form.MDDiaLCodE.value + "-----" + document.vicidial_form.phone_code.value); if (APIDiaL_array_detail[2] == 'YES') // lookup lead in system @@ -11094,7 +11096,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) VDIC_web_form_address_three = VICIDiaL_web_form_address_three; CalL_AutO_LauncH = VDIC_data_VDAC[3]; if( document.images ) { document.images['livecall'].src = image_livecall_ON.src;} - if ( (CalL_AutO_LauncH=='EMAIL') || (CalL_AutO_LauncH=='SCRIPT') ) + if ( (CalL_AutO_LauncH=='EMAIL') || (CalL_AutO_LauncH=='SCRIPT') || (CalL_AutO_LauncH=='WEBFORM') ) { document.vicidial_form.email_row_id.value= VDIC_data_VDAC[4]; document.getElementById("EmailAudioAlertFile").play(); diff --git a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php index 87eec225..48a2a95c 100644 --- a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php +++ b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2018 Matt Florell LICENSE: AGPLv2 # # live real-time stats for the VICIDIAL Auto-Dialer all servers # @@ -107,10 +107,11 @@ # 170321-1145 - Added pause code time limits colors # 170409-1556 - Added IP List validation code # 170615-0023 - Added DIAL status for manual dial agent calls that have not been answered +# 180204-1538 - Added display of LIVE Inbound Callback Queue Calls # -$version = '2.14-95'; -$build = '170615-0023'; +$version = '2.14-96'; +$build = '180204-1538'; header ("Content-type: text/html; charset=utf-8"); @@ -1270,10 +1271,8 @@ if ($droppedOFtotal > 0) ##### SHOW IN-GROUP STATS OR INBOUND ONLY WITH VIEW-MORE ### if ( ($ALLINGROUPstats > 0) or ( (preg_match('/O/',$with_inbound)) and ($adastats > 1) ) ) { - $stmtB="SELECT calls_today,drops_today,$answers_singleSQL,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4,hold_sec_stat_one,hold_sec_stat_two,hold_sec_answer_calls,hold_sec_drop_calls,hold_sec_queue_calls,campaign_id from vicidial_campaign_stats where campaign_id IN ($closer_campaignsSQL) order by campaign_id;"; - + $stmtB="SELECT campaign_id from vicidial_campaign_stats where campaign_id IN ($closer_campaignsSQL) order by campaign_id;"; if ($DB > 0) {echo "\n|$stmtB|\n";} - $r=0; $rslt=mysql_to_mysqli($stmtB, $link); $ingroups_to_print = mysqli_num_rows($rslt); @@ -1282,23 +1281,41 @@ if ( ($ALLINGROUPstats > 0) or ( (preg_match('/O/',$with_inbound)) and ($adastat while ($ingroups_to_print > $r) { $row=mysqli_fetch_row($rslt); - $callsTODAY = $row[0]; - $dropsTODAY = $row[1]; - $answersTODAY = $row[2]; - $VSCcat1 = $row[3]; - $VSCcat1tally = $row[4]; - $VSCcat2 = $row[5]; - $VSCcat2tally = $row[6]; - $VSCcat3 = $row[7]; - $VSCcat3tally = $row[8]; - $VSCcat4 = $row[9]; - $VSCcat4tally = $row[10]; - $hold_sec_stat_one = $row[11]; - $hold_sec_stat_two = $row[12]; - $hold_sec_answer_calls = $row[13]; - $hold_sec_drop_calls = $row[14]; - $hold_sec_queue_calls = $row[15]; - $ingroupdetail = $row[16]; + $ARYingroupdetail[$r] = $row[0]; + $r++; + } + + $r=0; + while ($ingroups_to_print > $r) + { + $stmtB="SELECT calls_today,drops_today,$answers_singleSQL,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4,hold_sec_stat_one,hold_sec_stat_two,hold_sec_answer_calls,hold_sec_drop_calls,hold_sec_queue_calls,campaign_id from vicidial_campaign_stats where campaign_id='$ARYingroupdetail[$r]';"; + + if ($DB > 0) {echo "\n|$stmtB|\n";} + + $rslt=mysql_to_mysqli($stmtB, $link); + $ingroup_to_print = mysqli_num_rows($rslt); + if ($ingroup_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + $callsTODAY = $row[0]; + $dropsTODAY = $row[1]; + $answersTODAY = $row[2]; + $VSCcat1 = $row[3]; + $VSCcat1tally = $row[4]; + $VSCcat2 = $row[5]; + $VSCcat2tally = $row[6]; + $VSCcat3 = $row[7]; + $VSCcat3tally = $row[8]; + $VSCcat4 = $row[9]; + $VSCcat4tally = $row[10]; + $hold_sec_stat_one = $row[11]; + $hold_sec_stat_two = $row[12]; + $hold_sec_answer_calls = $row[13]; + $hold_sec_drop_calls = $row[14]; + $hold_sec_queue_calls = $row[15]; + $ingroupdetail = $row[16]; + } + $drpctTODAY = ( MathZDC($dropsTODAY, $answersTODAY) * 100); $drpctTODAY = round($drpctTODAY, 2); $drpctTODAY = sprintf("%01.2f", $drpctTODAY); @@ -1321,6 +1338,19 @@ if ( ($ALLINGROUPstats > 0) or ( (preg_match('/O/',$with_inbound)) and ($adastat $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); + $Dicbq_stmt="SELECT count(*) from vicidial_inbound_callback_queue where icbq_status='LIVE' and group_id='$ARYingroupdetail[$r]';"; + $Dicbq_rslt=mysql_to_mysqli($Dicbq_stmt, $link); + $Dicbq_ct = mysqli_num_rows($Dicbq_rslt); + $Dicbq_live=0; + if ($Dicbq_ct > 0) + { + $Dicbq_ARY=mysqli_fetch_row($Dicbq_rslt); + if ($Dicbq_ARY[0] > 0) + { + $Dicbq_live = "$Dicbq_ARY[0]"; + } + } + if (preg_match('/0$|2$|4$|6$|8$/',$r)) {$bgcolor='#E6E6E6';} else {$bgcolor='white';} $ingroup_detail .= ""; @@ -1329,18 +1359,21 @@ if ( ($ALLINGROUPstats > 0) or ( (preg_match('/O/',$with_inbound)) and ($adastat $ingroup_detail .= ""._QXZ("CALLS TODAY").":  $callsTODAY    "; $ingroup_detail .= ""._QXZ("TMA")." 1  $PCThold_sec_stat_one%     "; $ingroup_detail .= ""._QXZ("Average Hold time for Answered Calls").":  $AVGhold_sec_answer_calls   "; + $ingroup_detail .= "   "._QXZ("LIVE Inbound Callback Queue Calls").":  $Dicbq_live   "; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""._QXZ("DROPS TODAY").":  $dropsTODAY    "; $ingroup_detail .= ""._QXZ("TMA")." 2:  $PCThold_sec_stat_two%     "; $ingroup_detail .= ""._QXZ("Average Hold time for Dropped Calls").":  $AVGhold_sec_drop_calls   "; + $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""; $ingroup_detail .= ""._QXZ("ANSWERS TODAY").":  $answersTODAY    "; $ingroup_detail .= ""._QXZ("DROP PERCENT").":  $drpctTODAY%    "; $ingroup_detail .= ""._QXZ("Average Hold time for All Calls").":  $AVGhold_sec_queue_calls   "; + $ingroup_detail .= ""; $ingroup_detail .= ""; $r++; @@ -2338,6 +2371,14 @@ if ($allow_chats) } } +$icbq_stmt="SELECT count(*) from vicidial_inbound_callback_queue where icbq_status='LIVE' and group_id IN($closer_campaignsSQL);"; +$icbq_rslt=mysql_to_mysqli($icbq_stmt, $link); +$icbq_ct = mysqli_num_rows($icbq_rslt); +if ($icbq_ct > 0) + { + $icbq_ARY=mysqli_fetch_row($icbq_rslt); + $icbq_live = $icbq_ARY[0]; + } ##### BEGIN HTML output for calls ##### if ( ($report_display_type=='HTML') or ($report_display_type=='WALL_2') ) @@ -2378,8 +2419,13 @@ if ( ($report_display_type=='HTML') or ($report_display_type=='WALL_2') ) echo " "; echo " "; } - echo " "; - echo " "; +# echo " "; + + + echo "   "; + echo ""; + echo ""._QXZ("callback queue calls").""; + echo ""; echo ""; echo "$out_total"; @@ -2406,7 +2452,7 @@ if ( ($report_display_type=='HTML') or ($report_display_type=='WALL_2') ) { echo " "; } -# echo " "; + echo "$icbq_live"; echo ""; echo " "; # echo ""; diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index fa0c054d..0c4f54fe 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -2305,6 +2305,34 @@ if (isset($_GET["inbound_no_agents_no_dial_container"])) {$inbound_no_agents_n elseif (isset($_POST["inbound_no_agents_no_dial_container"])) {$inbound_no_agents_no_dial_container=$_POST["inbound_no_agents_no_dial_container"];} if (isset($_GET["inbound_no_agents_no_dial_threshold"])) {$inbound_no_agents_no_dial_threshold=$_GET["inbound_no_agents_no_dial_threshold"];} elseif (isset($_POST["inbound_no_agents_no_dial_threshold"])) {$inbound_no_agents_no_dial_threshold=$_POST["inbound_no_agents_no_dial_threshold"];} +if (isset($_GET["icbq_expiration_hours"])) {$icbq_expiration_hours=$_GET["icbq_expiration_hours"];} + elseif (isset($_POST["icbq_expiration_hours"])) {$icbq_expiration_hours=$_POST["icbq_expiration_hours"];} +if (isset($_GET["closing_time_action"])) {$closing_time_action=$_GET["closing_time_action"];} + elseif (isset($_POST["closing_time_action"])) {$closing_time_action=$_POST["closing_time_action"];} +if (isset($_GET["closing_time_now_trigger"])) {$closing_time_now_trigger=$_GET["closing_time_now_trigger"];} + elseif (isset($_POST["closing_time_now_trigger"])) {$closing_time_now_trigger=$_POST["closing_time_now_trigger"];} +if (isset($_GET["closing_time_filename"])) {$closing_time_filename=$_GET["closing_time_filename"];} + elseif (isset($_POST["closing_time_filename"])) {$closing_time_filename=$_POST["closing_time_filename"];} +if (isset($_GET["closing_time_end_filename"])) {$closing_time_end_filename=$_GET["closing_time_end_filename"];} + elseif (isset($_POST["closing_time_end_filename"])) {$closing_time_end_filename=$_POST["closing_time_end_filename"];} +if (isset($_GET["closing_time_lead_reset"])) {$closing_time_lead_reset=$_GET["closing_time_lead_reset"];} + elseif (isset($_POST["closing_time_lead_reset"])) {$closing_time_lead_reset=$_POST["closing_time_lead_reset"];} +if (isset($_GET["closing_time_option_exten"])) {$closing_time_option_exten=$_GET["closing_time_option_exten"];} + elseif (isset($_POST["closing_time_option_exten"])) {$closing_time_option_exten=$_POST["closing_time_option_exten"];} +if (isset($_GET["closing_time_option_callmenu"])) {$closing_time_option_callmenu=$_GET["closing_time_option_callmenu"];} + elseif (isset($_POST["closing_time_option_callmenu"])) {$closing_time_option_callmenu=$_POST["closing_time_option_callmenu"];} +if (isset($_GET["closing_time_option_voicemail"])) {$closing_time_option_voicemail=$_GET["closing_time_option_voicemail"];} + elseif (isset($_POST["closing_time_option_voicemail"])) {$closing_time_option_voicemail=$_POST["closing_time_option_voicemail"];} +if (isset($_GET["closing_time_option_xfer_group"])) {$closing_time_option_xfer_group=$_GET["closing_time_option_xfer_group"];} + elseif (isset($_POST["closing_time_option_xfer_group"])) {$closing_time_option_xfer_group=$_POST["closing_time_option_xfer_group"];} +if (isset($_GET["closing_time_option_callback_list_id"])) {$closing_time_option_callback_list_id=$_GET["closing_time_option_callback_list_id"];} + elseif (isset($_POST["closing_time_option_callback_list_id"])) {$closing_time_option_callback_list_id=$_POST["closing_time_option_callback_list_id"];} +if (isset($_GET["icbq_call_time_id"])) {$icbq_call_time_id=$_GET["icbq_call_time_id"];} + elseif (isset($_POST["icbq_call_time_id"])) {$icbq_call_time_id=$_POST["icbq_call_time_id"];} +if (isset($_GET["add_lead_timezone"])) {$add_lead_timezone=$_GET["add_lead_timezone"];} + elseif (isset($_POST["add_lead_timezone"])) {$add_lead_timezone=$_POST["add_lead_timezone"];} +if (isset($_GET["icbq_dial_filter"])) {$icbq_dial_filter=$_GET["icbq_dial_filter"];} + elseif (isset($_POST["icbq_dial_filter"])) {$icbq_dial_filter=$_POST["icbq_dial_filter"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -2724,6 +2752,7 @@ if ($non_latin < 1) $allow_manage_active_lists = preg_replace('/[^0-9]/','',$allow_manage_active_lists); $expired_lists_inactive = preg_replace('/[^0-9]/','',$expired_lists_inactive); $did_system_filter = preg_replace('/[^0-9]/','',$did_system_filter); + $icbq_expiration_hours = preg_replace('/[^0-9]/','',$icbq_expiration_hours); $user_new_lead_limit = preg_replace('/[^-0-9]/','',$user_new_lead_limit); $drop_call_seconds = preg_replace('/[^-0-9]/','',$drop_call_seconds); @@ -2853,13 +2882,14 @@ if ($non_latin < 1) $three_way_record_stop = preg_replace('/[^NY]/','',$three_way_record_stop); $hangup_xfer_record_start = preg_replace('/[^NY]/','',$hangup_xfer_record_start); $scheduled_callbacks_email_alert = preg_replace('/[^NY]/','',$scheduled_callbacks_email_alert); + $closing_time_now_trigger = preg_replace('/[^NY]/','',$closing_time_now_trigger); + $closing_time_lead_reset = preg_replace('/[^NY]/','',$closing_time_lead_reset); $qc_enabled = preg_replace('/[^0-9NY]/','',$qc_enabled); $active = preg_replace('/[^0-9NY]/','',$active); $ofcom_uk_drop_calc = preg_replace('/[^0-9NY]/','',$ofcom_uk_drop_calc); $agent_xfer_park_3way = preg_replace('/[^0-9NY]/','',$agent_xfer_park_3way); - ### ALPHA-NUMERIC ONLY ### $script_id = preg_replace('/[^0-9a-zA-Z]/','',$script_id); $agent_script_override = preg_replace('/[^0-9a-zA-Z]/','',$agent_script_override); @@ -3238,6 +3268,14 @@ if ($non_latin < 1) $next_dial_my_callbacks = preg_replace('/[^-_0-9a-zA-Z]/','',$next_dial_my_callbacks); $anyone_callback_inactive_lists = preg_replace('/[^-_0-9a-zA-Z]/','',$anyone_callback_inactive_lists); $inbound_no_agents_no_dial_container = preg_replace('/[^-_0-9a-zA-Z]/','',$inbound_no_agents_no_dial_container); + $closing_time_action = preg_replace('/[^-_0-9a-zA-Z]/','',$closing_time_action); + $closing_time_option_exten = preg_replace('/[^-_0-9a-zA-Z]/','',$closing_time_option_exten); + $closing_time_option_callmenu = preg_replace('/[^-_0-9a-zA-Z]/','',$closing_time_option_callmenu); + $closing_time_option_voicemail = preg_replace('/[^-_0-9a-zA-Z]/','',$closing_time_option_voicemail); + $closing_time_option_callback_list_id = preg_replace('/[^-_0-9a-zA-Z]/','',$closing_time_option_callback_list_id); + $icbq_call_time_id = preg_replace('/[^-_0-9a-zA-Z]/','',$icbq_call_time_id); + $add_lead_timezone = preg_replace('/[^-_0-9a-zA-Z]/','',$add_lead_timezone); + $icbq_dial_filter = preg_replace('/[^-_0-9a-zA-Z]/','',$icbq_dial_filter); ### ALPHA-NUMERIC and underscore and dash and slash and dot $menu_timeout_prompt = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$menu_timeout_prompt); @@ -3286,6 +3324,8 @@ if ($non_latin < 1) $nva_error_filename = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$nva_error_filename); $inbound_survey_filename = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$inbound_survey_filename); $inbound_survey_question_filename = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$inbound_survey_question_filename); + $closing_time_filename = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$closing_time_filename); + $closing_time_end_filename = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$closing_time_end_filename); ### ALPHA-NUMERIC and underscore and dash and slash and dot and comma $menu_prompt = preg_replace('/[^-\/\|\,\._0-9a-zA-Z]/','',$menu_prompt); @@ -4248,12 +4288,13 @@ else # 180109-1316 - Added call_status_stats API function # 180111-1544 - Added anyone_callback_inactive_lists system setting # 180130-2309 - Added inbound_no_agents_no_dial options +# 180204-0208 - Added In-Group Wait-Time option PRESS_CALLBACK_QUEUE, and Closing-Time options # # 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-651a'; -$build = '180130-2309'; +$admin_version = '2.14-652a'; +$build = '180204-0208'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -10645,7 +10686,7 @@ if ($ADD==2011) } else { - $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu,icbq_expiration_hours,closing_time_action,closing_time_now_trigger,closing_time_filename,closing_time_end_filename,closing_time_lead_reset,closing_time_option_exten,closing_time_option_callmenu,closing_time_option_voicemail,closing_time_option_xfer_group,closing_time_option_callback_list_id,icbq_call_time_id,add_lead_timezone,icbq_dial_filter) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu,icbq_expiration_hours,closing_time_action,closing_time_now_trigger,closing_time_filename,closing_time_end_filename,closing_time_lead_reset,closing_time_option_exten,closing_time_option_callmenu,closing_time_option_voicemail,closing_time_option_xfer_group,closing_time_option_callback_list_id,icbq_call_time_id,add_lead_timezone,icbq_dial_filter from vicidial_inbound_groups where group_id=\"$source_group_id\";"; $rslt=mysql_to_mysqli($stmt, $link); $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$group_id');"; @@ -10720,7 +10761,7 @@ if ( ($ADD==2911) and ($SSallow_emails>0) ) } else { - $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu,icbq_expiration_hours,closing_time_action,closing_time_now_trigger,closing_time_filename,closing_time_end_filename,closing_time_lead_reset,closing_time_option_exten,closing_time_option_callmenu,closing_time_option_voicemail,closing_time_option_xfer_group,closing_time_option_callback_list_id,icbq_call_time_id,add_lead_timezone,icbq_dial_filter) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu,icbq_expiration_hours,closing_time_action,closing_time_now_trigger,closing_time_filename,closing_time_end_filename,closing_time_lead_reset,closing_time_option_exten,closing_time_option_callmenu,closing_time_option_voicemail,closing_time_option_xfer_group,closing_time_option_callback_list_id,icbq_call_time_id,add_lead_timezone,icbq_dial_filter from vicidial_inbound_groups where group_id=\"$source_group_id\";"; $rslt=mysql_to_mysqli($stmt, $link); $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$group_id');"; @@ -10795,7 +10836,7 @@ if ( ($ADD==29111) and ($SSallow_chats>0) ) } else { - $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu from vicidial_inbound_groups where group_id=\"$source_group_id\";"; + $stmt="INSERT INTO vicidial_inbound_groups (group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu,icbq_expiration_hours,closing_time_action,closing_time_now_trigger,closing_time_filename,closing_time_end_filename,closing_time_lead_reset,closing_time_option_exten,closing_time_option_callmenu,closing_time_option_voicemail,closing_time_option_xfer_group,closing_time_option_callback_list_id,icbq_call_time_id,add_lead_timezone,icbq_dial_filter) SELECT \"$group_id\",\"$group_name\",group_color,\"N\",web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename,eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu,icbq_expiration_hours,closing_time_action,closing_time_now_trigger,closing_time_filename,closing_time_end_filename,closing_time_lead_reset,closing_time_option_exten,closing_time_option_callmenu,closing_time_option_voicemail,closing_time_option_xfer_group,closing_time_option_callback_list_id,icbq_call_time_id,add_lead_timezone,icbq_dial_filter from vicidial_inbound_groups where group_id=\"$source_group_id\";"; $rslt=mysql_to_mysqli($stmt, $link); $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$group_id');"; @@ -15027,7 +15068,7 @@ if ($ADD==4111 || $ADD==4811 || $ADD==4911) echo "
"._QXZ("GROUP MODIFIED ").": $group_id\n"; - $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysqli_real_escape_string($link, $web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', group_handling='$group_handling', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',ingroup_recording_override='$ingroup_recording_override',ingroup_rec_filename='$ingroup_rec_filename',afterhours_xfer_group='$afterhours_xfer_group',qc_enabled='$qc_enabled',qc_statuses='$QC_statuses',qc_shift_id='$qc_shift_id',qc_get_record_launch='$qc_get_record_launch',qc_show_recording='$qc_show_recording',qc_web_form_address='$qc_web_form_address',qc_script='$qc_script',play_place_in_line='$play_place_in_line',play_estimate_hold_time='$play_estimate_hold_time',hold_time_option='$hold_time_option',hold_time_option_seconds='$hold_time_option_seconds',hold_time_option_exten='$hold_time_option_exten',hold_time_option_voicemail='$hold_time_option_voicemail',hold_time_option_xfer_group='$hold_time_option_xfer_group',hold_time_option_callback_filename='$hold_time_option_callback_filename',hold_time_option_callback_list_id='$hold_time_option_callback_list_id',hold_recall_xfer_group='$hold_recall_xfer_group',no_delay_call_route='$no_delay_call_route',play_welcome_message='$play_welcome_message',answer_sec_pct_rt_stat_one='$answer_sec_pct_rt_stat_one',answer_sec_pct_rt_stat_two='$answer_sec_pct_rt_stat_two',default_group_alias='$default_group_alias',no_agent_no_queue='$no_agent_no_queue',no_agent_action='$no_agent_action',no_agent_action_value='$no_agent_action_value',web_form_address_two='" . mysqli_real_escape_string($link, $web_form_address_two) . "',timer_action='$timer_action',timer_action_message='$timer_action_message',timer_action_seconds='$timer_action_seconds',start_call_url='" . mysqli_real_escape_string($link, $start_call_url) . "',dispo_call_url='" . mysqli_real_escape_string($link, $dispo_call_url) . "',xferconf_c_number='$xferconf_c_number',xferconf_d_number='$xferconf_d_number',xferconf_e_number='$xferconf_e_number',ignore_list_script_override='$ignore_list_script_override',extension_appended_cidname='$extension_appended_cidname',uniqueid_status_display='$uniqueid_status_display',uniqueid_status_prefix='$uniqueid_status_prefix',hold_time_option_minimum='$hold_time_option_minimum',hold_time_option_press_filename='$hold_time_option_press_filename',hold_time_option_callmenu='$hold_time_option_callmenu',onhold_prompt_no_block='$onhold_prompt_no_block',onhold_prompt_seconds='$onhold_prompt_seconds',hold_time_option_no_block='$hold_time_option_no_block',hold_time_option_prompt_seconds='$hold_time_option_prompt_seconds',hold_time_second_option='$hold_time_second_option',hold_time_third_option='$hold_time_third_option',wait_hold_option_priority='$wait_hold_option_priority',wait_time_option='$wait_time_option',wait_time_second_option='$wait_time_second_option',wait_time_third_option='$wait_time_third_option',wait_time_option_seconds='$wait_time_option_seconds',wait_time_option_exten='$wait_time_option_exten',wait_time_option_voicemail='$wait_time_option_voicemail',wait_time_option_xfer_group='$wait_time_option_xfer_group',wait_time_option_callmenu='$wait_time_option_callmenu',wait_time_option_callback_filename='$wait_time_option_callback_filename',wait_time_option_callback_list_id='$wait_time_option_callback_list_id',wait_time_option_press_filename='$wait_time_option_press_filename',wait_time_option_no_block='$wait_time_option_no_block',wait_time_option_prompt_seconds='$wait_time_option_prompt_seconds',timer_action_destination='$timer_action_destination',calculate_estimated_hold_seconds='$calculate_estimated_hold_seconds',add_lead_url='" . mysqli_real_escape_string($link, $add_lead_url) . "',eht_minimum_prompt_filename='$eht_minimum_prompt_filename',eht_minimum_prompt_no_block='$eht_minimum_prompt_no_block',eht_minimum_prompt_seconds='$eht_minimum_prompt_seconds',on_hook_ring_time='$on_hook_ring_time',na_call_url='" . mysqli_real_escape_string($link, $na_call_url) . "',on_hook_cid='$on_hook_cid',action_xfer_cid='$action_xfer_cid',drop_callmenu='$drop_callmenu',after_hours_callmenu='$after_hours_callmenu',user_group='$user_group',max_calls_method='$max_calls_method',max_calls_count='$max_calls_count',max_calls_action='$max_calls_action',dial_ingroup_cid='$dial_ingroup_cid',web_form_address_three='" . mysqli_real_escape_string($link, $web_form_address_three) . "',populate_lead_ingroup='$populate_lead_ingroup',drop_lead_reset='$drop_lead_reset',after_hours_lead_reset='$after_hours_lead_reset',nanq_lead_reset='$nanq_lead_reset',wait_time_lead_reset='$wait_time_lead_reset',hold_time_lead_reset='$hold_time_lead_reset',status_group_id='$status_group_id',routing_initiated_recordings='$routing_initiated_recordings',on_hook_cid_number='$on_hook_cid_number',customer_chat_screen_colors='$customer_chat_screen_colors',customer_chat_survey_link='" . mysqli_real_escape_string($link, $customer_chat_survey_link) . "',customer_chat_survey_text='$customer_chat_survey_text',populate_lead_province='$populate_lead_province',areacode_filter='$areacode_filter',areacode_filter_seconds='$areacode_filter_seconds',areacode_filter_action='$areacode_filter_action',areacode_filter_action_value='$areacode_filter_action_value',populate_state_areacode='$populate_state_areacode',inbound_survey='$inbound_survey',inbound_survey_filename='$inbound_survey_filename',inbound_survey_accept_digit='$inbound_survey_accept_digit',inbound_survey_question_filename='$inbound_survey_question_filename',inbound_survey_callmenu='$inbound_survey_callmenu' where group_id='$group_id';"; + $stmt="UPDATE vicidial_inbound_groups set group_name='$group_name', group_color='$group_color', active='$active', web_form_address='" . mysqli_real_escape_string($link, $web_form_address) . "', voicemail_ext='$voicemail_ext', next_agent_call='$next_agent_call', fronter_display='$fronter_display', ingroup_script='$script_id', get_call_launch='$get_call_launch', group_handling='$group_handling', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number', xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',drop_exten='$drop_exten',call_time_id='$call_time_id',after_hours_action='$after_hours_action',after_hours_message_filename='$after_hours_message_filename',after_hours_exten='$after_hours_exten',after_hours_voicemail='$after_hours_voicemail',welcome_message_filename='$welcome_message_filename',moh_context='$moh_context',onhold_prompt_filename='$onhold_prompt_filename',prompt_interval='$prompt_interval',agent_alert_exten='$agent_alert_exten',agent_alert_delay='$agent_alert_delay',default_xfer_group='$default_xfer_group',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',ingroup_recording_override='$ingroup_recording_override',ingroup_rec_filename='$ingroup_rec_filename',afterhours_xfer_group='$afterhours_xfer_group',qc_enabled='$qc_enabled',qc_statuses='$QC_statuses',qc_shift_id='$qc_shift_id',qc_get_record_launch='$qc_get_record_launch',qc_show_recording='$qc_show_recording',qc_web_form_address='$qc_web_form_address',qc_script='$qc_script',play_place_in_line='$play_place_in_line',play_estimate_hold_time='$play_estimate_hold_time',hold_time_option='$hold_time_option',hold_time_option_seconds='$hold_time_option_seconds',hold_time_option_exten='$hold_time_option_exten',hold_time_option_voicemail='$hold_time_option_voicemail',hold_time_option_xfer_group='$hold_time_option_xfer_group',hold_time_option_callback_filename='$hold_time_option_callback_filename',hold_time_option_callback_list_id='$hold_time_option_callback_list_id',hold_recall_xfer_group='$hold_recall_xfer_group',no_delay_call_route='$no_delay_call_route',play_welcome_message='$play_welcome_message',answer_sec_pct_rt_stat_one='$answer_sec_pct_rt_stat_one',answer_sec_pct_rt_stat_two='$answer_sec_pct_rt_stat_two',default_group_alias='$default_group_alias',no_agent_no_queue='$no_agent_no_queue',no_agent_action='$no_agent_action',no_agent_action_value='$no_agent_action_value',web_form_address_two='" . mysqli_real_escape_string($link, $web_form_address_two) . "',timer_action='$timer_action',timer_action_message='$timer_action_message',timer_action_seconds='$timer_action_seconds',start_call_url='" . mysqli_real_escape_string($link, $start_call_url) . "',dispo_call_url='" . mysqli_real_escape_string($link, $dispo_call_url) . "',xferconf_c_number='$xferconf_c_number',xferconf_d_number='$xferconf_d_number',xferconf_e_number='$xferconf_e_number',ignore_list_script_override='$ignore_list_script_override',extension_appended_cidname='$extension_appended_cidname',uniqueid_status_display='$uniqueid_status_display',uniqueid_status_prefix='$uniqueid_status_prefix',hold_time_option_minimum='$hold_time_option_minimum',hold_time_option_press_filename='$hold_time_option_press_filename',hold_time_option_callmenu='$hold_time_option_callmenu',onhold_prompt_no_block='$onhold_prompt_no_block',onhold_prompt_seconds='$onhold_prompt_seconds',hold_time_option_no_block='$hold_time_option_no_block',hold_time_option_prompt_seconds='$hold_time_option_prompt_seconds',hold_time_second_option='$hold_time_second_option',hold_time_third_option='$hold_time_third_option',wait_hold_option_priority='$wait_hold_option_priority',wait_time_option='$wait_time_option',wait_time_second_option='$wait_time_second_option',wait_time_third_option='$wait_time_third_option',wait_time_option_seconds='$wait_time_option_seconds',wait_time_option_exten='$wait_time_option_exten',wait_time_option_voicemail='$wait_time_option_voicemail',wait_time_option_xfer_group='$wait_time_option_xfer_group',wait_time_option_callmenu='$wait_time_option_callmenu',wait_time_option_callback_filename='$wait_time_option_callback_filename',wait_time_option_callback_list_id='$wait_time_option_callback_list_id',wait_time_option_press_filename='$wait_time_option_press_filename',wait_time_option_no_block='$wait_time_option_no_block',wait_time_option_prompt_seconds='$wait_time_option_prompt_seconds',timer_action_destination='$timer_action_destination',calculate_estimated_hold_seconds='$calculate_estimated_hold_seconds',add_lead_url='" . mysqli_real_escape_string($link, $add_lead_url) . "',eht_minimum_prompt_filename='$eht_minimum_prompt_filename',eht_minimum_prompt_no_block='$eht_minimum_prompt_no_block',eht_minimum_prompt_seconds='$eht_minimum_prompt_seconds',on_hook_ring_time='$on_hook_ring_time',na_call_url='" . mysqli_real_escape_string($link, $na_call_url) . "',on_hook_cid='$on_hook_cid',action_xfer_cid='$action_xfer_cid',drop_callmenu='$drop_callmenu',after_hours_callmenu='$after_hours_callmenu',user_group='$user_group',max_calls_method='$max_calls_method',max_calls_count='$max_calls_count',max_calls_action='$max_calls_action',dial_ingroup_cid='$dial_ingroup_cid',web_form_address_three='" . mysqli_real_escape_string($link, $web_form_address_three) . "',populate_lead_ingroup='$populate_lead_ingroup',drop_lead_reset='$drop_lead_reset',after_hours_lead_reset='$after_hours_lead_reset',nanq_lead_reset='$nanq_lead_reset',wait_time_lead_reset='$wait_time_lead_reset',hold_time_lead_reset='$hold_time_lead_reset',status_group_id='$status_group_id',routing_initiated_recordings='$routing_initiated_recordings',on_hook_cid_number='$on_hook_cid_number',customer_chat_screen_colors='$customer_chat_screen_colors',customer_chat_survey_link='" . mysqli_real_escape_string($link, $customer_chat_survey_link) . "',customer_chat_survey_text='$customer_chat_survey_text',populate_lead_province='$populate_lead_province',areacode_filter='$areacode_filter',areacode_filter_seconds='$areacode_filter_seconds',areacode_filter_action='$areacode_filter_action',areacode_filter_action_value='$areacode_filter_action_value',populate_state_areacode='$populate_state_areacode',inbound_survey='$inbound_survey',inbound_survey_filename='$inbound_survey_filename',inbound_survey_accept_digit='$inbound_survey_accept_digit',inbound_survey_question_filename='$inbound_survey_question_filename',inbound_survey_callmenu='$inbound_survey_callmenu',icbq_expiration_hours='$icbq_expiration_hours',closing_time_action='$closing_time_action',closing_time_now_trigger='$closing_time_now_trigger',closing_time_filename='$closing_time_filename',closing_time_end_filename='$closing_time_end_filename',closing_time_lead_reset='$closing_time_lead_reset',closing_time_option_exten='$closing_time_option_exten',closing_time_option_callmenu='$closing_time_option_callmenu',closing_time_option_voicemail='$closing_time_option_voicemail',closing_time_option_xfer_group='$closing_time_option_xfer_group',closing_time_option_callback_list_id='$closing_time_option_callback_list_id',icbq_call_time_id='$icbq_call_time_id',add_lead_timezone='$add_lead_timezone',icbq_dial_filter='$icbq_dial_filter' where group_id='$group_id';"; $rslt=mysql_to_mysqli($stmt, $link); switch($group_handling) @@ -26797,7 +26838,7 @@ if ($ADD==3111) echo "\n"; echo "\n"; echo "\n"; + + $stmt="SELECT count(*) from vicidial_inbound_callback_queue where group_id='$group_id' and icbq_status='LIVE';"; + $rslt=mysql_to_mysqli($stmt, $link); + $icbq_to_print = mysqli_num_rows($rslt); + if ($icbq_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + if ($row[0] > 0) + { + echo "\n"; + } + } + echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; - echo "\n"; + echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; @@ -27510,11 +27600,11 @@ if ($ADD==3111) echo "\n"; - echo "\n"; + echo "\n"; - echo "\n"; + echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; @@ -27544,7 +27634,57 @@ if ($ADD==3111) echo "\n"; - echo "\n"; + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; + + echo "\n"; echo "\n"; @@ -27629,9 +27769,11 @@ if ($ADD==3111) echo "\n"; } + echo "\n"; + echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; @@ -36960,7 +37102,7 @@ if ($ADD==1000) echo ""; echo ""; echo ""; - echo "\n"; + echo "\n"; echo ""; echo ""; echo ""; @@ -37000,6 +37142,17 @@ if ($ADD==1000) if ($allowed_campaigns_count < 1) {$allowed_campaigns_warning='   NA';} + $icbq_LIVE_count=''; + $stmt="SELECT count(*) from vicidial_inbound_callback_queue where group_id='$group_id_ary[$o]' and icbq_status='LIVE';"; + $rslt=mysql_to_mysqli($stmt, $link); + $icbq_to_print = mysqli_num_rows($rslt); + if ($icbq_to_print > 0) + { + $row=mysqli_fetch_row($rslt); + if ($row[0] > 0) + {$icbq_LIVE_count = " $row[0]";} + } + if (preg_match('/1$|3$|5$|7$|9$/i', $o)) {$bgcolor='class="records_list_x"';} else @@ -37007,6 +37160,7 @@ if ($ADD==1000) echo " 0) {echo " onclick=\"window.document.location='$PHP_SELF?ADD=3111&group_id=$group_id_ary[$o]'\"";} echo ">"; echo ""; echo ""; + echo ""; echo ""; echo ""; echo ""; diff --git a/agc_2-X/trunk/www/vicidial/functions.php b/agc_2-X/trunk/www/vicidial/functions.php index 3faeac2b..b4b66993 100644 --- a/agc_2-X/trunk/www/vicidial/functions.php +++ b/agc_2-X/trunk/www/vicidial/functions.php @@ -1333,6 +1333,22 @@ function use_archive_table($table_name) } } +function table_exists($table_name) + { + global $link; + $tbl_stmt="show tables like '".$table_name."'"; + $tbl_rslt=mysql_to_mysqli($tbl_stmt, $link); + if (mysqli_num_rows($tbl_rslt)>0) + { + $tbl_row=mysqli_fetch_row($tbl_rslt); + return $tbl_row[0]; + } + else + { + return false; + } + } + # function to print/echo content, options for length, alignment and ordered internal variables are included function _QXZ($English_text, $sprintf=0, $align="l", $v_one='', $v_two='', $v_three='', $v_four='', $v_five='', $v_six='', $v_seven='', $v_eight='', $v_nine='') { diff --git a/agc_2-X/trunk/www/vicidial/help.php b/agc_2-X/trunk/www/vicidial/help.php index cfd128b8..1f30e29f 100644 --- a/agc_2-X/trunk/www/vicidial/help.php +++ b/agc_2-X/trunk/www/vicidial/help.php @@ -149,6 +149,7 @@ # 180108-2115 - Added campaigns-next_dial_my_callbacks entry # 180111-1547 - Added settings-anyone_callback_inactive_lists entry # 180130-2303 - Added inbound_no_agents_no_dial entries +# 180204-0213 - Added inbound_groups-icbq_expiration_hours and closed-time entries # require("dbconnect_mysqli.php"); @@ -2488,6 +2489,11 @@ if ($SSqc_features_active > 0)
- +
+ +
+ - +

@@ -2792,7 +2798,7 @@ if ($SSqc_features_active > 0)

- - + -
@@ -2867,7 +2873,7 @@ if ($SSqc_features_active > 0)

- - + -
@@ -2939,6 +2945,71 @@ if ($SSqc_features_active > 0)
- +
+
+
+ - + +
+
+
+ - + +
+
+
+ - + +
+
+
+ - + +
+
+
+ - + +
+
+
+ - + +
+
+
+ - + +
+
+
+ - + +
+
+
+ - + +
+
+
+ - + +
+
+
+ - + +
+
+
+ - + +
+
+
+ - +

@@ -3034,15 +3105,20 @@ if ($SSqc_features_active > 0)
- +
+
+
+ - +

-
-
+
- - + -
@@ -6845,6 +6921,16 @@ if ($SSqc_features_active > 0) +



+
+
+ - +

+(name must be exact). In this container, variable names are listed individually per line, and each listed variable is given it's own column in the detailed URL report."); ?>

+
+ + +





\n"; echo ""; - $stmt="SELECT group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename, eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,group_calldate,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu from vicidial_inbound_groups where group_id='$group_id' $LOGadmin_viewable_groupsSQL;"; + $stmt="SELECT group_id,group_name,group_color,active,web_form_address,voicemail_ext,next_agent_call,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,drop_call_seconds,drop_action,drop_exten,call_time_id,after_hours_action,after_hours_message_filename,after_hours_exten,after_hours_voicemail,welcome_message_filename,moh_context,onhold_prompt_filename,prompt_interval,agent_alert_exten,agent_alert_delay,default_xfer_group,queue_priority,drop_inbound_group,ingroup_recording_override,ingroup_rec_filename,afterhours_xfer_group,qc_enabled,qc_statuses,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,play_place_in_line,play_estimate_hold_time,hold_time_option,hold_time_option_seconds,hold_time_option_exten,hold_time_option_voicemail,hold_time_option_xfer_group,hold_time_option_callback_filename,hold_time_option_callback_list_id,hold_recall_xfer_group,no_delay_call_route,play_welcome_message,answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two,default_group_alias,no_agent_no_queue,no_agent_action,no_agent_action_value,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,ignore_list_script_override,extension_appended_cidname,uniqueid_status_display,uniqueid_status_prefix,hold_time_option_minimum,hold_time_option_press_filename,hold_time_option_callmenu,onhold_prompt_no_block,onhold_prompt_seconds,hold_time_option_no_block,hold_time_option_prompt_seconds,hold_time_second_option,hold_time_third_option,wait_hold_option_priority,wait_time_option,wait_time_second_option,wait_time_third_option,wait_time_option_seconds,wait_time_option_exten,wait_time_option_voicemail,wait_time_option_xfer_group,wait_time_option_callmenu,wait_time_option_callback_filename,wait_time_option_callback_list_id,wait_time_option_press_filename,wait_time_option_no_block,wait_time_option_prompt_seconds,timer_action_destination,calculate_estimated_hold_seconds,add_lead_url,eht_minimum_prompt_filename, eht_minimum_prompt_no_block,eht_minimum_prompt_seconds,on_hook_ring_time,na_call_url,on_hook_cid,group_calldate,action_xfer_cid,drop_callmenu,after_hours_callmenu,user_group,max_calls_method,max_calls_count,max_calls_action,dial_ingroup_cid,group_handling,web_form_address_three,populate_lead_ingroup,drop_lead_reset,after_hours_lead_reset,nanq_lead_reset,wait_time_lead_reset,hold_time_lead_reset,status_group_id,routing_initiated_recordings,on_hook_cid_number,customer_chat_screen_colors,customer_chat_survey_link,customer_chat_survey_text,populate_lead_province,areacode_filter,areacode_filter_seconds,areacode_filter_action,areacode_filter_action_value,populate_state_areacode,inbound_survey,inbound_survey_filename,inbound_survey_accept_digit,inbound_survey_question_filename,inbound_survey_callmenu,icbq_expiration_hours,closing_time_action,closing_time_now_trigger,closing_time_filename,closing_time_end_filename,closing_time_lead_reset,closing_time_option_exten,closing_time_option_callmenu,closing_time_option_voicemail,closing_time_option_xfer_group,closing_time_option_callback_list_id,icbq_call_time_id,add_lead_timezone,icbq_dial_filter from vicidial_inbound_groups where group_id='$group_id' $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); @@ -26939,7 +26980,20 @@ if ($ADD==3111) $inbound_survey_accept_digit = $row[135]; $inbound_survey_question_filename = $row[136]; $inbound_survey_callmenu = $row[137]; - + $icbq_expiration_hours = $row[138]; + $closing_time_action = $row[139]; + $closing_time_now_trigger = $row[140]; + $closing_time_filename = $row[141]; + $closing_time_end_filename = $row[142]; + $closing_time_lead_reset = $row[143]; + $closing_time_option_exten = $row[144]; + $closing_time_option_callmenu = $row[145]; + $closing_time_option_voicemail = $row[146]; + $closing_time_option_xfer_group = $row[147]; + $closing_time_option_callback_list_id = $row[148]; + $icbq_call_time_id = $row[149]; + $add_lead_timezone = $row[150]; + $icbq_dial_filter = $row[151]; ##### get callmenu listings for dynamic pulldown $stmt="SELECT menu_id,menu_name from vicidial_call_menu $whereLOGadmin_viewable_groupsSQL order by menu_id;"; @@ -26948,11 +27002,13 @@ if ($ADD==3111) $o=0; $Xmenuslist=''; $Wmenuslist=''; + $Cmenuslist=''; while ($Xmenus_to_print > $o) { $rowx=mysqli_fetch_row($rslt); $Xmenuslist .= "\n"; $Wmenuslist .= "value=\"$rowx[0]\">$rowx[0] - $rowx[1]\n"; + $Cmenuslist .= "value=\"$rowx[0]\">$rowx[0] - $rowx[1]\n"; $o++; } if ($Xmenus_selected < 1) {$Xmenuslist .= "\n";} if ($Wmenus_selected < 1) {$Wmenuslist .= "\n";} + if ($Cmenus_selected < 1) + {$Cmenuslist .= "\n";} ##### get in-groups listings for dynamic pulldown @@ -26989,6 +27053,8 @@ if ($ADD==3111) $Wgroups_selected=0; $Tgroups_menu=''; $Tgroups_selected=0; + $Cgroups_menu=''; + $Cgroups_selected=0; $o=0; while ($Xgroups_to_print > $o) { @@ -26997,6 +27063,7 @@ if ($ADD==3111) $Dgroups_menu .= "\n"; $Tgroups_menu .= "value=\"$rowx[0]\">$rowx[0] - $rowx[1]\n"; + $Cgroups_menu .= "value=\"$rowx[0]\">$rowx[0] - $rowx[1]\n"; $Wgroups_menu .= "value=\"$rowx[0]\">$rowx[0] - $rowx[1]\n"; $Hgroups_menu .= "value=\"$rowx[0]\">$rowx[0] - $rowx[1]\n"; } @@ -27056,6 +27129,10 @@ if ($ADD==3111) {$Tgroups_menu .= "\n";} else {$Tgroups_menu .= "\n";} + if ($Cgroups_selected < 1) + {$Cgroups_menu .= "\n";} + else + {$Cgroups_menu .= "\n";} if ($Wgroups_selected < 1) {$Wgroups_menu .= "\n";} else @@ -27090,6 +27167,19 @@ if ($ADD==3111) echo "
"._QXZ("Group Name").": $NWB#inbound_groups-group_name$NWE
"._QXZ("Group Color").": $NWB#inbound_groups-group_color$NWE
"._QXZ("Active").": $NWB#inbound_groups-active$NWE
"._QXZ("Callback Queue Calls").":   $row[0] $NWB#inbound_groups-callback_queue_calls$NWE
"._QXZ("In-Group Calldate").": $group_calldate$NWB#inbound_groups-group_calldate$NWE
\n"; @@ -27476,11 +27566,11 @@ if ($ADD==3111) echo "
"._QXZ("Estimated Hold Time Minimum Prompt Seconds").": $NWB#inbound_groups-eht_minimum_prompt_seconds$NWE
"._QXZ("Wait Time Option").": $NWB#inbound_groups-wait_time_option$NWE
"._QXZ("Wait Time Option").": $NWB#inbound_groups-wait_time_option$NWE
"._QXZ("Wait Time Second Option").": $NWB#inbound_groups-wait_time_second_option$NWE
"._QXZ("Wait Time Second Option").": $NWB#inbound_groups-wait_time_second_option$NWE
"._QXZ("Wait Time Third Option").": $NWB#inbound_groups-wait_time_third_option$NWE
"._QXZ("Wait Time Third Option").": $NWB#inbound_groups-wait_time_third_option$NWE
"._QXZ("Wait Time Option Seconds").": $NWB#inbound_groups-wait_time_option_seconds$NWE
"._QXZ("Wait Hold Option Priority").": $NWB#inbound_groups-wait_hold_option_priority$NWE
"._QXZ("Estimated Hold Time Option").": $NWB#inbound_groups-hold_time_option$NWE
"._QXZ("Estimated Hold Time Option").": $NWB#inbound_groups-hold_time_option$NWE
"._QXZ("Hold Time Second Option").": $NWB#inbound_groups-hold_time_second_option$NWE
"._QXZ("Hold Time Second Option").": $NWB#inbound_groups-hold_time_second_option$NWE
"._QXZ("Hold Time Third Option").": $NWB#inbound_groups-hold_time_third_option$NWE
"._QXZ("Hold Time Third Option").": $NWB#inbound_groups-hold_time_third_option$NWE
"._QXZ("Hold Time Option Seconds").": $NWB#inbound_groups-hold_time_option_seconds$NWE
"._QXZ("Hold Time Option Callback List ID").": $NWB#inbound_groups-hold_time_option_callback_list_id$NWE
"._QXZ("Agent Alert Filename").": "._QXZ("audio chooser")." $NWB#inbound_groups-agent_alert_exten$NWE
"._QXZ("Callback Queue Expire Hours").": $NWB#inbound_groups-icbq_expiration_hours$NWE
"._QXZ("Callback Queue Call Time").": $NWB#inbound_groups-icbq_call_time_id$NWE
\n"; + $stmt="SELECT ct_holidays from vicidial_call_times where call_time_id='$icbq_call_time_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + $call_times_to_print = mysqli_num_rows($rslt); + if ($call_times_to_print > 0) + { + $rowx=mysqli_fetch_row($rslt); + $ct_holidays = $rowx[0]; + $holiday_rules = explode('|',$ct_holidays); + $ct_hrs = ((count($holiday_rules)) - 2); + if ($ct_hrs < 0) {$ct_hrs=0;} + echo _QXZ("Holidays defined for this callback queue call time").": $ct_hrs\n"; + } + else + {echo ""._QXZ("Call time not found")."!: $icbq_call_time_id\n";} + echo "
"._QXZ("Callback Queue Dial Filter").": $NWB#inbound_groups-icbq_dial_filter$NWE
"._QXZ("Closing Time Action").": $NWB#inbound_groups-closing_time_action$NWE
"._QXZ("Closing Time Now Trigger").": $NWB#inbound_groups-closing_time_now_trigger$NWE
"._QXZ("Closing Time Press Filename").": "._QXZ("audio chooser")." $NWB#inbound_groups-closing_time_filename$NWE
"._QXZ("Closing Time End Filename").": "._QXZ("audio chooser")." $NWB#inbound_groups-closing_time_end_filename$NWE
"._QXZ("Closing Time Option Lead Reset").": $NWB#inbound_groups-closing_time_lead_reset$NWE
"._QXZ("Closing Time Option Extension").": $NWB#inbound_groups-closing_time_option_exten$NWE
"._QXZ("Closing Time Option Callmenu").": $NWB#inbound_groups-closing_time_option_callmenu$NWE
"._QXZ("Closing Time Option Voicemail").": "._QXZ("voicemail chooser")." $NWB#inbound_groups-closing_time_option_voicemail$NWE
"._QXZ("Closing Time Option Transfer In-Group").": $NWB#inbound_groups-closing_time_option_xfer_group$NWE
"._QXZ("Closing Time Option Callback List ID").": $NWB#inbound_groups-closing_time_option_callback_list_id$NWE
"._QXZ("Agent Alert Filename").": "._QXZ("audio chooser")." $NWB#inbound_groups-agent_alert_exten$NWE
"._QXZ("Agent Alert Delay").": $NWB#inbound_groups-agent_alert_delay$NWE
"._QXZ("Dispo Call URL").": $NWB#inbound_groups-dispo_call_url$NWE
"._QXZ("No Agent Call URL").": $NWB#inbound_groups-na_call_url$NWE
"._QXZ("Add Lead URL").": $NWB#inbound_groups-add_lead_url$NWE
"._QXZ("No Agent Call URL").": $NWB#inbound_groups-na_call_url$NWE
"._QXZ("Add Lead Timezone").": $NWB#inbound_groups-add_lead_timezone$NWE
"._QXZ("Extension Append CID").": $NWB#inbound_groups-extension_appended_cidname$NWE
"._QXZ("IN-GROUP").""._QXZ("NAME").""._QXZ("PRIORITY").""._QXZ("PRIORITY").""._QXZ("ACTIVE").""._QXZ("ADMIN GROUP").""._QXZ("TIME")."
$group_id_ary[$o] $group_name_ary[$o] $group_priority_ary[$o] $icbq_LIVE_count $group_active_ary[$o] $allowed_campaigns_warning $group_group_ary[$o] $group_time_ary[$o]