Added Khomp campaign settings option

Added experimental stereo recording testing code

git-svn-id: svn://192.168.202.10@3880 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2024-10-22 02:15:09 +00:00
parent a0b526484f
commit d53bbc1a5d
10 changed files with 1015 additions and 286 deletions
+52 -8
View File
@@ -263,6 +263,7 @@
# 240420-2242 - Added ConfBridge code
# 240415-1701 - Fix for ConfBridge code
# 240723-1632 - Small fix for ConfBridge
# 240906-1032 - Added testing for stereo_recording in-group option *NOT PRODUCTION READY*
#
$script = 'agi-VDAD_ALL_inbound.agi';
@@ -402,7 +403,7 @@ $dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA
or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database
$stmtA = "SELECT agi_output,local_gmt FROM servers where server_ip = '$VARserver_ip';";
$stmtA = "SELECT agi_output,local_gmt,conf_engine FROM servers where server_ip = '$VARserver_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -415,6 +416,7 @@ while ($sthArows > $rec_count)
@aryA = $sthA->fetchrow_array;
$DBagi_output = $aryA[0];
$local_gmt = $aryA[1];
$conf_engine = $aryA[2];
if ($isdst) {$local_gmt++;}
if ($DBagi_output =~ /STDERR/) {$AGILOG = '1';}
if ($DBagi_output =~ /FILE/) {$AGILOG = '2';}
@@ -894,7 +896,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,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,populate_lead_source,populate_lead_vendor,enter_ingroup_url,cid_cb_confirm_number,cid_cb_invalid_filter_phone_group,cid_cb_valid_length,cid_cb_valid_filename,cid_cb_confirmed_filename,cid_cb_enter_filename,cid_cb_you_entered_filename,cid_cb_press_to_confirm_filename,cid_cb_invalid_filename,cid_cb_reenter_filename,cid_cb_error_filename,place_in_line_caller_number_filename,place_in_line_you_next_filename,answer_signal,no_agent_delay,agent_search_method,populate_lead_comments,drop_call_seconds_override,populate_lead_owner,in_queue_nanque,in_queue_nanque_exceptions,second_alert_trigger,second_alert_trigger_seconds,second_alert_filename,second_alert_delay,second_alert_container,second_alert_only,third_alert_trigger,third_alert_trigger_seconds,third_alert_filename,third_alert_delay,third_alert_container,third_alert_only 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,populate_lead_source,populate_lead_vendor,enter_ingroup_url,cid_cb_confirm_number,cid_cb_invalid_filter_phone_group,cid_cb_valid_length,cid_cb_valid_filename,cid_cb_confirmed_filename,cid_cb_enter_filename,cid_cb_you_entered_filename,cid_cb_press_to_confirm_filename,cid_cb_invalid_filename,cid_cb_reenter_filename,cid_cb_error_filename,place_in_line_caller_number_filename,place_in_line_you_next_filename,answer_signal,no_agent_delay,agent_search_method,populate_lead_comments,drop_call_seconds_override,populate_lead_owner,in_queue_nanque,in_queue_nanque_exceptions,second_alert_trigger,second_alert_trigger_seconds,second_alert_filename,second_alert_delay,second_alert_container,second_alert_only,third_alert_trigger,third_alert_trigger_seconds,third_alert_filename,third_alert_delay,third_alert_container,third_alert_only,stereo_recording 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;
@@ -1050,6 +1052,7 @@ if ($sthArows > 0)
$third_alert_delay = $aryA[138];
$third_alert_container = $aryA[139];
$third_alert_only = $aryA[140];
$stereo_recording = $aryA[141];
if ( (length($place_in_line_caller_number_filename) < 1) || ($place_in_line_caller_number_filename =~ /^NULL$/i) )
{$place_in_line_caller_number_filename='queue-thereare';}
@@ -3430,6 +3433,18 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
$dbhP=$dbhA; $mysql_count='02214'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
}
if ( ($stereo_recording =~ /CUSTOMER/i) && ($conf_engine eq "CONFBRIDGE") )
{
$retval_stop = $AGI->exec("StopMixMonitor","");
$retval = $AGI->exec("MixMonitor",",r(/var/spool/asterisk/monitorS/$campaign_rec_filename-in.wav)t(/var/spool/asterisk/monitorS/$campaign_rec_filename-out.wav)");
### insert record into recording_log_stereo table ###
$stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log) values('$recording_id','$VDADserver_ip','$now_date','0','$campaign_rec_filename','$insert_lead_id','$stereo_recording $channel_group','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|');";
$SRaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- REMOTE STEREO RECORDING STARTED : |$retval|$retval_stop|$SRaffected_rows|$recording_id|$stmtA|"; &agi_output;}
}
$vmgr_callerid = substr($campaign_rec_filename, 0, 17) . '...';
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$vmgr_callerid','Channel: $channelrec','Context: $ext_context','Exten: $recording_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$affected_rows = $dbhA->do($stmtA);
@@ -3901,7 +3916,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$conf_engine = $aryA[0];
$conf_engine = $aryA[0];
$rec_count++;
}
$sthA->finish();
@@ -4670,21 +4685,50 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override
$campaign_rec_filename =~ s/CALLID/$callerid/gi;
$campaign_rec_filename =~ s/\"|\'//gi;
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
if ( ($stereo_recording =~ /CUSTOMER/i) && ($conf_engine eq "CONFBRIDGE") )
{
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
$retval_stop = $AGI->exec("StopMixMonitor","");
$retval = $AGI->exec("MixMonitor",",r(/var/spool/asterisk/monitorS/$campaign_rec_filename-in.wav)t(/var/spool/asterisk/monitorS/$campaign_rec_filename-out.wav)");
}
else
{
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
$retval = $AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
}
else
{
$retval = $AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
}
}
### insert record into recording_log table ###
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$phone_number','$now_date','$now_date_epoch','0','$campaign_rec_filename','$insert_lead_id','$VDADuser','$campaign_rec_filename','$insert_close_id');";
$RLRAaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01173'; $MEL_aff_rows=$RLRAaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$RLRAaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$retval|$RLRAaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;}
if ( ($stereo_recording =~ /CUSTOMER/i) && ($conf_engine eq "CONFBRIDGE") )
{
$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='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$recording_id = $aryA[0];
}
$sthA->finish();
### insert record into recording_log_stereo table ###
$stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log) values('$recording_id','$VDADserver_ip','$now_date','0','$campaign_rec_filename','$insert_lead_id','$stereo_recording $channel_group','start: $now_date|vicidial_id: $insert_close_id|user: $VDADuser|channel: $channel|');";
$SRaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- REMOTE STEREO RECORDING STARTED : |$retval|$SRaffected_rows|$recording_id|$stmtA|"; &agi_output;}
}
}
}
### END REMOTE AGENT SECTION
+166 -53
View File
@@ -129,7 +129,9 @@
# 220524-1746 - Changed SHARED_ campaign in-group transfers to use 'SRDROP' log status instead of 'DROP'
# 230309-0952 - Added abandon_check_queue feature
# 240804-1218 - Remove ding and sleep for dropped calls going to an extension(message)
# 240906-1021 - Added testing for stereo_recording campaign option *NOT PRODUCTION READY*
# 241001-2222 - Fixes for Khomp call processing
# 241020-1928 - Added khomp campaign settings options
#
$script = 'agi-VDAD_ALL_outbound.agi';
@@ -299,7 +301,7 @@ $sthA->finish();
### Grab Server values from the database
$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks,agi_output,voicemail_dump_exten_no_inst,external_server_ip FROM servers where server_ip = '$VARserver_ip';";
$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks,agi_output,voicemail_dump_exten_no_inst,external_server_ip,conf_engine FROM servers where server_ip = '$VARserver_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -317,6 +319,7 @@ while ($sthArows > $rec_count)
$DBagi_output = $aryA[6];
$voicemail_dump_exten_no_inst = $aryA[7];
$external_server_ip = $aryA[8];
$conf_engine = $aryA[9];
if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;}
if ($DBext_context) {$ext_context = $DBext_context;}
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
@@ -825,7 +828,7 @@ if ($VDACaffected_rows > 0)
##### END - Max call stats
### Grab campaign values from the database
$stmtA = "SELECT drop_call_seconds,drop_action,safe_harbor_exten,concurrent_transfers,next_agent_call,voicemail_ext,drop_inbound_group,use_internal_dnc,use_campaign_dnc,cpd_amd_action,am_message_exten,three_way_call_cid,campaign_cid,survey_first_audio_file,survey_opt_in_audio_file,survey_ni_audio_file,survey_third_audio_file,survey_fourth_audio_file,extension_appended_cidname,queue_priority,closer_campaigns,queuemetrics_phone_environment,campaign_recording,campaign_rec_filename,safe_harbor_audio,safe_harbor_menu_id,survey_recording,safe_harbor_audio_field,use_other_campaign_dnc,cpd_unknown_action,routing_initiated_recordings,campaign_rec_exten,call_quota_lead_ranking,sip_event_logging,amd_type,agent_search_method,dial_method FROM vicidial_campaigns where campaign_id = '$VDADcampaign';";
$stmtA = "SELECT drop_call_seconds,drop_action,safe_harbor_exten,concurrent_transfers,next_agent_call,voicemail_ext,drop_inbound_group,use_internal_dnc,use_campaign_dnc,cpd_amd_action,am_message_exten,three_way_call_cid,campaign_cid,survey_first_audio_file,survey_opt_in_audio_file,survey_ni_audio_file,survey_third_audio_file,survey_fourth_audio_file,extension_appended_cidname,queue_priority,closer_campaigns,queuemetrics_phone_environment,campaign_recording,campaign_rec_filename,safe_harbor_audio,safe_harbor_menu_id,survey_recording,safe_harbor_audio_field,use_other_campaign_dnc,cpd_unknown_action,routing_initiated_recordings,campaign_rec_exten,call_quota_lead_ranking,sip_event_logging,amd_type,agent_search_method,dial_method,stereo_recording,khomp_settings_container FROM vicidial_campaigns where campaign_id = '$VDADcampaign';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -873,6 +876,8 @@ if ($VDACaffected_rows > 0)
$amd_type = $aryA[34];
$agent_search_method_OVERRIDE = $aryA[35];
$campaign_dial_method = $aryA[36];
$stereo_recording = $aryA[37];
$khomp_settings_container = $aryA[38];
if (length($closer_campaigns) > 2)
{
$closer_campaigns =~ s/^ | -$//gi;
@@ -891,12 +896,15 @@ if ($VDACaffected_rows > 0)
$khomp_api_login_url = '';
$khomp_api_user = '';
$khomp_api_pass = '';
$khomp_api_check_ssl = '';
$khomp_header = '';
$khomp_id_format = '';
$khomp_api_token = '';
$khomp_api_token_expire = '';
$khomp_api_token_expire = 0;
$stmtA = "SELECT container_entry FROM vicidial_settings_containers WHERE container_id = 'KHOMPSETTINGS';";
$agi_string = "-- KHOMP: Using settings container $khomp_settings_container"; &agi_output;
$stmtA = "SELECT container_entry FROM vicidial_settings_containers WHERE container_id = '$khomp_settings_container';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -930,6 +938,7 @@ if ($VDACaffected_rows > 0)
if ( $key eq 'khomp_api_proxied' ) { $khomp_api_proxied = $value; }
if ( $key eq 'khomp_api_user' ) { $khomp_api_user = $value; }
if ( $key eq 'khomp_api_pass' ) { $khomp_api_pass = $value; }
if ( $key eq 'khomp_api_check_ssl' ) { $khomp_api_check_ssl = $value; }
if ( $key eq 'khomp_header' ) { $khomp_header = $value; }
if ( $key eq 'khomp_id_format' ) { $khomp_id_format = $value; }
if ( $key eq 'khomp_api_login_url' ) { $khomp_api_login_url = $value; }
@@ -938,7 +947,7 @@ if ($VDACaffected_rows > 0)
}
}
$agi_string = "KHOMP Settings: url-$khomp_api_url|proxied-$khomp_api_proxied|login_url-$khomp_api_login_url|user-$khomp_api_user|pass-$khomp_api_pass|header-$khomp_header|format-$khomp_id_format";
$agi_string = "KHOMP Settings: url-$khomp_api_url|proxied-$khomp_api_proxied|login_url-$khomp_api_login_url|user-$khomp_api_user|pass-$khomp_api_pass|ssl-check-$khomp_api_check_ssl|header-$khomp_header|format-$khomp_id_format|api-token-$khomp_api_token|token-expire-$khomp_api_token_expire|";
&agi_output;
}
@@ -1648,10 +1657,10 @@ if ($call_handle_method =~ /REMIND/)
$khomp_api_login_url,
$khomp_api_user,
$khomp_api_pass,
$khomp_api_check_ssl,
$khomp_header,
$khomp_id_format,
$khomp_api_token,
$khomp_api_token_expire,
$khomp_settings_container,
$external_server_ip,
$VDADcampaign,
$callerid,
@@ -1755,10 +1764,10 @@ if ($call_handle_method =~ /SURVEY/)
$khomp_api_login_url,
$khomp_api_user,
$khomp_api_pass,
$khomp_api_check_ssl,
$khomp_header,
$khomp_id_format,
$khomp_api_token,
$khomp_api_token_expire,
$khomp_settings_container,
$external_server_ip,
$VDADcampaign,
$callerid,
@@ -2641,10 +2650,10 @@ if (( $amd_type eq 'KHOMP' ) && ( $khomp_enabled ) )
$khomp_api_login_url,
$khomp_api_user,
$khomp_api_pass,
$khomp_api_check_ssl,
$khomp_header,
$khomp_id_format,
$khomp_api_token,
$khomp_api_token_expire,
$khomp_settings_container,
$external_server_ip,
$VDADcampaign,
$callerid,
@@ -3165,21 +3174,49 @@ while ($drop_timer <= $DROP_TIME)
$campaign_rec_filename =~ s/CALLID/$callerid/gi;
$campaign_rec_filename =~ s/\"|\'//gi;
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
if ( ($stereo_recording =~ /CUSTOMER/i) && ($conf_engine eq "CONFBRIDGE") )
{
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
$retval = $AGI->exec("MixMonitor",",r(/var/spool/asterisk/monitorS/$campaign_rec_filename-in.wav)t(/var/spool/asterisk/monitorS/$campaign_rec_filename-out.wav)");
}
else
{
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
$retval = $AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
}
else
{
$retval = $AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
}
}
### insert record into recording_log table ###
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$VDADphone','$now_date','$now_date_epoch','0','$campaign_rec_filename','$CIDlead_id','$VDADuser','$campaign_rec_filename','$uniqueid');";
$RLRAaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01074'; $MEL_aff_rows=$RLRAaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$RLRAaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$retval|$RLRAaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;}
if ( ($stereo_recording =~ /CUSTOMER/i) && ($conf_engine eq "CONFBRIDGE") )
{
$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='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$recording_id = $aryA[0];
}
$sthA->finish();
### insert record into recording_log_stereo table ###
$stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log) values('$recording_id','$VARserver_ip','$now_date','0','$campaign_rec_filename','$CIDlead_id','$stereo_recording $VDADcampaign','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|');";
$SRaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- REMOTE STEREO RECORDING STARTED : |$retval|$SRaffected_rows|$recording_id|$stmtA|"; &agi_output;}
}
}
}
### END REMOTE AGENT SECTION
@@ -3278,6 +3315,17 @@ while ($drop_timer <= $DROP_TIME)
$dbhP=$dbhA; $mysql_count='02125'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
}
if ( ($stereo_recording =~ /CUSTOMER/i) && ($conf_engine eq "CONFBRIDGE") )
{
$retval = $AGI->exec("MixMonitor",",r(/var/spool/asterisk/monitorS/$campaign_rec_filename-in.wav)t(/var/spool/asterisk/monitorS/$campaign_rec_filename-out.wav)");
### insert record into recording_log_stereo table ###
$stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log) values('$recording_id','$VARserver_ip','$now_date','0','$campaign_rec_filename','$CIDlead_id','$stereo_recording $VDADcampaign','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|');";
$SRaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- REMOTE STEREO RECORDING STARTED : |$retval|$SRaffected_rows|$recording_id|$stmtA|"; &agi_output;}
}
$vmgr_callerid = substr($campaign_rec_filename, 0, 17) . '...';
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$vmgr_callerid','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$affected_rows = $dbhA->do($stmtA);
@@ -3906,21 +3954,50 @@ while ($drop_timer <= $DROP_TIME)
$campaign_rec_filename =~ s/CALLID/$callerid/gi;
$campaign_rec_filename =~ s/\"|\'//gi;
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
if ( ($stereo_recording =~ /CUSTOMER/i) && ($conf_engine eq "CONFBRIDGE") )
{
$AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
$retval = $AGI->exec("MixMonitor",",r(/var/spool/asterisk/monitorS/$campaign_rec_filename-in.wav)t(/var/spool/asterisk/monitorS/$campaign_rec_filename-out.wav)");
}
else
{
$AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
%ast_ver_str = parse_asterisk_version($asterisk_version);
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} < 6))
{
$retval = $AGI->exec("Monitor wav|/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
}
else
{
$retval = $AGI->exec("Monitor","wav,/var/spool/asterisk/monitor/MIX/$campaign_rec_filename");
}
}
### insert record into recording_log table ###
$stmtA = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,length_in_sec,filename,lead_id,user,location,vicidial_id) values('$channel','$VARserver_ip','$VDADphone','$now_date','$now_date_epoch','0','$campaign_rec_filename','$CIDlead_id','$VDADuser','$campaign_rec_filename','$uniqueid');";
$RLRAaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01076'; $MEL_aff_rows=$RLRAaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$RLRAaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- REMOTE RECORDING STARTED : |$retval|$RLRAaffected_rows|$campaign_rec_filename|$stmtA|"; &agi_output;}
if ( ($stereo_recording =~ /CUSTOMER/i) && ($conf_engine eq "CONFBRIDGE") )
{
$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='01XXX'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$recording_id = $aryA[0];
}
$sthA->finish();
### insert record into recording_log_stereo table ###
$stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log) values('$recording_id','$VARserver_ip','$now_date','0','$campaign_rec_filename','$CIDlead_id','$stereo_recording $VDADcampaign','start: $now_date|vicidial_id: $uniqueid|channel: $channel|');";
$SRaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- REMOTE2 STEREO RECORDING STARTED : |$retval|$SRaffected_rows|$recording_id|$stmtA|"; &agi_output;}
}
}
}
### END REMOTE AGENT SECTION
@@ -4019,6 +4096,17 @@ while ($drop_timer <= $DROP_TIME)
$dbhP=$dbhA; $mysql_count='02133'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
}
if ( ($stereo_recording =~ /CUSTOMER/i) && ($conf_engine eq "CONFBRIDGE") )
{
$retval = $AGI->exec("MixMonitor",",r(/var/spool/asterisk/monitorS/$campaign_rec_filename-in.wav)t(/var/spool/asterisk/monitorS/$campaign_rec_filename-out.wav)");
### insert record into recording_log_stereo table ###
$stmtA = "INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log) values('$recording_id','$VARserver_ip','$now_date','0','$campaign_rec_filename','$CIDlead_id','$stereo_recording $VDADcampaign','start: $now_date|vicidial_id: $uniqueid|user: $VDADuser|channel: $channel|');";
$SRaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01XXX'; $MEL_aff_rows=$SRaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- REMOTE STEREO RECORDING STARTED : |$retval|$SRaffected_rows|$recording_id|$stmtA|"; &agi_output;}
}
$vmgr_callerid = substr($campaign_rec_filename, 0, 17) . '...';
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$VDADserver_ip','','Originate','$vmgr_callerid','Channel: $channelrec','Context: $ext_context','Exten: $campaign_rec_exten','Priority: 1','Callerid: $campaign_rec_filename','','','','','');";
$affected_rows = $dbhA->do($stmtA);
@@ -5268,10 +5356,10 @@ sub process_khomp_analytics
$khomp_api_login_url,
$khomp_api_user,
$khomp_api_pass,
$khomp_api_check_ssl,
$khomp_header,
$khomp_id_format,
$khomp_api_token,
$khomp_api_token_expire,
$khomp_settings_container,
$external_server_ip,
$campaign_id,
$callerid,
@@ -5292,8 +5380,7 @@ sub process_khomp_analytics
{ $khomp_id = $callerid . '_' . $campaign_id . '_' . $external_server_ip; }
my $api_auth_time = 0;
if ( ( !( $khomp_api_token_expire ) ) and ( $khomp_api_token_expire != 0 ) ) { $khomp_api_token_expire = 0; }
if ( ( $khomp_api_token_expire < time() ) or ( $khomp_api_token eq 'TOKENTOKENTOKEN' ))
if ( ($khomp_api_token_expire < time() ) or ( $khomp_api_token eq 'TOKENTOKENTOKEN' ))
{
if ($AGILOG) {$agi_string = "-- KHOMP API Token $khomp_api_token has expired at $khomp_api_token_expire"; &agi_output;}
@@ -5301,34 +5388,38 @@ sub process_khomp_analytics
my $new_khomp_api_token = '';
if ( $khomp_api_proxied eq 'false' )
{
($new_khomp_api_token, $api_auth_time) = khomp_api_login( $khomp_api_login_url, $khomp_api_user, $khomp_api_pass );
($new_khomp_api_token, $api_auth_time) = khomp_api_login( $khomp_api_login_url, $khomp_api_user, $khomp_api_pass, $khomp_api_check_ssl );
}
# update the settings container
my $old_token_string = "khomp_api_token => $khomp_api_token";
my $new_token_string = "khomp_api_token => $new_khomp_api_token";
my $new_token_expire_time = time() + 3600;
my $old_token_expire_string = "khomp_api_token_expire => $khomp_api_token_expire";
my $new_token_expire_string = "khomp_api_token_expire => $new_token_expire_time";
if ( $new_khomp_api_token ne '0' )
{
# LOCK vicidial_settings_containers
$stmtA = "LOCK TABLES vicidial_settings_containers WRITE";
$dbhA->do($stmtA);
# UPDATE the Token
$stmtToken = "UPDATE vicidial_settings_containers SET container_entry = REGEXP_REPLACE(container_entry, '$old_token_string', '$new_token_string') WHERE container_id = 'KHOMPSETTINGS';";
$affected_rows = $dbhA->do($stmtToken);
# UPDATE the Expire time
$stmtExpire = "UPDATE vicidial_settings_containers SET container_entry = REGEXP_REPLACE(container_entry, '$old_token_expire_string', '$new_token_expire_string') WHERE container_id = 'KHOMPSETTINGS';";
$affected_rows = $dbhA->do($stmtExpire);
# Unlock vicidial_settings_containers
$stmtA = "UNLOCK TABLES";
$dbhA->do($stmtA);
# update the settings container
my $old_token_string = "khomp_api_token => $khomp_api_token";
my $new_token_string = "khomp_api_token => $new_khomp_api_token";
my $new_token_expire_time = time() + 3600;
my $old_token_expire_string = "khomp_api_token_expire => $khomp_api_token_expire";
my $new_token_expire_string = "khomp_api_token_expire => $new_token_expire_time";
if ($AGILOG) {$agi_string = "-- KHOMP SC TOKEN UPDATE|$affected_rows|$stmtToken|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- KHOMP SC TOKEN EXPIRE UPDATE|$affected_rows|$stmtExpire|"; &agi_output;}
# LOCK vicidial_settings_containers
$stmtA = "LOCK TABLES vicidial_settings_containers WRITE";
$dbhA->do($stmtA);
# UPDATE the Token
$stmtToken = "UPDATE vicidial_settings_containers SET container_entry = REGEXP_REPLACE(container_entry, '$old_token_string', '$new_token_string') WHERE container_id = '$khomp_settings_container';";
$affected_rows = $dbhA->do($stmtToken);
# UPDATE the Expire time
$stmtExpire = "UPDATE vicidial_settings_containers SET container_entry = REGEXP_REPLACE(container_entry, '$old_token_expire_string', '$new_token_expire_string') WHERE container_id = '$khomp_settings_container';";
$affected_rows = $dbhA->do($stmtExpire);
# Unlock vicidial_settings_containers
$stmtA = "UNLOCK TABLES";
$dbhA->do($stmtA);
# over write the old with the new
$khomp_api_token = $new_khomp_api_token;
if ($AGILOG) {$agi_string = "-- KHOMP SC TOKEN UPDATE|$affected_rows|$stmtToken|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- KHOMP SC TOKEN EXPIRE UPDATE|$affected_rows|$stmtExpire|"; &agi_output;}
# over write the old with the new
$khomp_api_token = $new_khomp_api_token;
}
}
else
{
@@ -5357,7 +5448,7 @@ sub process_khomp_analytics
#UC# $khomp_json = encode_json( $khomp_request );
# call the API
($result, $api_query_time) = khomp_json_api( $khomp_json, $khomp_api_url );
($result, $api_query_time) = khomp_json_api( $khomp_json, $khomp_api_url, $khomp_api_check_ssl );
# check the result
if ( $result =~ /^ERROR/ )
@@ -5653,7 +5744,8 @@ sub khomp_api_login
(
$khomp_api_login_url,
$khomp_api_user,
$khomp_api_pass
$khomp_api_pass,
$khomp_api_check_ssl
) = @_;
my $token = 'login';
@@ -5681,7 +5773,17 @@ sub khomp_api_login
# encode it as JSON
#UC# $login_json = encode_json( $login_json );
my $curl_cmd = "$curlbin -sS --data \'$login_json\' $khomp_api_login_url";
my $curl_cmd = "";
if ($khomp_api_check_ssl == 0)
{
$agi_string = "-- KHOMP SSL VERIFICATION DISABLE!"; &agi_output;
$curl_cmd = "$curlbin --insecure -sS --data \'$login_json\' $khomp_api_login_url";
}
else
{
$curl_cmd = "$curlbin -sS --data \'$login_json\' $khomp_api_login_url";
}
$agi_string = "-- KHOMP CURL COMMAND: $curl_cmd"; &agi_output;
@@ -5701,6 +5803,8 @@ sub khomp_api_login
$token = $result->{'result'}->{'token'};
if ( $token eq '' ) { $token = '0'; }
($auth_end_sec, $auth_end_usec) = gettimeofday();
$api_auth_time = tv_interval ( [$auth_start_sec, $auth_start_usec], [$auth_end_sec, $auth_end_usec]);
@@ -5711,7 +5815,7 @@ sub khomp_api_login
### code for connecting to KHOMP api and passing JSON
sub khomp_json_api
{
( $khomp_json, $khomp_api_url ) = @_;
( $khomp_json, $khomp_api_url, $khomp_api_check_ssl ) = @_;
my $query_start_sec;
my $query_start_usec;
@@ -5723,7 +5827,16 @@ sub khomp_json_api
($query_start_sec, $query_start_usec) = gettimeofday();
my $curl_cmd = "$curlbin -sS --data \'$khomp_json\' $khomp_api_url";
my $curl_cmd = "";
if ($khomp_api_check_ssl == 0)
{
$agi_string = "-- KHOMP SSL VERIFICATION DISABLE!"; &agi_output;
$curl_cmd = "$curlbin --insecure -sS --data \'$khomp_json\' $khomp_api_url";
}
else
{
$curl_cmd = "$curlbin -sS --data \'$khomp_json\' $khomp_api_url";
}
$agi_string = "-- KHOMP CURL COMMAND: $curl_cmd"; &agi_output;
+267
View File
@@ -0,0 +1,267 @@
#!/usr/bin/perl
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
$i++;
}
if (!$VARDB_port) {$VARDB_port='3306';}
$CLIcontainer='KHOMPSETTINGS';
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help/i)
{
print "allowed run time options(must stay in this order):\n";
print " [--khomp-container=XXX] = the settings container with the khomp settings to use\n";
print "\n";
exit;
}
else
{
if ($args =~ /--khomp-container=/i) # CLI defined container
{
@CLIvarARY = split(/--khomp-container=/,$args);
@CLIvarARX = split(/ /,$CLIvarARY[1]);
if (length($CLIvarARX[0])>2)
{
$CLIcontainer = $CLIvarARX[0];
$CLIcontainer =~ s/\/$| |\r|\n|\t//gi;
}
else
{$CLIcontainer = 'KHOMPSETTINGS';}
@CLIvarARY=@MT; @CLIvarARY=@MT;
}
}
}
use DBI;
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
use Time::Local;
use Time::HiRes ('tv_interval','gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
($START_s_hires, $START_usec) = gettimeofday();
# Needed for Khomp Integration
use JSON::PP qw(encode_json decode_json);
### find curl binary for KHOMP
$curlbin = '';
$khomp_enabled = 1;
if ( -e ('/bin/curl')) {$curlbin = '/bin/curl';}
else
{
if ( -e ('/usr/bin/curl')) {$curlbin = '/usr/bin/curl';}
else
{
if ( -e ('/usr/local/bin/curl')) {$curlbin = '/usr/local/bin/curl';}
else
{
if ($AGILOG) {$agi_string = "ERROR: curl binary not found, KHOMP disabled"; &agi_output;}
$khomp_enabled = 0;
}
}
}
$khomp_api_url = '';
$khomp_api_proxied = 'false';
$khomp_api_login_url = '';
$khomp_api_user = '';
$khomp_api_pass = '';
$khomp_api_token = '';
$khomp_api_check_ssl = '';
$khomp_api_token_expire = 0;
$stmtA = "SELECT container_entry FROM vicidial_settings_containers WHERE container_id = '$CLIcontainer';";
$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;
$container_entry = $aryA[0];
my @lines = split ( /\n/, $container_entry );
foreach my $line (@lines)
{
# remove comments and blank lines
$line =~ /^\s*$/ and next; # skip blank lines
$line =~ /^\s*#/ and next; # skip line that begin with #
if ( $line =~ /#/ ) # check for comments midway through the line
{
# remove them
@split_line = split( /#/ , $line );
$line = $split_line[0];
}
if ( $line =~ /=>/ )
{
@setting = split( /=>/ , $line );
$key = $setting[0];
$key =~ s/^\s+|\s+$//g;
$value = $setting[1];
$value =~ s/^\s+|\s+$//g;
if ( $key eq 'khomp_api_url' ) { $khomp_api_url = $value; }
if ( $key eq 'khomp_api_proxied' ) { $khomp_api_proxied = $value; }
if ( $key eq 'khomp_api_user' ) { $khomp_api_user = $value; }
if ( $key eq 'khomp_api_pass' ) { $khomp_api_pass = $value; }
if ( $key eq 'khomp_api_check_ssl' ) { $khomp_api_check_ssl = $value; }
if ( $key eq 'khomp_api_login_url' ) { $khomp_api_login_url = $value; }
if ( $key eq 'khomp_api_token' ) { $khomp_api_token = $value; }
if ( $key eq 'khomp_api_token_expire' ) { $khomp_api_token_expire = $value; }
}
}
print "Current KHOMP Settings: url-$khomp_api_url\nproxied-$khomp_api_proxied\nlogin_url-$khomp_api_login_url\nuser-$khomp_api_user\npass-$khomp_api_pass\nheader-$khomp_header\nssl-check-$khomp_api_check_ssl\nformat-$khomp_id_format\ntoken-$khomp_api_token\ntoken expire-$khomp_api_token_expire\n\n";
}
else
{
print "No KHOMP Settings Container!!! Exiting\n";
exit();
}
my $api_auth_time = 0;
if ( ( !( $khomp_api_token_expire ) ) and ( $khomp_api_token_expire != 0 ) ) { $khomp_api_token_expire = 0; }
if ($AGILOG) {$agi_string = "-- KHOMP API Token $khomp_api_token has expired at $khomp_api_token_expire"; &agi_output;}
# get a new API token
my $new_khomp_api_token = '';
if ( $khomp_api_proxied eq 'false' )
{
($new_khomp_api_token, $api_auth_time) = khomp_api_login( $khomp_api_login_url, $khomp_api_user, $khomp_api_pass, $khomp_api_check_ssl );
}
if ( $new_khomp_api_token eq '' )
{
print "ERROR!!! No Token! Exit!\n\n";
exit;
}
# update the settings container
my $old_token_string = "khomp_api_token => $khomp_api_token";
my $new_token_string = "khomp_api_token => $new_khomp_api_token";
my $new_token_expire_time = time() + 3600;
my $old_token_expire_string = "khomp_api_token_expire => $khomp_api_token_expire";
my $new_token_expire_string = "khomp_api_token_expire => $new_token_expire_time";
# LOCK vicidial_settings_containers
$stmtA = "LOCK TABLES vicidial_settings_containers WRITE";
$dbhA->do($stmtA);
# UPDATE the Token
$stmtToken = "UPDATE vicidial_settings_containers SET container_entry = REGEXP_REPLACE(container_entry, '$old_token_string', '$new_token_string') WHERE container_id = '$CLIcontainer';";
$affected_rows = $dbhA->do($stmtToken);
# UPDATE the Expire time
$stmtExpire = "UPDATE vicidial_settings_containers SET container_entry = REGEXP_REPLACE(container_entry, '$old_token_expire_string', '$new_token_expire_string') WHERE container_id = '$CLIcontainer';";
$affected_rows = $dbhA->do($stmtExpire);
# Unlock vicidial_settings_containers
$stmtA = "UNLOCK TABLES";
$dbhA->do($stmtA);
print "-- KHOMP SC TOKEN UPDATE|$affected_rows|$stmtToken|\n";
print "-- KHOMP SC TOKEN EXPIRE UPDATE|$affected_rows|$stmtExpire|\n";
print "-- KHOMP Auth API Call took $api_auth_time seconds\n";
### code for logging into KHOMP api
sub khomp_api_login
{
(
$khomp_api_login_url,
$khomp_api_user,
$khomp_api_pass,
$khomp_api_check_ssl
) = @_;
my $token = 'login';
my $auth_start_sec;
my $auth_start_usec;
my $auth_end_sec;
my $auth_end_usec;
my $auth_sec;
my $auth_usec;
my $api_auth_time;
($auth_start_sec, $auth_start_usec) = gettimeofday();
# build JSON object
my $login_json = {
'id' => 0,
'method' => 'SessionLogin',
'params' => {
'username' => "$khomp_api_user",
'password' => "$khomp_api_pass",
},
'jsonrpc' => '2.0',
};
# encode it as JSON
$login_json = encode_json( $login_json );
if ($khomp_api_check_ssl == 0) { $curlbin = "$curlbin --insecure"; }
my $curl_cmd = "$curlbin -sS --data \'$login_json\' $khomp_api_login_url";
print "-- KHOMP CURL COMMAND: $curl_cmd\n";
$message = `$curl_cmd`;
print "-- KHOMP RESULT: $message\n";
chomp($message);
print "-- KHOMP LOGIN URL: |$khomp_api_login_url|\n";
print "-- KHOMP LOGIN JSON : |$login_json|\n";
print "-- KHOMP LOGIN RESPONSE JSON: |$message|\n";
$json = JSON::PP->new->ascii->pretty->allow_nonref;
$result = $json->decode($message);
$token = $result->{'result'}->{'token'};
($auth_end_sec, $auth_end_usec) = gettimeofday();
$api_auth_time = tv_interval ( [$auth_start_sec, $auth_start_usec], [$auth_end_sec, $auth_end_usec]);
return ($token, $api_auth_time);
}
+371 -195
View File
@@ -101,6 +101,7 @@
# 231118-1054 - Added hangup processing of 3-way press outside-agent calls
# 240225-0957 - Added AUTONEXT hopper_hold_inserts campaign option
# 241001-2224 - Fixes for Khomp call processing
# 241020-1929 - Added khomp campaign settings options
#
# defaults for PreFork
@@ -213,18 +214,18 @@ $curlbin = '';
$khomp_enabled = 1;
if ( -e ('/bin/curl')) {$curlbin = '/bin/curl';}
else
{
if ( -e ('/usr/bin/curl')) {$curlbin = '/usr/bin/curl';}
else
{
if ( -e ('/usr/local/bin/curl')) {$curlbin = '/usr/local/bin/curl';}
else
{
if ($AGILOG) {$agi_string = "ERROR: curl binary not found, KHOMP disabled"; &agi_output;}
$khomp_enabled = 0;
}
}
}
{
if ( -e ('/usr/bin/curl')) {$curlbin = '/usr/bin/curl';}
else
{
if ( -e ('/usr/local/bin/curl')) {$curlbin = '/usr/local/bin/curl';}
else
{
if ($AGILOG) {$agi_string = "ERROR: curl binary not found, KHOMP disabled"; &agi_output;}
$khomp_enabled = 0;
}
}
}
sub process_request
@@ -319,146 +320,6 @@ sub process_request
if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} >= 12))
{$h_exten_reason=1;}
### Grab KHOMP settings from the KHOMPSETTINGS settings container
$khomp_api_url = '';
$khomp_api_proxied = 'false';
$khomp_api_login_url = '';
$khomp_api_user = '';
$khomp_api_pass = '';
$khomp_header = '';
$khomp_id_format = '';
$khomp_sub_account_header = '';
$khomp_api_token = '';
$khomp_api_token_expire = '';
$stmtA = "SELECT container_entry FROM vicidial_settings_containers WHERE container_id = 'KHOMPSETTINGS';";
$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;
$container_entry = $aryA[0];
my @lines = split ( /\n/, $container_entry );
foreach my $line (@lines)
{
# remove comments and blank lines
$line =~ /^\s*$/ and next; # skip blank lines
$line =~ /^\s*#/ and next; # skip line that begin with #
if ( $line =~ /#/ ) # check for comments midway through the line
{
# remove them
@split_line = split( /#/ , $line );
$line = $split_line[0];
}
if ( $line =~ /=>/ )
{
@setting = split( /=>/ , $line );
$key = $setting[0];
$key =~ s/^\s+|\s+$//g;
$value = $setting[1];
$value =~ s/^\s+|\s+$//g;
if ( $key eq 'khomp_api_url' ) { $khomp_api_url = $value; }
if ( $key eq 'khomp_api_proxied' ) { $khomp_api_proxied = $value; }
if ( $key eq 'khomp_api_user' ) { $khomp_api_user = $value; }
if ( $key eq 'khomp_api_pass' ) { $khomp_api_pass = $value; }
if ( $key eq 'khomp_header' ) { $khomp_header = $value; }
if ( $key eq 'khomp_id_format' ) { $khomp_id_format = $value; }
if ( $key eq 'khomp_api_login_url' ) { $khomp_api_login_url = $value; }
if ( $key eq 'khomp_sub_account_header' ) { $khomp_sub_account_header = $value; }
if ( $key eq 'khomp_api_token' ) { $khomp_api_token = $value; }
if ( $key eq 'khomp_api_token_expire' ) { $khomp_api_token_expire = $value; }
}
}
$agi_string = "KHOMP Settings: url-$khomp_api_url|user-$khomp_api_user|pass-$khomp_api_pass|header-$khomp_header|format-$khomp_id_format|sub-account-$khomp_sub_account_header";
#&agi_output;
}
### load the Khomp status map
%conclusion_map = {};
$stmtA = "SELECT container_entry FROM vicidial_settings_containers WHERE container_id = 'KHOMPSTATUSMAP';";
$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;
$container_entry = $aryA[0];
my @lines = split ( /\n/, $container_entry );
foreach my $line (@lines)
{
# remove comments and blank lines
$line =~ /^\s*$/ and next; # skip blank lines
$line =~ /^\s*#/ and next; # skip line that begin with #
if ( $line =~ /#/ ) # check for comments midway through the line
{
# remove them
@split_line = split( /#/ , $line );
$line = $split_line[0];
}
if ( $line =~ /=>/ )
{
@setting = split( /=>/ , $line );
$conclusion_pattern = $setting[0];
$conclusion_pattern =~ s/^\s+|\s+$//g;
$action_status = $setting[1];
$action_status =~ s/^\s+|\s+$//g;
# check if the conclusion_pattern looks like "blah"."blahblah" or just "blah"
if ( $conclusion_pattern =~ /"\."/ )
{
# if "blah"."blahblah" break it up
@rsr = split( /"\."/ , $conclusion_pattern );
$conclusion = $rsr[0];
$conclusion =~ s/^\s+|\s+$//g;
$conclusion =~ s/^"|"$//g;
$pattern = $rsr[1];
$pattern =~ s/^\s+|\s+$//g;
$pattern =~ s/^"|"$//g;
}
else
{
# otherwise result is the string and pattern is blank
$conclusion = $conclusion_pattern;
$conclusion =~ s/^\s+|\s+$//g;
$conclusion =~ s/^"|"$//g;
$pattern = "";
}
@as = split( /\./ , $action_status );
$action = @as[0];
$action =~ s/^\s+|\s+$//g;
$action =~ s/^"|"$//g;
$status = @as[1];
$status =~ s/^\s+|\s+$//g;
$status =~ s/^"|"$//g;
$dial_status = @as[2];
$dial_status =~ s/^\s+|\s+$//g;
$dial_status =~ s/^"|"$//g;
# load the result map hash with the values
$conclusion_map{"$conclusion"}{"$pattern"}{'action'} = $action;
$conclusion_map{"$conclusion"}{"$pattern"}{'status'} = $status;
$conclusion_map{"$conclusion"}{"$pattern"}{'dial_status'} = $dial_status;
}
}
}
if ($AGILOG)
{
$agi_string = "+++++++++++++++++ FastAGI Start ++++ Asterisk version: $ast_ver_str{major} $ast_ver_str{minor} ++++++ hER: $h_exten_reason ++++++";
@@ -532,9 +393,9 @@ sub process_request
$dial_time = $ARGV_vars[4];
$answered_time = $ARGV_vars[5];
$tech_hangup_cause = $ARGV_vars[6];
if( $dial_time > $answered_time )
if( $dial_time > $answered_time )
{$ring_time = $dial_time - $answered_time;}
else
else
{$ring_time = 0;}
$agi_string = "URL HVcauses: |$PRI|$DEBUG|$hangup_cause|$dialstatus|$dial_time|$ring_time|$tech_hangup_cause|";
&agi_output;
@@ -729,7 +590,7 @@ sub process_request
$sthA->finish();
### get campaign settings
$stmtA = "SELECT amd_type,campaign_vdad_exten,dial_timeout,manual_dial_timeout FROM vicidial_campaigns where campaign_id = '$campaign';";
$stmtA = "SELECT amd_type,campaign_vdad_exten,dial_timeout,manual_dial_timeout,khomp_settings_container FROM vicidial_campaigns where campaign_id = '$campaign';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -740,9 +601,156 @@ sub process_request
$campaign_vdad_exten = $aryA[1];
$dial_timeout = $aryA[2];
$man_dial_timeout = $aryA[3];
$khomp_settings_container = $aryA[4];
}
$sthA->finish();
if (( $amd_type eq 'KHOMP' ) && ( $khomp_enabled ) )
{
### Grab KHOMP settings from the KHOMPSETTINGS settings container
$khomp_api_url = '';
$khomp_api_proxied = 'false';
$khomp_api_login_url = '';
$khomp_api_user = '';
$khomp_api_pass = '';
$khomp_api_check_ssl = '';
$khomp_header = '';
$khomp_id_format = '';
$khomp_sub_account_header = '';
$agi_string = "-- KHOMP: Using settings container $khomp_settings_container"; &agi_output;
$stmtA = "SELECT container_entry FROM vicidial_settings_containers WHERE container_id = '$khomp_settings_container';";
$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;
$container_entry = $aryA[0];
my @lines = split ( /\n/, $container_entry );
foreach my $line (@lines)
{
# remove comments and blank lines
$line =~ /^\s*$/ and next; # skip blank lines
$line =~ /^\s*#/ and next; # skip line that begin with #
if ( $line =~ /#/ ) # check for comments midway through the line
{
# remove them
@split_line = split( /#/ , $line );
$line = $split_line[0];
}
if ( $line =~ /=>/ )
{
@setting = split( /=>/ , $line );
$key = $setting[0];
$key =~ s/^\s+|\s+$//g;
$value = $setting[1];
$value =~ s/^\s+|\s+$//g;
if ( $key eq 'khomp_api_url' ) { $khomp_api_url = $value; }
if ( $key eq 'khomp_api_proxied' ) { $khomp_api_proxied = $value; }
if ( $key eq 'khomp_api_user' ) { $khomp_api_user = $value; }
if ( $key eq 'khomp_api_pass' ) { $khomp_api_pass = $value; }
if ( $key eq 'khomp_api_check_ssl' ) { $khomp_api_check_ssl = $value; }
if ( $key eq 'khomp_header' ) { $khomp_header = $value; }
if ( $key eq 'khomp_id_format' ) { $khomp_id_format = $value; }
if ( $key eq 'khomp_api_login_url' ) { $khomp_api_login_url = $value; }
if ( $key eq 'khomp_sub_account_header' ) { $khomp_sub_account_header = $value; }
if ( $key eq 'khomp_api_token' ) { $khomp_api_token = $value; }
if ( $key eq 'khomp_api_token_expire' ) { $khomp_api_token_expire = $value; }
}
}
$agi_string = "KHOMP Settings: url-$khomp_api_url|proxied-$khomp_api_proxied|login_url-$khomp_api_login_url|user-$khomp_api_user|pass-$khomp_api_pass|ssl-check-$khomp_api_check_ssl|header-$khomp_header|format-$khomp_id_format|api-token-$khomp_api_token|token-expire-$khomp_api_token_expire|";
&agi_output;
}
### load the Khomp status map
%conclusion_map = {};
$stmtA = "SELECT container_entry FROM vicidial_settings_containers WHERE container_id = 'KHOMPSTATUSMAP';";
$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;
$container_entry = $aryA[0];
my @lines = split ( /\n/, $container_entry );
foreach my $line (@lines)
{
# remove comments and blank lines
$line =~ /^\s*$/ and next; # skip blank lines
$line =~ /^\s*#/ and next; # skip line that begin with #
if ( $line =~ /#/ ) # check for comments midway through the line
{
# remove them
@split_line = split( /#/ , $line );
$line = $split_line[0];
}
if ( $line =~ /=>/ )
{
@setting = split( /=>/ , $line );
$conclusion_pattern = $setting[0];
$conclusion_pattern =~ s/^\s+|\s+$//g;
$action_status = $setting[1];
$action_status =~ s/^\s+|\s+$//g;
# check if the conclusion_pattern looks like "blah"."blahblah" or just "blah"
if ( $conclusion_pattern =~ /"\."/ )
{
# if "blah"."blahblah" break it up
@rsr = split( /"\."/ , $conclusion_pattern );
$conclusion = $rsr[0];
$conclusion =~ s/^\s+|\s+$//g;
$conclusion =~ s/^"|"$//g;
$pattern = $rsr[1];
$pattern =~ s/^\s+|\s+$//g;
$pattern =~ s/^"|"$//g;
}
else
{
# otherwise result is the string and pattern is blank
$conclusion = $conclusion_pattern;
$conclusion =~ s/^\s+|\s+$//g;
$conclusion =~ s/^"|"$//g;
$pattern = "";
}
@as = split( /\./ , $action_status );
$action = @as[0];
$action =~ s/^\s+|\s+$//g;
$action =~ s/^"|"$//g;
$status = @as[1];
$status =~ s/^\s+|\s+$//g;
$status =~ s/^"|"$//g;
$dial_status = @as[2];
$dial_status =~ s/^\s+|\s+$//g;
$dial_status =~ s/^"|"$//g;
# load the result map hash with the values
$conclusion_map{"$conclusion"}{"$pattern"}{'action'} = $action;
$conclusion_map{"$conclusion"}{"$pattern"}{'status'} = $status;
$conclusion_map{"$conclusion"}{"$pattern"}{'dial_status'} = $dial_status;
}
}
}
}
### set dialplan variable CAMPCUST to the campaign_id of the outbound auto-dial or manual dial call
if (length($CAMPCUST) > 0)
{
@@ -1277,7 +1285,7 @@ sub process_request
}
### get campaign settings
$stmtA = "SELECT amd_type,auto_alt_threshold FROM vicidial_campaigns where campaign_id = '$campaign';";
$stmtA = "SELECT amd_type,khomp_settings_container,auto_alt_threshold FROM vicidial_campaigns where campaign_id = '$campaign';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
@@ -1285,12 +1293,155 @@ sub process_request
{
@aryA = $sthA->fetchrow_array;
$amd_type = $aryA[0];
$CLauto_alt_threshold = $aryA[1];
$khomp_settings_container = $aryA[1];
$CLauto_alt_threshold = $aryA[2];
}
$sthA->finish();
if (( $amd_type eq 'KHOMP' ) && ( $khomp_enabled ) )
{
### Grab KHOMP settings from the KHOMPSETTINGS settings container
$khomp_api_url = '';
$khomp_api_proxied = 'false';
$khomp_api_login_url = '';
$khomp_api_user = '';
$khomp_api_pass = '';
$khomp_api_check_ssl = '';
$khomp_header = '';
$khomp_id_format = '';
$khomp_sub_account_header = '';
$stmtA = "SELECT container_entry FROM vicidial_settings_containers WHERE container_id = '$khomp_settings_container';";
$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;
$container_entry = $aryA[0];
my @lines = split ( /\n/, $container_entry );
foreach my $line (@lines)
{
# remove comments and blank lines
$line =~ /^\s*$/ and next; # skip blank lines
$line =~ /^\s*#/ and next; # skip line that begin with #
if ( $line =~ /#/ ) # check for comments midway through the line
{
# remove them
@split_line = split( /#/ , $line );
$line = $split_line[0];
}
if ( $line =~ /=>/ )
{
@setting = split( /=>/ , $line );
$key = $setting[0];
$key =~ s/^\s+|\s+$//g;
$value = $setting[1];
$value =~ s/^\s+|\s+$//g;
if ( $key eq 'khomp_api_url' ) { $khomp_api_url = $value; }
if ( $key eq 'khomp_api_proxied' ) { $khomp_api_proxied = $value; }
if ( $key eq 'khomp_api_user' ) { $khomp_api_user = $value; }
if ( $key eq 'khomp_api_pass' ) { $khomp_api_pass = $value; }
if ( $key eq 'khomp_api_check_ssl' ) { $khomp_api_check_ssl = $value; }
if ( $key eq 'khomp_header' ) { $khomp_header = $value; }
if ( $key eq 'khomp_id_format' ) { $khomp_id_format = $value; }
if ( $key eq 'khomp_api_login_url' ) { $khomp_api_login_url = $value; }
if ( $key eq 'khomp_sub_account_header' ) { $khomp_sub_account_header = $value; }
if ( $key eq 'khomp_api_token' ) { $khomp_api_token = $value; }
if ( $key eq 'khomp_api_token_expire' ) { $khomp_api_token_expire = $value; }
}
}
$agi_string = "KHOMP Settings: url-$khomp_api_url|user-$khomp_api_user|pass-$khomp_api_pass|ssl-check-$khomp_api_check_ssl|header-$khomp_header|format-$khomp_id_format|sub-account-$khomp_sub_account_header";
#&agi_output;
}
### load the Khomp status map
%conclusion_map = {};
$stmtA = "SELECT container_entry FROM vicidial_settings_containers WHERE container_id = 'KHOMPSTATUSMAP';";
$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;
$container_entry = $aryA[0];
my @lines = split ( /\n/, $container_entry );
foreach my $line (@lines)
{
# remove comments and blank lines
$line =~ /^\s*$/ and next; # skip blank lines
$line =~ /^\s*#/ and next; # skip line that begin with #
if ( $line =~ /#/ ) # check for comments midway through the line
{
# remove them
@split_line = split( /#/ , $line );
$line = $split_line[0];
}
if ( $line =~ /=>/ )
{
@setting = split( /=>/ , $line );
$conclusion_pattern = $setting[0];
$conclusion_pattern =~ s/^\s+|\s+$//g;
$action_status = $setting[1];
$action_status =~ s/^\s+|\s+$//g;
# check if the conclusion_pattern looks like "blah"."blahblah" or just "blah"
if ( $conclusion_pattern =~ /"\."/ )
{
# if "blah"."blahblah" break it up
@rsr = split( /"\."/ , $conclusion_pattern );
$conclusion = $rsr[0];
$conclusion =~ s/^\s+|\s+$//g;
$conclusion =~ s/^"|"$//g;
$pattern = $rsr[1];
$pattern =~ s/^\s+|\s+$//g;
$pattern =~ s/^"|"$//g;
}
else
{
# otherwise result is the string and pattern is blank
$conclusion = $conclusion_pattern;
$conclusion =~ s/^\s+|\s+$//g;
$conclusion =~ s/^"|"$//g;
$pattern = "";
}
@as = split( /\./ , $action_status );
$action = @as[0];
$action =~ s/^\s+|\s+$//g;
$action =~ s/^"|"$//g;
$status = @as[1];
$status =~ s/^\s+|\s+$//g;
$status =~ s/^"|"$//g;
$dial_status = @as[2];
$dial_status =~ s/^\s+|\s+$//g;
$dial_status =~ s/^"|"$//g;
# load the result map hash with the values
$conclusion_map{"$conclusion"}{"$pattern"}{'action'} = $action;
$conclusion_map{"$conclusion"}{"$pattern"}{'status'} = $status;
$conclusion_map{"$conclusion"}{"$pattern"}{'dial_status'} = $dial_status;
}
}
}
if ($AGILOG) {$agi_string = "-- KHOMP process call for campaign $campaign callerid $callerid"; &agi_output;}
( $khomp_action, $khomp_VDL_status, $khomp_VDAC_status ) = process_khomp_analytics(
$khomp_api_url,
@@ -1298,11 +1449,10 @@ sub process_request
$khomp_api_login_url,
$khomp_api_user,
$khomp_api_pass,
$khomp_api_check_ssl,
$khomp_header,
$khomp_id_format,
$khomp_sub_account_header,
$khomp_api_token,
$khomp_api_token_expire,
$khomp_settings_container,
$external_server_ip,
$campaign,
$callerid,
@@ -3101,7 +3251,7 @@ sub check_24hour_call_count
if ($DBX) {print " 24-Hour Call Count State Override Match(postcode $TFH_OR_postcode_state): $TEMPcall_limit_24hour|$container_lines[$c]\n";}
if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)
{
if ($DBX) {print " POSTCODE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
if ($DBX) {print " POSTCODE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
$TEMPcall_limit_24hour = $TEMP_state_ARY[2];
}
}
@@ -3110,7 +3260,7 @@ sub check_24hour_call_count
if ($DBX) {print " 24-Hour Call Count State Override Match(state $temp_24hour_state): $TEMPcall_limit_24hour|$container_lines[$c]\n";}
if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)
{
if ($DBX) {print " STATE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
if ($DBX) {print " STATE field override of override triggered: ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour)\n";}
$TEMPcall_limit_24hour = $TEMP_state_ARY[2];
}
}
@@ -3220,11 +3370,10 @@ sub process_khomp_analytics
$khomp_api_login_url,
$khomp_api_user,
$khomp_api_pass,
$khomp_api_check_ssl,
$khomp_header,
$khomp_id_format,
$khomp_sub_account_header,
$khomp_api_token,
$khomp_api_token_expire,
$khomp_settings_container,
$external_server_ip,
$campaign_id,
$callerid,
@@ -3245,43 +3394,46 @@ sub process_khomp_analytics
{ $khomp_id = $callerid . '_' . $campaign_id . '_' . $external_server_ip; }
my $api_auth_time = 0;
if ( ( !( $khomp_api_token_expire ) ) and ( $khomp_api_token_expire != 0 ) ) { $khomp_api_token_expire = 0; }
if ( ($khomp_api_token_expire < time() ) or ( $khomp_api_token eq 'TOKENTOKENTOKEN' ))
my $cur_time = time();
if ( ($khomp_api_token_expire < $cur_time ) or ( $khomp_api_token eq 'TOKENTOKENTOKEN' ))
{
if ($AGILOG) {$agi_string = "-- KHOMP API Token $khomp_api_token has expired at $khomp_api_token_expire"; &agi_output;}
if ($AGILOG) {$agi_string = "-- KHOMP API Token $khomp_api_token has expired at $khomp_api_token_expire|$cur_time"; &agi_output;}
# get a new API token
my $new_khomp_api_token = '';
if ( $khomp_api_proxied eq 'false' )
{
($new_khomp_api_token, $api_auth_time) = khomp_api_login( $khomp_api_login_url, $khomp_api_user, $khomp_api_pass );
($new_khomp_api_token, $api_auth_time) = khomp_api_login( $khomp_api_login_url, $khomp_api_user, $khomp_api_pass, $khomp_api_check_ssl );
}
# update the settings container
my $old_token_string = "khomp_api_token => $khomp_api_token";
my $new_token_string = "khomp_api_token => $new_khomp_api_token";
my $new_token_expire_time = time() + 3600;
my $old_token_expire_string = "khomp_api_token_expire => $khomp_api_token_expire";
my $new_token_expire_string = "khomp_api_token_expire => $new_token_expire_time";
if ( $new_khomp_api_token ne '0' )
{
# update the settings container
my $old_token_string = "khomp_api_token => $khomp_api_token";
my $new_token_string = "khomp_api_token => $new_khomp_api_token";
my $new_token_expire_time = time() + 3600;
my $old_token_expire_string = "khomp_api_token_expire => $khomp_api_token_expire";
my $new_token_expire_string = "khomp_api_token_expire => $new_token_expire_time";
# LOCK vicidial_settings_containers
$stmtA = "LOCK TABLES vicidial_settings_containers WRITE";
$dbhA->do($stmtA);
# UPDATE the Token
$stmtToken = "UPDATE vicidial_settings_containers SET container_entry = REGEXP_REPLACE(container_entry, '$old_token_string', '$new_token_string') WHERE container_id = 'KHOMPSETTINGS';";
$affected_rows = $dbhA->do($stmtToken);
# UPDATE the Expire time
$stmtExpire = "UPDATE vicidial_settings_containers SET container_entry = REGEXP_REPLACE(container_entry, '$old_token_expire_string', '$new_token_expire_string') WHERE container_id = 'KHOMPSETTINGS';";
$affected_rows = $dbhA->do($stmtExpire);
# Unlock vicidial_settings_containers
$stmtA = "UNLOCK TABLES";
$dbhA->do($stmtA);
# LOCK vicidial_settings_containers
$stmtA = "LOCK TABLES vicidial_settings_containers WRITE";
$dbhA->do($stmtA);
# UPDATE the Token
$stmtToken = "UPDATE vicidial_settings_containers SET container_entry = REGEXP_REPLACE(container_entry, '$old_token_string', '$new_token_string') WHERE container_id = '$khomp_settings_container';";
$affected_rows = $dbhA->do($stmtToken);
# UPDATE the Expire time
$stmtExpire = "UPDATE vicidial_settings_containers SET container_entry = REGEXP_REPLACE(container_entry, '$old_token_expire_string', '$new_token_expire_string') WHERE container_id = '$khomp_settings_container';";
$affected_rows = $dbhA->do($stmtExpire);
# Unlock vicidial_settings_containers
$stmtA = "UNLOCK TABLES";
$dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "-- KHOMP SC TOKEN UPDATE|$affected_rows|$stmtToken|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- KHOMP SC TOKEN EXPIRE UPDATE|$affected_rows|$stmtExpire|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- KHOMP SC TOKEN UPDATE|$affected_rows|$stmtToken|"; &agi_output;}
if ($AGILOG) {$agi_string = "-- KHOMP SC TOKEN EXPIRE UPDATE|$affected_rows|$stmtExpire|"; &agi_output;}
# over write the old with the new
$khomp_api_token = $new_khomp_api_token;
# over write the old with the new
$khomp_api_token = $new_khomp_api_token;
}
}
else
{
@@ -3561,7 +3713,8 @@ sub khomp_api_login
(
$khomp_api_login_url,
$khomp_api_user,
$khomp_api_pass
$khomp_api_pass,
$khomp_api_check_ssl
) = @_;
my $token = 'login';
@@ -3589,7 +3742,16 @@ sub khomp_api_login
# encode it as JSON
#UC# $login_json = encode_json( $login_json );
my $curl_cmd = "$curlbin -sS --data \'$login_json\' $khomp_api_login_url";
my $curl_cmd = "";
if ($khomp_api_check_ssl == 0)
{
$agi_string = "-- KHOMP SSL VERIFICATION DISABLE!"; &agi_output;
$curl_cmd = "$curlbin --insecure -sS --data \'$login_json\' $khomp_api_login_url";
}
else
{
$curl_cmd = "$curlbin -sS --data \'$login_json\' $khomp_api_login_url";
}
$agi_string = "-- KHOMP CURL COMMAND: $curl_cmd"; &agi_output;
@@ -3609,6 +3771,11 @@ sub khomp_api_login
$token = $result->{'result'}->{'token'};
if ( $token eq '' ) {
$agi_string = "-- ERROR!!!!!!KHOMP RETURNED INVALID TOKEN!!!!!"; &agi_output;
$token = '0';
}
($auth_end_sec, $auth_end_usec) = gettimeofday();
$api_auth_time = tv_interval ( [$auth_start_sec, $auth_start_usec], [$auth_end_sec, $auth_end_usec]);
@@ -3619,7 +3786,7 @@ sub khomp_api_login
### code for connecting to KHOMP api and passing JSON
sub khomp_json_api
{
( $khomp_json, $khomp_api_url ) = @_;
( $khomp_json, $khomp_api_url, $khomp_api_check_ssl ) = @_;
my $query_start_sec;
my $query_start_usec;
@@ -3631,7 +3798,16 @@ sub khomp_json_api
($query_start_sec, $query_start_usec) = gettimeofday();
my $curl_cmd = "$curlbin -sS --data \'$khomp_json\' $khomp_api_url";
my $curl_cmd = "";
if ($khomp_api_check_ssl == 0)
{
$agi_string = "-- KHOMP SSL VERIFICATION DISABLE!"; &agi_output;
$curl_cmd = "$curlbin --insecure -sS --data \'$khomp_json\' $khomp_api_url";
}
else
{
$curl_cmd = "$curlbin -sS --data \'$khomp_json\' $khomp_api_url";
}
$agi_string = "-- KHOMP CURL COMMAND: $curl_cmd"; &agi_output;
@@ -315,13 +315,13 @@ action VARCHAR(20),
callerid VARCHAR(20),
cmd_line_b VARCHAR(100),
cmd_line_c VARCHAR(100),
cmd_line_d VARCHAR(100),
cmd_line_d VARCHAR(200),
cmd_line_e VARCHAR(100),
cmd_line_f VARCHAR(100),
cmd_line_g VARCHAR(100),
cmd_line_h VARCHAR(100),
cmd_line_i VARCHAR(100),
cmd_line_j VARCHAR(100),
cmd_line_i VARCHAR(50),
cmd_line_j VARCHAR(50),
cmd_line_k VARCHAR(100),
index (callerid),
index (uniqueid),
@@ -1130,7 +1130,9 @@ call_log_days SMALLINT(5) default '0',
leave_3way_stop_recording ENUM('DISABLED','ALL_CALLS') default 'DISABLED',
manual_minimum_ring_seconds SMALLINT(5) default '0',
manual_minimum_attempt_seconds SMALLINT(5) default '0',
manual_minimum_answer_seconds SMALLINT(5) default '0'
manual_minimum_answer_seconds SMALLINT(5) default '0',
stereo_recording ENUM('DISABLED','CUSTOMER','CUSTOMER_MUTE') default 'DISABLED',
khomp_settings_container VARCHAR(40) DEFAULT 'KHOMPSETTINGS'
) ENGINE=MyISAM;
CREATE TABLE vicidial_lists (
@@ -1456,7 +1458,8 @@ third_alert_delay INT(6) default '1000',
third_alert_container VARCHAR(40) default 'DISABLED',
third_alert_only VARCHAR(40) default 'DISABLED',
agent_search_list VARCHAR(20) default '',
state_descriptions VARCHAR(40) default '---DISABLED---'
state_descriptions VARCHAR(40) default '---DISABLED---',
stereo_recording ENUM('DISABLED','CUSTOMER','CUSTOMER_MUTE') default 'DISABLED'
) ENGINE=MyISAM;
CREATE TABLE vicidial_stations (
@@ -2039,7 +2042,8 @@ coldstorage_server_ip VARCHAR(50) default '',
coldstorage_dbname VARCHAR(50) default '',
coldstorage_login VARCHAR(50) default '',
coldstorage_pass VARCHAR(50) default '',
coldstorage_port VARCHAR(10) default ''
coldstorage_port VARCHAR(10) default '',
stereo_recording ENUM('0','1','2','3','4','5','6') default '0'
) ENGINE=MyISAM;
CREATE TABLE vicidial_campaigns_list_mix (
@@ -5285,6 +5289,21 @@ PRIMARY KEY (vtl_id),
UNIQUE KEY vicidial_timeoff_log_agent_month_key (user,timeoff_month,timeoff_type)
);
CREATE TABLE recording_log_stereo (
recording_id INT(10) UNSIGNED PRIMARY KEY NOT NULL,
server_ip VARCHAR(15),
start_time DATETIME,
end_time DATETIME,
length_in_sec MEDIUMINT(8) UNSIGNED,
filename VARCHAR(100),
lead_id INT(9) UNSIGNED,
options VARCHAR(100),
processing_log TEXT,
index(filename),
index(lead_id),
index(start_time)
) ENGINE=MyISAM;
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
@@ -5689,4 +5708,4 @@ INSERT INTO `wallboard_reports` VALUES ('AGENTS_AND_QUEUES','Agents and Queues',
UPDATE system_settings set vdc_agent_api_active='1';
UPDATE system_settings SET db_schema_version='1718',db_schema_update_date=NOW(),reload_timestamp=NOW();
UPDATE system_settings SET db_schema_version='1719',db_schema_update_date=NOW(),reload_timestamp=NOW();
+28
View File
@@ -2750,3 +2750,31 @@ ALTER TABLE vicidial_campaigns ADD manual_minimum_attempt_seconds SMALLINT(5) de
ALTER TABLE vicidial_campaigns ADD manual_minimum_answer_seconds SMALLINT(5) default '0';
UPDATE system_settings SET db_schema_version='1718',db_schema_update_date=NOW() where db_schema_version < 1718;
ALTER TABLE system_settings ADD stereo_recording ENUM('0','1','2','3','4','5','6') default '0';
ALTER TABLE vicidial_campaigns ADD stereo_recording ENUM('DISABLED','CUSTOMER','CUSTOMER_MUTE') default 'DISABLED';
ALTER TABLE vicidial_campaigns ADD khomp_settings_container VARCHAR(40) DEFAULT 'KHOMPSETTINGS';
ALTER TABLE vicidial_inbound_groups ADD stereo_recording ENUM('DISABLED','CUSTOMER','CUSTOMER_MUTE') default 'DISABLED';
ALTER TABLE vicidial_manager MODIFY cmd_line_i VARCHAR(50);
ALTER TABLE vicidial_manager MODIFY cmd_line_j VARCHAR(50);
ALTER TABLE vicidial_manager MODIFY cmd_line_d VARCHAR(200);
CREATE TABLE recording_log_stereo (
recording_id INT(10) UNSIGNED PRIMARY KEY NOT NULL,
server_ip VARCHAR(15),
start_time DATETIME,
end_time DATETIME,
length_in_sec MEDIUMINT(8) UNSIGNED,
filename VARCHAR(100),
lead_id INT(9) UNSIGNED,
options VARCHAR(100),
processing_log TEXT,
index(filename),
index(lead_id),
index(start_time)
) ENGINE=MyISAM;
UPDATE system_settings SET db_schema_version='1719',db_schema_update_date=NOW() where db_schema_version < 1719;
+40 -2
View File
@@ -553,10 +553,11 @@
# 240612-0206 - Fix for extension_appended_cidname newer options
# 240801-1140 - Code updates for PHP8 compatibility
# 240830-1618 - Added manual_minimum_ring_seconds SIP action lookup code
# 240906-1646 - Added testing for stereo_recording campaign option for manual dial calls *NOT PRODUCTION READY*
#
$version = '2.14-446';
$build = '240830-1618';
$version = '2.14-447';
$build = '240906-1646';
$php_script = 'vdc_db_query.php';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=913;
@@ -879,6 +880,8 @@ if (isset($_GET["manual_minimum_ring_seconds"])) {$manual_minimum_ring_seconds
elseif (isset($_POST["manual_minimum_ring_seconds"])) {$manual_minimum_ring_seconds=$_POST["manual_minimum_ring_seconds"];}
if (isset($_GET["manual_minimum_ringing"])) {$manual_minimum_ringing=$_GET["manual_minimum_ringing"];}
elseif (isset($_POST["manual_minimum_ringing"])) {$manual_minimum_ringing=$_POST["manual_minimum_ringing"];}
if (isset($_GET["stereo_recording"])) {$stereo_recording=$_GET["stereo_recording"];}
elseif (isset($_POST["stereo_recording"])) {$stereo_recording=$_POST["stereo_recording"];}
$DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
$user=preg_replace("/\'|\"|\\\\|;| /","",$user);
@@ -1219,6 +1222,7 @@ $pause_max_url_trigger = preg_replace('/[^0-9]/','',$pause_max_url_trigger);
$ACTION = preg_replace('/[^-_0-9a-zA-Z]/','',$ACTION);
$manual_minimum_ring_seconds = preg_replace('/[^0-9]/','',$manual_minimum_ring_seconds);
$manual_minimum_ringing = preg_replace('/[^0-9]/','',$manual_minimum_ringing);
$stereo_recording = preg_replace('/[^-_0-9a-zA-Z]/','',$stereo_recording);
$vendor_lead_code = preg_replace("/\"|\\\\|;/",'-',$vendor_lead_code);
$title = preg_replace("/\"|\\\\|;/",'-',$title);
$first_name = preg_replace("/\"|\\\\|;/",'-',$first_name);
@@ -8107,6 +8111,40 @@ if ($ACTION == 'manDiaLlookCaLL')
if ( ($routing_initiated_recording == 'Y') and (preg_match("/^M/",$MDnextCID)) )
{
if (preg_match("/CUSTOMER/",$stereo_recording))
{
$stmt="SELECT conf_engine FROM servers where server_ip='$server_ip';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ( $row[0] == 'CONFBRIDGE' )
{
if ( (strlen($recording_filename) < 1) or (strlen($recording_id) < 1) )
{
$stmt = "SELECT recording_id,filename from recording_log where lead_id='$lead_id' and vicidial_id='$MDnextCID';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$RL_ct = mysqli_num_rows($rslt);
if ($RL_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$recording_id = $row[0];
$recording_filename = $row[1];
}
}
$tempMDnextCID = $MDnextCID;
$tempMDnextCID = preg_replace("/^../",'SR',$tempMDnextCID);
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','MixMonitor','$tempMDnextCID','ActionID: $tempMDnextCID','Channel: $channel','options: r(../monitorS/$recording_filename-in.wav)t(../monitorS/$recording_filename-out.wav)','','','','','','','');";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$stmt="INSERT INTO recording_log_stereo (recording_id,server_ip,start_time,length_in_sec,filename,lead_id,options,processing_log) values('$recording_id','$server_ip','$NOW_TIME','0','$recording_filename','$lead_id','$stereo_recording $campaign','start: $NOW_TIME|vicidial_id: $uniqueid|user: $user|channel: $channel|CID: $MDnextCID|');";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
$stmt="UPDATE recording_log set vicidial_id='$uniqueid' where lead_id='$lead_id' and vicidial_id='$MDnextCID';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_to_mysqli($stmt, $link);
+8 -3
View File
@@ -857,7 +857,7 @@ $random = (rand(1000000, 9999999) + 10000000);
#############################################
##### START SYSTEM_SETTINGS AND USER LANGUAGE LOOKUP #####
$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_third_webform,default_language,active_modules,allow_chats,chat_url,default_phone_code,agent_screen_colors,manual_auto_next,agent_xfer_park_3way,admin_web_directory,agent_script,agent_push_events,agent_push_url,agent_logout_link,agentonly_callback_campaign_lock,manual_dial_validation,mute_recordings,enable_second_script,enable_first_webform,recording_buttons,outbound_cid_any,browser_call_alerts,manual_dial_phone_strip,require_password_length,pass_hash_enabled,agent_hidden_sound_seconds,agent_hidden_sound,agent_hidden_sound_volume,agent_screen_timer,agent_hide_hangup,allow_web_debug,max_logged_in_agents,login_kickall,agent_notifications,inbound_credits,two_factor_auth_agent_hours,two_factor_container,sip_event_logging FROM system_settings;";
$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled,pllb_grouping_limit,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,meetme_enter_login_filename,meetme_enter_leave3way_filename,enable_third_webform,default_language,active_modules,allow_chats,chat_url,default_phone_code,agent_screen_colors,manual_auto_next,agent_xfer_park_3way,admin_web_directory,agent_script,agent_push_events,agent_push_url,agent_logout_link,agentonly_callback_campaign_lock,manual_dial_validation,mute_recordings,enable_second_script,enable_first_webform,recording_buttons,outbound_cid_any,browser_call_alerts,manual_dial_phone_strip,require_password_length,pass_hash_enabled,agent_hidden_sound_seconds,agent_hidden_sound,agent_hidden_sound_volume,agent_screen_timer,agent_hide_hangup,allow_web_debug,max_logged_in_agents,login_kickall,agent_notifications,inbound_credits,two_factor_auth_agent_hours,two_factor_container,sip_event_logging,stereo_recording FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);}
#if ($DB) {echo "$stmt\n";}
@@ -924,6 +924,7 @@ if ($qm_conf_ct > 0)
$SStwo_factor_auth_hours = $row[56];
$SStwo_factor_container = $row[57];
$SSsip_event_logging = $row[58];
$SSstereo_recording = $row[59];
if ( ($SSagent_hidden_sound == '---NONE---') or ($SSagent_hidden_sound == '') ) {$SSagent_hidden_sound_seconds=0;}
}
else
@@ -3125,7 +3126,7 @@ else
$HKstatusnames = substr("$HKstatusnames", 0, -1);
##### grab the campaign settings
$stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,manual_preview_dial,api_manual_dial,manual_dial_call_time_check,my_callback_option,per_call_notes,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment,auto_pause_precall,auto_pause_precall_code,auto_resume_precall,manual_dial_cid,custom_3way_button_transfer,callback_days_limit,disable_dispo_screen,disable_dispo_status,screen_labels,status_display_fields,pllb_grouping,pllb_grouping_limit,in_group_dial,in_group_dial_select,pause_after_next_call,owner_populate,manual_dial_lead_id,dead_max,dispo_max,pause_max,dead_max_dispo,dispo_max_dispo,max_inbound_calls,manual_dial_search_checkbox,hide_call_log_info,timer_alt_seconds,wrapup_bypass,wrapup_after_hotkey,callback_active_limit,callback_active_limit_override,comments_all_tabs,comments_dispo_screen,comments_callback_screen,qc_comment_history,show_previous_callback,clear_script,manual_dial_search_filter,web_form_address_three,manual_dial_override_field,status_display_ingroup,customer_gone_seconds,agent_display_fields,manual_dial_timeout,manual_auto_next,manual_auto_show,allow_required_fields,dead_to_dispo,agent_xfer_validation,ready_max_logout,callback_display_days,three_way_record_stop,hangup_xfer_record_start,max_inbound_calls_outcome,manual_auto_next_options,agent_screen_time_display,pause_max_dispo,script_top_dispo,routing_initiated_recordings,dead_trigger_seconds,dead_trigger_action,dead_trigger_repeat,dead_trigger_filename,scheduled_callbacks_force_dial,callback_hours_block,callback_display_days,scheduled_callbacks_timezones_container,three_way_volume_buttons,manual_dial_validation,mute_recordings,leave_vm_no_dispo,leave_vm_message_group_id,campaign_script_two,browser_alert_sound,browser_alert_volume,three_way_record_stop_exception,pause_max_exceptions,transfer_button_launch,leave_3way_start_recording,leave_3way_start_recording_exception,calls_waiting_vl_one,calls_waiting_vl_two,in_man_dial_next_ready_seconds,in_man_dial_next_ready_seconds_override,transfer_no_dispo,local_call_time,pause_max_url,agent_hide_hangup,ig_xfer_list_sort,script_tab_frame_size,user_group_script,agent_hangup_route,agent_hangup_value,agent_hangup_ig_override,show_confetti,custom_one,custom_two,custom_three,custom_four,custom_five,allow_chats,dead_stop_recording,force_per_call_notes,state_descriptions,script_tab_height,leave_3way_stop_recording,manual_minimum_ring_seconds,manual_minimum_attempt_seconds,manual_minimum_answer_seconds,sip_event_logging FROM vicidial_campaigns where campaign_id = '$VD_campaign';";
$stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,manual_preview_dial,api_manual_dial,manual_dial_call_time_check,my_callback_option,per_call_notes,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment,auto_pause_precall,auto_pause_precall_code,auto_resume_precall,manual_dial_cid,custom_3way_button_transfer,callback_days_limit,disable_dispo_screen,disable_dispo_status,screen_labels,status_display_fields,pllb_grouping,pllb_grouping_limit,in_group_dial,in_group_dial_select,pause_after_next_call,owner_populate,manual_dial_lead_id,dead_max,dispo_max,pause_max,dead_max_dispo,dispo_max_dispo,max_inbound_calls,manual_dial_search_checkbox,hide_call_log_info,timer_alt_seconds,wrapup_bypass,wrapup_after_hotkey,callback_active_limit,callback_active_limit_override,comments_all_tabs,comments_dispo_screen,comments_callback_screen,qc_comment_history,show_previous_callback,clear_script,manual_dial_search_filter,web_form_address_three,manual_dial_override_field,status_display_ingroup,customer_gone_seconds,agent_display_fields,manual_dial_timeout,manual_auto_next,manual_auto_show,allow_required_fields,dead_to_dispo,agent_xfer_validation,ready_max_logout,callback_display_days,three_way_record_stop,hangup_xfer_record_start,max_inbound_calls_outcome,manual_auto_next_options,agent_screen_time_display,pause_max_dispo,script_top_dispo,routing_initiated_recordings,dead_trigger_seconds,dead_trigger_action,dead_trigger_repeat,dead_trigger_filename,scheduled_callbacks_force_dial,callback_hours_block,callback_display_days,scheduled_callbacks_timezones_container,three_way_volume_buttons,manual_dial_validation,mute_recordings,leave_vm_no_dispo,leave_vm_message_group_id,campaign_script_two,browser_alert_sound,browser_alert_volume,three_way_record_stop_exception,pause_max_exceptions,transfer_button_launch,leave_3way_start_recording,leave_3way_start_recording_exception,calls_waiting_vl_one,calls_waiting_vl_two,in_man_dial_next_ready_seconds,in_man_dial_next_ready_seconds_override,transfer_no_dispo,local_call_time,pause_max_url,agent_hide_hangup,ig_xfer_list_sort,script_tab_frame_size,user_group_script,agent_hangup_route,agent_hangup_value,agent_hangup_ig_override,show_confetti,custom_one,custom_two,custom_three,custom_four,custom_five,allow_chats,dead_stop_recording,force_per_call_notes,state_descriptions,script_tab_height,leave_3way_stop_recording,manual_minimum_ring_seconds,manual_minimum_attempt_seconds,manual_minimum_answer_seconds,sip_event_logging,stereo_recording FROM vicidial_campaigns where campaign_id = '$VD_campaign';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -3328,6 +3329,9 @@ else
$manual_minimum_attempt_seconds =$row[195];
$manual_minimum_answer_seconds =$row[196];
$CAMPsip_event_logging = $row[197];
$stereo_recording = $row[198];
if ($SSstereo_recording < 1) {$stereo_recording='DISABLED';}
if ( ($manual_minimum_ring_seconds > 0) and ($SSsip_event_logging < 1) )
{
@@ -6707,6 +6711,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
var hide_relogin_fields='<?php echo $hide_relogin_fields ?>';
var MD_dial_timed_out=0;
var routing_initiated_recording='<?php echo $routing_initiated_recording ?>';
var stereo_recording='<?php echo $stereo_recording ?>';
var dead_trigger_count=0;
var dead_recording_triggered=0;
var dead_trigger_first_ran=0;
@@ -11238,7 +11243,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
if ( (script_recording_delay < 1) && (routing_initiated_recording == 'Y') && ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) )
{temp_rir='Y';}
manDiaLlook_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLlookCaLL&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&MDnextCID=" + CIDcheck + "&agent_log_id=" + agent_log_id + "&lead_id=" + document.vicidial_form.lead_id.value + "&DiaL_SecondS=" + MD_ring_secondS + "&stage=" + taskCheckOR + "&campaign=" + campaign + "&phone_number=" + dialed_number + "&routing_initiated_recording=" + temp_rir + "&manual_minimum_ring_seconds=" + manual_minimum_ring_seconds + "&manual_minimum_ringing=" + manual_minimum_ringing;
manDiaLlook_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLlookCaLL&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&MDnextCID=" + CIDcheck + "&agent_log_id=" + agent_log_id + "&lead_id=" + document.vicidial_form.lead_id.value + "&DiaL_SecondS=" + MD_ring_secondS + "&stage=" + taskCheckOR + "&campaign=" + campaign + "&phone_number=" + dialed_number + "&routing_initiated_recording=" + temp_rir + "&manual_minimum_ring_seconds=" + manual_minimum_ring_seconds + "&manual_minimum_ringing=" + manual_minimum_ringing + "&stereo_recording=" + stereo_recording + "&recording_filename=" + recording_filename +"&recording_id=" + recording_id;
xmlhttp.open('POST', 'vdc_db_query.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(manDiaLlook_query);
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
# version: 20241001152501
# version: 20241020180701
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 20 digits in length, Must be at least 2 characters in length. We strongly recommend not reusing user accounts for different users, for reporting accuracy. To disable a user account, set the Active option to -N-.</QXZ>
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length, unless the User Password Minimum Length system setting is enabled, which will require a longer password. Only letters and numbers are allowed in user passwords. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ>
@@ -204,6 +204,7 @@ campaigns-cpd_amd_action CPD AMD Action <QXZ>If you are using the Sangoma ParaXi
campaigns-cpd_unknown_action CPD Unknown Action <QXZ>If you are using the Sangoma ParaXip Call Progress Detection software and you want to send calls that have an Unknown result to a destination other than an agent, then you will want to enable this setting either setting it to DISPO which will disposition the call as AA and hang it up if the call is being processed and has not been sent to an agent yet or MESSAGE which will send the call to the defined Answering Machine Message for this campaign. Default is DISABLED. Setting this to INGROUP will send an answering machine to an inbound group. Setting this to CALLMENU will send an answering machine to a Call Menu in the system.</QXZ>
campaigns-amd_inbound_group AMD Inbound Group <QXZ>If CPD AMD Action is set to INGROUP, then this is the Inbound Group that the call will be sent to if an answering machine is detected.</QXZ>
campaigns-amd_callmenu AMD Call Menu <QXZ>If CPD AMD Action is set to CALLMENU, then this is the Call Menu that the call will be sent to if an answering machine is detected.</QXZ>
campaigns-khomp_settings_container KHOMP Settings <QXZ>If you are using a KHOMP call progress gateway server, this setting will allow you to use a specific set of Khomp settings only for this campaign. To appear in the pull-down menu the container must be a KHOMP_SETTINGS container type. Default is KHOMPSETTINGS.</QXZ>
campaigns-leave_vm_message_group_id VM Message Group <QXZ>If this option is set, the VM transfer panel button will open up a new panel with all of the messages that are shown in the selected VM Message Group that the agent can choose to have played to the customer voicemail box when transferred. Default is blank for disabled.</QXZ>
campaigns-leave_vm_no_dispo Leave VM No Dispo <QXZ>If this option is enabled, when the agent transfers a call to a VM Message, the agent screen will not automatically be sent to the disposition screen, it will stay in the talk screen. Default is DISABLED.</QXZ>
campaigns-manual_auto_next Manual Auto Next Seconds <QXZ>If the Dial Method is set to MANUAL or INBOUND_MAN, then this setting will trigger the next lead to be automatically be dialed after this number of seconds. If enabled, it cannot be set lower than 5 seconds. Default is 0 for disabled.</QXZ>