From 0ddf5bd30207acaf38f7753cff94745fed4a9667 Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 6 Dec 2012 22:45:00 +0000 Subject: [PATCH] Added a campaign feature to allow an agent to search for a lead while on an inbound call and have their active lead change to a search result lead that they select. git-svn-id: svn://192.168.202.10@1903 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 4 + agc_2-X/trunk/docs/VICIDIAL_statuses.txt | 1 + .../trunk/extras/MySQL_AST_CREATE_tables.sql | 7 +- agc_2-X/trunk/extras/upgrade_2.6.sql | 6 + .../TO_BE_TRANSLATED_2.6.txt | 4 + agc_2-X/trunk/www/agc/vdc_db_query.php | 727 +++++++++++++++++- agc_2-X/trunk/www/agc/vicidial.php | 430 ++++++++++- agc_2-X/trunk/www/vicidial/admin.php | 15 +- 8 files changed, 1167 insertions(+), 27 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index ea572925..e186ae8c 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -128,6 +128,10 @@ OTHER CHANGES: 30. Added Enhanced Disconnect logging for outside the USA, disabled by default +31. Added a campaign feature to allow an agent to search for a lead while on an + inbound call and have their active lead change to a search result lead + that they select. + diff --git a/agc_2-X/trunk/docs/VICIDIAL_statuses.txt b/agc_2-X/trunk/docs/VICIDIAL_statuses.txt index a0838fdf..6781804e 100644 --- a/agc_2-X/trunk/docs/VICIDIAL_statuses.txt +++ b/agc_2-X/trunk/docs/VICIDIAL_statuses.txt @@ -63,3 +63,4 @@ MLINAT - Multi-Lead auto-alt-dial lead set to inactive MAXCAL - Max Calls drop from in-group LRERR - Outbound Local Channel Resolution Error QCFAIL - QC_FAIL_CALLBK +LSMERG - Agent lead search old lead merge diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index 8b2a22ed..406a7c16 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -585,7 +585,7 @@ agent_choose_blended ENUM('0','1') default '1', realtime_block_user_info ENUM('0','1') default '0', custom_fields_modify ENUM('0','1') default '0', force_change_password ENUM('Y','N') default 'N', -agent_lead_search_override ENUM('NOT_ACTIVE','ENABLED','DISABLED') default 'NOT_ACTIVE', +agent_lead_search_override ENUM('NOT_ACTIVE','ENABLED','LIVE_CALL_INBOUND','LIVE_CALL_INBOUND_AND_MANUAL','DISABLED') default 'NOT_ACTIVE', modify_shifts ENUM('1','0') default '0', modify_phones ENUM('1','0') default '0', modify_carriers ENUM('1','0') default '0', @@ -823,7 +823,7 @@ lead_order_randomize ENUM('Y','N') default 'N', lead_order_secondary ENUM('LEAD_ASCEND','LEAD_DESCEND','CALLTIME_ASCEND','CALLTIME_DESCEND') default 'LEAD_ASCEND', per_call_notes ENUM('ENABLED','DISABLED') default 'DISABLED', my_callback_option ENUM('CHECKED','UNCHECKED') default 'UNCHECKED', -agent_lead_search ENUM('ENABLED','DISABLED') default 'DISABLED', +agent_lead_search ENUM('ENABLED','LIVE_CALL_INBOUND','LIVE_CALL_INBOUND_AND_MANUAL','DISABLED') default 'DISABLED', agent_lead_search_method VARCHAR(30) default 'CAMPLISTS_ALL', queuemetrics_phone_environment VARCHAR(20) default '', auto_pause_precall ENUM('Y','N') default 'N', @@ -2994,6 +2994,7 @@ INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,cate INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable,scheduled_callback,completed) values('LRERR','Outbound Local Channel Res Err','N','Y','UNDEFINED','N','N','N','N','N','N','N'); INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable,scheduled_callback,completed) values('QCFAIL','QC_FAIL_CALLBK','N','Y','QC','N','N','Y','N','N','Y','N'); INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable,scheduled_callback,completed) values('ADCT','Disconnected Number Temporary','N','N','UNDEFINED','N','N','N','N','N','N','N'); +INSERT INTO vicidial_statuses (status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable,scheduled_callback,completed) values('LSMERG','Agent lead search old lead merge','N','N','UNDEFINED','N','N','N','N','N','N','N'); INSERT INTO vicidial_qc_codes (code,code_name,qc_result_type) VALUES ('QCPASS','PASS','PASS'); INSERT INTO vicidial_qc_codes (code,code_name,qc_result_type) VALUES ('QCFAIL','FAIL','FAIL'); @@ -3004,4 +3005,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version'; UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1335',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1336',db_schema_update_date=NOW(); diff --git a/agc_2-X/trunk/extras/upgrade_2.6.sql b/agc_2-X/trunk/extras/upgrade_2.6.sql index e1563965..e109e346 100644 --- a/agc_2-X/trunk/extras/upgrade_2.6.sql +++ b/agc_2-X/trunk/extras/upgrade_2.6.sql @@ -193,3 +193,9 @@ UPDATE system_settings SET db_schema_version='1334',db_schema_update_date=NOW() ALTER TABLE system_settings ADD enhanced_disconnect_logging ENUM('0','1') default '0'; UPDATE system_settings SET db_schema_version='1335',db_schema_update_date=NOW() where db_schema_version < 1335; + +ALTER TABLE vicidial_campaigns MODIFY agent_lead_search ENUM('ENABLED','LIVE_CALL_INBOUND','LIVE_CALL_INBOUND_AND_MANUAL','DISABLED') default 'DISABLED'; + +ALTER TABLE vicidial_users MODIFY agent_lead_search_override ENUM('NOT_ACTIVE','ENABLED','LIVE_CALL_INBOUND','LIVE_CALL_INBOUND_AND_MANUAL','DISABLED') default 'NOT_ACTIVE'; + +UPDATE system_settings SET db_schema_version='1336',db_schema_update_date=NOW() where db_schema_version < 1336; diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt index c8e24c36..122b9bde 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.6.txt @@ -79,6 +79,8 @@ If the option Use Campaign DNC List is enabled, this option can allow you to use LIST EXPIRED AND SET TO ACTIVE|| Enhanced Disconnect Logging|| This setting enables logging of calls that get a CONGESTION signal with a cause code of 1, 19, 21, 34 or 38. We usually do not recommend enabling this in the USA. Default is 0 for disabled|| +LIVE_CALL_INBOUND will allow search for a lead while on an inbound call only. LIVE_CALL_INBOUND_AND_MANUAL will allow search for a lead while on an inbound call or while paused. When Lead Search is used on a live inbound call, the lead of the call when it went to the agent will be changed to a status of LSMERG, and the logs for the call will be modified to link to the agent selected lead instead|| +If this is a call that will go to a Call Menu and then back to an in-group, we suggest you use CUSTOMERCLOSER in this field, and also you need to set the In-Group Search Method in the Call Menu to CLOSER|| ############################################################ CLIENT @@ -99,6 +101,8 @@ YOU MUST SELECT AN AGENT TO TRANSFER TO WHEN USING AGENTDIRECT|| Another live agent session was open using your user ID. It has been disabled. Click OK to continue to the agent screen|| View Comment History|| reset form|| +SELECT THIS LEAD|| +YOU MUST BE ON AN ACTIVE INBOUND CALL TO SEARCH FOR A LEAD|| ############################################################ MANAGER Manual diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index 6ac499bc..0d5c773d 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -320,12 +320,13 @@ # 121124-2357 - Added Other Campaign DNC option # 121130-0740 - Added call notes option to dispo call url # 121205-1620 - Added parentheses around filter SQL when in SQL queries +# 121206-0635 - Added inbound lead search feature # -$version = '2.6-218'; -$build = '121205-1620'; +$version = '2.6-219'; +$build = '121206-0635'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=446; +$mysql_log_count=484; $one_mysql_log=0; require("dbconnect.php"); @@ -544,6 +545,8 @@ if (isset($_GET["dial_ingroup"])) {$dial_ingroup=$_GET["dial_ingroup"];} elseif (isset($_POST["dial_ingroup"])) {$dial_ingroup=$_POST["dial_ingroup"];} if (isset($_GET["nocall_dial_flag"])) {$nocall_dial_flag=$_GET["nocall_dial_flag"];} elseif (isset($_POST["nocall_dial_flag"])) {$nocall_dial_flag=$_POST["nocall_dial_flag"];} +if (isset($_GET["inbound_lead_search"])) {$inbound_lead_search=$_GET["inbound_lead_search"];} + elseif (isset($_POST["inbound_lead_search"])) {$inbound_lead_search=$_POST["inbound_lead_search"];} header ("Content-type: text/html; charset=utf-8"); @@ -6012,6 +6015,707 @@ if ($ACTION == 'VDADcheckINCOMING') } +################################################################################ +### LeaDSearcHSelecTUpdatE - for inbound lead search update select calls +### gathers lead information to send to agent screen +################################################################################ +if ($ACTION == 'LeaDSearcHSelecTUpdatE') + { + $VDCL_ingroup_recording_override = ''; + $VDCL_ingroup_rec_filename = ''; + $Ctype = 'A'; + $MT[0]=''; + $row=''; $rowx=''; + $channel_live=1; + $alt_phone_code=''; + $alt_phone_number=''; + $alt_phone_note=''; + $alt_phone_active=''; + $alt_phone_count=''; + $INclosecallid=''; + $INxfercallid=''; + + if ( (strlen($campaign)<1) || (strlen($server_ip)<1) || ($lead_id<0) ) + { + $channel_live=0; + echo "0\n"; + echo "Campaign $campaign is not valid or lead_id $lead_id is not valid\n"; + exit; + } + else + { + ### grab the call info from the vicidial_live_agents table + $stmt = "SELECT uniqueid,callerid,channel,call_server_ip,comments FROM vicidial_live_agents where server_ip = '$server_ip' and user='$user' and campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00447',$user,$server_ip,$session_name,$one_mysql_log);} + $queue_leadID_ct = mysql_num_rows($rslt); + + if ($queue_leadID_ct > 0) + { + $row=mysql_fetch_row($rslt); + $uniqueid = $row[0]; + $callerid = $row[1]; + $channel = $row[2]; + $call_server_ip = $row[3]; + $VLAcomments = $row[4]; + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + echo "1\n" . $lead_id . '|' . $uniqueid . '|' . $callerid . '|' . $channel . '|' . $call_server_ip . "|\n"; + + $original_phone_number = $phone_number; + + ### update the agent lead_id to the new lead_id in vicidial_live_agents + $stmt = "UPDATE vicidial_live_agents set lead_id='$lead_id' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00448',$user,$server_ip,$session_name,$one_mysql_log);} + $retry_count=0; + while ( ($errno > 0) and ($retry_count < 9) ) + { + $rslt=mysql_query($stmt, $link); + $one_mysql_log=1; + $errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9106$retry_count",$user,$server_ip,$session_name,$one_mysql_log); + $one_mysql_log=0; + $retry_count++; + } + + ### update the auto calls lead_id to the new lead_id in vicidial_auto_calls + $stmt = "UPDATE vicidial_auto_calls set lead_id='$lead_id' where callerid='$callerid' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00449',$user,$server_ip,$session_name,$one_mysql_log);} + + ### update the previous lead_id(stage) entry in vicidial_list, set the status to LSMERG + $stmt = "UPDATE vicidial_list set status='LSMERG' where lead_id='$stage';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00450',$user,$server_ip,$session_name,$one_mysql_log);} + + ### update the vicidial_grab_call_log lead_id to the new lead_id + $stmt = "UPDATE vicidial_grab_call_log set lead_id='$lead_id' where lead_id='$stage' and user='$user' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00451',$user,$server_ip,$session_name,$one_mysql_log);} + + ### update the vicidial_log_extended lead_id to the new lead_id + $stmt = "UPDATE vicidial_log_extended set lead_id='$lead_id' where lead_id='$stage' and caller_code='$callerid' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00453',$user,$server_ip,$session_name,$one_mysql_log);} + + ### update the park_log lead_id to the new lead_id + $stmt = "UPDATE park_log set lead_id='$lead_id' where lead_id='$stage' and user='$user' and uniqueid='$uniqueid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00454',$user,$server_ip,$session_name,$one_mysql_log);} + + ##### grab the data from vicidial_list for the lead_id + $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='$lead_id' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00455',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $list_lead_ct = mysql_num_rows($rslt); + if ($list_lead_ct > 0) + { + $row=mysql_fetch_row($rslt); + # $lead_id = trim("$row[0]"); + $dispo = trim("$row[3]"); + $tsr = trim("$row[4]"); + $vendor_id = trim("$row[5]"); + $source_id = trim("$row[6]"); + $list_id = trim("$row[7]"); + $gmt_offset_now = trim("$row[8]"); + $phone_code = trim("$row[10]"); + $phone_number = trim("$row[11]"); + $title = trim("$row[12]"); + $first_name = trim("$row[13]"); + $middle_initial = trim("$row[14]"); + $last_name = trim("$row[15]"); + $address1 = trim("$row[16]"); + $address2 = trim("$row[17]"); + $address3 = trim("$row[18]"); + $city = trim("$row[19]"); + $state = trim("$row[20]"); + $province = trim("$row[21]"); + $postal_code = trim("$row[22]"); + $country_code = trim("$row[23]"); + $gender = trim("$row[24]"); + $date_of_birth = trim("$row[25]"); + $alt_phone = trim("$row[26]"); + $email = trim("$row[27]"); + $security = trim("$row[28]"); + $comments = stripslashes(trim("$row[29]")); + $called_count = trim("$row[30]"); + $rank = trim("$row[32]"); + $owner = trim("$row[33]"); + $entry_list_id = trim("$row[34]"); + if ($entry_list_id < 100) {$entry_list_id = $list_id;} + } + if ($qc_features_active > 0) + { + //Added by Poundteam for Audited Comments + ##### if list has audited comments, grab the audited comments + require_once('audit_comments.php'); + $ACcount = ''; + $ACcomments = ''; + $audit_comments_active=audit_comments_active($list_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log); + if ($audit_comments_active) + { + get_audited_comments($lead_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log); + } + $ACcomments = strip_tags(htmlentities($ACcomments)); + $ACcomments = eregi_replace("\r",'',$ACcomments); + $ACcomments = eregi_replace("\n",'!N',$ACcomments); + //END Added by Poundteam for Audited Comments + } + + ##### if lead is a callback, grab the callback comments + $CBentry_time = ''; + $CBcallback_time = ''; + $CBuser = ''; + $CBcomments = ''; + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00456',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00457',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or ($dispo == 'CBHOLD') ) + { + $stmt="SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='$lead_id' order by callback_id desc LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00458',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBentry_time = trim("$row[0]"); + $CBcallback_time = trim("$row[1]"); + $CBuser = trim("$row[2]"); + $CBcomments = trim("$row[3]"); + } + } + $stmt="SELECT owner_populate FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00459',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_op_ct = mysql_num_rows($rslt); + if ($camp_op_ct > 0) + { + $row=mysql_fetch_row($rslt); + $owner_populate = $row[0]; + } + $ownerSQL=''; + if ( ($owner_populate=='ENABLED') and ( (strlen($owner) < 1) or ($owner=='NULL') ) ) + { + $ownerSQL = ",owner='$user'"; + $owner=$user; + } + + ### update the lead status to INCALL + $stmt = "UPDATE vicidial_list set status='INCALL', user='$user' $ownerSQL where lead_id='$lead_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00460',$user,$server_ip,$session_name,$one_mysql_log);} + + ### gather custom_call_id from vicidial_log_extended table + $custom_call_id=''; + $stmt="SELECT custom_call_id FROM vicidial_log_extended where uniqueid='$uniqueid';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00461',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vle_record_ct = mysql_num_rows($rslt); + if ($vle_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $custom_call_id = $row[0]; + } + + ### update the log status to INCALL + $user_group=''; + $stmt="SELECT user_group,full_name FROM vicidial_users where user='$user' LIMIT 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00462',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $ug_record_ct = mysql_num_rows($rslt); + if ($ug_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $user_group = trim("$row[0]"); + $fullname = $row[1]; + } + + $dialed_number = $phone_number; + $dialed_label = 'MAIN'; + $call_type = 'IN'; + $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where lead_id = '$stage' order by call_date desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00463',$user,$server_ip,$session_name,$one_mysql_log);} + $VDCL_mvac_ct = mysql_num_rows($rslt); + if ($VDCL_mvac_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDADchannel_group = $row[0]; + $INclosecallid = $row[1]; + $INxfercallid = $row[2]; + } + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|$VDADchannel_group|$call_type|$dialed_number|$dialed_label|$INclosecallid|$INxfercallid|\n"); + fclose($fp); + } + + ### update the recording_log lead_id to the new lead_id + $stmt = "UPDATE recording_log set lead_id='$lead_id' where lead_id='$stage' and user='$user' and vicidial_id='$INclosecallid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00464',$user,$server_ip,$session_name,$one_mysql_log);} + + ### update the vicidial_closer_log user to INCALL + $stmt = "UPDATE vicidial_closer_log set lead_id='$lead_id' where lead_id='$stage' and user='$user' and uniqueid='$uniqueid' order by closecallid desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00465',$user,$server_ip,$session_name,$one_mysql_log);} + + if (strlen($closecallid)<1) + { + $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' order by call_date desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00466',$user,$server_ip,$session_name,$one_mysql_log);} + $VDCL_mvac_ct = mysql_num_rows($rslt); + if ($VDCL_mvac_ct > 0) + { + $row=mysql_fetch_row($rslt); + $INclosecallid = $row[0]; + $INxfercallid = $row[1]; + } + } + + ### update the vicidial_xfer_log lead_id to the new lead_id + $stmt = "UPDATE vicidial_xfer_log set lead_id='$lead_id' where lead_id='$stage' and closer='$user' and xfercallid='$INxfercallid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00452',$user,$server_ip,$session_name,$one_mysql_log);} + + $script_recording_delay=0; + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_inbound_groups vig WHERE group_id='$VDADchannel_group' and vs.script_id=vig.ingroup_script and script_text LIKE \"%--A--recording_%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00467',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vs_vc_ct = mysql_num_rows($rslt); + if ($vs_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $script_recording_delay = $row[0]; + } + + $stmt = "SELECT group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename,default_group_alias,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00468',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cid_ct = mysql_num_rows($rslt); + if ($VDIG_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_name = $row[0]; + $VDCL_group_color = $row[1]; + $VDCL_group_web = stripslashes($row[2]); + $VDCL_fronter_display = $row[3]; + $VDCL_ingroup_script = $row[4]; + $VDCL_get_call_launch = $row[5]; + $VDCL_xferconf_a_dtmf = $row[6]; + $VDCL_xferconf_a_number = $row[7]; + $VDCL_xferconf_b_dtmf = $row[8]; + $VDCL_xferconf_b_number = $row[9]; + $VDCL_default_xfer_group = $row[10]; + $VDCL_ingroup_recording_override = $row[11]; + $VDCL_ingroup_rec_filename = $row[12]; + $VDCL_default_group_alias = $row[13]; + $VDCL_group_web_two = stripslashes($row[14]); + $VDCL_timer_action = $row[15]; + $VDCL_timer_action_message = $row[16]; + $VDCL_timer_action_seconds = $row[17]; + $VDCL_start_call_url = $row[18]; + $VDCL_dispo_call_url = $row[19]; + $VDCL_xferconf_c_number = $row[20]; + $VDCL_xferconf_d_number = $row[21]; + $VDCL_xferconf_e_number = $row[22]; + $VDCL_uniqueid_status_display = $row[23]; + $VDCL_uniqueid_status_prefix = $row[24]; + $VDCL_timer_action_destination = $row[25]; + + $stmt = "SELECT campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination from vicidial_campaigns where campaign_id='$campaign';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00469',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidOR_ct = mysql_num_rows($rslt); + if ($VDIG_cidOR_ct > 0) + { + $row=mysql_fetch_row($rslt); + if (strlen($VDCL_xferconf_a_dtmf) < 1) + {$VDCL_xferconf_a_dtmf = $row[1];} + if (strlen($VDCL_xferconf_a_number) < 1) + {$VDCL_xferconf_a_number = $row[2];} + if (strlen($VDCL_xferconf_b_dtmf) < 1) + {$VDCL_xferconf_b_dtmf = $row[3];} + if (strlen($VDCL_xferconf_b_number) < 1) + {$VDCL_xferconf_b_number = $row[4];} + if (strlen($VDCL_default_group_alias) < 1) + {$VDCL_default_group_alias = $row[5];} + if (strlen($VDCL_timer_action) < 1) + {$VDCL_timer_action = $row[6];} + if (strlen($VDCL_timer_action_message) < 1) + {$VDCL_timer_action_message = $row[7];} + if (strlen($VDCL_timer_action_seconds) < 1) + {$VDCL_timer_action_seconds = $row[8];} + if (strlen($VDCL_start_call_url) < 1) + {$VDCL_start_call_url = $row[9];} + if (strlen($VDCL_dispo_call_url) < 1) + {$VDCL_dispo_call_url = $row[10];} + if (strlen($VDCL_xferconf_c_number) < 1) + {$VDCL_xferconf_c_number = $row[11];} + if (strlen($VDCL_xferconf_d_number) < 1) + {$VDCL_xferconf_d_number = $row[12];} + if (strlen($VDCL_xferconf_e_number) < 1) + {$VDCL_xferconf_e_number = $row[13];} + if (strlen($VDCL_timer_action_destination) < 1) + {$VDCL_timer_action_destination = $row[14];} + + if ( ( (ereg('NONE',$VDCL_ingroup_script)) and (strlen($VDCL_ingroup_script) < 5) ) or (strlen($VDCL_ingroup_script) < 1) ) + { + $VDCL_ingroup_script = $row[0]; + $script_recording_delay=0; + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='$campaign' and vs.script_id=vc.campaign_script and script_text LIKE \"%--A--recording_%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00470',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vs_vc_ct = mysql_num_rows($rslt); + if ($vs_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $script_recording_delay = $row[0]; + } + } + } + + $stmt = "SELECT group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00471',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidgwv_ct = mysql_num_rows($rslt); + if ($VDIG_cidgwv_ct > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_web_vars = $row[0]; + } + + if (strlen($VDCL_group_web_vars) < 1) + { + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00472',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidogwv = mysql_num_rows($rslt); + if ($VDIG_cidogwv > 0) + { + $row=mysql_fetch_row($rslt); + $VDCL_group_web_vars = $row[0]; + } + } + + $Ctype = 'I'; + } + + ### Check for List ID override settings + if (strlen($list_id)>0) + { + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two from vicidial_lists where list_id='$list_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00473',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIG_cidOR_ct = mysql_num_rows($rslt); + if ($VDIG_cidOR_ct > 0) + { + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 0) + {$VDCL_xferconf_a_number = $row[0];} + if (strlen($row[1]) > 0) + {$VDCL_xferconf_b_number = $row[1];} + if (strlen($row[2]) > 0) + {$VDCL_xferconf_c_number = $row[2];} + if (strlen($row[3]) > 0) + {$VDCL_xferconf_d_number = $row[3];} + if (strlen($row[4]) > 0) + {$VDCL_xferconf_e_number = $row[4];} + if (strlen($row[5]) > 5) + {$VDCL_group_web = $row[5];} + if (strlen($row[6]) > 5) + {$VDCL_group_web_two = $row[6];} + } + } + + $DID_id=''; + $DID_extension=''; + $DID_pattern=''; + $DID_description=''; + + $stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='$uniqueid' order by call_date desc limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00474',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIDL_ct = mysql_num_rows($rslt); + if ($VDIDL_ct > 0) + { + $row=mysql_fetch_row($rslt); + $DID_id = $row[0]; + $DID_extension = $row[1]; + + $stmt = "SELECT did_pattern,did_description from vicidial_inbound_dids where did_id='$DID_id' limit 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00475',$user,$server_ip,$session_name,$one_mysql_log);} + $VDIDL_ct = mysql_num_rows($rslt); + if ($VDIDL_ct > 0) + { + $row=mysql_fetch_row($rslt); + $DID_pattern = $row[0]; + $DID_description = $row[1]; + } + } + + ### if web form is set then send on to vicidial.php for override of WEB_FORM address + if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|\n";} + else {echo "X|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|\n";} + + $stmt = "SELECT full_name from vicidial_users where user='$tsr';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00476',$user,$server_ip,$session_name,$one_mysql_log);} + $VDU_cid_ct = mysql_num_rows($rslt); + if ($VDU_cid_ct > 0) + { + $row=mysql_fetch_row($rslt); + $fronter_full_name = $row[0]; + echo $fronter_full_name . '|' . $tsr . "\n"; + } + else {echo '|' . $tsr . "\n";} + + + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_lists WHERE list_id='$list_id' and agent_script_override!='' and agent_script_override IS NOT NULL and agent_script_override!='NONE';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00477',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vls_vc_ct = mysql_num_rows($rslt); + if ($vls_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $script_recording_delay=0; + ##### find if script contains recording fields + $stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_lists vls WHERE list_id='$list_id' and vs.script_id=vls.agent_script_override and script_text LIKE \"%--A--recording_%\";"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00478',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $vs_vc_ct = mysql_num_rows($rslt); + if ($vs_vc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $script_recording_delay = $row[0]; + } + } + } + + $custom_field_names='|'; + $custom_field_names_SQL=''; + $custom_field_values='----------'; + $custom_field_types='|'; + ### find the names of all custom fields, if any + $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00479',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cffn_ct = mysql_num_rows($rslt); + $d=0; + while ($cffn_ct > $d) + { + $row=mysql_fetch_row($rslt); + $custom_field_names .= "$row[0]|"; + $custom_field_names_SQL .= "$row[0],"; + $custom_field_types .= "$row[1]|"; + $custom_field_values .= "----------"; + $d++; + } + if ($cffn_ct > 0) + { + $custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL); + ### find the values of the named custom fields + $stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00480',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cffv_ct = mysql_num_rows($rslt); + if ($cffv_ct > 0) + { + $custom_field_values='----------'; + $row=mysql_fetch_row($rslt); + $d=0; + while ($cffn_ct > $d) + { + $custom_field_values .= "$row[$d]----------"; + $d++; + } + $custom_field_values = preg_replace("/\n/"," ",$custom_field_values); + $custom_field_values = preg_replace("/\r/","",$custom_field_values); + } + } + + if (strlen($phone_number) < 3) + {$phone_number = $original_phone_number;} + else + { + if (strlen($alt_phone) < 3) + {$alt_phone = $original_phone_number;} + else + { + if (strlen($address3) < 3) + {$address3 = $original_phone_number;} + } + } + $comments = eregi_replace("\r",'',$comments); + $comments = eregi_replace("\n",'!N',$comments); + + $LeaD_InfO = $callerid . "\n"; + $LeaD_InfO .= $lead_id . "\n"; + $LeaD_InfO .= $dispo . "\n"; + $LeaD_InfO .= $tsr . "\n"; + $LeaD_InfO .= $vendor_id . "\n"; + $LeaD_InfO .= $list_id . "\n"; + $LeaD_InfO .= $gmt_offset_now . "\n"; + $LeaD_InfO .= $phone_code . "\n"; + $LeaD_InfO .= $phone_number . "\n"; + $LeaD_InfO .= $title . "\n"; + $LeaD_InfO .= $first_name . "\n"; + $LeaD_InfO .= $middle_initial . "\n"; + $LeaD_InfO .= $last_name . "\n"; + $LeaD_InfO .= $address1 . "\n"; + $LeaD_InfO .= $address2 . "\n"; + $LeaD_InfO .= $address3 . "\n"; + $LeaD_InfO .= $city . "\n"; + $LeaD_InfO .= $state . "\n"; + $LeaD_InfO .= $province . "\n"; + $LeaD_InfO .= $postal_code . "\n"; + $LeaD_InfO .= $country_code . "\n"; + $LeaD_InfO .= $gender . "\n"; + $LeaD_InfO .= $date_of_birth . "\n"; + $LeaD_InfO .= $alt_phone . "\n"; + $LeaD_InfO .= $email . "\n"; + $LeaD_InfO .= $security . "\n"; + $LeaD_InfO .= $comments . "\n"; + $LeaD_InfO .= $called_count . "\n"; + $LeaD_InfO .= $CBentry_time . "\n"; + $LeaD_InfO .= $CBcallback_time . "\n"; + $LeaD_InfO .= $CBuser . "\n"; + $LeaD_InfO .= $CBcomments . "\n"; + $LeaD_InfO .= $dialed_number . "\n"; + $LeaD_InfO .= $dialed_label . "\n"; + $LeaD_InfO .= $source_id . "\n"; + $LeaD_InfO .= $alt_phone_code . "\n"; + $LeaD_InfO .= $alt_phone_number . "\n"; + $LeaD_InfO .= $alt_phone_note . "\n"; + $LeaD_InfO .= $alt_phone_active . "\n"; + $LeaD_InfO .= $alt_phone_count . "\n"; + $LeaD_InfO .= $rank . "\n"; + $LeaD_InfO .= $owner . "\n"; + $LeaD_InfO .= $script_recording_delay . "\n"; + $LeaD_InfO .= $entry_list_id . "\n"; + $LeaD_InfO .= $custom_field_names . "\n"; + $LeaD_InfO .= $custom_field_values . "\n"; + $LeaD_InfO .= $custom_field_types . "\n"; + $LeaD_InfO .= $LISTweb_form_address . "\n"; + $LeaD_InfO .= $LISTweb_form_address_two . "\n"; + $LeaD_InfO .= $ACcount . "\n"; + $LeaD_InfO .= $ACcomments . "\n"; + + echo $LeaD_InfO; + + + $stmt="UPDATE vicidial_agent_log set lead_id='$lead_id' where agent_log_id='$agent_log_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00481',$user,$server_ip,$session_name,$one_mysql_log);} + + ### If a scheduled callback, change vicidial_callback record to INACTIVE + $CBstatus = 0; + + $stmt="SELECT count(*) FROM vicidial_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00482',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + if ($CBstatus < 1) + { + $stmt="SELECT count(*) FROM vicidial_campaign_statuses where status='$dispo' and scheduled_callback='Y';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00483',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cb_record_ct = mysql_num_rows($rslt); + if ($cb_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $CBstatus = $row[0]; + } + } + if ( ($CBstatus > 0) or (eregi("CALLBK|CBHOLD", $dispo)) ) + { + $stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='$lead_id' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00484',$user,$server_ip,$session_name,$one_mysql_log);} + } + } + else + { + echo "0\n"; + # echo "No leads to update for $user on $server_ip\n"; + exit; + } + } + } + + ################################################################################ ### userLOGout - Logs the user out of VICIDiaL client, deleting db records and ### inserting into vicidial_user_log @@ -9139,8 +9843,15 @@ if ($ACTION == 'SEARCHRESULTSview') echo " $ALLcity[$i] \n"; echo " $ALLstate[$i]\n"; echo " $ALLpostal_code[$i] \n"; - echo " INFO \n"; - echo " DIAL \n"; + echo " INFO \n"; + if ($inbound_lead_search < 1) + { + echo " DIAL \n"; + } + else + { + echo " SELECT \n"; + } echo "\n"; } @@ -9525,6 +10236,9 @@ if ($ACTION == 'LEADINFOview') if ($search == 'logfirst') {$hide_dial_links++;} + if ($inbound_lead_search > 0) + {$hide_dial_links++;} + ### BEGIN Display callback information ### $callback_id = preg_replace('/\D/','',$callback_id); if (strlen($callback_id) > 0) @@ -9742,6 +10456,8 @@ if ($ACTION == 'LEADINFOview') $INFOout .= "Dial Link:   DIAL"; } $INFOout .= ""; + if ($inbound_lead_search > 0) + {$INFOout .= "SELECT THIS LEAD";} if ( ($label_title!='---HIDE---') or ($label_hide_field_logs=='N') ) {$INFOout .= "$label_title:   $row[7]";} if ( ($label_first_name!='---HIDE---') or ($label_hide_field_logs=='N') ) @@ -9917,7 +10633,6 @@ if ($ACTION == 'LEADINFOview') } $Allcounter[$g] = $g; - $g++; $u++; } diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 09f595ec..e481862c 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -391,10 +391,11 @@ # 121116-1407 - Added QC functionality # 121129-2149 - Corrected hotkeys activation conditions # 121130-0734 - Fixed call notes amphersand issue #612 +# 121206-0634 - Added inbound lead search feature # -$version = '2.6-359c'; -$build = '121130-0734'; +$version = '2.6-360c'; +$build = '121206-0634'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=79; $one_mysql_log=0; @@ -1559,7 +1560,7 @@ else if ( ($disable_dispo_screen == 'DISPO_DISABLED') and (strlen($disable_dispo_status) > 0) ) {$disable_dispo_screen=1;} - if ( ($VU_agent_lead_search_override == 'ENABLED') or ($VU_agent_lead_search_override == 'DISABLED') ) + if ( ($VU_agent_lead_search_override == 'ENABLED') or ($VU_agent_lead_search_override == 'LIVE_CALL_INBOUND') or ($VU_agent_lead_search_override == 'LIVE_CALL_INBOUND_AND_MANUAL') or ($VU_agent_lead_search_override == 'DISABLED') ) {$agent_lead_search = $VU_agent_lead_search_override;} $AllowManualQueueCalls=1; $AllowManualQueueCallsChoice=0; @@ -3644,6 +3645,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var deactivated_old_session=''; var owner_populate=''; var qc_enabled=''; + var inbound_lead_search=0; var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; @@ -5870,7 +5872,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) // closes lead search screen function LeaDSearcHVieWClose() { - if (auto_resume_precall == 'Y') + if ( (auto_resume_precall == 'Y') && (inbound_lead_search < 1) ) { AutoDial_ReSume_PauSe("VDADready"); } @@ -6006,6 +6008,392 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } +// ################################################################################ +// Populate lead information from search while on inbound call + function LeaDSearcHSelecT(LSSlead_id,LSStype) + { + var move_on=0; + if (VD_live_customer_call==1) + { + move_on=1; + } + if (move_on == 1) + { + if (typeof(xmlhttprequestselectupdate) == "undefined") + { + var xmlhttprequestselectupdate=false; + /*@cc_on @*/ + /*@if (@_jscript_version >= 5) + // JScript gives us Conditional compilation, we can cope with old IE versions. + // and security blocked creation of the objects. + try { + xmlhttprequestselectupdate = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttprequestselectupdate = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttprequestselectupdate = false; + } + } + @end @*/ + if (!xmlhttprequestselectupdate && typeof XMLHttpRequest!='undefined') + { + xmlhttprequestselectupdate = new XMLHttpRequest(); + } + if (xmlhttprequestselectupdate) + { + checkVDAI_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&ACTION=LeaDSearcHSelecTUpdatE" + "&lead_id=" + LSSlead_id + "&stage=" + document.vicidial_form.lead_id.value + "&agent_log_id=" + agent_log_id + "&phone_number=" + document.vicidial_form.phone_number.value; + xmlhttprequestselectupdate.open('POST', 'vdc_db_query.php'); + xmlhttprequestselectupdate.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttprequestselectupdate.send(checkVDAI_query); + xmlhttprequestselectupdate.onreadystatechange = function() + { + if (xmlhttprequestselectupdate.readyState == 4 && xmlhttprequestselectupdate.status == 200) + { + var check_incoming = null; + lead_change = xmlhttprequestselectupdate.responseText; + // alert(checkVDAI_query); + // alert(xmlhttprequestselectupdate.responseText); + var change_array=lead_change.split("\n"); + if (change_array[0] == '1') + { + var VDIC_data_VDAC=change_array[1].split("|"); + VDIC_web_form_address = VICIDiaL_web_form_address + VDIC_web_form_address_two = VICIDiaL_web_form_address_two + var VDIC_fronter=''; + + var change_data=change_array[2].split("|"); + if (change_data[0].length > 5) + {VDIC_web_form_address = change_data[0];} + var VDCL_group_name = change_data[1]; + var VDCL_group_color = change_data[2]; + var VDCL_fronter_display = change_data[3]; + VDCL_group_id = change_data[4]; + CalL_ScripT_id = change_data[5]; + CalL_AutO_LauncH = change_data[6]; + CalL_XC_a_Dtmf = change_data[7]; + CalL_XC_a_NuMber = change_data[8]; + CalL_XC_b_Dtmf = change_data[9]; + CalL_XC_b_NuMber = change_data[10]; + if ( (change_data[11].length > 1) && (change_data[11] != '---NONE---') ) + {LIVE_default_xfer_group = change_data[11];} + else + {LIVE_default_xfer_group = default_xfer_group;} + + if ( (change_data[12].length > 1) && (change_data[12]!='DISABLED') ) + {LIVE_campaign_recording = change_data[12];} + else + {LIVE_campaign_recording = campaign_recording;} + + if ( (change_data[13].length > 1) && (change_data[13]!='NONE') ) + {LIVE_campaign_rec_filename = change_data[13];} + else + {LIVE_campaign_rec_filename = campaign_rec_filename;} + + if ( (change_data[14].length > 1) && (change_data[14]!='NONE') ) + {LIVE_default_group_alias = change_data[14];} + else + {LIVE_default_group_alias = default_group_alias;} + + if ( (change_data[15].length > 1) && (change_data[15]!='NONE') ) + {LIVE_caller_id_number = change_data[15];} + else + {LIVE_caller_id_number = default_group_alias_cid;} + + if (change_data[16].length > 0) + {LIVE_web_vars = change_data[16];} + else + {LIVE_web_vars = default_web_vars;} + + if (change_data[17].length > 5) + {VDIC_web_form_address_two = change_data[17];} + + CalL_XC_c_NuMber = change_data[21]; + CalL_XC_d_NuMber = change_data[22]; + CalL_XC_e_NuMber = change_data[23]; + CalL_XC_e_NuMber = change_data[23]; + uniqueid_status_display = change_data[24]; + uniqueid_status_prefix = change_data[26]; + did_id = change_data[28]; + did_extension = change_data[29]; + did_pattern = change_data[30]; + did_description = change_data[31]; + closecallid = change_data[32]; + xfercallid = change_data[33]; + + document.vicidial_form.lead_id.value = VDIC_data_VDAC[0]; + LeaDPreVDispO = change_array[6]; + fronter = change_array[7]; + document.vicidial_form.vendor_lead_code.value = change_array[8]; + document.vicidial_form.list_id.value = change_array[9]; + document.vicidial_form.gmt_offset_now.value = change_array[10]; + document.vicidial_form.phone_code.value = change_array[11]; + if ( (disable_alter_custphone=='Y') || (disable_alter_custphone=='HIDE') ) + { + var tmp_pn = document.getElementById("phone_numberDISP"); + if (disable_alter_custphone=='Y') + { + tmp_pn.innerHTML = change_array[12]; + } + } + document.vicidial_form.phone_number.value = change_array[12]; + document.vicidial_form.title.value = change_array[13]; + document.vicidial_form.first_name.value = change_array[14]; + document.vicidial_form.middle_initial.value = change_array[15]; + document.vicidial_form.last_name.value = change_array[16]; + document.vicidial_form.address1.value = change_array[17]; + document.vicidial_form.address2.value = change_array[18]; + document.vicidial_form.address3.value = change_array[19]; + document.vicidial_form.city.value = change_array[20]; + document.vicidial_form.state.value = change_array[21]; + document.vicidial_form.province.value = change_array[22]; + document.vicidial_form.postal_code.value = change_array[23]; + document.vicidial_form.country_code.value = change_array[24]; + document.vicidial_form.gender.value = change_array[25]; + document.vicidial_form.date_of_birth.value = change_array[26]; + document.vicidial_form.alt_phone.value = change_array[27]; + document.vicidial_form.email.value = change_array[28]; + document.vicidial_form.security_phrase.value = change_array[29]; + var REGcommentsNL = new RegExp("!N","g"); + change_array[30] = change_array[30].replace(REGcommentsNL, "\n"); + document.vicidial_form.comments.value = change_array[30]; + document.vicidial_form.called_count.value = change_array[31]; + CBentry_time = change_array[32]; + CBcallback_time = change_array[33]; + CBuser = change_array[34]; + CBcomments = change_array[35]; + dialed_number = change_array[36]; + dialed_label = change_array[37]; + source_id = change_array[38]; + EAphone_code = change_array[39]; + EAphone_number = change_array[40]; + EAalt_phone_notes = change_array[41]; + EAalt_phone_active = change_array[42]; + EAalt_phone_count = change_array[43]; + document.vicidial_form.rank.value = change_array[44]; + document.vicidial_form.owner.value = change_array[45]; + document.vicidial_form.entry_list_id.value = change_array[47]; + custom_field_names = change_array[48]; + custom_field_values = change_array[49]; + custom_field_types = change_array[50]; + //Added By Poundteam for Audited Comments (Manual Dial Section Only) + if (qc_enabled > 0) + { + document.vicidial_form.ViewCommentButton.value = change_array[53]; + document.vicidial_form.audit_comments_button.value = change_array[53]; + var REGACcomments = new RegExp("!N","g"); + change_array[54] = change_array[54].replace(REGACcomments, "\n"); + document.vicidial_form.audit_comments.value = change_array[54]; + } + //END section Added By Poundteam for Audited Comments + // Add here for AutoDial (VDADcheckINCOMING in vdc_db_query) + + if (hide_gender > 0) + { + document.vicidial_form.gender_list.value = change_array[25]; + } + else + { + var gIndex = 0; + if (document.vicidial_form.gender.value == 'M') {var gIndex = 1;} + if (document.vicidial_form.gender.value == 'F') {var gIndex = 2;} + document.getElementById("gender_list").selectedIndex = gIndex; + } + + hideDiv('SearcHForMDisplaYBox'); + hideDiv('SearcHResultSDisplaYBox'); + hideDiv('LeaDInfOBox'); + document.vicidial_form.search_phone_number.value=''; + document.vicidial_form.search_lead_id.value=''; + document.vicidial_form.search_vendor_lead_code.value=''; + document.vicidial_form.search_first_name.value=''; + document.vicidial_form.search_last_name.value=''; + document.vicidial_form.search_city.value=''; + document.vicidial_form.search_state.value=''; + document.vicidial_form.search_postal_code.value=''; + + lead_dial_number = document.vicidial_form.phone_number.value; + var dispnum = document.vicidial_form.phone_number.value; + var status_display_number = phone_number_format(dispnum); + var callnum = dialed_number; + var dial_display_number = phone_number_format(callnum); + + if (CBentry_time.length > 2) + { + document.getElementById("CusTInfOSpaN").innerHTML = " PREVIOUS CALLBACK "; + document.getElementById("CusTInfOSpaN").style.background = CusTCB_bgcolor; + document.getElementById("CBcommentsBoxA").innerHTML = "Last Call: " + CBentry_time; + document.getElementById("CBcommentsBoxB").innerHTML = "CallBack: " + CBcallback_time; + document.getElementById("CBcommentsBoxC").innerHTML = "Agent: " + CBuser; + document.getElementById("CBcommentsBoxD").innerHTML = "Comments:
" + CBcomments; + showDiv('CBcommentsBox'); + } + + if ( (quick_transfer_button == 'IN_GROUP') || (quick_transfer_button == 'LOCKED_IN_GROUP') ) + { + if (quick_transfer_button_locked > 0) + {quick_transfer_button_orig = default_xfer_group;} + + document.getElementById("QuickXfer").innerHTML = "\"QUICK"; + } + if (prepopulate_transfer_preset_enabled > 0) + { + if ( (prepopulate_transfer_preset == 'PRESET_1') || (prepopulate_transfer_preset == 'LOCKED_PRESET_1') ) + {document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber; document.vicidial_form.xfername.value='D1';} + if ( (prepopulate_transfer_preset == 'PRESET_2') || (prepopulate_transfer_preset == 'LOCKED_PRESET_2') ) + {document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber; document.vicidial_form.xfername.value='D2';} + if ( (prepopulate_transfer_preset == 'PRESET_3') || (prepopulate_transfer_preset == 'LOCKED_PRESET_3') ) + {document.vicidial_form.xfernumber.value = CalL_XC_c_NuMber; document.vicidial_form.xfername.value='D3';} + if ( (prepopulate_transfer_preset == 'PRESET_4') || (prepopulate_transfer_preset == 'LOCKED_PRESET_4') ) + {document.vicidial_form.xfernumber.value = CalL_XC_d_NuMber; document.vicidial_form.xfername.value='D4';} + if ( (prepopulate_transfer_preset == 'PRESET_5') || (prepopulate_transfer_preset == 'LOCKED_PRESET_5') ) + {document.vicidial_form.xfernumber.value = CalL_XC_e_NuMber; document.vicidial_form.xfername.value='D5';} + } + if ( (quick_transfer_button == 'PRESET_1') || (quick_transfer_button == 'PRESET_2') || (quick_transfer_button == 'PRESET_3') || (quick_transfer_button == 'PRESET_4') || (quick_transfer_button == 'PRESET_5') || (quick_transfer_button == 'LOCKED_PRESET_1') || (quick_transfer_button == 'LOCKED_PRESET_2') || (quick_transfer_button == 'LOCKED_PRESET_3') || (quick_transfer_button == 'LOCKED_PRESET_4') || (quick_transfer_button == 'LOCKED_PRESET_5') ) + { + if ( (quick_transfer_button == 'PRESET_1') || (quick_transfer_button == 'LOCKED_PRESET_1') ) + {document.vicidial_form.xfernumber.value = CalL_XC_a_NuMber; document.vicidial_form.xfername.value='D1';} + if ( (quick_transfer_button == 'PRESET_2') || (quick_transfer_button == 'LOCKED_PRESET_2') ) + {document.vicidial_form.xfernumber.value = CalL_XC_b_NuMber; document.vicidial_form.xfername.value='D2';} + if ( (quick_transfer_button == 'PRESET_3') || (quick_transfer_button == 'LOCKED_PRESET_3') ) + {document.vicidial_form.xfernumber.value = CalL_XC_c_NuMber; document.vicidial_form.xfername.value='D3';} + if ( (quick_transfer_button == 'PRESET_4') || (quick_transfer_button == 'LOCKED_PRESET_4') ) + {document.vicidial_form.xfernumber.value = CalL_XC_d_NuMber; document.vicidial_form.xfername.value='D4';} + if ( (quick_transfer_button == 'PRESET_5') || (quick_transfer_button == 'LOCKED_PRESET_5') ) + {document.vicidial_form.xfernumber.value = CalL_XC_e_NuMber; document.vicidial_form.xfername.value='D5';} + if (quick_transfer_button_locked > 0) + {quick_transfer_button_orig = document.vicidial_form.xfernumber.value;} + + document.getElementById("QuickXfer").innerHTML = "\"QUICK"; + } + + // Build transfer pull-down list + var loop_ct = 0; + var live_XfeR_HTML = ''; + var XfeR_SelecT = ''; + while (loop_ct < XFgroupCOUNT) + { + if (VARxfergroups[loop_ct] == LIVE_default_xfer_group) + {XfeR_SelecT = 'selected ';} + else {XfeR_SelecT = '';} + live_XfeR_HTML = live_XfeR_HTML + "\n"; + loop_ct++; + } + document.getElementById("XfeRGrouPLisT").innerHTML = ""; + + if (VDCL_group_id.length > 1) + {var group = VDCL_group_id;} + else + {var group = campaign;} + if ( (dialed_label.length < 2) || (dialed_label=='NONE') ) {dialed_label='MAIN';} + + if (hide_gender < 1) + { + var genderIndex = document.getElementById("gender_list").selectedIndex; + var genderValue = document.getElementById('gender_list').options[genderIndex].value; + document.vicidial_form.gender.value = genderValue; + } + + LeaDDispO=''; + + var regWFAcustom = new RegExp("^VAR","ig"); + if (VDIC_web_form_address.match(regWFAcustom)) + { + TEMP_VDIC_web_form_address = URLDecode(VDIC_web_form_address,'YES','CUSTOM'); + TEMP_VDIC_web_form_address = TEMP_VDIC_web_form_address.replace(regWFAcustom, ''); + } + else + { + TEMP_VDIC_web_form_address = URLDecode(VDIC_web_form_address,'YES','DEFAULT','1'); + } + + if (VDIC_web_form_address_two.match(regWFAcustom)) + { + TEMP_VDIC_web_form_address_two = URLDecode(VDIC_web_form_address_two,'YES','CUSTOM'); + TEMP_VDIC_web_form_address_two = TEMP_VDIC_web_form_address_two.replace(regWFAcustom, ''); + } + else + { + TEMP_VDIC_web_form_address_two = URLDecode(VDIC_web_form_address_two,'YES','DEFAULT','2'); + } + + document.getElementById("WebFormSpan").innerHTML = "\"Web\n"; + + if (enable_second_webform > 0) + { + document.getElementById("WebFormSpanTwo").innerHTML = "\"Web\n"; + } + + if ( (view_scripts == 1) && (CalL_ScripT_id.length > 0) ) + { + var SCRIPT_web_form = 'http://127.0.0.1/testing.php'; + var TEMP_SCRIPT_web_form = URLDecode(SCRIPT_web_form,'YES','DEFAULT','1'); + + if ( (script_recording_delay > 0) && ( (LIVE_campaign_recording == 'ALLCALLS') || (LIVE_campaign_recording == 'ALLFORCE') ) ) + { + delayed_script_load = 'YES'; + RefresHScript('CLEAR'); + } + else + { + load_script_contents(); + } + } + + if (custom_fields_enabled > 0) + { + FormContentsLoad(); + } + if (CalL_AutO_LauncH == 'SCRIPT') + { + if (delayed_script_load == 'YES') + { + load_script_contents(); + } + ScriptPanelToFront(); + } + if (CalL_AutO_LauncH == 'FORM') + { + FormPanelToFront(); + } + + if (CalL_AutO_LauncH == 'WEBFORM') + { + window.open(TEMP_VDIC_web_form_address, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + } + if (CalL_AutO_LauncH == 'WEBFORMTWO') + { + window.open(TEMP_VDIC_web_form_address_two, web_form_target, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=640,height=450'); + } + + if (useIE > 0) + { + var regCTC = new RegExp("^NONE","ig"); + if (CopY_tO_ClipboarD.match(regCTC)) + {var nothing=1;} + else + { + var tmp_clip = document.getElementById(CopY_tO_ClipboarD); + // alert_box("Copy to clipboard SETTING: |" + useIE + "|" + CopY_tO_ClipboarD + "|" + tmp_clip.value + "|"); + window.clipboardData.setData('Text', tmp_clip.value) + // alert_box("Copy to clipboard: |" + tmp_clip.value + "|" + CopY_tO_ClipboarD + "|"); + } + } + } + else + { + // do nothing + } + xmlhttprequestselectupdate = undefined; + delete xmlhttprequestselectupdate; + } + } + } + } + } + } + + // ################################################################################ // Insert the new manual dial as a lead and go to manual dial screen function NeWManuaLDiaLCalLSubmiT(tempDiaLnow) @@ -8930,6 +9318,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) function OpeNSearcHForMDisplaYBox() { var move_on=1; + if ( (AutoDialWaiting == 1) || (VD_live_customer_call==1) || (alt_dial_active==1) || (MD_channel_look==1) || (in_lead_preview_state==1) ) { if ((auto_pause_precall == 'Y') && ( (agent_pause_codes_active=='Y') || (agent_pause_codes_active=='FORCE') ) && (AutoDialWaiting == 1) && (VD_live_customer_call!=1) && (alt_dial_active!=1) && (MD_channel_look!=1) && (in_lead_preview_state!=1) ) @@ -8937,16 +9326,34 @@ function set_length(SLnumber,SLlength_goal,SLdirection) agent_log_id = AutoDial_ReSume_PauSe("VDADpause",'','','','','1',auto_pause_precall_code); } else + { + if ( (inOUT=='IN') && ( (agent_lead_search=='LIVE_CALL_INBOUND') || (agent_lead_search=='LIVE_CALL_INBOUND_AND_MANUAL') ) ) + { + // set phone number in search box to number of live inbound call + document.vicidial_form.search_phone_number.value=document.vicidial_form.phone_number.value; + inbound_lead_search=1; + } + else + { + move_on=0; + alert_box("YOU MUST BE PAUSED TO SEARCH FOR A LEAD"); + } + } + } + else + { + if (agent_lead_search=='LIVE_CALL_INBOUND') { move_on=0; - alert_box("YOU MUST BE PAUSED TO SEARCH FOR A LEAD"); + alert_box("YOU MUST BE ON AN ACTIVE INBOUND CALL TO SEARCH FOR A LEAD"); } } if (move_on == 1) { HidEGenDerPulldown(); showDiv('SearcHForMDisplaYBox'); - WaitingForNextStep=1; + if ( (VD_live_customer_call!=1) || (inOUT=='OUT') ) + {WaitingForNextStep=1;} } } @@ -9357,6 +9764,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.MDLeadID.value = ''; document.vicidial_form.MDType.value = ''; document.vicidial_form.MDPhonENumbeRHiddeN.value = ''; + inbound_lead_search=0; if (post_phone_time_diff_alert_message.length > 10) { @@ -11314,7 +11722,7 @@ function phone_number_format(formatphone) { // ################################################################################ // View Customer lead information - function VieWLeaDInfO(VLI_lead_id,VLI_cb_id) + function VieWLeaDInfO(VLI_lead_id,VLI_cb_id,VLI_inbound_lead_search) { showDiv('LeaDInfOBox'); @@ -11339,7 +11747,7 @@ function phone_number_format(formatphone) { } if (xmlhttp) { - RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=LEADINFOview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&lead_id=" + VLI_lead_id + "&disable_alter_custphone=" + disable_alter_custphone + "&campaign=" + campaign + "&callback_id=" + VLI_cb_id + "&stage="; + RAview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=LEADINFOview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&lead_id=" + VLI_lead_id + "&disable_alter_custphone=" + disable_alter_custphone + "&campaign=" + campaign + "&callback_id=" + VLI_cb_id + "&inbound_lead_search=" + VLI_inbound_lead_search + "&stage="; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(RAview_query); @@ -11486,7 +11894,7 @@ function phone_number_format(formatphone) { // Gather and display lead search data function LeadSearchSubmit() { - if ( (AutoDialWaiting == 1) || (VD_live_customer_call==1) || (alt_dial_active==1) || (MD_channel_look==1) || (in_lead_preview_state==1) ) + if ( ( (AutoDialWaiting == 1) || (VD_live_customer_call==1) || (alt_dial_active==1) || (MD_channel_look==1) || (in_lead_preview_state==1) ) && (inbound_lead_search < 1) ) { alert_box("YOU MUST BE PAUSED TO SEARCH FOR A LEAD"); } @@ -11525,7 +11933,7 @@ function phone_number_format(formatphone) { } if (xmlhttp) { - LSview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=SEARCHRESULTSview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&phone_number=" + document.vicidial_form.search_phone_number.value + "&lead_id=" + document.vicidial_form.search_lead_id.value + "&vendor_lead_code=" + document.vicidial_form.search_vendor_lead_code.value + "&first_name=" + document.vicidial_form.search_first_name.value + "&last_name=" + document.vicidial_form.search_last_name.value + "&city=" + document.vicidial_form.search_city.value + "&state=" + document.vicidial_form.search_state.value + "&postal_code=" + document.vicidial_form.search_postal_code.value + "&search=" + phone_search_fields + "&campaign=" + campaign + "&stage="; + LSview_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=SEARCHRESULTSview&format=text&user=" + user + "&pass=" + pass + "&conf_exten=" + session_id + "&extension=" + extension + "&protocol=" + protocol + "&phone_number=" + document.vicidial_form.search_phone_number.value + "&lead_id=" + document.vicidial_form.search_lead_id.value + "&vendor_lead_code=" + document.vicidial_form.search_vendor_lead_code.value + "&first_name=" + document.vicidial_form.search_first_name.value + "&last_name=" + document.vicidial_form.search_last_name.value + "&city=" + document.vicidial_form.search_city.value + "&state=" + document.vicidial_form.search_state.value + "&postal_code=" + document.vicidial_form.search_postal_code.value + "&search=" + phone_search_fields + "&campaign=" + campaign + "&inbound_lead_search=" + inbound_lead_search + "&stage="; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(LSview_query); @@ -13204,7 +13612,7 @@ $zi=2; Customer Information:         LEAD SEARCH
";} ?> diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index ef1304e9..bace2d2d 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -3206,12 +3206,13 @@ else # 121129-2319 - Added enhanced_disconnect_logging option # 121130-1425 - Fixed user group permissions issue with allowed campaigns modifications of user groups # 121205-1619 - Added parentheses around filter SQL when in SQL queries +# 121206-0630 - Added inbound lead search feature # # 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.6-388a'; -$build = '121205-1619'; +$admin_version = '2.6-389a'; +$build = '121206-0630'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -4537,7 +4538,7 @@ if ($ADD==99999)

