From 397ad60e370bf47f0e45af82506caad0c9a7b87c Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 27 Mar 2018 18:14:03 +0000 Subject: [PATCH] Added code for LOCALFQDN conversion to browser-used server URL for webform and script iframes git-svn-id: svn://192.168.202.10@2952 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 3 +++ docs/CALL_URL_FEATURES.txt | 18 ++++++++++++++++++ www/agc/functions.php | 9 +++++++++ www/agc/vdc_script_display.php | 11 ++++++++++- www/agc/vicidial.php | 17 ++++++++++++++--- 5 files changed, 54 insertions(+), 4 deletions(-) diff --git a/UPGRADE b/UPGRADE index 017f23ae..d6bca1fe 100644 --- a/UPGRADE +++ b/UPGRADE @@ -288,6 +288,9 @@ OTHER CHANGES: 76. Added "Admin Lead Source ID Display" System Settings option to allow Modify Lead page modification of Source ID field, and display in hopper list. +77. Added LOCALFQDN trigger for webforms and script Iframes to allow for use of + absolute URLs on multi-home networks. See CALL_URL_FEATURES.txt doc. + diff --git a/docs/CALL_URL_FEATURES.txt b/docs/CALL_URL_FEATURES.txt index 1a76388f..aea6ec27 100644 --- a/docs/CALL_URL_FEATURES.txt +++ b/docs/CALL_URL_FEATURES.txt @@ -14,12 +14,26 @@ the variable names that you want to use --A--phone_number--B-- just like in the SCRIPTS tab section. If you want to use custom fields in a web form address, you need to add &CF_uses_custom_fields=Y as part of your URL. +For multi-home networks where the agents may have more than one restricted path +to the webserver, you can use the "LOCALFQDN" variable as part of the webform +URL to grab the server that the agent used to get to the agent screen and use +that as the server in the URL. So, if you have http://LOCALFQDN/agc/test.php as +the webform URL, and one agent goes to http://10.0.0.2/agc/vicidial.php to log +in to the agent screen, then the agent screen will change that webform link to +http://10.0.0.2/agc/test.php. If another agent, on a different network segment, +has to log in to the same server using http://10.0.1.2:8080/agc/vicidial.php, +then that agent will have the same webform URL changed to +http://10.0.1.2:8080/agc/test.php. This allows you to still use absolute links +in both webforms and script IFRAMES to avoid issues with using relative links. + + Start Call URL - This web URL address is not seen by the agent, but it is called every time a call is sent to an agent if it is populated. Uses the same variables as the web form fields and scripts. This URL can NOT be a relative path. The Start URL does not work for Manual dial calls. Default is blank. + Dispo Call URL - This web URL address is not seen by the agent, but it is called every time a call is dispositioned by an agent if it is populated. Uses the same variables as the web form fields and scripts. @@ -31,6 +45,7 @@ agent, and callback_datetime is the agent selected date and time for a callback. The actual talk time in seconds of the call is talk_time. This URL can NOT be a relative path. It is always called from the webserver. Default is blank. + Add Lead URL - This web URL address is not seen by the agent, but it is called every time a lead is added to the system through the inbound process. Default is blank. You must begin this URL with VAR if you want to use variables, and of @@ -40,6 +55,7 @@ lead_id, vendor_lead_code, list_id, phone_number, phone_code, did_id, did_extension, did_pattern, did_description, uniqueid, call_id. This feature is only available for In-Groups. + No Agent Call URL - This is similar to Dispo Call URL, but it is for calls that are not sent to agents such as DROPs, No Answers, Busys and timeouts. This option is available for Campaigns and In-Groups. This feature will only work for @@ -47,9 +63,11 @@ auto-dial and inbound calls, not manual dial calls. For inbound calls, the specific in-group that a call was sent to needs to have the No Agent Call URL field filled in or this function will not run for that call. + CRM Popup Login - If set to Y, the CRM Popup Address is used to open a new window on agent login to this campaign. Default is N. + CRM Popup Address - The web address of a CRM login page, it can have variables populated just like the web form address, with the VAR in the front and using --A--user_custom_one--B-- to define variables. diff --git a/www/agc/functions.php b/www/agc/functions.php index 1eea1299..11f1bde9 100644 --- a/www/agc/functions.php +++ b/www/agc/functions.php @@ -44,6 +44,7 @@ # 171116-2333 - Added code for duplicate custom fields # 171129-0812 - Fixed issue with duplicate custom fields # 180319-1339 - Added entry_date as custom field SCRIPT type variable +# 180327-1357 - Added code for LOCALFQDN conversion to browser-used server URL script iframes # # $mysql_queries = 26 @@ -323,6 +324,13 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i $TODAY = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); + $server_name = getenv("SERVER_NAME"); + $server_port = getenv("SERVER_PORT"); + $CL=':'; + if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} + else {$server_port = "$CL$server_port";} + $FQDN = "$server_name$server_port"; + $vicidial_list_fields = '|lead_id|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|'; $custom_required_fields='|'; $custom_required_fields_check='|'; @@ -1216,6 +1224,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB,$call_i $CFoutput = preg_replace('/--A--list_description--B--/i',"$list_description",$CFoutput); $CFoutput = preg_replace('/--A--TABLEper_call_notes--B--/i',"$NOTESout",$CFoutput); + $CFoutput = preg_replace("/LOCALFQDN/",$FQDN,$CFoutput); # custom fields replacement $o=0; diff --git a/www/agc/vdc_script_display.php b/www/agc/vdc_script_display.php index 8eb80d91..3480ba98 100644 --- a/www/agc/vdc_script_display.php +++ b/www/agc/vdc_script_display.php @@ -38,9 +38,10 @@ # 171006-2055 - Added inbound_list_script_override option # 171126-1124 - Added email message display from inbound emails only # 180224-1406 - Added LOGINvar variables, and options.php $INSERT_ variables +# 180327-1356 - Added code for LOCALFQDN conversion to browser-used server URL for script iframes # -$version = '2.14-32'; +$version = '2.14-33'; $build = '180224-1406'; require_once("dbconnect_mysqli.php"); @@ -270,6 +271,13 @@ $agents='@agents'; $script_height = ($script_height - 20); $full_script_height = ($script_height + 200); +$server_name = getenv("SERVER_NAME"); +$server_port = getenv("SERVER_PORT"); +$CL=':'; +if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} +else {$server_port = "$CL$server_port";} +$FQDN = "$server_name$server_port"; + $IFRAME=0; $IFRAMEencode=1; @@ -693,6 +701,7 @@ $script_text = preg_replace('/--A--LOGINvarTHREE--B--/i',"$LOGINvarTHREE",$scrip $script_text = preg_replace('/--A--LOGINvarFOUR--B--/i',"$LOGINvarFOUR",$script_text); $script_text = preg_replace('/--A--LOGINvarFIVE--B--/i',"$LOGINvarFIVE",$script_text); $script_text = preg_replace('/--A--web_vars--B--/i',"$web_vars",$script_text); +$script_text = preg_replace("/LOCALFQDN/",$FQDN,$script_text); if ($CF_uses_custom_fields=='Y') { diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 4a3acc43..8c061f13 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -588,10 +588,11 @@ # 180306-1717 - Added script_top_dispo feature # 180314-2222 - Fix for lead search screen hidden fields, issue #1079 # 180323-2228 - Added more logging for notices +# 180327-1355 - Added code for LOCALFQDN conversion to browser-used server URL for webform and script iframes # -$version = '2.14-558c'; -$build = '180323-2228'; +$version = '2.14-559c'; +$build = '180327-1355'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=87; $one_mysql_log=0; @@ -899,7 +900,6 @@ if ( ($SSweb_logo!='default_new') and ($SSweb_logo!='default_old') ) $hide_gender=0; $US='_'; -$CL=':'; $AT='@'; $DS='-'; $date = date("r"); @@ -909,10 +909,14 @@ $browser=preg_replace("/\'|\"|\\\\/","",$browser); $script_name = getenv("SCRIPT_NAME"); $server_name = getenv("SERVER_NAME"); $server_port = getenv("SERVER_PORT"); +$CL=':'; if (preg_match("/443/i",$server_port)) {$HTTPprotocol = 'https://';} else {$HTTPprotocol = 'http://';} if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} else {$server_port = "$CL$server_port";} +$FQDN = "$server_name$server_port"; +$chat_URL = preg_replace("/LOCALFQDN/",$FQDN,$chat_URL); +$agent_push_url = preg_replace("/LOCALFQDN/",$FQDN,$agent_push_url); $agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; $agcDIR = preg_replace('/vicidial\.php/i','',$agcPAGE); $agcDIR = preg_replace("/$SSagent_script/i",'',$agcDIR); @@ -923,6 +927,8 @@ if (strlen($VUselected_language) < 1) $vdc_form_display = 'vdc_form_display.php'; if (preg_match("/cf_encrypt/",$active_modules)) {$vdc_form_display = 'vdc_form_display_encrypt.php';} + + header ("Content-type: text/html; charset=utf-8"); header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 @@ -3349,6 +3355,7 @@ else if ($webphone_debug == 'Y') {$webphone_options .= "--DEBUG";} if (strlen($web_socket_url) > 5) {$webphone_options .= "--WEBSOCKETURL$web_socket_url";} if (strlen($webphone_layout) > 0) {$webphone_options .= "--WEBPHONELAYOUT$webphone_layout";} + $webphone_url = preg_replace("/LOCALFQDN/",$FQDN,$webphone_url); ### base64 encode variables $b64_phone_login = base64_encode($extension); @@ -4162,6 +4169,7 @@ $CCAL_OUT .= ""; var filedate = ''; var agcDIR = ''; var agcPAGE = ''; + var FQDN = ''; var extension = ''; var extension_xfer = ''; var dialplan_number = ''; @@ -4386,6 +4394,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var adfREGrank = new RegExp("rank","g"); var adfREGowner = new RegExp("owner","g"); var adfREGlast_local_call_time = new RegExp("last_local_call_time","g"); + var regLOCALFQDN = new RegExp("LOCALFQDN","g"); var DispO3waychannel = ''; var DispO3wayXtrAchannel = ''; var DispO3wayCalLserverip = ''; @@ -15634,6 +15643,7 @@ else var regWFAencode = new RegExp("^VAR","ig"); encoded = encoded.replace(regWFAencode, ''); + encoded = encoded.replace(regLOCALFQDN, FQDN); decoded=encoded; // simple no ? decoded = decoded.replace(RGnl, '+'); @@ -17342,6 +17352,7 @@ function phone_number_format(formatphone) { var regWFAcustom = new RegExp("^VAR","ig"); var TEMP_crm_login_address = URLDecode(crm_login_address,'YES'); TEMP_crm_login_address = TEMP_crm_login_address.replace(regWFAcustom, ''); + TEMP_crm_login_address = TEMP_crm_login_address.replace(regLOCALFQDN, FQDN); var CRMwin = 'CRMwin'; CRMwin = window.open(TEMP_crm_login_address, CRMwin,'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=700,height=480');