Added 'logtable' SIP action, added sip actions to auto-dial calls

git-svn-id: svn://192.168.202.10@3134 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2019-09-26 05:02:28 +00:00
parent 19be0745ce
commit c21795bfc5
8 changed files with 303 additions and 25 deletions
+122 -2
View File
@@ -120,12 +120,13 @@
# 180926-2350 - Added _wait_time options for next_agent_call
# 190531-0901 - Changed dialplan inputs to accept connected-line name for CIDname validation, added SIP event processing
# 190713-1045 - Added Call Quota logging
# 190925-1348 - Added campaign SIP Actions processing
#
$script = 'agi-VDAD_ALL_outbound.agi';
$AGILOG = '0';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=140;
$mysql_log_count=147;
$one_mysql_log=0;
use Time::Local;
@@ -408,6 +409,8 @@ if ($AGILOG) {$agi_string = "+++++ VDAD START : |$CIDlead_id|$now_date|$AST_ver|
##### BEGIN SIP event logging, if enabled in the system #####
if ($SSsip_event_logging > 0)
{
$SIP_event_recent_inserted=0;
$SIP_event_action_checked=0;
# flag the vicidial_sip_event_recent record as undergoing processing
$stmtA = "UPDATE vicidial_sip_event_recent set processed='U' where caller_code='$callerid' LIMIT 1;";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
@@ -465,6 +468,7 @@ if ($SSsip_event_logging > 0)
if ($invite_to_ring != '0') {$invite_to_ring = ($invite_to_ring / 1000000);}
if ($ring_to_final != '0') {$ring_to_final = ($ring_to_final / 1000000);}
if ($dial_time != '0') {$dial_time = ($dial_time / 1000000);}
$invite_to_final = $dial_time;
# insert a record into the vicidial_log_extended_sip table for this call
$stmtA = "INSERT INTO vicidial_log_extended_sip SET call_date='$invite_date', caller_code='$callerid', invite_to_ring='$invite_to_ring', ring_to_final='$ring_to_final', invite_to_final='$dial_time', last_event_code='200';";
@@ -479,6 +483,8 @@ if ($SSsip_event_logging > 0)
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01140'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- SIP-event recent processed: |$affected_rows|$callerid|"; &agi_output;}
$SIP_event_recent_inserted++;
}
}
}
@@ -774,7 +780,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 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 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;
@@ -818,6 +824,7 @@ if ($VDACaffected_rows > 0)
$routing_initiated_recordings = $aryA[30];
$campaign_rec_exten = $aryA[31];
$VD_call_quota_lead_ranking = $aryA[32];
$CAMPsip_event_logging = $aryA[33];
if (length($closer_campaigns) > 2)
{
$closer_campaigns =~ s/^ | -$//gi;
@@ -829,6 +836,119 @@ if ($VDACaffected_rows > 0)
$sthA->finish();
##### BEGIN SIP Action check #####
if ( ($SIP_event_recent_inserted > 0) && ($SIP_event_action_checked < 1) && (length($CAMPsip_event_logging) > 0) and ($CAMPsip_event_logging !~ /^DISABLED$/i) )
{
# Gather settings container for SIP Event Actions
$CQcontainer_entry='';
$stmtA = "SELECT container_entry FROM vicidial_settings_containers where container_id='$CAMPsip_event_logging';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ( ($AGILOG > 0) && ($sthArows > 0) ) {$agi_string = "-- SIP ACTION check: |$sthArows|$invite_to_final|$CAMPsip_event_logging|"; &agi_output;}
$dbhP=$dbhA; $mysql_count='01141'; $MEL_aff_rows=$sthArows; &mysql_error_logging;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$SAcontainer_entry = $aryA[0];
$SAcontainer_entry =~ s/\r|\t|\'|\"//gi;
@sip_action_settings = split(/\n/,$SAcontainer_entry);
$sea=0;
foreach (@sip_action_settings)
{
if ($sip_action_settings[$sea] =~ /^invite_to_final => /)
{
# invite_to_final => 0.0,1.0,hangup-dispo-message,FAS,Auto Hangup and Dispo of False Answer Call
$sip_action_settings[$sea] =~ s/invite_to_final => //gi;
@invite_to_finalARY = split(/,/,$sip_action_settings[$sea]);
$T_dial_time = ($invite_to_final + 0);
$itf_begin = ($invite_to_finalARY[0] + 0);
$itf_end = ($invite_to_finalARY[1] + 0);
$itf_actions = $invite_to_finalARY[2];
$itf_dispo = $invite_to_finalARY[3];
$itf_message = $invite_to_finalARY[4];
if ( ($T_dial_time >= $itf_begin) && ($T_dial_time <= $itf_end) && (length($itf_actions) > 4) )
{
if ($itf_actions =~ /logtable/i)
{
##### insert record into vicidial_sip_action_log
$stmtA="INSERT INTO vicidial_sip_action_log set call_date='$invite_date',caller_code='$callerid',lead_id='$CIDlead_id',phone_number='$VDADphone',user='VDAD',result='$itf_dispo';";
$SAaffected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01142'; $MEL_aff_rows=$SAaffected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- SIP ACTION logtable inserted : |$SAaffected_rows|($T_dial_time <> $itf_begin -> $itf_end)|$itf_actions|$stmtA|"; &agi_output;}
}
if ($itf_actions =~ /hangup/i)
{
if (length($itf_dispo) < 1)
{$itf_dispo='SIPACT';}
$xCLlist_id=0;
$called_count=0;
$stmtA = "SELECT list_id,security_phrase,called_count from vicidial_list where lead_id='$CIDlead_id' limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsLI=$sthA->rows;
$dbhP=$dbhA; $mysql_count='01143'; $MEL_aff_rows=$sthArowsLI; &mysql_error_logging;
if ($sthArowsLI > 0)
{
@aryA = $sthA->fetchrow_array;
$xCLlist_id = $aryA[0];
$security_phrase = $aryA[1];
$called_count = $aryA[2];
}
$sthA->finish();
($END_s_hires, $END_usec) = gettimeofday();
$START_time = $START_s_hires . '.' . sprintf("%06s", $START_usec);
$END_time = $END_s_hires . '.' . sprintf("%06s", $END_usec);
$RUN_time = ($END_time - $START_time);
$RUN_time = sprintf("%.3f", $RUN_time);
if ($AGILOG) {$agi_string = "Preprocess time: |$RUN_time ($END_time - $START_time)|"; &agi_output;}
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,processed,alt_dial,list_id,comments,called_count,term_reason) values('$uniqueid','$CIDlead_id','$VDADcampaign','$SQLdate','$now_date_epoch','$now_date_epoch','0','$itf_dispo','$VDADphone_code','$VDADphone','VDAD','N','$VDADalt_dial','$xCLlist_id','$RUN_time','$called_count','SYSTEM')";
if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;}
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01144'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- SIP ACTION VDAD : |$VDADlead_id|$CIDlead_id|($T_dial_time <> $itf_begin -> $itf_end)|$itf_actions|insert to vicidial_log: $uniqueid"; &agi_output;}
$stmtA = "INSERT INTO vicidial_log_extended set uniqueid='$uniqueid',server_ip='$VARserver_ip',call_date='$SQLdate',lead_id = '$CIDlead_id',caller_code='$callerid',custom_call_id='';";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01145'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- SIP ACTION VDAD VLE insert: |$affected_rows|\n|$stmtA|"; &agi_output;}
$stmtA = "UPDATE vicidial_list set status='$itf_dispo' where lead_id='$CIDlead_id';";
if ($AGILOG) { $agi_string = "|$stmtA|"; &agi_output; }
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01146'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG)
{$agi_string = "-- SIP ACTION VDAD vicidial_list update: $itf_dispo|$affected_rows|$CIDlead_id"; &agi_output;}
$stmtA = "DELETE FROM vicidial_auto_calls where callerid='$callerid' order by call_time desc limit 1;";
$affected_rows = $dbhA->do($stmtA);
$dbhP=$dbhA; $mysql_count='01147'; $MEL_aff_rows=$affected_rows; &mysql_error_logging;
if ($AGILOG) {$agi_string = "-- VDAD vac record deleted: |$affected_rows|$VDADcampaign|"; &agi_output;}
if ( ($SScall_quota_lead_ranking > 0) && ($VD_call_quota_lead_ranking !~ /^DISABLED$/i) )
{
$temp_status = $itf_dispo;
&call_quota_logging;
}
$AGI->hangup();
exit;
}
}
}
$sea++;
}
}
$sthA->finish();
$SIP_event_action_checked++;
}
##### END SIP Action check #####
### start recording if survey recording is enabled
if ( ($call_handle_method =~ /SURVEY/) && ($survey_recording =~ /Y/) )
{
@@ -56,6 +56,7 @@
# 180712-1641 - Added --wipe-all-being-archived AND --did-log-days options
# 190318-1541 - Added vicidial_amd_log archiving
# 190531-0841 - Added vicidial_log_extended_sip archiving
# 190926-0005 - Added vicidial_sip_action_log archiving
#
$CALC_TEST=0;
@@ -2645,6 +2646,59 @@ if (!$T)
}
##### vicidial_sip_action_log
$stmtA = "SELECT count(*) from vicidial_sip_action_log;";
$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;
$vicidial_sip_action_log_count = $aryA[0];
}
$sthA->finish();
$stmtA = "SELECT count(*) from vicidial_sip_action_log_archive;";
$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;
$vicidial_sip_action_log_archive_count = $aryA[0];
}
$sthA->finish();
if (!$Q) {print "\nProcessing vicidial_sip_action_log table... ($vicidial_sip_action_log_count|$vicidial_sip_action_log_archive_count)\n";}
$stmtA = "INSERT IGNORE INTO vicidial_sip_action_log_archive SELECT * from vicidial_sip_action_log;";
$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_sip_action_log_archive table \n";}
$rv = $sthA->err();
if (!$rv)
{
$stmtA = "DELETE FROM vicidial_sip_action_log WHERE call_date < '$del_time';";
$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_sip_action_log table \n";}
$stmtA = "optimize table vicidial_sip_action_log;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$stmtA = "optimize table vicidial_sip_action_log_archive;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
}
if ($recording_log_archive > 0)
{
##### recording_log
+28 -5
View File
@@ -1,4 +1,4 @@
SIP EVENT LOGGING DOC Started: 2019-05-30 Updated: 2019-07-30
SIP EVENT LOGGING DOC Started: 2019-05-30 Updated: 2019-09-25
!!!! THIS IS AN EXPERIMENTAL FEATURE, PLEASE READ ALL IMPORTANT NOTES !!!!
@@ -15,6 +15,9 @@ For phase 2 of this project, we added some basic reporting(AST_SIP_event_report.
ADDED 2019-07-24: The new campaign "SIP Event Actions" settings will allow you to define specific actions to happen depending on what is in the SIP Event Log for each call. Initially this feature will only affect manual dial agent screen calls, for example, allowing you to automatically hang up manual dial calls that take less than one seccond from the dial event to the answer. See the "Campaign SIP Event Actions" section below for more information.
ADDED 2019-09-25: The ability to log to vicidial_sip_action_log table. Also added auto-dial call SIP Action execution.
IMPORTANT VICIDIAL VERSION NOTE!!!
@@ -97,7 +100,10 @@ Campaign SIP Event Actions:
This is designed to be a set of features that will allow for flexible configuration of different actions that are to be taken on calls based upon their SIP event logs.
The first action of this feature to be enabled is the ability to set agent screen manual dial calls to be hung up if certain criteria are met, for example, less than 1 second from dial to answer.
The first action of this feature to be enabled is the ability to set agent screen manual dial calls and auto-dialed calls to be hung up if certain criteria are met, for example, less than 1 second from dial to answer.
The second action to be enabled is the ability to log to a special vicidial_sip_action_log table when certain criteria are met.
This set of features is configured using a Settings Container of the "SIP_EVENT_ACTIONS" type, which you define in the Campaign Detail screen "SIP Event Actions" setting.
@@ -107,7 +113,7 @@ Example SIP_EVENT_ACTIONS Settings Container:
; agent screen actions
AGENT_SCREEN_ACTIONS_START
invite_to_final => 0.0,1.0,hangup-dispo-message,FAS,Auto Hangup and Dispo of False Answer Call
invite_to_final => 0.0,1.0,hangup-dispo-message-logtable,FAS,Auto Hangup and Dispo of False Answer Call
AGENT_SCREEN_ACTIONS_FINISH
@@ -115,13 +121,18 @@ AGENT_SCREEN_ACTIONS_FINISH
Settings within agent screen actions:
1. time range start - a number with 1-6 decimal places
2. time range finish - a number with 1-6 decimal places
3. agent screen action taken - any combination of the following: 'hangup', 'dispo', 'message' separated by dashes
4. If 'dispo' is included in #3, then this is the dispo set
3. agent screen action taken - any combination of the following: 'hangup', 'dispo', 'message', 'logtable' separated by dashes
4. If 'dispo' is included in #3, then this is the dispo set. If 'logtable' is used, then this is the result logged
5. If 'message' is included in #3, then this is the message sent to the agent
If you include a message, it will be displayed on the agent's screen for 4 seconds then it will automatically disappear.
If you use 'logtable', a record will be inserted into the vicidial_sip_action_log table.
For auto-dialed calls, if 'hangup' is used, then 'dispo' will be assumed, even if no tdefined
@@ -202,6 +213,18 @@ index(caller_code)
CREATE TABLE vicidial_log_extended_sip_archive LIKE vicidial_log_extended_sip;
CREATE UNIQUE INDEX vlesa on vicidial_log_extended_sip_archive (caller_code,call_date);
CREATE TABLE vicidial_sip_action_log (
call_date DATETIME(6),
caller_code VARCHAR(30) NOT NULL,
lead_id INT(9) UNSIGNED,
phone_number VARCHAR(18),
user VARCHAR(20),
result VARCHAR(40),
index(call_date),
index(caller_code),
index(result)
) ENGINE=MyISAM;
MariaDB [asterisk]> SELECT * FROM vicidial_sip_event_log limit 10;
+--------------+----------------------+---------------------+----------------+-------------------+------------------------------------------------------+----------------------------+-----------+
@@ -486,7 +486,7 @@ user VARCHAR(20),
comments VARCHAR(255),
processed ENUM('Y','N'),
user_group VARCHAR(20),
term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE') default 'NONE',
term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE','SYSTEM') default 'NONE',
alt_dial VARCHAR(6) default 'NONE',
called_count SMALLINT(5) UNSIGNED default '0',
index (lead_id),
@@ -2453,7 +2453,7 @@ user VARCHAR(20),
comments VARCHAR(255),
processed ENUM('Y','N'),
user_group VARCHAR(20),
term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE') default 'NONE',
term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE','SYSTEM') default 'NONE',
alt_dial VARCHAR(6) default 'NONE',
index (lead_id),
index (call_date)
@@ -2908,7 +2908,7 @@ user VARCHAR(20),
comments VARCHAR(255),
processed ENUM('Y','N'),
user_group VARCHAR(20),
term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE') default 'NONE',
term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE','SYSTEM') default 'NONE',
alt_dial VARCHAR(6) default 'NONE',
caller_code VARCHAR(30) NOT NULL,
index (lead_id),
@@ -4185,6 +4185,18 @@ index (bench_date),
index (lead_id)
) ENGINE=MyISAM;
CREATE TABLE vicidial_sip_action_log (
call_date DATETIME(6),
caller_code VARCHAR(30) NOT NULL,
lead_id INT(9) UNSIGNED,
phone_number VARCHAR(18),
user VARCHAR(20),
result VARCHAR(40),
index(call_date),
index(caller_code),
index(result)
) ENGINE=MyISAM;
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
@@ -4427,6 +4439,9 @@ ALTER TABLE vicidial_sip_event_log_5 MODIFY sip_event_id INT(9) UNSIGNED NOT NUL
CREATE TABLE vicidial_sip_event_log_6 LIKE vicidial_sip_event_log;
ALTER TABLE vicidial_sip_event_log_6 MODIFY sip_event_id INT(9) UNSIGNED NOT NULL;
CREATE TABLE vicidial_sip_action_log_archive LIKE vicidial_sip_action_log;
CREATE UNIQUE INDEX vlesa on vicidial_sip_action_log_archive (caller_code,call_date);
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
@@ -4507,4 +4522,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='1575',db_schema_update_date=NOW(),reload_timestamp=NOW();
UPDATE system_settings SET db_schema_version='1576',db_schema_update_date=NOW(),reload_timestamp=NOW();
+24
View File
@@ -1030,3 +1030,27 @@ index (lead_id)
) ENGINE=MyISAM;
UPDATE system_settings SET db_schema_version='1575',db_schema_update_date=NOW() where db_schema_version < 1575;
CREATE TABLE vicidial_sip_action_log (
call_date DATETIME(6),
caller_code VARCHAR(30) NOT NULL,
lead_id INT(9) UNSIGNED,
phone_number VARCHAR(18),
user VARCHAR(20),
result VARCHAR(40),
index(call_date),
index(caller_code),
index(result)
) ENGINE=MyISAM;
CREATE TABLE vicidial_sip_action_log_archive LIKE vicidial_sip_action_log;
CREATE UNIQUE INDEX vlesa on vicidial_sip_action_log_archive (caller_code,call_date);
ALTER TABLE vicidial_log MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE','SYSTEM') default 'NONE';
ALTER TABLE twoday_vicidial_log MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE','SYSTEM') default 'NONE';
ALTER TABLE vicidial_log_noanswer MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE','SYSTEM') default 'NONE';
ALTER TABLE vicidial_log_archive MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE','SYSTEM') default 'NONE';
ALTER TABLE vicidial_log_noanswer_archive MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE','SYSTEM') default 'NONE';
UPDATE system_settings SET db_schema_version='1576',db_schema_update_date=NOW() where db_schema_version < 1576;
+20 -4
View File
@@ -81,10 +81,11 @@
# 170817-0739 - Small change to xfer dead call checking process
# 180602-0149 - Changed SQL query for email queue count for accuracy
# 190730-0927 - Added campaign SIP Actions processing
# 190925-1348 - Added logtable SIP Action
#
$version = '2.14-55';
$build = '190730-0927';
$version = '2.14-56';
$build = '190925-1348';
$php_script = 'conf_exten_check.php';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=51;
@@ -140,6 +141,9 @@ if (isset($_GET["MDnextCID"])) {$MDnextCID=$_GET["MDnextCID"];}
elseif (isset($_POST["MDnextCID"])) {$MDnextCID=$_POST["MDnextCID"];}
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
if ($bcrypt == 'OFF')
{$bcrypt=0;}
@@ -989,8 +993,20 @@ if ($ACTION == 'refresh')
$itf_message = $invite_to_finalARY[4];
if ( ($T_dial_time >= $itf_begin) and ($T_dial_time <= $itf_end) and (strlen($itf_actions) > 4) )
{
# $call_output = "$uniqueid\n$channel\nERROR\n" . $hangup_cause_msg . "\n<br>" . $sip_hangup_cause_msg;
$sip_event_action_output = "SIP ACTION-----" . $itf_actions . "-----" . $itf_dispo . "-----" . $itf_message;
if (preg_match("/logtable/i",$itf_actions))
{
##### insert record into vicidial_sip_action_log
$stmt="INSERT INTO vicidial_sip_action_log set call_date='$invite_date',caller_code='$MDnextCID',lead_id='$lead_id',phone_number='$phone_number',user='$user',result='$itf_dispo';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03052',$user,$server_ip,$session_name,$one_mysql_log);}
$affected_rowsX = mysqli_affected_rows($link);
}
if (preg_match("/hangup|dispo|message/i",$itf_actions))
{
# $call_output = "$uniqueid\n$channel\nERROR\n" . $hangup_cause_msg . "\n<br>" . $sip_hangup_cause_msg;
$sip_event_action_output = "SIP ACTION-----" . $itf_actions . "-----" . $itf_dispo . "-----" . $itf_message;
}
}
}
$sea++;
+29 -6
View File
@@ -478,13 +478,14 @@
# 190709-1846 - Added Call Quota logging
# 190722-1658 - Added ENABLED_EXTENDED_RANGE Agent Screen Time Display option
# 190730-0926 - Added campaign SIP Actions processing
# 190925-1347 - Added logtable SIP Action
#
$version = '2.14-372';
$build = '190730-0926';
$version = '2.14-373';
$build = '190925-1347';
$php_script = 'vdc_db_query.php';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=808;
$mysql_log_count=809;
$one_mysql_log=0;
$DB=0;
$VD_login=0;
@@ -6732,7 +6733,7 @@ if ($ACTION == 'manDiaLlookCaLL')
##### BEGIN SIP event logging, if enabled in the system #####
if ($SSsip_event_logging > 0)
{
##### insert log into vicidial_log_extended for manual VICIDiaL call
##### update vicidial_sip_event_recent entry to processed for manual VICIDiaL call
$stmt="UPDATE vicidial_sip_event_recent set processed='U' where caller_code='$MDnextCID' LIMIT 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
@@ -6849,8 +6850,20 @@ if ($ACTION == 'manDiaLlookCaLL')
$itf_message = $invite_to_finalARY[4];
if ( ($T_dial_time >= $itf_begin) and ($T_dial_time <= $itf_end) and (strlen($itf_actions) > 4) )
{
# $call_output = "$uniqueid\n$channel\nERROR\n" . $hangup_cause_msg . "\n<br>" . $sip_hangup_cause_msg;
$sip_event_action_output = "SIP ACTION\n" . $itf_actions . "\n" . $itf_dispo . "\n" . $itf_message;
if (preg_match("/logtable/i",$itf_actions))
{
##### insert record into vicidial_sip_action_log
$stmt="INSERT INTO vicidial_sip_action_log set call_date='$invite_date',caller_code='$MDnextCID',lead_id='$lead_id',phone_number='$phone_number',user='$user',result='$itf_dispo';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00809',$user,$server_ip,$session_name,$one_mysql_log);}
$affected_rowsX = mysqli_affected_rows($link);
}
if (preg_match("/hangup|dispo|message/i",$itf_actions))
{
# $call_output = "$uniqueid\n$channel\nERROR\n" . $hangup_cause_msg . "\n<br>" . $sip_hangup_cause_msg;
$sip_event_action_output = "SIP ACTION\n" . $itf_actions . "\n" . $itf_dispo . "\n" . $itf_message;
}
}
}
$sea++;
@@ -17768,6 +17781,16 @@ if ($ACTION == 'CalLBacKLisT')
if ($rslt) {$callbacks_count = mysqli_num_rows($rslt);}
echo "$callbacks_count\n";
$loop_count=0;
$callback_id = array();
$lead_id = array();
$campaign_id = array();
$status = array();
$entry_time = array();
$callback_time = array();
$comments = array();
$customer_timezone = array();
$customer_time = array();
$customer_timezone_diff = array();
while ($callbacks_count>$loop_count)
{
$row=mysqli_fetch_row($rslt);
+7 -4
View File
@@ -618,10 +618,11 @@
# 190730-0925 - Added campaign SIP Actions processing
# 190901-0956 - Added cid_choice option to API transfer_conference function
# 190902-0914 - Fix for PHP 7.2
# 190925-1346 - Changes for more SIP Event Action features
#
$version = '2.14-587c';
$build = '190902-0914';
$version = '2.14-588c';
$build = '190925-1346';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=87;
$one_mysql_log=0;
@@ -5748,7 +5749,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
}
if (xmlhttprequestcheckconf)
{
checkconf_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&client=vdc&conf_exten=" + taskconfnum + "&auto_dial_level=" + auto_dial_level + "&campagentstdisp=" + campagentstdisp + "&customer_chat_id=" + document.vicidial_form.customer_chat_id.value + "&live_call_seconds=" + VD_live_call_secondS + "&xferchannel=" + document.vicidial_form.xferchannel.value + "&check_for_answer=" + MDcheck_for_answer + "&MDnextCID=" + MDnextCID + "&campaign=" + campaign + "&clicks=" + button_click_log;
checkconf_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&client=vdc&conf_exten=" + taskconfnum + "&auto_dial_level=" + auto_dial_level + "&campagentstdisp=" + campagentstdisp + "&customer_chat_id=" + document.vicidial_form.customer_chat_id.value + "&live_call_seconds=" + VD_live_call_secondS + "&xferchannel=" + document.vicidial_form.xferchannel.value + "&check_for_answer=" + MDcheck_for_answer + "&MDnextCID=" + MDnextCID + "&campaign=" + campaign + "&phone_number=" + dialed_number + "&clicks=" + button_click_log;
button_click_log='';
xmlhttprequestcheckconf.open('POST', 'conf_exten_check.php');
xmlhttprequestcheckconf.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
@@ -8689,7 +8690,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 + "&routing_initiated_recording=" + temp_rir;
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;
xmlhttp.open('POST', 'vdc_db_query.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(manDiaLlook_query);
@@ -10543,6 +10544,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
alert_box_close_counter=10;
alert_box("<?php echo _QXZ("CHECK-FOR-CALL RUNNING, PLEASE WAIT");?>: " + CFAI_sent);
button_click_log = button_click_log + "" + SQLdate + "-----CFAI_stopped_pause_click---" + CFAI_sent + " " + taskaction + " " + agent_log_id + "|";
agent_events('agent_alert', "CHECK-FOR-CALL RUNNING: " + agent_log_id, aec); aec++;
}
else
{
@@ -11590,6 +11592,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
alert_box_close_counter=0;
hideDiv('AlertBox');
}
agent_events('agent_alert', "CHECK-FOR-CALL COMPLETE: " + agent_log_id, aec); aec++;
}
}
}