- Agent Lead Search Override - This setting will override whatever the campaign has set for Agent Lead Search. NOT_ACTIVE will use the campaign setting. ENABLED will allow lead searching and DISABLED will not allow lead searching. Default is NOT_ACTIVE. + Agent Lead Search Override - This setting will override whatever the campaign has set for Agent Lead Search. NOT_ACTIVE will use the campaign setting. ENABLED will allow lead searching and DISABLED will not allow lead searching. Default is NOT_ACTIVE. LIVE_CALL_INBOUND will allow search for a lead while on an inbound call only. LIVE_CALL_INBOUND_AND_MANUAL will allow search for a lead while on an inbound call or while paused. When Lead Search is used on a live inbound call, the lead of the call when it went to the agent will be changed to a status of LSMERG, and the logs for the call will be modified to link to the agent selected lead instead.
@@ -5388,7 +5389,7 @@ if ($ADD==99999)

- Agent Lead Search - Setting this option to ENABLED will allow agents to search for leads and view lead information while paused in the agent interface. Also, if the Agent User Group is allowed to view Call Logs then the agent will be able to view past call notes for any lead that they are viewing information on. Default is DISABLED. + Agent Lead Search - Setting this option to ENABLED will allow agents to search for leads and view lead information while paused in the agent interface. Also, if the Agent User Group is allowed to view Call Logs then the agent will be able to view past call notes for any lead that they are viewing information on. Default is DISABLED. LIVE_CALL_INBOUND will allow search for a lead while on an inbound call only. LIVE_CALL_INBOUND_AND_MANUAL will allow search for a lead while on an inbound call or while paused. When Lead Search is used on a live inbound call, the lead of the call when it went to the agent will be changed to a status of LSMERG, and the logs for the call will be modified to link to the agent selected lead instead.
@@ -6105,7 +6106,7 @@ if ($ADD==99999)

