From bc4d468eda92a4da19ecc4a0b615cb5e40aca276 Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 21 Nov 2011 15:31:15 +0000 Subject: [PATCH] Added ability to set scheduled callbacks with Agent API. Added alt_phone and address3 field searches to DID and Call Menu in-group call routing, to allow searching first by phone number, then optionally by alt_phone and address3. Fixed admin change log display issue git-svn-id: svn://192.168.202.10@1755 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 6 + agi/agi-VDAD_ALL_inbound.agi | 124 ++++++++++++------ docs/AGENT_API.txt | 13 +- docs/CUSTOM_FIELDS.txt | 2 +- docs/NON-AGENT_API.txt | 4 +- docs/QUEUEMETRICS.txt | 2 +- extras/MySQL_AST_CREATE_tables.sql | 28 +++- extras/upgrade_2.4.sql | 27 ++++ .../TO_BE_TRANSLATED_2.4.txt | 1 + www/agc/api.php | 62 ++++++++- www/agc/vdc_db_query.php | 14 +- www/agc/vicidial.php | 53 +++++++- www/vicidial/admin.php | 14 +- www/vicidial/admin_header.php | 3 +- 14 files changed, 287 insertions(+), 66 deletions(-) diff --git a/UPGRADE b/UPGRADE index d8899181..f299c305 100644 --- a/UPGRADE +++ b/UPGRADE @@ -763,6 +763,12 @@ OTHER CHANGES: 173. Added ability to block customer information and hide portions of customer phone numbers within the admin interface on a per admin-user basis. +174. Added ability to set scheduled callbacks with Agent API. + +175. Added alt_phone and address3 field searches to DID and Call Menu in-group + call routing, to allow searching first by phone number, then optionally + by alt_phone and address3. + diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index 5dfd8c87..07ea0935 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -14,6 +14,15 @@ # ; - CIDLOOKUP - Lookup CID to find record in whole system # ; - CIDLOOKUPRL - Restrict lookup to one list # ; - CIDLOOKUPRC - Restrict lookup to one campaign's lists +# ; - CIDLOOKUPALT - Lookup CID to find record in whole system by phone number then alt_phone +# ; - CIDLOOKUPRLALT - Restrict lookup to one list by phone number then alt_phone +# ; - CIDLOOKUPRCALT - Restrict lookup to one campaign's lists by phone number then alt_phone +# ; - CIDLOOKUPADDR3 - Lookup CID to find record in whole system by phone number then address3 +# ; - CIDLOOKUPRLADDR3 - Restrict lookup to one list by phone number then address3 +# ; - CIDLOOKUPRCADDR3 - Restrict lookup to one campaign's lists by phone number then address3 +# ; - CIDLOOKUPALTADDR3 - Lookup CID to find record in whole system by phone number then alt_phone then address3 +# ; - CIDLOOKUPRLALTADDR3 - Restrict lookup to one list by phone number then alt_phone then address3 +# ; - CIDLOOKUPRCALTADDR3 - Restrict lookup to one campaign's lists by phone number then alt_phone then address3 # ; - CLOSER - Closer calls from VICIDIAL fronters(and previous in-group calls) # ; - ANI - ANI received, add record with phone number (based on RBS T1s) # ; - ANILOOKUP - Lookup ANI to find record in whole system @@ -160,6 +169,7 @@ # 110922-2149 - Added compatibility with DID remote agent extension overrides # 110923-1133 - Added drop and after-hours to callmenu, and added action transfer cid setting # 111102-2014 - Added in-group max_calls_ feature +# 111116-0157 - Added ALT and ADDR3 methods for CIDLOOKUP # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -171,7 +181,7 @@ $wait_prompt_runs=0; $at='@'; $S='*'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=187; +$mysql_log_count=189; $one_mysql_log=0; @@ -915,48 +925,86 @@ if ($call_handle_method =~ /LOOKUP/) } else { - ### insert a record into the vicidial_list table - $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments) values('$SQLdate','$tsSQLdate','INBND','$fronter','$vendor_id','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','$local_gmt','$VLcomments');"; - $affected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='02011'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; - $cbc=0; - $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='02012'; $MEL_aff_rows=$sthArows; &mysql_error_logging; - if ($sthArows > 0) + $VLfound=0; + if ($call_handle_method =~ /ALT/) { - @aryA = $sthA->fetchrow_array; - $insert_lead_id = $aryA[0]; - $cbc++; + $stmtA= "SELECT lead_id from vicidial_list where alt_phone='$phone_number' $listSQL order by last_local_call_time desc limit 1;"; + if ($AGILOG) {$agi_string = "VDAD vicidial_list ALT search |$phone_number|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02188'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $insert_lead_id = $aryA[0]; + $VLfound++; + $sthA->finish(); + if ($AGILOG) {$agi_string = "VDAD vicidial_list ALT found |$insert_lead_id|$stmtA|"; &agi_output;} + } } - $sthA->finish(); - - ### Start the Add-Lead-URL get proccess - if (length($add_lead_url) > 5) + if ( ($call_handle_method =~ /ADDR3/) && ($VLfound < 1) ) { - $PADlead_id = sprintf("%010s", $insert_lead_id); while (length($PADlead_id) > 10) {chop($PADlead_id);} - $XXqueryCID = "Y$CIDdate$PADlead_id"; - - $launch = $PATHhome . "/AST_send_URL.pl"; - $launch .= " --SYSLOG" if ($SYSLOG); - $launch .= " --lead_id=" . $insert_lead_id; - $launch .= " --phone_number=" . $phone_number; - $launch .= " --user="; - $launch .= " --call_type=IN"; - $launch .= " --campaign=" . $channel_group; - $launch .= " --uniqueid=" . $uniqueid; - $launch .= " --alt_dial="; - $launch .= " --call_id=" . $XXqueryCID; - $launch .= " --function=INGROUP_ADD_LEAD_URL"; - - system($launch . ' &'); - - if ($AGILOG) {$agi_string = "$launch|"; &agi_output;} + $stmtA= "SELECT lead_id from vicidial_list where address3='$phone_number' $listSQL order by last_local_call_time desc limit 1;"; + if ($AGILOG) {$agi_string = "VDAD vicidial_list ADDR3 search |$phone_number|$stmtA|"; &agi_output;} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02189'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $insert_lead_id = $aryA[0]; + $VLfound++; + $sthA->finish(); + if ($AGILOG) {$agi_string = "VDAD vicidial_list ADDR3 found |$insert_lead_id|$stmtA|"; &agi_output;} + } } + if ($VLfound < 1) + { + ### insert a record into the vicidial_list table + $stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now,comments) values('$SQLdate','$tsSQLdate','INBND','$fronter','$vendor_id','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','$local_gmt','$VLcomments');"; + $affected_rows = $dbhA->do($stmtA); + $dbhP=$dbhA; $mysql_count='02011'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $cbc=0; + $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='02012'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $insert_lead_id = $aryA[0]; + $cbc++; + } + $sthA->finish(); - if ($AGILOG) {$agi_string = "VDAD vicidial_list insert |$insert_lead_id|$stmtA|"; &agi_output;} + ### Start the Add-Lead-URL get proccess + if (length($add_lead_url) > 5) + { + $PADlead_id = sprintf("%010s", $insert_lead_id); while (length($PADlead_id) > 10) {chop($PADlead_id);} + $XXqueryCID = "Y$CIDdate$PADlead_id"; + + $launch = $PATHhome . "/AST_send_URL.pl"; + $launch .= " --SYSLOG" if ($SYSLOG); + $launch .= " --lead_id=" . $insert_lead_id; + $launch .= " --phone_number=" . $phone_number; + $launch .= " --user="; + $launch .= " --call_type=IN"; + $launch .= " --campaign=" . $channel_group; + $launch .= " --uniqueid=" . $uniqueid; + $launch .= " --alt_dial="; + $launch .= " --call_id=" . $XXqueryCID; + $launch .= " --function=INGROUP_ADD_LEAD_URL"; + + system($launch . ' &'); + + if ($AGILOG) {$agi_string = "$launch|"; &agi_output;} + } + + if ($AGILOG) {$agi_string = "VDAD vicidial_list insert |$insert_lead_id|$stmtA|"; &agi_output;} + } } } } diff --git a/docs/AGENT_API.txt b/docs/AGENT_API.txt index c7414c82..9f566b68 100644 --- a/docs/AGENT_API.txt +++ b/docs/AGENT_API.txt @@ -1,4 +1,4 @@ -AGENT API DOCUMENT Started: 2008-07-03 Updated: 2011-09-11 +AGENT API DOCUMENT Started: 2008-07-03 Updated: 2011-11-14 This document describes the functions of an API(Application Programming Interface) for the VICIDIAL Agent screen. This functionality will be rather limited at first @@ -106,7 +106,16 @@ DESCRIPTION: Sets the status of the current customer call on the agent dispotion screen VALUES: (value) -Any valid status in the VICIDIAL system will work for this function +value - + Any valid status in the VICIDIAL system will work for this function +callback_datetime - + YYYY-MM-DD+HH:MM:SS, date and time of scheduled callback. REQUIRED if callback is set and status is flagged as a scheduled callback +callback_type - + USERONLY or ANYONE, default is ANYONE +callback_comments - + Optional comments to appear when the callback is called back, must be less than 200 characters in length +qm_dispo_code - + Option callstatus code used if QM is enabled EXAMPLE URL: http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=external_status&value=A diff --git a/docs/CUSTOM_FIELDS.txt b/docs/CUSTOM_FIELDS.txt index 12afa281..4292eac3 100644 --- a/docs/CUSTOM_FIELDS.txt +++ b/docs/CUSTOM_FIELDS.txt @@ -15,7 +15,7 @@ Development Stages: 1. Create admin interface to manage dynamic fields per list_id 2. Create display of custom fields within the ViciDial agent interface, including variables to be used in web forms and scripts 3. Add exporting of custom tables to list download feature as well as the calls export report -4. Create list loading interface to put leads into the vicidial_list table and the custom fields, includes reusable template definitions(field mapping) +4. Create list loading interface to put leads into the vicidial_list table and the custom fields, includes reusable template definitions(field mapping pending) Limitations: - You could not dial leads sorted by any custom fields diff --git a/docs/NON-AGENT_API.txt b/docs/NON-AGENT_API.txt index 8a19fafd..1adbda98 100644 --- a/docs/NON-AGENT_API.txt +++ b/docs/NON-AGENT_API.txt @@ -1,11 +1,11 @@ -NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2011-09-28 +NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2011-11-06 This document describes the functions of an API(Application Programming Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. This functionality will be rather limited at first and will be built upon as critical functions are identified and programmed into it. -There is also an agent API script, for more information on that, please read +There is also an Agent API script, for more information on that, please read the AGENT_API.txt document. diff --git a/docs/QUEUEMETRICS.txt b/docs/QUEUEMETRICS.txt index e5a9082e..d92f23d2 100644 --- a/docs/QUEUEMETRICS.txt +++ b/docs/QUEUEMETRICS.txt @@ -232,7 +232,7 @@ data2: callerID or number called(sometimes prepended by DNIS) [3101-9015556189], vicidial_list field you would like to prefend to the phone number on ENTERQUEUE/CALLOUTBOUND events -data3: ?? +data3: optional qm_dispo_code variable for CALLSTATUS verbs, submitted through the agent-API external_status function data4: ?? diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 091b793e..d5b2a54d 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -369,7 +369,7 @@ comments VARCHAR(20), campaign_weight TINYINT(1) default '0', calls_today SMALLINT(5) UNSIGNED default '0', external_hangup VARCHAR(1) default '', -external_status VARCHAR(6) default '', +external_status VARCHAR(255) default '', external_pause VARCHAR(20) default '', external_dial VARCHAR(100) default '', external_ingroups TEXT, @@ -1472,7 +1472,8 @@ campaign_cid_areacodes_enabled ENUM('0','1') default '1', pllb_grouping_limit SMALLINT(5) default '100', did_ra_extensions_enabled ENUM('0','1') default '0', expanded_list_stats ENUM('0','1') default '1', -contacts_enabled ENUM('0','1') default '0' +contacts_enabled ENUM('0','1') default '0', +svn_version VARCHAR(100) default '' ); CREATE TABLE vicidial_campaigns_list_mix ( @@ -2580,6 +2581,27 @@ location VARCHAR(100) default '' CREATE INDEX ci_first_name on contact_information (first_name); CREATE INDEX ci_last_name on contact_information (last_name); +CREATE TABLE dialable_inventory_snapshots ( +snapshot_id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +snapshot_time DATETIME default NULL, +list_id BIGINT(14) unsigned default NULL, +list_name VARCHAR(30) default NULL, +campaign_id VARCHAR(8) default NULL, +list_lastcalldate VARCHAR(20) default NULL, +list_start_inv mediumint(8) unsigned default NULL, +dialable_count mediumint(8) unsigned default NULL, +dialable_count_nofilter mediumint(8) unsigned default NULL, +dialable_count_oneoff mediumint(8) unsigned default NULL, +dialable_count_inactive mediumint(8) unsigned default NULL, +average_call_count decimal(3,1) default NULL, +penetration decimal(5,2) default NULL, +shift_data TEXT, +time_setting ENUM('LOCAL','SERVER') default NULL, +UNIQUE KEY snapshot_date_list_key +(snapshot_time,list_id,time_setting), +KEY snapshot_date_key (snapshot_time) +); + ALTER TABLE vicidial_campaign_server_stats ENGINE=MEMORY; @@ -2732,7 +2754,7 @@ CREATE TABLE vicidial_log_noanswer_archive LIKE vicidial_log_noanswer; CREATE TABLE vicidial_did_agent_log_archive LIKE vicidial_did_agent_log; CREATE UNIQUE INDEX vdala on vicidial_did_agent_log_archive (uniqueid,call_date,did_route); -UPDATE system_settings SET db_schema_version='1308',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1309',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/upgrade_2.4.sql b/extras/upgrade_2.4.sql index bda29b04..28f0bef2 100644 --- a/extras/upgrade_2.4.sql +++ b/extras/upgrade_2.4.sql @@ -1178,3 +1178,30 @@ ALTER TABLE vicidial_closer_log MODIFY term_reason ENUM('CALLER','AGENT','QUEUET ALTER TABLE vicidial_closer_log_archive MODIFY term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','HOLDRECALLXFER','HOLDTIME','NOAGENT','NONE','MAXCALLS') default 'NONE'; UPDATE system_settings SET db_schema_version='1308',db_schema_update_date=NOW() where db_schema_version < 1308; + +CREATE TABLE dialable_inventory_snapshots ( +snapshot_id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +snapshot_time DATETIME default NULL, +list_id BIGINT(14) unsigned default NULL, +list_name VARCHAR(30) default NULL, +campaign_id VARCHAR(8) default NULL, +list_lastcalldate VARCHAR(20) default NULL, +list_start_inv mediumint(8) unsigned default NULL, +dialable_count mediumint(8) unsigned default NULL, +dialable_count_nofilter mediumint(8) unsigned default NULL, +dialable_count_oneoff mediumint(8) unsigned default NULL, +dialable_count_inactive mediumint(8) unsigned default NULL, +average_call_count decimal(3,1) default NULL, +penetration decimal(5,2) default NULL, +shift_data TEXT, +time_setting ENUM('LOCAL','SERVER') default NULL, +UNIQUE KEY snapshot_date_list_key +(snapshot_time,list_id,time_setting), +KEY snapshot_date_key (snapshot_time) +); + +ALTER TABLE vicidial_live_agents MODIFY external_status VARCHAR(255) default ''; + +ALTER TABLE system_settings ADD svn_version VARCHAR(100) default ''; + +UPDATE system_settings SET db_schema_version='1309',db_schema_update_date=NOW() where db_schema_version < 1309; diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index d24f2358..2f6293a4 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -817,6 +817,7 @@ Max Calls Count|| This option must be set higher than 0 if you want to use the Max Calls Method feature. Default is 0|| Max Calls Action|| This is the action to be taken if the Max Calls Method is enabled and the number of calls exceeds what is set above in the Max Calls Count setting. The calls above that amount will be sent to either the DROP action, the AFTERHOURS action or the NO_AGENT_NO_QUEUE action and will be logged as a MAXCAL status with a MAXCALLS hangup reason. Default is NO_AGENT_NO_QUEUE|| +If a CIDLOOKUP method is used with ALT, it will search the alt_phone field for the phone number if no matches are found for the main phone number. If a CIDLOOKUP method is used with ADDR3, it will search the address3 field for the phone number if no matches are found for the main phone number and optionally the alt_phone field|| lead_report_export.php diff --git a/www/agc/api.php b/www/agc/api.php index 59c6799c..5fce269e 100644 --- a/www/agc/api.php +++ b/www/agc/api.php @@ -55,10 +55,11 @@ # 110409-0821 - Added run_time logging of API functions # 110430-0953 - Added option to external_dial by lead_id with alt_dial option # 110911-1555 - Added logout function +# 111114-0037 - Added scheduled callback and qm-dispo-code fields to external_status function # -$version = '2.4-21'; -$build = '110911-1555'; +$version = '2.4-22'; +$build = '111114-0037'; $startMS = microtime(); @@ -175,6 +176,14 @@ if (isset($_GET["alt_dial"])) {$alt_dial=$_GET["alt_dial"];} elseif (isset($_POST["alt_dial"])) {$alt_dial=$_POST["alt_dial"];} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["callback_datetime"])) {$callback_datetime=$_GET["callback_datetime"];} + elseif (isset($_POST["callback_datetime"])) {$callback_datetime=$_POST["callback_datetime"];} +if (isset($_GET["callback_type"])) {$callback_type=$_GET["callback_type"];} + elseif (isset($_POST["callback_type"])) {$callback_type=$_POST["callback_type"];} +if (isset($_GET["callback_comments"])) {$callback_comments=$_GET["callback_comments"];} + elseif (isset($_POST["callback_comments"])) {$callback_comments=$_POST["callback_comments"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -247,6 +256,12 @@ if ($non_latin < 1) $owner = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$owner); $dial_override = ereg_replace("[^A-Z]","",$dial_override); $consultative = ereg_replace("[^A-Z]","",$consultative); + $callback_datetime = ereg_replace("\+"," ",$callback_datetime); + $callback_datetime = ereg_replace("[^ -\.\_0-9a-zA-Z]","",$callback_datetime); + $callback_type = ereg_replace("[^A-Z]","",$callback_type); + $callback_comments = ereg_replace("\+"," ",$callback_comments); + $callback_comments = ereg_replace("[^ -\.\_0-9a-zA-Z]","",$callback_comments); + $qm_dispo_code = ereg_replace("[^-\.\_0-9a-zA-Z]","",$qm_dispo_code); } else { @@ -476,6 +491,49 @@ if ($function == 'external_status') $row=mysql_fetch_row($rslt); if ($row[0] > 0) { + $CB_status_found=0; + if (strlen($callback_datetime) > 12) + { + $callback_status = $value; + + $stmt = "select count(*) from vicidial_statuses where status='$callback_status' and scheduled_callback='Y';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {$CB_status_found++;} + else + { + $stmt = "select campaign_id from vicidial_live_agents where user='$agent_user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[0]; + + $stmt = "select count(*) from vicidial_campaign_statuses where campaign_id='$campaign_id' and status='$callback_status' and scheduled_callback='Y';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {$CB_status_found++;} + } + + if ($CB_status_found > 0) + { + if (strlen($callback_type) < 4) + {$callback_type='ANYONE';} + while (strlen($callback_comments) > 200) {$callback_comments = preg_replace("/.$/",'',$callback_comments);} + $value = "$callback_status!$callback_datetime!$callback_type!$callback_comments!"; + } + } + if (strlen($qm_dispo_code) > 0) + { + if ($CB_status_found < 1) + {$value = "$value!!!!$qm_dispo_code";} + else + {$value = "$value$qm_dispo_code";} + } + $stmt="UPDATE vicidial_live_agents set external_status='$value' where user='$agent_user';"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index ca41f5ca..48b7aba2 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -92,6 +92,7 @@ # - $call_notes # - $disable_alter_custphone = ('N','Y','HIDE') # - $old_CID = ('M06301413000000002',...) +# - $qm_dispo_code # # # CHANGELOG: @@ -298,10 +299,11 @@ # 111021-1549 - Added old_CID variable to help clear alt-dial-old calls # 111021-1707 - Added callback_hours_block feature # 111024-1238 - Added callback_list_calltime option +# 111114-0035 - Added qm-dispo-code field to updatedispo function # -$version = '2.4-199'; -$build = '111024-1238'; +$version = '2.4-200'; +$build = '111114-0035'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=438; $one_mysql_log=0; @@ -516,6 +518,8 @@ if (isset($_GET["location"])) {$location=$_GET["location"];} elseif (isset($_POST["location"])) {$location=$_POST["location"];} if (isset($_GET["old_CID"])) {$old_CID=$_GET["old_CID"];} elseif (isset($_POST["old_CID"])) {$old_CID=$_POST["old_CID"];} +if (isset($_GET["qm_dispo_code"])) {$qm_dispo_code=$_GET["qm_dispo_code"];} + elseif (isset($_POST["qm_dispo_code"])) {$qm_dispo_code=$_POST["qm_dispo_code"];} header ("Content-type: text/html; charset=utf-8"); @@ -6960,8 +6964,10 @@ if ($ACTION == 'updateDISPO') if (strlen($stage) < 2) {$stage = $campaign;} - - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$log_dispo_choice',serverid='$queuemetrics_log_id';"; + $qm_dispo_codeSQL=''; + if (strlen($qm_dispo_code) > 0) + {$qm_dispo_codeSQL = ",data3='$qm_dispo_code'";} + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$stage',agent='Agent/$user',verb='CALLSTATUS',data1='$log_dispo_choice',serverid='$queuemetrics_log_id' $qm_dispo_codeSQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00160',$user,$server_ip,$session_name,$one_mysql_log);} diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index c11aef86..ef178a0c 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -370,10 +370,11 @@ # 111018-1528 - Added more contact fields, added code to prevent API transfer duplicates # 111021-1623 - Fix for rare stuck vac issue with manual alt dial # 111024-1237 - Added callback_list_calltime option +# 111114-0039 - Added scheduled callback and qm-dispo-code fields to API # -$version = '2.4-337c'; -$build = '111024-1237'; +$version = '2.4-338c'; +$build = '111114-0039'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=75; $one_mysql_log=0; @@ -3067,6 +3068,7 @@ $CCAL_OUT .= ""; var CallBackrecipient = ''; var CallBackCommenTs = ''; var CallBackLeadStatus = ''; + var DispoQMcsCODE = ''; var scheduled_callbacks = ''; var dispo_check_all_pause = ''; var api_check_all_pause = ''; @@ -4437,10 +4439,42 @@ function set_length(SLnumber,SLlength_goal,SLdirection) dialedcall_send_hangup(); } - if ( (APIStatuS.length < 10) && (APIStatuS.length > 0) && (AgentDispoing > 1) ) + if ( (APIStatuS.length < 1000) && (APIStatuS.length > 0) && (AgentDispoing > 1) && (APIStatuS != '::::::::::') ) { - document.vicidial_form.DispoSelection.value = APIStatuS; - DispoSelect_submit(); + var regCBmatch = new RegExp('!',"g"); + if (APIStatuS.match(regCBmatch)) + { + var APIcbSTATUS_array = APIStatuS.split("!"); + var APIcbSTATUS = APIcbSTATUS_array[0]; + var APIcbDATETIME = APIcbSTATUS_array[1]; + var APIcbTYPE = APIcbSTATUS_array[2]; + var APIcbCOMMENTS = APIcbSTATUS_array[3]; + var APIqmCScode = APIcbSTATUS_array[4]; + + if ( (APIcbDATETIME.length > 10) && (APIcbTYPE.length > 5) ) + { + CallBackDatETimE = APIcbDATETIME; + CallBackrecipient = APIcbTYPE; + CallBackLeadStatus = APIcbSTATUS; + CallBackCommenTs = APIcbCOMMENTS; + hideDiv('CallBackSelectBox'); + document.vicidial_form.DispoSelection.value = 'CBHOLD'; + } + else + {document.vicidial_form.DispoSelection.value = APIcbSTATUS;} + if (APIqmCScode.length > 0) + { + DispoQMcsCODE = APIqmCScode; + } + // ZZZZZZZZZZZZZZZZZZZZZZZ API callback + // alert("CBdata: " + CallBackDatETimE + "|" + CallBackrecipient + "|" + CallBackLeadStatus + "|" + CallBackCommenTs + "|" + DispoQMcsCODE + "|"); + DispoSelect_submit(); + } + else + { + document.vicidial_form.DispoSelection.value = APIStatuS; + DispoSelect_submit(); + } } if (APIPausE.length > 4) { @@ -8886,7 +8920,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (xmlhttp) { - DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&phone_number=" + document.vicidial_form.phone_number.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&dial_method" + dial_method + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&CallBackLeadStatus=" + CallBackLeadStatus + "&comments=" + CallBackCommenTs + "&custom_field_names=" + custom_field_names + "&call_notes=" + document.vicidial_form.call_notes_dispo.value; + DSupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=updateDISPO&format=text&user=" + user + "&pass=" + pass + "&dispo_choice=" + DispoChoice + "&lead_id=" + document.vicidial_form.lead_id.value + "&campaign=" + campaign + "&auto_dial_level=" + auto_dial_level + "&agent_log_id=" + agent_log_id + "&CallBackDatETimE=" + CallBackDatETimE + "&list_id=" + document.vicidial_form.list_id.value + "&recipient=" + CallBackrecipient + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&MDnextCID=" + LasTCID + "&stage=" + group + "&vtiger_callback_id=" + vtiger_callback_id + "&phone_number=" + document.vicidial_form.phone_number.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&dial_method" + dial_method + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&CallBackLeadStatus=" + CallBackLeadStatus + "&comments=" + CallBackCommenTs + "&custom_field_names=" + custom_field_names + "&call_notes=" + document.vicidial_form.call_notes_dispo.value + "&qm_dispo_code=" + DispoQMcsCODE; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(DSupdate_query); @@ -9000,6 +9034,13 @@ function set_length(SLnumber,SLlength_goal,SLdirection) APIManualDialQueue_last=0; document.vicidial_form.FORM_LOADED.value = '0'; CallBackLeadStatus = ''; + CallBackDatETimE=''; + CallBackrecipient=''; + CallBackCommenTs=''; + DispoQMcsCODE=''; + document.vicidial_form.CallBackDatESelectioN.value = ''; + document.vicidial_form.CallBackCommenTsField.value = ''; + document.vicidial_form.search_phone_number.value=''; document.vicidial_form.search_lead_id.value=''; document.vicidial_form.search_vendor_lead_code.value=''; diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index b194a185..67270300 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -3016,12 +3016,13 @@ else # 111025-0728 - Added user group to all sections, more user settings # 111102-1930 - Added in-group max_calls_ options # 111106-1116 - Many fixes for user_group restrictions +# 111116-0207 - Added ALT and ADDR3 in-group handle methods # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.4-347a'; -$build = '111106-1116'; +$admin_version = '2.4-348a'; +$build = '111116-0207'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -6279,7 +6280,7 @@ if ($ADD==99999)

