2012-06-04 14:58:40 +00:00
<? php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
2024-09-05 16:10:04 -07:00
Portions created by the Initial Developer are Copyright (C) 2008-2024
2012-06-04 14:58:40 +00:00
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
2014-12-21 07:03:10 +00:00
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
2012-06-04 14:58:40 +00:00
*/
2016-10-05 03:44:55 -06:00
2022-10-10 16:35:14 -06:00
//includes files
2023-06-15 14:28:23 -03:00
require_once dirname ( __DIR__ , 2 ) . "/resources/require.php" ;
2016-10-05 03:44:55 -06:00
require_once "resources/check_auth.php" ;
//check permissions
if ( permission_exists ( 'call_center_agent_add' ) || permission_exists ( 'call_center_agent_edit' )) {
//access granted
}
else {
echo "access denied" ;
exit ;
}
2012-06-04 14:58:40 +00:00
2013-05-29 21:14:36 +00:00
//add multi-lingual support
2015-01-18 10:06:08 +00:00
$language = new text ;
$text = $language -> get ();
2013-05-29 21:14:36 +00:00
2024-10-07 13:07:03 -06:00
//connect to the database
$database = new database ;
2023-06-01 16:39:05 -06:00
//set the defaults
$agent_id = '' ;
$agent_name = '' ;
$agent_password = '' ;
2012-06-04 14:58:40 +00:00
//action add or update
2023-05-26 10:07:25 -06:00
if ( ! empty ( $_REQUEST [ "id" ]) && is_uuid ( $_REQUEST [ "id" ])) {
2012-06-04 14:58:40 +00:00
$action = "update" ;
2019-07-02 10:56:36 -06:00
$call_center_agent_uuid = $_REQUEST [ "id" ];
2012-06-04 14:58:40 +00:00
}
else {
$action = "add" ;
}
2024-10-07 13:07:03 -06:00
//get the users array
$sql = "select * from v_users " ;
$sql .= "where domain_uuid = :domain_uuid " ;
$sql .= "order by username asc " ;
$parameters [ 'domain_uuid' ] = $_SESSION [ 'domain_uuid' ];
$users = $database -> select ( $sql , $parameters , 'all' );
unset ( $sql , $parameters );
2012-06-04 14:58:40 +00:00
//get http post variables and set them to php variables
2023-05-26 10:07:25 -06:00
if ( ! empty ( $_POST )) {
2023-06-01 23:59:29 +00:00
$call_center_agent_uuid = $_POST [ "call_center_agent_uuid" ] ?? null ;
2019-07-02 10:56:36 -06:00
$user_uuid = $_POST [ "user_uuid" ];
$agent_name = $_POST [ "agent_name" ];
$agent_type = $_POST [ "agent_type" ];
$agent_call_timeout = $_POST [ "agent_call_timeout" ];
$agent_id = $_POST [ "agent_id" ];
$agent_password = $_POST [ "agent_password" ];
$agent_status = $_POST [ "agent_status" ];
$agent_contact = $_POST [ "agent_contact" ];
$agent_no_answer_delay_time = $_POST [ "agent_no_answer_delay_time" ];
$agent_max_no_answer = $_POST [ "agent_max_no_answer" ];
$agent_wrap_up_time = $_POST [ "agent_wrap_up_time" ];
$agent_reject_delay_time = $_POST [ "agent_reject_delay_time" ];
$agent_busy_delay_time = $_POST [ "agent_busy_delay_time" ];
2021-01-29 13:56:04 -05:00
$agent_record = $_POST [ "agent_record" ];
2019-07-02 10:56:36 -06:00
//$agent_logout = $_POST["agent_logout"];
2012-06-04 14:58:40 +00:00
}
2016-10-05 03:44:55 -06:00
//process the user data and save it to the database
2023-05-26 10:07:25 -06:00
if ( ! empty ( $_POST ) && empty ( $_POST [ "persistformvar" ])) {
2012-06-04 14:58:40 +00:00
2019-09-17 21:59:42 -06:00
//validate the token
$token = new token ;
if ( ! $token -> validate ( $_SERVER [ 'PHP_SELF' ])) {
message :: add ( $text [ 'message-invalid_token' ], 'negative' );
header ( 'Location: call_center_agents.php' );
exit ;
}
2016-10-05 03:44:55 -06:00
//check for all required data
$msg = '' ;
2023-05-05 13:46:37 -03:00
//if (empty($call_center_agent_uuid)) { $msg .= $text['message-required']." ".$text['label-call_center_agent_uuid']."<br>\n"; }
//if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
//if (empty($user_uuid)) { $msg .= $text['message-required']." ".$text['label-user_uuid']."<br>\n"; }
if ( empty ( $agent_name )) { $msg .= $text [ 'message-required' ] . " " . $text [ 'label-agent_name' ] . "<br> \n " ; }
if ( empty ( $agent_type )) { $msg .= $text [ 'message-required' ] . " " . $text [ 'label-agent_type' ] . "<br> \n " ; }
if ( empty ( $agent_call_timeout )) { $msg .= $text [ 'message-required' ] . " " . $text [ 'label-agent_call_timeout' ] . "<br> \n " ; }
//if (empty($agent_id)) { $msg .= $text['message-required']." ".$text['label-agent_id']."<br>\n"; }
//if (empty($agent_password)) { $msg .= $text['message-required']." ".$text['label-agent_password']."<br>\n"; }
//if (empty($agent_status)) { $msg .= $text['message-required']." ".$text['label-agent_status']."<br>\n"; }
if ( empty ( $agent_contact )) { $msg .= $text [ 'message-required' ] . " " . $text [ 'label-agent_contact' ] . "<br> \n " ; }
//if (empty($agent_logout)) { $msg .= $text['message-required']." ".$text['label-agent_logout']."<br>\n"; }
if ( ! empty ( $msg ) && empty ( $_POST [ "persistformvar" ])) {
2016-10-05 03:44:55 -06:00
require_once "resources/header.php" ;
require_once "resources/persist_form_var.php" ;
echo "<div align='center'> \n " ;
echo "<table><tr><td> \n " ;
echo $msg . "<br />" ;
echo "</td></tr></table> \n " ;
persistformvar ( $_POST );
echo "</div> \n " ;
require_once "resources/footer.php" ;
return ;
}
2012-06-04 14:58:40 +00:00
2023-05-09 11:36:39 -06:00
//set default values
if ( empty ( $agent_call_timeout )) { $agent_call_timeout = "20" ; }
if ( empty ( $agent_max_no_answer )) { $agent_max_no_answer = "0" ; }
if ( empty ( $agent_wrap_up_time )) { $agent_wrap_up_time = "10" ; }
if ( empty ( $agent_no_answer_delay_time )) { $agent_no_answer_delay_time = "30" ; }
if ( empty ( $agent_reject_delay_time )) { $agent_reject_delay_time = "90" ; }
if ( empty ( $agent_busy_delay_time )) { $agent_busy_delay_time = "90" ; }
2019-09-19 14:43:00 -06:00
//add the call_center_agent_uuid
2023-05-05 13:46:37 -03:00
if ( empty ( $call_center_agent_uuid )) {
2019-09-19 14:43:00 -06:00
$call_center_agent_uuid = uuid ();
}
2020-12-02 12:30:02 -07:00
//change the contact string to loopback - Not recommended added for backwards comptability causes multiple problems
if ( $_SESSION [ 'call_center' ][ 'agent_contact_method' ][ 'text' ] == 'loopback' ) {
$agent_contact = str_replace ( "user/" , "loopback/" , $agent_contact );
$agent_contact = str_replace ( "@" , "/" , $agent_contact );
}
2023-03-30 12:46:36 -06:00
//freeswitch expands the contact string, so we need to sanitize it.
2023-03-30 01:24:04 -04:00
$agent_contact = str_replace ( '$' , '' , $agent_contact );
2019-09-19 14:43:00 -06:00
//prepare the array
$array [ 'call_center_agents' ][ 0 ][ 'domain_uuid' ] = $_SESSION [ 'domain_uuid' ];
$array [ 'call_center_agents' ][ 0 ][ 'call_center_agent_uuid' ] = $call_center_agent_uuid ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_name' ] = $agent_name ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_type' ] = $agent_type ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_call_timeout' ] = $agent_call_timeout ;
$array [ 'call_center_agents' ][ 0 ][ 'user_uuid' ] = $user_uuid ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_id' ] = $agent_id ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_password' ] = $agent_password ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_contact' ] = $agent_contact ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_status' ] = $agent_status ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_no_answer_delay_time' ] = $agent_no_answer_delay_time ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_max_no_answer' ] = $agent_max_no_answer ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_wrap_up_time' ] = $agent_wrap_up_time ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_reject_delay_time' ] = $agent_reject_delay_time ;
$array [ 'call_center_agents' ][ 0 ][ 'agent_busy_delay_time' ] = $agent_busy_delay_time ;
2021-01-29 13:56:04 -05:00
$array [ 'call_center_agents' ][ 0 ][ 'agent_record' ] = $agent_record ;
2019-09-19 14:43:00 -06:00
if ( is_uuid ( $user_uuid )) {
$array [ 'users' ][ 0 ][ 'domain_uuid' ] = $_SESSION [ 'domain_uuid' ];
$array [ 'users' ][ 0 ][ 'user_uuid' ] = $user_uuid ;
$array [ 'users' ][ 0 ][ 'user_status' ] = $agent_status ;
}
//save to the data
$database -> app_name = 'call_center' ;
$database -> app_uuid = '95788e50-9500-079e-2807-fd530b0ea370' ;
$database -> save ( $array );
//syncrhonize configuration
save_call_center_xml ();
//clear the cache
$cache = new cache ;
$cache -> delete ( 'configuration:callcenter.conf' );
2012-06-04 14:58:40 +00:00
//get and then set the complete agent_contact with the call_timeout and when necessary confirm
2014-08-03 20:54:15 +00:00
//if you change this variable, also change resources/switch.php
2015-12-07 18:02:56 -07:00
$confirm = "group_confirm_file=custom/press_1_to_accept_this_call.wav,group_confirm_key=1,group_confirm_read_timeout=2000,leg_timeout=" . $agent_call_timeout ;
2012-06-04 14:58:40 +00:00
if ( strstr ( $agent_contact , '}' ) === FALSE ) {
//not found
if ( stristr ( $agent_contact , 'sofia/gateway' ) === FALSE ) {
//add the call_timeout
2015-12-07 18:02:56 -07:00
$agent_contact = "{call_timeout=" . $agent_call_timeout . ",sip_invite_domain=" . $_SESSION [ 'domain_name' ] . "}" . $agent_contact ;
2012-06-04 14:58:40 +00:00
}
else {
//add the call_timeout and confirm
2015-12-07 18:02:56 -07:00
$agent_contact = "{" . $confirm . ",call_timeout=" . $agent_call_timeout . ",sip_invite_domain=" . $_SESSION [ 'domain_name' ] . "}" . $agent_contact ;
2012-06-04 14:58:40 +00:00
}
}
else {
2016-02-29 22:54:24 -07:00
$position = strrpos ( $agent_contact , "}" );
$first = substr ( $agent_contact , 0 , $position );
$last = substr ( $agent_contact , $position );
//add call_timeout and sip_invite_domain, only if missing
$call_timeout = ( stristr ( $agent_contact , 'call_timeout' ) === FALSE ) ? ',call_timeout=' . $agent_call_timeout : null ;
$sip_invite_domain = ( stristr ( $agent_contact , 'sip_invite_domain' ) === FALSE ) ? ',sip_invite_domain=' . $_SESSION [ 'domain_name' ] : null ;
//compose
2012-06-04 14:58:40 +00:00
if ( stristr ( $agent_contact , 'sofia/gateway' ) === FALSE ) {
2016-02-29 22:54:24 -07:00
$agent_contact = $first . $sip_invite_domain . $call_timeout . $last ;
2012-06-04 14:58:40 +00:00
}
else {
2016-02-29 22:54:24 -07:00
$agent_contact = $first . ',' . $confirm . $sip_invite_domain . $call_timeout . $last ;
2012-06-04 14:58:40 +00:00
}
}
//add the agent
//setup the event socket connection
2023-12-02 20:16:18 -04:00
$esl = event_socket :: create ();
2012-06-04 14:58:40 +00:00
//add the agent using event socket
2023-12-02 20:16:18 -04:00
if ( $esl -> connected ()) {
2012-06-04 14:58:40 +00:00
//add the agent
2023-12-02 20:16:18 -04:00
$cmd = "callcenter_config agent add " . $call_center_agent_uuid . " '" . $agent_type . "'" ;
$response = event_socket :: api ( $cmd );
2012-06-04 14:58:40 +00:00
usleep ( 200 );
//agent set contact
2023-12-02 20:16:18 -04:00
$cmd = "callcenter_config agent set contact " . $call_center_agent_uuid . " '" . $agent_contact . "'" ;
$response = event_socket :: api ( $cmd );
2012-06-04 14:58:40 +00:00
usleep ( 200 );
//agent set status
2023-12-02 20:16:18 -04:00
$cmd = "callcenter_config agent set status " . $call_center_agent_uuid . " '" . $agent_status . "'" ;
$response = event_socket :: api ( $cmd );
2012-06-04 14:58:40 +00:00
usleep ( 200 );
//agent set reject_delay_time
2023-12-02 20:16:18 -04:00
$cmd = 'callcenter_config agent set reject_delay_time ' . $call_center_agent_uuid . ' ' . $agent_reject_delay_time ;
$response = event_socket :: api ( $cmd );
2012-06-04 14:58:40 +00:00
usleep ( 200 );
//agent set busy_delay_time
2023-12-02 20:16:18 -04:00
$cmd = 'callcenter_config agent set busy_delay_time ' . $call_center_agent_uuid . ' ' . $agent_busy_delay_time ;
$response = event_socket :: api ( $cmd );
2012-10-18 16:15:12 +00:00
//agent set no_answer_delay_time
2023-12-02 20:16:18 -04:00
$cmd = 'callcenter_config agent set no_answer_delay_time ' . $call_center_agent_uuid . ' ' . $agent_no_answer_delay_time ;
$response = event_socket :: api ( $cmd );
2012-10-18 16:15:12 +00:00
//agent set max_no_answer
2023-12-02 20:16:18 -04:00
$cmd = 'callcenter_config agent set max_no_answer ' . $call_center_agent_uuid . ' ' . $agent_max_no_answer ;
$response = event_socket :: api ( $cmd );
2012-10-18 16:15:12 +00:00
//agent set wrap_up_time
2023-12-02 20:16:18 -04:00
$cmd = 'callcenter_config agent set wrap_up_time ' . $call_center_agent_uuid . ' ' . $agent_wrap_up_time ;
$response = event_socket :: api ( $cmd );
2012-06-04 14:58:40 +00:00
}
2016-10-05 03:44:55 -06:00
//redirect the user
if ( isset ( $action )) {
if ( $action == "add" ) {
2018-08-31 03:09:01 +00:00
message :: add ( $text [ 'message-add' ]);
2016-10-05 03:44:55 -06:00
}
if ( $action == "update" ) {
2018-08-31 03:09:01 +00:00
message :: add ( $text [ 'message-update' ]);
2016-10-05 03:44:55 -06:00
}
header ( "Location: call_center_agents.php" );
return ;
}
2023-05-05 13:46:37 -03:00
} //(is_array($_POST) && empty($_POST["persistformvar"]))
2012-06-04 14:58:40 +00:00
2015-08-07 15:06:07 -05:00
//initialize the destinations object
$destination = new destinations ;
2012-06-04 14:58:40 +00:00
//pre-populate the form
2023-05-26 10:07:25 -06:00
if ( ! empty ( $_GET [ "id" ]) && is_uuid ( $_GET [ "id" ]) && empty ( $_POST [ "persistformvar" ])) {
2019-07-02 10:56:36 -06:00
$call_center_agent_uuid = $_GET [ "id" ];
2012-11-24 02:59:17 +00:00
$sql = "select * from v_call_center_agents " ;
2019-07-02 10:56:36 -06:00
$sql .= "where domain_uuid = :domain_uuid " ;
$sql .= "and call_center_agent_uuid = :call_center_agent_uuid " ;
$parameters [ 'domain_uuid' ] = $_SESSION [ 'domain_uuid' ];
$parameters [ 'call_center_agent_uuid' ] = $call_center_agent_uuid ;
$row = $database -> select ( $sql , $parameters , 'row' );
2023-05-26 10:07:25 -06:00
if ( ! empty ( $row )) {
2016-10-05 03:44:55 -06:00
$call_center_agent_uuid = $row [ "call_center_agent_uuid" ];
2017-05-16 10:28:53 -06:00
$user_uuid = $row [ "user_uuid" ];
2012-06-04 14:58:40 +00:00
$agent_name = $row [ "agent_name" ];
$agent_type = $row [ "agent_type" ];
$agent_call_timeout = $row [ "agent_call_timeout" ];
2015-05-03 16:55:43 +00:00
$agent_id = $row [ "agent_id" ];
$agent_password = $row [ "agent_password" ];
2012-06-04 14:58:40 +00:00
$agent_status = $row [ "agent_status" ];
2016-10-05 03:44:55 -06:00
$agent_contact = $row [ "agent_contact" ];
2012-06-04 14:58:40 +00:00
$agent_no_answer_delay_time = $row [ "agent_no_answer_delay_time" ];
$agent_max_no_answer = $row [ "agent_max_no_answer" ];
$agent_wrap_up_time = $row [ "agent_wrap_up_time" ];
$agent_reject_delay_time = $row [ "agent_reject_delay_time" ];
$agent_busy_delay_time = $row [ "agent_busy_delay_time" ];
2021-01-29 13:56:04 -05:00
$agent_record = $row [ "agent_record" ];
2016-10-05 03:44:55 -06:00
//$agent_logout = $row["agent_logout"];
2012-06-04 14:58:40 +00:00
}
2019-08-28 21:02:08 -06:00
unset ( $sql , $parameters , $row );
2012-06-04 14:58:40 +00:00
}
//set default values
2023-05-05 13:46:37 -03:00
if ( empty ( $agent_type )) { $agent_type = "callback" ; }
if ( empty ( $agent_call_timeout )) { $agent_call_timeout = "20" ; }
if ( empty ( $agent_max_no_answer )) { $agent_max_no_answer = "0" ; }
if ( empty ( $agent_wrap_up_time )) { $agent_wrap_up_time = "10" ; }
if ( empty ( $agent_no_answer_delay_time )) { $agent_no_answer_delay_time = "30" ; }
if ( empty ( $agent_reject_delay_time )) { $agent_reject_delay_time = "90" ; }
if ( empty ( $agent_busy_delay_time )) { $agent_busy_delay_time = "90" ; }
2012-06-04 14:58:40 +00:00
2019-09-17 21:59:42 -06:00
//create token
$object = new token ;
$token = $object -> create ( $_SERVER [ 'PHP_SELF' ]);
2012-06-04 14:58:40 +00:00
//show the header
2013-05-29 21:14:36 +00:00
if ( $action == "add" ) {
2014-07-10 00:32:50 +00:00
$document [ 'title' ] = $text [ 'title-call_center_agent_add' ];
2013-05-29 21:14:36 +00:00
}
if ( $action == "update" ) {
2014-07-10 00:32:50 +00:00
$document [ 'title' ] = $text [ 'title-call_center_agent_edit' ];
2013-05-29 21:14:36 +00:00
}
2016-10-05 03:44:55 -06:00
2024-10-07 13:07:03 -06:00
//include the header
require_once "resources/header.php" ;
2015-05-04 21:01:55 +00:00
2012-06-04 14:58:40 +00:00
//show the content
2024-10-07 13:07:03 -06:00
echo "<form method='post' name='frm' id='frm' onsubmit=''> \n " ;
2020-01-13 09:44:46 -07:00
echo "<div class='action_bar' id='action_bar'> \n " ;
echo " <div class='heading'>" ;
2012-06-04 14:58:40 +00:00
if ( $action == "add" ) {
2020-01-13 09:44:46 -07:00
echo "<b>" . $text [ 'header-call_center_agent_add' ] . "</b>" ;
2012-06-04 14:58:40 +00:00
}
if ( $action == "update" ) {
2020-01-13 09:44:46 -07:00
echo "<b>" . $text [ 'header-call_center_agent_edit' ] . "</b>" ;
2012-06-04 14:58:40 +00:00
}
2020-01-13 09:44:46 -07:00
echo "</div> \n " ;
echo " <div class='actions'> \n " ;
2020-03-05 00:05:45 -07:00
echo button :: create ([ 'type' => 'button' , 'label' => $text [ 'button-back' ], 'icon' => $_SESSION [ 'theme' ][ 'button_icon_back' ], 'id' => 'btn_back' , 'link' => 'call_center_agents.php' ]);
echo button :: create ([ 'type' => 'submit' , 'label' => $text [ 'button-save' ], 'icon' => $_SESSION [ 'theme' ][ 'button_icon_save' ], 'id' => 'btn_save' , 'style' => 'margin-left: 15px;' ]);
2020-01-13 09:44:46 -07:00
echo " </div> \n " ;
echo " <div style='clear: both;'></div> \n " ;
echo "</div> \n " ;
2012-06-04 14:58:40 +00:00
2024-09-05 16:10:04 -07:00
echo "<div class='card'> \n " ;
2014-10-24 02:55:55 +00:00
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'> \n " ;
2012-06-04 14:58:40 +00:00
echo "<tr> \n " ;
2020-01-13 09:44:46 -07:00
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 06:50:00 +00:00
echo " " . $text [ 'label-agent_name' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
2020-01-13 09:44:46 -07:00
echo "<td width='70%' class='vtable' align='left'> \n " ;
2023-06-01 16:39:05 -06:00
echo " <input class='formfld' type='text' name='agent_name' maxlength='255' value= \" " . escape ( $agent_name ) . " \" /> \n " ;
2012-06-04 14:58:40 +00:00
echo "<br /> \n " ;
2013-05-29 21:14:36 +00:00
echo $text [ 'description-agent_name' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "</tr> \n " ;
echo "<tr> \n " ;
2015-05-03 16:55:43 +00:00
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 06:50:00 +00:00
echo " " . $text [ 'label-type' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
2018-06-30 18:56:48 -06:00
echo " <input class='formfld' type='text' name='agent_type' maxlength='255' value= \" " . escape ( $agent_type ) . " \" pattern='^(callback|uuid-standby)$'> \n " ;
2012-06-04 14:58:40 +00:00
echo "<br /> \n " ;
2013-05-29 21:14:36 +00:00
echo $text [ 'description-type' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "</tr> \n " ;
echo "<tr> \n " ;
2015-05-03 16:55:43 +00:00
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 06:50:00 +00:00
echo " " . $text [ 'label-call_timeout' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
2018-06-30 18:56:48 -06:00
echo " <input class='formfld' type='number' name='agent_call_timeout' maxlength='255' min='1' step='1' value='" . escape ( $agent_call_timeout ) . "'> \n " ;
2012-06-04 14:58:40 +00:00
echo "<br /> \n " ;
2013-05-29 21:14:36 +00:00
echo $text [ 'description-call_timeout' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "</tr> \n " ;
2018-02-21 14:06:42 -07:00
echo " <tr>" ;
2018-04-08 10:45:42 -06:00
echo " <td class='vncell' valign='top'>" . $text [ 'label-username' ] . "</td>" ;
2018-02-21 14:06:42 -07:00
echo " <td class='vtable' align='left'>" ;
echo " <select name= \" user_uuid \" class='formfld' style='width: auto;'> \n " ;
echo " <option value= \"\" ></option> \n " ;
2023-06-01 23:59:29 +00:00
foreach ( $users as $field ) {
echo " <option value='" . escape ( $field [ 'user_uuid' ]) . "' " . ( ! empty ( $user_uuid ) && $user_uuid == $field [ 'user_uuid' ] ? "selected='selected'" : null ) . ">" . escape ( $field [ 'username' ]) . "</option> \n " ;
2017-05-16 10:28:53 -06:00
}
2018-02-21 14:06:42 -07:00
echo " </select>" ;
unset ( $users );
echo " <br> \n " ;
2023-05-26 10:07:25 -06:00
echo " " .! empty ( $text [ 'description-users' ]) . " \n " ;
2018-02-21 14:06:42 -07:00
echo " </td>" ;
echo " </tr>" ;
2017-05-16 10:28:53 -06:00
2012-06-04 14:58:40 +00:00
echo "<tr> \n " ;
2015-05-03 16:55:43 +00:00
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-agent_id' ] . " \n " ;
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
2023-06-01 16:39:05 -06:00
echo " <input class='formfld' type='number' name='agent_id' id='agent_id' maxlength='255' min='1' step='1' value='" . escape ( $agent_id ) . "'> \n " ;
2015-05-03 16:55:43 +00:00
echo "<br /> \n " ;
echo $text [ 'description-agent_id' ] . " \n " ;
echo "</td> \n " ;
echo "</tr> \n " ;
echo "<tr> \n " ;
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
echo " " . $text [ 'label-agent_password' ] . " \n " ;
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
2023-06-01 16:39:05 -06:00
echo " <input class='formfld' type='password' name='agent_password' autocomplete='off' onmouseover= \" this.type='text'; \" onfocus= \" this.type='text'; \" onmouseout= \" if (! \$ (this).is(':focus')) { this.type='password'; } \" onblur= \" this.type='password'; \" maxlength='255' min='1' step='1' value='" . escape ( $agent_password ) . "'> \n " ;
2015-05-03 16:55:43 +00:00
echo "<br /> \n " ;
echo $text [ 'description-agent_password' ] . " \n " ;
echo "</td> \n " ;
echo "</tr> \n " ;
echo "<tr> \n " ;
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 06:50:00 +00:00
echo " " . $text [ 'label-contact' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
2023-06-12 21:03:45 +00:00
echo $destination -> select ( 'user_contact' , 'agent_contact' , ( $agent_contact ?? null ));
2012-06-04 14:58:40 +00:00
echo "<br /> \n " ;
2013-05-29 21:14:36 +00:00
echo $text [ 'description-contact' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "</tr> \n " ;
echo "<tr> \n " ;
2015-05-03 16:55:43 +00:00
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 06:50:00 +00:00
echo " " . $text [ 'label-status' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
echo " <select class='formfld' name='agent_status'> \n " ;
2023-06-01 23:59:29 +00:00
echo " <option value=''></option> \n " ;
echo " <option value='Logged Out' " . ( ! empty ( $agent_status ) && $agent_status == "Logged Out" ? "selected='selected'" : null ) . ">" . $text [ 'option-logged_out' ] . "</option> \n " ;
echo " <option value='Available' " . ( ! empty ( $agent_status ) && $agent_status == "Available" ? "selected='selected'" : null ) . ">" . $text [ 'option-available' ] . "</option> \n " ;
echo " <option value='Available (On Demand)' " . ( ! empty ( $agent_status ) && $agent_status == "Available (On Demand)" ? "selected='selected'" : null ) . ">" . $text [ 'option-available_on_demand' ] . "</option> \n " ;
echo " <option value='On Break' " . ( ! empty ( $agent_status ) && $agent_status == "On Break" ? "selected='selected'" : null ) . ">" . $text [ 'option-on_break' ] . "</option> \n " ;
2012-06-04 14:58:40 +00:00
echo " </select> \n " ;
echo "<br /> \n " ;
2013-05-29 21:14:36 +00:00
echo $text [ 'description-status' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "</tr> \n " ;
echo "<tr> \n " ;
2015-05-03 16:55:43 +00:00
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 06:50:00 +00:00
echo " " . $text [ 'label-no_answer_delay_time' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
2021-05-03 23:09:12 -04:00
echo " <input class='formfld' type='number' name='agent_no_answer_delay_time' maxlength='255' min='0' step='1' value='" . escape ( $agent_no_answer_delay_time ) . "'> \n " ;
2012-06-04 14:58:40 +00:00
echo "<br /> \n " ;
2013-05-29 21:14:36 +00:00
echo $text [ 'description-no_answer_delay_time' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "</tr> \n " ;
echo "<tr> \n " ;
2015-05-03 16:55:43 +00:00
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 06:50:00 +00:00
echo " " . $text [ 'label-max_no_answer' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
2018-06-30 18:56:48 -06:00
echo " <input class='formfld' type='number' name='agent_max_no_answer' maxlength='255' min='0' step='1' value='" . escape ( $agent_max_no_answer ) . "'> \n " ;
2012-06-04 14:58:40 +00:00
echo "<br /> \n " ;
2013-05-29 21:14:36 +00:00
echo $text [ 'description-max_no_answer' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "</tr> \n " ;
echo "<tr> \n " ;
2015-05-03 16:55:43 +00:00
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 06:50:00 +00:00
echo " " . $text [ 'label-wrap_up_time' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
2021-05-03 18:26:11 -04:00
echo " <input class='formfld' type='number' name='agent_wrap_up_time' maxlength='255' min='0' step='1' value='" . escape ( $agent_wrap_up_time ) . "'> \n " ;
2012-06-04 14:58:40 +00:00
echo "<br /> \n " ;
2013-05-29 21:14:36 +00:00
echo $text [ 'description-wrap_up_time' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "</tr> \n " ;
echo "<tr> \n " ;
2015-05-03 16:55:43 +00:00
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 06:50:00 +00:00
echo " " . $text [ 'label-reject_delay_time' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
2021-05-03 18:26:11 -04:00
echo " <input class='formfld' type='number' name='agent_reject_delay_time' maxlength='255' min='0' step='1' value='" . escape ( $agent_reject_delay_time ) . "'> \n " ;
2012-06-04 14:58:40 +00:00
echo "<br /> \n " ;
2013-05-29 21:14:36 +00:00
echo $text [ 'description-reject_delay_time' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "</tr> \n " ;
echo "<tr> \n " ;
2015-05-03 16:55:43 +00:00
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2015-02-15 06:50:00 +00:00
echo " " . $text [ 'label-busy_delay_time' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
2018-06-30 18:56:48 -06:00
echo " <input class='formfld' type='number' name='agent_busy_delay_time' maxlength='255' min='1' step='1' value='" . escape ( $agent_busy_delay_time ) . "'> \n " ;
2012-06-04 14:58:40 +00:00
echo "<br /> \n " ;
2013-05-29 21:14:36 +00:00
echo $text [ 'description-busy_delay_time' ] . " \n " ;
2012-06-04 14:58:40 +00:00
echo "</td> \n " ;
echo "</tr> \n " ;
2021-01-29 13:56:04 -05:00
echo "<tr> \n " ;
echo "<td class='vncell' valign='top' align='left' nowrap> \n " ;
echo " " . $text [ 'label-record_template' ] . " \n " ;
echo "</td> \n " ;
echo "<td class='vtable' align='left'> \n " ;
echo " <select class='formfld' name='agent_record'> \n " ;
2023-06-01 23:59:29 +00:00
echo " <option value='true'>" . $text [ 'option-true' ] . "</option> \n " ;
echo " <option value='false' " . ( ! empty ( $agent_record ) && $agent_record != "true" ? "selected='selected'" : null ) . ">" . $text [ 'option-false' ] . "</option> \n " ;
2021-01-29 13:56:04 -05:00
echo " </select> \n " ;
echo "<br /> \n " ;
echo $text [ 'description-record_template' ] . " \n " ;
echo "</td> \n " ;
echo "</tr> \n " ;
2014-10-24 02:55:55 +00:00
/*
2012-06-04 14:58:40 +00:00
echo "<tr>\n";
2015-05-03 16:55:43 +00:00
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
2015-02-15 06:50:00 +00:00
echo " ".$text['label-agent_logout']."\n";
2012-06-04 14:58:40 +00:00
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
2018-06-30 18:56:48 -06:00
echo " <input class='formfld' type='text' name='agent_logout' maxlength='255' value='".escape($agent_logout)."'>\n";
2012-06-04 14:58:40 +00:00
echo "<br />\n";
2013-05-29 21:14:36 +00:00
echo $text['description-agent_logout']."\n";
2012-06-04 14:58:40 +00:00
echo "</td>\n";
echo "</tr>\n";
2014-10-24 02:55:55 +00:00
*/
2012-06-04 14:58:40 +00:00
2020-01-13 09:44:46 -07:00
echo "</table>" ;
2024-09-05 16:10:04 -07:00
echo "</div> \n " ;
2020-01-13 09:44:46 -07:00
echo "<br /><br />" ;
2012-06-04 14:58:40 +00:00
if ( $action == "update" ) {
2020-01-13 09:44:46 -07:00
echo "<input type='hidden' name='call_center_agent_uuid' value='" . escape ( $call_center_agent_uuid ) . "'> \n " ;
2012-06-04 14:58:40 +00:00
}
2020-01-13 09:44:46 -07:00
echo "<input type='hidden' name='" . $token [ 'name' ] . "' value='" . $token [ 'hash' ] . "'> \n " ;
2012-06-04 14:58:40 +00:00
echo "</form>" ;
2016-10-05 03:44:55 -06:00
//include the footer
2013-07-06 06:29:50 +00:00
require_once "resources/footer.php" ;
2015-05-03 16:55:43 +00:00
2023-06-05 12:41:28 -06:00
?>