- Action Transfer CID - Used for Drop, After-hours and No-agent-no-queue actions. This is the caller ID number that the call uses before it is transferred to extensions, messages, voicemail or call menus. You can use CUSTOMER in this field to use the customer phone number, or CAMPAIGN to use the first allowed campaign caller id number. Default is CUSTOMER. + Action Transfer CID - Used for Drop, After-hours and No-agent-no-queue actions. This is the caller ID number that the call uses before it is transferred to extensions, messages, voicemail or call menus. You can use CUSTOMER in this field to use the customer phone number, or CAMPAIGN to use the first allowed campaign caller id number. Default is CUSTOMER. If this is a call that will go to a Call Menu and then back to an in-group, we suggest you use CUSTOMERCLOSER in this field, and also you need to set the In-Group Search Method in the Call Menu to CLOSER.
@@ -20720,7 +20721,7 @@ if ($ADD==3) echo "Agent Shift Enforcement Override: $NWB#vicidial_users-agent_shift_enforcement_override$NWE\n"; echo "Agent Call Log View Override: $NWB#vicidial_users-agent_call_log_view_override$NWE\n"; - echo "Agent Lead Search Override: $NWB#vicidial_users-agent_lead_search_override$NWE\n"; + echo "Agent Lead Search Override: $NWB#vicidial_users-agent_lead_search_override$NWE\n"; echo "Alert Enabled: $alert_enabled $NWB#vicidial_users-alert_enabled$NWE\n"; @@ -21880,7 +21881,7 @@ if ($ADD==31) echo "Call Notes Per Call: $NWB#vicidial_campaigns-per_call_notes$NWE\n"; - echo "Agent Lead Search: $NWB#vicidial_campaigns-agent_lead_search$NWE\n"; + echo "Agent Lead Search: $NWB#vicidial_campaigns-agent_lead_search$NWE\n"; echo "Agent Lead Search Method: $NWB#vicidial_campaigns-agent_lead_search_method$NWE\n";