diff --git a/UPGRADE b/UPGRADE index a7669ef9..eedfb391 100644 --- a/UPGRADE +++ b/UPGRADE @@ -156,6 +156,9 @@ OTHER CHANGES: 36. Added utility in CallCard section to generate new card IDs and view by Run. +37. Added Agent API functions for Send DTMF, Park Customer and the Transfer + Conference functions as well + diff --git a/docs/AGENT_API.txt b/docs/AGENT_API.txt index d349745d..a5db7dca 100644 --- a/docs/AGENT_API.txt +++ b/docs/AGENT_API.txt @@ -22,6 +22,9 @@ set_timer_action - sets timer action for the current call the agent is on st_login_log - looks up the vicidial_users.custom_three field and logs event from CRM st_get_agent_active_lead - looks up active lead info for an agent and outputs lead information ra_call_control - remote agent call control: hangup/transfer calls being handled by remote agents +send_dtmf - sends dtmf signal string to agent's session +transfer_conference - sends several commands related to the agent transfer-conf frame +park_call - sends command to park customer or grab customer from park New scripts: @@ -445,6 +448,107 @@ SUCCESS: ra_call_control hungup - 6666|Y0315201639000402027|HANGUP +-------------------------------------------------------------------------------- +send_dtmf - + +DESCRIPTION: +Sends dtmf signal string to agent's session + +VALUES: (value) +only valid DTMF characters with these replacements: + P = # (pound or hash) + S = * (star) + Q = (one second of silence) + +EXAMPLE URLS: +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=send_dtmf&value=QQQQ1234SQQQQQ6654P + +RESPONSES: +ERROR: send_dtmf not valid - QQ|6666 +ERROR: no user found - 6666 +ERROR: agent_user is not logged in - 6666 +SUCCESS: send_dtmf function set - QQQQ1234SQQQQQ6654P|6666 + + + +-------------------------------------------------------------------------------- +park_call - + +DESCRIPTION: +sends command to park customer or grab customer out of park + +VALUES: + value - + REQUIRED, choices are below + PARK_CUSTOMER - send customer to the park extension as defined in the campaign the agent is logged into + GRAB_CUSTOMER - grab customer from the park extension and send them to the agent session + +EXAMPLE URLS: +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=park_call&value=PARK_CUSTOMER +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=park_call&value=GRAB_CUSTOMER + +RESPONSES: +ERROR: park_call not valid - PARK_CUSTOMER|6666 +ERROR: no user found - 6666 +ERROR: agent_user is not logged in - 6666 +ERROR: agent_user does not have a lead on their screen - 6666 +SUCCESS: park_call function set - PARK_CUSTOMER|6666 + + + +-------------------------------------------------------------------------------- +transfer_conference - + +DESCRIPTION: +sends several commands related to the agent transfer-conf frame + +VALUES: + value - + REQUIRED, choices are below + HANGUP_XFER - hangup the third party line + HANGUP_BOTH - hangup customer and third party line + BLIND_TRANSFER - send a call to a defined phone number + LEAVE_VM - blind transfer customer to the campaign-defined voicemail message + LOCAL_CLOSER - send call to another ViciDial agent, must have in-group, optional phone_number field for AGENTDIRECT agent + DIAL_WITH_CUSTOMER - 3-way call with customer on the line + PARK_CUSTOMER_DIAL - send customer to park and place a call to a third party + LEAVE_3WAY_CALL - leave customer and third party in conference and go to the disposition screen + phone_number - + OPTIONAL/REQUIRED, required for any transfer or dial value + ingroup_choices - + OPTIONAL/REQUIRED, required for local_closer and consultative transfers, must be a single active in-group, reserved option of "DEFAULTINGROUP" can be used to select the default in-group for the in-group or campaign that the call originated from + consultative - + OPTIONAL, when you want to do a consultative transfer with your customer and another ViciDial agent, 'YES' and 'NO' are valid options, you can only use this with DIAL_WITH_CUSTOMER or PARK_CUSTOMER_DIAL + dial_override - + OPTIONAL, dials exactly the phone number specified with no campaign-defined phone code or prefix + +EXAMPLE URLS: +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=HANGUP_XFER +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=HANGUP_BOTH +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=BLIND_TRANSFER&phone_number=8500 +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=LEAVE_VM +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=LOCAL_CLOSER&ingroup_choices=DEFAULTINGROUP +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=LOCAL_CLOSER&ingroup_choices=AGENTDIRECT&phone_number=6666 +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=LOCAL_CLOSER&ingroup_choices=SALESLINE +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=DIAL_WITH_CUSTOMER&ingroup_choices=TEST_IN3&consultative=YES +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=DIAL_WITH_CUSTOMER&phone_number=8500 +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=DIAL_WITH_CUSTOMER&phone_number=919998888112&dial_override=YES +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=PARK_CUSTOMER_DIAL&ingroup_choices=TEST_IN3&consultative=YES +http://server/agc/api.php?source=test&user=6666&pass=1234&agent_user=1000&function=transfer_conference&value=LEAVE_3WAY_CALL + +RESPONSES: +ERROR: transfer_conference not valid - QQ|6666 +ERROR: value is not valid - XYZFUNCTION|6666 +ERROR: no user found - 6666 +ERROR: ingroup is not valid - XYZINGROUP +ERROR: agent_user is not logged in - 6666 +ERROR: agent_user does not have a live call - 6666 +SUCCESS: transfer_conference function set - LOCAL_CLOSER|SALESLINE||YES|6666 + + + + + @@ -459,16 +563,6 @@ update vicidial_live_agents set external_hangup=1 where user='1000'; update vicidial_live_agents set external_status='A' where user='1000'; -Database changes: (these are already in the system, DO NOT RUN THEM) -ALTER TABLE vicidial_live_agents ADD external_hangup VARCHAR(1) default ''; -ALTER TABLE vicidial_live_agents ADD external_status VARCHAR(6) default ''; -ALTER TABLE vicidial_live_agents ADD external_pause VARCHAR(20) default ''; -ALTER TABLE vicidial_live_agents ADD external_dial VARCHAR(100) default ''; - -ALTER TABLE vicidial_users ADD vdc_agent_api_access ENUM('0','1') default '0'; - -ALTER TABLE system_settings ADD vdc_agent_api_active ENUM('0','1') default '0'; - CREATE TABLE vicidial_api_log ( api_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, user VARCHAR(20) NOT NULL, diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index e1f7a116..b7f253a0 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -373,6 +373,9 @@ outbound_autodial ENUM('Y','N') default 'N', manager_ingroup_set ENUM('Y','N','SET') default 'N', ra_user VARCHAR(20) default '', ra_extension VARCHAR(100) default '', +external_dtmf VARCHAR(100) default '', +external_transferconf VARCHAR(100) default '', +external_park VARCHAR(40) default '', index (random_id), index (last_call_time), index (last_update_time), @@ -2245,7 +2248,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log; -UPDATE system_settings SET db_schema_version='1224',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1225',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 aa372848..ac767e8b 100644 --- a/extras/upgrade_2.4.sql +++ b/extras/upgrade_2.4.sql @@ -349,3 +349,9 @@ ALTER table vicidial_inbound_groups ADD onhold_prompt_no_block ENUM('N','Y') def ALTER table vicidial_inbound_groups ADD onhold_prompt_seconds SMALLINT(5) default '10'; UPDATE system_settings SET db_schema_version='1224',db_schema_update_date=NOW(); + +ALTER TABLE vicidial_live_agents ADD external_dtmf VARCHAR(100) default ''; +ALTER TABLE vicidial_live_agents ADD external_transferconf VARCHAR(100) default ''; +ALTER TABLE vicidial_live_agents ADD external_park VARCHAR(40) default ''; + +UPDATE system_settings SET db_schema_version='1225',db_schema_update_date=NOW(); diff --git a/www/agc/api.php b/www/agc/api.php index dd1290eb..9517a55f 100644 --- a/www/agc/api.php +++ b/www/agc/api.php @@ -10,7 +10,7 @@ # - $user # - $pass # - $agent_user -# - $function - ('external_hangup','external_status','external_pause','external_dial','change_ingroups') +# - $function - ('external_hangup','external_status','external_pause','external_dial','change_ingroups',...) # - $value # - $vendor_id # - $focus @@ -47,10 +47,11 @@ # 100315-2021 - Added ra_call_control function # 100318-0605 - Added close_window_link and language options # 100401-2357 - Added external_add_lead function (contributed by aouyar) +# 100527-0926 - Added send_dtmf, transfer_conference and park_call functions # -$version = '2.4-14'; -$build = '100401-2357'; +$version = '2.4-15'; +$build = '100527-0926'; require("dbconnect.php"); @@ -157,6 +158,10 @@ if (isset($_GET["dnc_check"])) {$dnc_check=$_GET["dnc_check"];} elseif (isset($_POST["dnc_check"])) {$dnc_check=$_POST["dnc_check"];} if (isset($_GET["campaign_dnc_check"])) {$campaign_dnc_check=$_GET["campaign_dnc_check"];} elseif (isset($_POST["campaign_dnc_check"])) {$campaign_dnc_check=$_POST["campaign_dnc_check"];} +if (isset($_GET["dial_override"])) {$dial_override=$_GET["dial_override"];} + elseif (isset($_POST["dial_override"])) {$dial_override=$_POST["dial_override"];} +if (isset($_GET["consultative"])) {$consultative=$_GET["consultative"];} + elseif (isset($_POST["consultative"])) {$consultative=$_POST["consultative"];} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} @@ -228,6 +233,8 @@ if ($non_latin < 1) $vendor_lead_code = ereg_replace("[^ -\.\_0-9a-zA-Z]","",$vendor_lead_code); $rank = ereg_replace("[^-0-9]","",$rank); $owner = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$owner); + $dial_override = ereg_replace("[^A-Z]","",$dial_override); + $consultative = ereg_replace("[^A-Z]","",$consultative); } else { @@ -248,6 +255,7 @@ $ENTRYdate = date("YmdHis"); $MT[0]=''; $api_script = 'agent'; $api_logging = 1; +if ($consultative != 'YES') {$consultative='NO';} ################################################################################ @@ -1953,6 +1961,338 @@ if ($function == 'ra_call_control') + +################################################################################ +### BEGIN - send_dtmf - send dtmf signals +################################################################################ +if ($function == 'send_dtmf') + { + if ( (strlen($value)<1) or ( (strlen($agent_user)<1) and (strlen($alt_user)<2) ) ) + { + $result = 'ERROR'; + $result_reason = "send_dtmf not valid"; + echo "$result: $result_reason - $value|$agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + else + { + if (strlen($alt_user)>1) + { + $stmt = "select count(*) from vicidial_users where custom_three='$alt_user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "select user from vicidial_users where custom_three='$alt_user' order by user;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $agent_user = $row[0]; + } + else + { + $result = 'ERROR'; + $result_reason = "no user found"; + echo "$result: $result_reason - $alt_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + $stmt = "select count(*) from vicidial_live_agents where user='$agent_user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt="UPDATE vicidial_live_agents set external_dtmf='$value' where user='$agent_user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $result = 'SUCCESS'; + $result_reason = "send_dtmf function set"; + echo "$result: $result_reason - $value|$agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + else + { + $result = 'ERROR'; + $result_reason = "agent_user is not logged in"; + echo "$result: $result_reason - $agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + } +################################################################################ +### END - send_dtmf +################################################################################ + + + + + +################################################################################ +### BEGIN - park_call - send customer to park or pick up customer from park +################################################################################ +if ($function == 'park_call') + { + if ( (strlen($value)<10) or ( (strlen($agent_user)<1) and (strlen($alt_user)<2) ) ) + { + $result = 'ERROR'; + $result_reason = "park_call not valid"; + echo "$result: $result_reason - $value|$agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + else + { + if (strlen($alt_user)>1) + { + $stmt = "select count(*) from vicidial_users where custom_three='$alt_user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "select user from vicidial_users where custom_three='$alt_user' order by user;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $agent_user = $row[0]; + } + else + { + $result = 'ERROR'; + $result_reason = "no user found"; + echo "$result: $result_reason - $alt_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + $stmt = "select count(*) from vicidial_live_agents where user='$agent_user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "select lead_id from vicidial_live_agents where user='$agent_user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $lead_id = $row[0]; + if ($lead_id > 0) + { + $stmt="UPDATE vicidial_live_agents set external_park='$value' where user='$agent_user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $result = 'SUCCESS'; + $result_reason = "park_call function set"; + echo "$result: $result_reason - $value|$agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + else + { + $result = 'ERROR'; + $result_reason = "agent_user does not have a lead on their screen"; + echo "$result: $result_reason - $agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + else + { + $result = 'ERROR'; + $result_reason = "agent_user is not logged in"; + echo "$result: $result_reason - $agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + } +################################################################################ +### END - park_call +################################################################################ + + + + + +################################################################################ +### BEGIN - transfer_conference - send several different functions for 3-way calling and transfers +################################################################################ +if ($function == 'transfer_conference') + { + if ( (strlen($value)<8) or ( (strlen($agent_user)<1) and (strlen($alt_user)<2) ) ) + { + $result = 'ERROR'; + $result_reason = "transfer_conference not valid"; + echo "$result: $result_reason - $value|$agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + else + { + $processed=0; + $SUCCESS=0; + if (strlen($alt_user)>1) + { + $stmt = "select count(*) from vicidial_users where custom_three='$alt_user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "select user from vicidial_users where custom_three='$alt_user' order by user;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $agent_user = $row[0]; + } + else + { + $result = 'ERROR'; + $result_reason = "no user found"; + echo "$result: $result_reason - $alt_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + $stmt = "select count(*) from vicidial_live_agents where user='$agent_user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + { + $stmt = "select lead_id,callerid from vicidial_live_agents where user='$agent_user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $lead_id = $row[0]; + $callerid = $row[1]; + if ( ($lead_id > 0) and (strlen($callerid)>15) ) + { + ### START In-group transfer or bridge ### + if ( ($value=='LOCAL_CLOSER') or ( ( ($value=='DIAL_WITH_CUSTOMER') or ($value=='PARK_CUSTOMER_DIAL') ) and ($consultative=='YES') ) ) + { + $processed++; + if (strlen($ingroup_choices) < 2) + { + $result = 'ERROR'; + $result_reason = "ingroup is not valid"; + echo "$result: $result_reason - $ingroup_choices\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + else + { + if (preg_match("/DEFAULTINGROUP/",$ingroup_choices)) + { + $stmt = "select campaign_id,call_type from vicidial_auto_calls where callerid='$callerid';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $campaign_id = $row[0]; + $call_type = $row[1]; + + if ($call_type=='IN') + { + $stmt = "select default_xfer_group from vicidial_inbound_groups where group_id='$campaign_id';"; + } + else + { + $stmt = "select default_xfer_group from vicidial_campaigns where campaign_id='$campaign_id';"; + } + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ingroup_choices = $row[0]; + } + + $stmt = "select count(*) from vicidial_inbound_groups where group_id='$ingroup_choices' and active='Y';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $ingroupactive = $row[0]; + + if ($ingroupactive < 1) + { + $result = 'ERROR'; + $result_reason = "ingroup is not valid"; + echo "$result: $result_reason - $ingroup_choices\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + else + { + $SUCCESS++; + + $external_transferconf = "$value---$ingroup_choices---$phone_number---$consultative---"; + } + } + } + ### END In-group transfer or bridge ### + + ### START other transfers ### + if ( ($processed < 1) and (($value=='BLIND_TRANSFER') or ($value=='LEAVE_VM') or ($value=='DIAL_WITH_CUSTOMER') or ($value=='PARK_CUSTOMER_DIAL')) ) + { + $processed++; + $external_transferconf = "$value------$phone_number---NO---$dial_override"; + $SUCCESS++; + } + + ### START hangups ### + if ( ($processed < 1) and ( ($value=='HANGUP_XFER') or ($value=='HANGUP_BOTH') ) ) + { + $processed++; + $external_transferconf = "$value---------NO---"; + $SUCCESS++; + } + + ### START leave-3way-call ### + if ( ($processed < 1) and ($value=='LEAVE_3WAY_CALL') ) + { + $processed++; + $external_transferconf = "$value---------NO---"; + $SUCCESS++; + } + + if ($processed < 1) + { + $result = 'ERROR'; + $result_reason = "value is not valid"; + echo "$result: $result_reason - $value|$user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + else + { + if ($SUCCESS > 0) + { + $stmt="UPDATE vicidial_live_agents set external_transferconf='$external_transferconf' where user='$agent_user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $result = 'SUCCESS'; + $result_reason = "transfer_conference function set"; + echo "$result: $result_reason - $value|$ingroup_choices|$phone_number|$consultative|$agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + } + else + { + $result = 'ERROR'; + $result_reason = "agent_user does not have a live call"; + echo "$result: $result_reason - $agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + else + { + $result = 'ERROR'; + $result_reason = "agent_user is not logged in"; + echo "$result: $result_reason - $agent_user\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + } +################################################################################ +### END - transfer_conference +################################################################################ + + + + + + ################################################################################ ### BEGIN - optional "close window" link ################################################################################ diff --git a/www/agc/conf_exten_check.php b/www/agc/conf_exten_check.php index 188363c9..811253af 100644 --- a/www/agc/conf_exten_check.php +++ b/www/agc/conf_exten_check.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to send whether the meetme conference has live channels connected and which they are # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -50,10 +50,11 @@ # 91130-2022 - Added code for manager override of in-group selection # 91228-1341 - Added API fields update functions # 100109-1337 - Fixed Manual dial live call detection +# 100527-0957 - Added send_dtmf, transfer_conference and park_call API functions # -$version = '2.2.0-25'; -$build = '100109-1337'; +$version = '2.4-26'; +$build = '100527-0957'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=32; $one_mysql_log=0; @@ -387,7 +388,7 @@ echo " } ### grab the API hangup and API dispo fields in vicidial_live_agents - $stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds,external_dtmf,external_transferconf,external_park from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);} @@ -401,6 +402,9 @@ echo " $timer_action = $row[6]; $timer_action_message = $row[7]; $timer_action_seconds = $row[8]; + $external_dtmf = $row[9]; + $external_transferconf = $row[10]; + $external_park = $row[11]; if (strlen($external_status)<1) {$external_status = '::::::::::';} @@ -570,7 +574,7 @@ echo " if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . "\n"; + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . "\n"; if (strlen($timer_action) > 3) { diff --git a/www/agc/manager_send.php b/www/agc/manager_send.php index f426266e..f9160b2c 100644 --- a/www/agc/manager_send.php +++ b/www/agc/manager_send.php @@ -1,5 +1,5 @@ LICENSE: AGPLv2 # @@ -12,7 +12,7 @@ # - $user # - $pass # optional variables: -# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') +# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','SysCIDdtmfOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectXtraCX','RedirectVD','HangupConfDial','VolumeControl','OriginateVDRelogin') # - $queryCID - ('CN012345678901234567',...) # - $format - ('text','debug') # - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...) @@ -97,10 +97,11 @@ # 91213-1208 - Added queue_position to queue_log COMPLETE... records # 100327-0846 - Fix for list_id override answering machine message # 100423-2304 - Added alertCID +# 100527-1014 - Added SysCIDdtmfOriginate function # -$version = '2.2.0-48'; -$build = '100423-2304'; +$version = '2.4-49'; +$build = '100527-1014'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=85; $one_mysql_log=0; @@ -294,6 +295,20 @@ if ($format=='debug') +###################### +# ACTION=SysCIDdtmfOriginate - prep the send dtmf command +###################### +if ($ACTION=="SysCIDdtmfOriginate") + { + $stmt="UPDATE vicidial_live_agents SET external_dtmf='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);} + + $ACTION="SysCIDOriginate"; + } + + ###################### # ACTION=SysCIDOriginate - insert Originate Manager statement allowing small CIDs for system calls @@ -771,6 +786,11 @@ if ($ACTION=="RedirectToPark") # fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n"); # fclose($fp); } + + $stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);} } if ($ACTION=="RedirectFromPark") @@ -795,6 +815,11 @@ if ($ACTION=="RedirectFromPark") if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02026',$user,$server_ip,$session_name,$one_mysql_log);} $ACTION="Redirect"; } + + $stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);} } if ($ACTION=="RedirectName") diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index e63e6b66..f44af924 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -5014,7 +5014,7 @@ if ($ACTION == 'updateDISPO') } ### reset the API fields in vicidial_live_agents record - $stmt = "UPDATE vicidial_live_agents set lead_id=0,external_hangup=0,external_status='',external_update_fields='0',external_update_fields_data='',external_timer_action_seconds='-1',last_state_change='$NOW_TIME' where user='$user' and server_ip='$server_ip';"; + $stmt = "UPDATE vicidial_live_agents set lead_id=0,external_hangup=0,external_status='',external_update_fields='0',external_update_fields_data='',external_timer_action_seconds='-1',external_dtmf='',external_transferconf='',external_park='',last_state_change='$NOW_TIME' 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,'00141',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7391,6 +7391,21 @@ if ($ACTION == 'DiaLableLeaDsCounT') } +################################################################################ +### Clear_API_Field - clears a single vicidial_live_agents field +################################################################################ +if ($ACTION == 'Clear_API_Field') + { + $stmt="UPDATE vicidial_live_agents SET $comments='' where user='$user';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + + echo "DONE: $comments"; + } + + + if ($format=='debug') diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 0865996e..edf47891 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -294,10 +294,11 @@ # 100428-0544 - Added uniqueid display option for PRESERVE # 100513-0714 - Added options.php option to hide the timeclock link # 100513-2337 - Changed user_login_first to attempt full login if phone_login/pass are filled in +# 100527-2212 - Added API send_dtmf, transfer_conference and park_call functions # -$version = '2.4-272'; -$build = '100513-2337'; +$version = '2.4-273'; +$build = '100527-2212'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=66; $one_mysql_log=0; @@ -2921,6 +2922,14 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var uniqueid_status_display=''; var uniqueid_status_prefix=''; var custom_call_id=''; + var api_dtmf=''; + var api_transferconf_function=''; + var api_transferconf_group=''; + var api_transferconf_number=''; + var api_transferconf_consultative=''; + var api_transferconf_override=''; + var api_parkcustomer=''; + var API_selected_xfergroup=''; var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; @@ -3269,16 +3278,19 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { var Ctasknum = tasknum_string.replace(regCXFvars, ''); if (Ctasknum.length < 2) - {Ctasknum = '990009';} + {Ctasknum = '90009';} var agentdirect = ''; } else { - Ctasknum = '990009'; + Ctasknum = '90009'; var agentdirect = tasknum_string; } var XfeRSelecT = document.getElementById("XfeRGrouP"); - tasknum = Ctasknum + "*" + XfeRSelecT.value + '*CXFER*' + document.vicidial_form.lead_id.value + '**' + dialed_number + '*' + user + '*' + agentdirect + '*' + VD_live_call_secondS + '*'; + var XfeR_GrouP = XfeRSelecT.value; + if (API_selected_xfergroup.length > 1) + {var XfeR_GrouP = API_selected_xfergroup;} + tasknum = Ctasknum + "*" + XfeR_GrouP + '*CXFER*' + document.vicidial_form.lead_id.value + '**' + dialed_number + '*' + user + '*' + agentdirect + '*' + VD_live_call_secondS + '*'; CustomerData_update(); } @@ -3441,7 +3453,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} if (xmlhttp) { var queryCID = dtmf_string; - VMCoriginate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=SysCIDOriginate&format=text&channel=" + dtmf_send_extension + "&queryCID=" + queryCID + "&exten=" + dtmf_silent_prefix + '' + conf_dtmf_room + "&ext_context=" + ext_context + "&ext_priority=1"; + VMCoriginate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=SysCIDdtmfOriginate&format=text&channel=" + dtmf_send_extension + "&queryCID=" + queryCID + "&exten=" + dtmf_silent_prefix + '' + conf_dtmf_room + "&ext_context=" + ext_context + "&ext_priority=1"; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(VMCoriginate_query); @@ -3600,6 +3612,80 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} api_timer_action_message = APITimerMessage_array[1]; var APITimerSeconds_array = check_time_array[19].split("APITimerSeconds: "); api_timer_action_seconds = APITimerSeconds_array[1]; + var APIdtmf_array = check_time_array[20].split("APIdtmf: "); + api_dtmf = APIdtmf_array[1]; + var APItransfercond_array = check_time_array[21].split("APItransferconf: "); + var api_transferconf_values_array = APItransfercond_array[1].split("---"); + api_transferconf_function = api_transferconf_values_array[0]; + api_transferconf_group = api_transferconf_values_array[1]; + api_transferconf_number = api_transferconf_values_array[2]; + api_transferconf_consultative = api_transferconf_values_array[3]; + api_transferconf_override = api_transferconf_values_array[4]; + var APIpark_array = check_time_array[22].split("APIpark: "); + api_parkcustomer = APIpark_array[1]; + + if (api_transferconf_function.length > 0) + { + if (api_transferconf_function == 'HANGUP_XFER') + {xfercall_send_hangup();} + if (api_transferconf_function == 'HANGUP_BOTH') + {bothcall_send_hangup();} + if (api_transferconf_function == 'LEAVE_VM') + {mainxfer_send_redirect('XfeRVMAIL',lastcustchannel,lastcustserverip);} + if (api_transferconf_function == 'LEAVE_3WAY_CALL') + {leave_3way_call('FIRST');} + if (api_transferconf_function == 'BLIND_TRANSFER') + { + document.vicidial_form.xfernumber.value = api_transferconf_number; + mainxfer_send_redirect('XfeRBLIND',lastcustchannel,lastcustserverip); + } + if (api_transferconf_function == 'LOCAL_CLOSER') + { + API_selected_xfergroup = api_transferconf_group; + document.vicidial_form.xfernumber.value = api_transferconf_number; + mainxfer_send_redirect('XfeRLOCAL',lastcustchannel,lastcustserverip); + } + if (api_transferconf_function == 'DIAL_WITH_CUSTOMER') + { + if (api_transferconf_consultative=='YES') + {document.vicidial_form.consultativexfer.checked=true;} + if (api_transferconf_consultative=='NO') + {document.vicidial_form.consultativexfer.checked=false;} + if (api_transferconf_override=='YES') + {document.vicidial_form.xferoverride.checked=true;} + API_selected_xfergroup = api_transferconf_group; + document.vicidial_form.xfernumber.value = api_transferconf_number; + SendManualDial('YES'); + } + if (api_transferconf_function == 'PARK_CUSTOMER_DIAL') + { + if (api_transferconf_consultative=='YES') + {document.vicidial_form.consultativexfer.checked=true;} + if (api_transferconf_consultative=='NO') + {document.vicidial_form.consultativexfer.checked=false;} + if (api_transferconf_override=='YES') + {document.vicidial_form.xferoverride.checked=true;} + API_selected_xfergroup = api_transferconf_group; + document.vicidial_form.xfernumber.value = api_transferconf_number; + xfer_park_dial(); + } + Clear_API_Field('external_transferconf'); + } + if (api_parkcustomer == 'PARK_CUSTOMER') + {mainxfer_send_redirect('ParK',lastcustchannel,lastcustserverip);} + if (api_parkcustomer == 'GRAB_CUSTOMER') + {mainxfer_send_redirect('FROMParK',lastcustchannel,lastcustserverip);} + if (api_dtmf.length > 0) + { + var REGdtmfPOUND = new RegExp("P","g"); + var REGdtmfSTAR = new RegExp("S","g"); + var REGdtmfQUIET = new RegExp("Q","g"); + api_dtmf = api_dtmf.replace(REGdtmfPOUND, '#'); + api_dtmf = api_dtmf.replace(REGdtmfSTAR, '*'); + api_dtmf = api_dtmf.replace(REGdtmfQUIET, ','); + document.vicidial_form.conf_dtmf.value = api_dtmf; + SendConfDTMF(session_id); + } if (api_timer_action.length > 2) { @@ -3607,7 +3693,6 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} timer_action_message = api_timer_action_message; timer_action_seconds = api_timer_action_seconds; } - if ( (APIHanguP==1) && (VD_live_customer_call==1) ) { hideDiv('CustomerGoneBox'); @@ -4112,9 +4197,13 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} CustomerData_update(); var XfeRSelecT = document.getElementById("XfeRGrouP"); + var XfeR_GrouP = XfeRSelecT.value; + if (API_selected_xfergroup.length > 1) + {var XfeR_GrouP = API_selected_xfergroup;} var queryCID = "XLvdcW" + epoch_sec + user_abb; // "90009*$group**$lead_id**$phone_number*$user*$agent_only*"; - var redirectdestination = closerxferinternal + '90009*' + XfeRSelecT.value + '**' + document.vicidial_form.lead_id.value + '**' + dialed_number + '*' + user + '*' + document.vicidial_form.xfernumber.value + '*'; + var redirectdestination = closerxferinternal + '90009*' + XfeR_GrouP + '**' + document.vicidial_form.lead_id.value + '**' + dialed_number + '*' + user + '*' + document.vicidial_form.xfernumber.value + '*'; + xferredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=RedirectVD&format=text&channel=" + redirectvalue + "&call_server_ip=" + redirectserverip + "&queryCID=" + queryCID + "&exten=" + redirectdestination + "&ext_context=" + ext_context + "&ext_priority=1&auto_dial_level=" + auto_dial_level + "&campaign=" + campaign + "&uniqueid=" + document.vicidial_form.uniqueid.value + "&lead_id=" + document.vicidial_form.lead_id.value + "&secondS=" + VD_live_call_secondS + "&session_id=" + session_id; } @@ -4145,6 +4234,9 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var redirectXTRAvalue = XDchannel; var redirecttype_test = document.vicidial_form.xfernumber.value; var XfeRSelecT = document.getElementById("XfeRGrouP"); + var XfeR_GrouP = XfeRSelecT.value; + if (API_selected_xfergroup.length > 1) + {var XfeR_GrouP = API_selected_xfergroup;} var regRXFvars = new RegExp("CXFER","g"); if ( ( (redirecttype_test.match(regRXFvars)) || (consultativexfer_checked > 0) ) && (local_consult_xfers > 0) ) {var redirecttype = 'RedirectXtraCXNeW';} @@ -4156,7 +4248,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} DispO3wayCalLxfernumber = document.vicidial_form.xfernumber.value; DispO3wayCalLcamptail = ''; - xferredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=" + redirecttype + "&format=text&channel=" + redirectvalue + "&call_server_ip=" + redirectserverip + "&queryCID=" + queryCID + "&exten=" + redirectdestination + "&ext_context=" + ext_context + "&ext_priority=1&extrachannel=" + redirectXTRAvalue + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&phone_number=" + document.vicidial_form.phone_number.value + "&filename=" + taskdebugnote + "&campaign=" + XfeRSelecT.value + "&session_id=" + session_id + "&agentchannel=" + agentchannel + "&protocol=" + protocol + "&extension=" + extension + "&auto_dial_level=" + auto_dial_level; + xferredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=" + redirecttype + "&format=text&channel=" + redirectvalue + "&call_server_ip=" + redirectserverip + "&queryCID=" + queryCID + "&exten=" + redirectdestination + "&ext_context=" + ext_context + "&ext_priority=1&extrachannel=" + redirectXTRAvalue + "&lead_id=" + document.vicidial_form.lead_id.value + "&phone_code=" + document.vicidial_form.phone_code.value + "&phone_number=" + document.vicidial_form.phone_number.value + "&filename=" + taskdebugnote + "&campaign=" + XfeR_GrouP + "&session_id=" + session_id + "&agentchannel=" + agentchannel + "&protocol=" + protocol + "&extension=" + extension + "&auto_dial_level=" + auto_dial_level; if (taskdebugnote == 'FIRST') { @@ -8334,6 +8426,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} uniqueid_status_display=''; uniqueid_status_prefix=''; custom_call_id=''; + API_selected_xfergroup=''; if (manual_dial_in_progress==1) { @@ -8914,6 +9007,47 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } +// ################################################################################ +// clear api field + function Clear_API_Field(temp_field) + { + var xmlhttp=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 { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (E) { + xmlhttp = false; + } + } + @end @*/ + if (!xmlhttp && typeof XMLHttpRequest!='undefined') + { + xmlhttp = new XMLHttpRequest(); + } + if (xmlhttp) + { + TERRupdate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Clear_API_Field&format=text&user=" + user + "&pass=" + pass + "&comments=" + temp_field; + xmlhttp.open('POST', 'vdc_db_query.php'); + xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); + xmlhttp.send(TERRupdate_query); + xmlhttp.onreadystatechange = function() + { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) + { + // alert(xmlhttp.responseText); + } + } + delete xmlhttp; + } + } + + // ################################################################################ // Log the user out of the system when they close their browser while logged in function BrowserCloseLogout()