- In-Group Call Handle Method - If IN_GROUP is selected as the DID Route, then this is the call handling method used for these calls. CID will add a new lead record with every call using the CallerID as the phone number, CIDLOOKUP will attempt to lookup the phone number by the CallerID in the entire system, CIDLOOKUPRL will attempt to lookup the phone number by the CallerID in only one specified list, CIDLOOKUPRC will attempt to lookup the phone number by the CallerID in all of the lists that belong to the specified campaign, CLOSER is specified for VICIDIAL Closer calls, ANI will add a new lead record with every call using the ANI as the phone number, ANILOOKUP will attempt to lookup the phone number by the ANI in the entire system, ANILOOKUPRL will attempt to lookup the phone number by the ANI in only one specified list, XDIGITID will prompt the caller for an X digit code before the call will be put into the queue, VIDPROMPT will prompt the caller for their ID number and will create a new lead record with the CallerID as the phone number and the ID as the Vendor ID, VIDPROMPTLOOKUP will attempt to lookup the ID in the entire system, VIDPROMPTLOOKUPRL will attempt to lookup the vendor ID by the ID in only one specified list, VIDPROMPTLOOKUPRC will attempt to lookup the vendor ID by the ID in all of the lists that belong to the specified campaign. Default is CID. + In-Group Call Handle Method - If IN_GROUP is selected as the DID Route, then this is the call handling method used for these calls. CID will add a new lead record with every call using the CallerID as the phone number, CIDLOOKUP will attempt to lookup the phone number by the CallerID in the entire system, CIDLOOKUPRL will attempt to lookup the phone number by the CallerID in only one specified list, CIDLOOKUPRC will attempt to lookup the phone number by the CallerID in all of the lists that belong to the specified campaign, CLOSER is specified for VICIDIAL Closer calls, ANI will add a new lead record with every call using the ANI as the phone number, ANILOOKUP will attempt to lookup the phone number by the ANI in the entire system, ANILOOKUPRL will attempt to lookup the phone number by the ANI in only one specified list, XDIGITID will prompt the caller for an X digit code before the call will be put into the queue, VIDPROMPT will prompt the caller for their ID number and will create a new lead record with the CallerID as the phone number and the ID as the Vendor ID, VIDPROMPTLOOKUP will attempt to lookup the ID in the entire system, VIDPROMPTLOOKUPRL will attempt to lookup the vendor ID by the ID in only one specified list, VIDPROMPTLOOKUPRC will attempt to lookup the vendor ID by the ID in all of the lists that belong to the specified campaign. Default is CID. If a CIDLOOKUP method is used with ALT, it will search the alt_phone field for the phone number if no matches are found for the main phone number. If a CIDLOOKUP method is used with ADDR3, it will search the address3 field for the phone number if no matches are found for the main phone number and optionally the alt_phone field.
@@ -25706,7 +25707,7 @@ if ($ADD==3311) echo "In-Group ID: $NWB#vicidial_inbound_dids-group_id$NWE\n"; - echo "In-Group Call Handle Method: $NWB#vicidial_inbound_dids-call_handle_method$NWE\n"; + echo "In-Group Call Handle Method: $NWB#vicidial_inbound_dids-call_handle_method$NWE\n"; echo "In-Group Agent Search Method: $NWB#vicidial_inbound_dids-agent_search_method$NWE\n"; echo "In-Group List ID: $NWB#vicidial_inbound_dids-list_id$NWE\n"; echo "In-Group Campaign ID: "; echo "$FDgroups_menu"; echo "$NWB#vicidial_inbound_dids-group_id$NWE\n"; - echo "Filter In-Group Call Handle Method: $NWB#vicidial_inbound_dids-call_handle_method$NWE\n"; + echo "Filter In-Group Call Handle Method: $NWB#vicidial_inbound_dids-call_handle_method$NWE\n"; echo "Filter In-Group Agent Search Method: $NWB#vicidial_inbound_dids-agent_search_method$NWE\n"; echo "Filter In-Group List ID: $NWB#vicidial_inbound_dids-list_id$NWE\n"; echo "Filter In-Group Campaign ID: