2016-04-26 03:30:23 +02: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 >
2019-05-26 07:13:37 +02:00
Portions created by the Initial Developer are Copyright ( C ) 2008 - 2019
2016-04-26 03:30:23 +02:00
the Initial Developer . All Rights Reserved .
Contributor ( s ) :
Mark J Crane < markjcrane @ fusionpbx . com >
*/
2017-01-29 21:05:05 +01:00
//includes
include " root.php " ;
require_once " resources/require.php " ;
require_once " resources/check_auth.php " ;
//check permissions
if ( permission_exists ( 'operator_panel_view' )) {
//access granted
}
else {
echo " access denied " ;
exit ;
}
2016-04-26 03:30:23 +02:00
//add multi-lingual support
$language = new text ;
2019-05-26 07:43:33 +02:00
$text = $language -> get ( null , 'app/basic_operator_panel' );
2016-04-26 03:30:23 +02:00
2017-01-29 21:05:05 +01:00
//get the call activity
2019-05-26 07:13:37 +02:00
$operator_panel = new basic_operator_panel ;
$activity = $operator_panel -> call_activity ();
if ( is_array ( $activity )) {
foreach ( $activity as $extension => $fields ) {
if ( substr_count ( $fields [ 'call_group' ], ',' )) {
$tmp = explode ( ',' , $fields [ 'call_group' ]);
if ( is_array ( $tmp )) foreach ( $tmp as $tmp_index => $tmp_value ) {
if ( trim ( $tmp_value ) == '' ) { unset ( $tmp [ $tmp_index ]); }
else { $groups [] = $tmp_value ; }
}
}
else if ( $fields [ 'call_group' ] != '' ) {
$groups [] = $fields [ 'call_group' ];
2017-01-29 21:05:05 +01:00
}
2016-04-26 03:30:23 +02:00
}
}
2017-01-29 21:05:05 +01:00
if ( is_array ( $groups )) {
$groups = array_unique ( $groups );
sort ( $groups );
2016-04-26 03:30:23 +02:00
}
2017-01-29 21:05:05 +01:00
//prevent warnings
if ( ! is_array ( $_SESSION [ 'user' ][ 'extensions' ])) {
$_SESSION [ 'user' ][ 'extensions' ] = array ();
}
2020-08-27 17:14:39 +02:00
//get registrations -- All SIP profiles
$obj = new registrations ;
$registrations = $obj -> get ( " all " );
2016-04-26 03:30:23 +02:00
$onhover_pause_refresh = " onmouseover='refresh_stop();' onmouseout='refresh_start();' " ;
echo " <table width='100%'> " ;
echo " <tr> " ;
echo " <td valign='top' align='left' width='50%' nowrap> " ;
echo " <b> " . $text [ 'title-operator_panel' ] . " </b> " ;
echo " </td> " ;
echo " <td valign='top' align='center' nowrap> " ;
if ( sizeof ( $_SESSION [ 'user' ][ 'extensions' ]) > 0 ) {
$status_options [ 1 ][ 'status' ] = " Available " ;
$status_options [ 1 ][ 'label' ] = $text [ 'label-status_available' ];
$status_options [ 1 ][ 'style' ] = " op_btn_status_available " ;
if ( permission_exists ( 'operator_panel_on_demand' )) {
$status_options [ 2 ][ 'status' ] = " Available (On Demand) " ;
$status_options [ 2 ][ 'label' ] = $text [ 'label-status_on_demand' ];
$status_options [ 2 ][ 'style' ] = " op_btn_status_available_on_demand " ;
}
$status_options [ 3 ][ 'status' ] = " On Break " ;
$status_options [ 3 ][ 'label' ] = $text [ 'label-status_on_break' ];
$status_options [ 3 ][ 'style' ] = " op_btn_status_on_break " ;
$status_options [ 4 ][ 'status' ] = " Do Not Disturb " ;
$status_options [ 4 ][ 'label' ] = $text [ 'label-status_do_not_disturb' ];
$status_options [ 4 ][ 'style' ] = " op_btn_status_do_not_disturb " ;
$status_options [ 5 ][ 'status' ] = " Logged Out " ;
$status_options [ 5 ][ 'label' ] = $text [ 'label-status_logged_out' ];
$status_options [ 5 ][ 'style' ] = " op_btn_status_logged_out " ;
2016-05-11 17:20:10 +02:00
if ( is_array ( $status_options )) foreach ( $status_options as $status_option ) {
2016-04-26 03:30:23 +02:00
echo " <input type='button' id=' " . $status_option [ 'style' ] . " ' class='btn' value= \" " . $status_option [ 'label' ] . " \" onclick= \" send_cmd('index.php?status='+escape(' " . $status_option [ 'status' ] . " ')); this.disabled='disabled'; refresh_start(); \" " . $onhover_pause_refresh . " > \n " ;
}
}
echo " </td> " ;
echo " <td valign='top' align='right' width='50%' nowrap> " ;
echo " <table cellpadding='0' cellspacing='0' border='0'> " ;
echo " <tr> " ;
echo " <td valign='middle' nowrap='nowrap' style='padding-right: 15px' id='refresh_state'> " ;
echo " <img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' onclick='refresh_stop();' alt= \" " . $text [ 'label-refresh_pause' ] . " \" title= \" " . $text [ 'label-refresh_pause' ] . " \" > " ;
echo " </td> " ;
if ( permission_exists ( 'operator_panel_eavesdrop' )) {
echo " <td valign='top' nowrap='nowrap'> " ;
if ( sizeof ( $_SESSION [ 'user' ][ 'extensions' ]) > 1 ) {
2019-08-10 17:56:11 +02:00
echo " <input type='hidden' id='eavesdrop_dest' value= \" " . (( $_REQUEST [ 'eavesdrop_dest' ] == '' ) ? $_SESSION [ 'user' ][ 'extension' ][ 0 ][ 'destination' ] : escape ( $_REQUEST [ 'eavesdrop_dest' ])) . " \" > " ;
2016-04-26 03:30:23 +02:00
echo " <img src='resources/images/eavesdrop.png' style='width: 12px; height: 12px; border: none; margin: 0px 5px; cursor: help;' title=' " . $text [ 'description-eavesdrop_destination' ] . " ' align='absmiddle'> " ;
echo " <select class='formfld' style='margin-right: 5px;' align='absmiddle' onchange= \" document.getElementById('eavesdrop_dest').value = this.options[this.selectedIndex].value; refresh_start(); \" onfocus='refresh_stop();'> \n " ;
2016-05-11 17:20:10 +02:00
if ( is_array ( $_SESSION [ 'user' ][ 'extensions' ])) foreach ( $_SESSION [ 'user' ][ 'extensions' ] as $user_extension ) {
2019-08-10 17:56:11 +02:00
echo " <option value=' " . escape ( $user_extension ) . " ' " . (( $_REQUEST [ 'eavesdrop_dest' ] == $user_extension ) ? " selected " : null ) . " > " . escape ( $user_extension ) . " </option> \n " ;
2016-04-26 03:30:23 +02:00
}
echo " </select> \n " ;
}
else if ( sizeof ( $_SESSION [ 'user' ][ 'extensions' ]) == 1 ) {
2019-08-10 17:56:11 +02:00
echo " <input type='hidden' id='eavesdrop_dest' value= \" " . escape ( $_SESSION [ 'user' ][ 'extension' ][ 0 ][ 'destination' ]) . " \" > " ;
2016-04-26 03:30:23 +02:00
}
echo " </td> " ;
}
2020-01-06 19:50:28 +01:00
if ( is_array ( $groups ) && @ sizeof ( $groups ) > 0 ) {
2016-04-26 03:30:23 +02:00
echo " <td valign='top' nowrap='nowrap'> " ;
2019-08-10 17:56:11 +02:00
echo " <input type='hidden' id='group' value= \" " . escape ( $_REQUEST [ 'group' ]) . " \" > " ;
2016-04-26 03:30:23 +02:00
if ( sizeof ( $groups ) > 5 ) {
//show select box
echo " <select class='formfld' onchange= \" document.getElementById('group').value = this.options[this.selectedIndex].value; refresh_start(); \" onfocus='refresh_stop();'> \n " ;
echo " <option value='' " . (( $_REQUEST [ 'group' ] == '' ) ? " selected " : null ) . " > " . $text [ 'label-call_group' ] . " </option> " ;
echo " <option value=''> " . $text [ 'button-all' ] . " </option> " ;
2016-05-11 17:20:10 +02:00
if ( is_array ( $groups )) foreach ( $groups as $group ) {
2019-08-10 17:56:11 +02:00
echo " <option value=' " . escape ( $group ) . " ' " . (( $_REQUEST [ 'group' ] == $group ) ? " selected " : null ) . " > " . escape ( $group ) . " </option> \n " ;
2016-04-26 03:30:23 +02:00
}
echo " </select> \n " ;
}
else {
//show buttons
echo " <input type='button' class='btn' title= \" " . $text [ 'label-call_group' ] . " \" value= \" " . $text [ 'button-all' ] . " \" onclick= \" document.getElementById('group').value = ''; \" " . $onhover_pause_refresh . " > " ;
2016-05-11 17:20:10 +02:00
if ( is_array ( $groups )) foreach ( $groups as $group ) {
2019-08-10 17:56:11 +02:00
echo " <input type='button' class='btn' title= \" " . $text [ 'label-call_group' ] . " \" value= \" " . escape ( $group ) . " \" " . (( $_REQUEST [ 'group' ] == $group ) ? " disabled='disabled' " : null ) . " onclick= \" document.getElementById('group').value = this.value; \" " . $onhover_pause_refresh . " > " ;
2016-04-26 03:30:23 +02:00
}
}
echo " </td> " ;
}
2020-08-27 17:14:39 +02:00
echo " <td valign='top' nowrap='nowrap'> " ;
echo " <input type='hidden' id='extension_filter' value= \" " . escape ( $_REQUEST [ 'extension_filter' ]) . " \" > " ;
echo " <input type='hidden' id='name_filter' value= \" " . strtolower ( $_REQUEST [ 'name_filter' ]) . " \" > " ;
echo " <input type='text' class='formfld' placeholder='Filter Extension' value= \" " . escape ( $_REQUEST [ 'extension_filter' ]) . " \" onkeyup= \" document.getElementById('extension_filter').value = this.value; refresh_start(); \" onfocus='refresh_stop();'> \n " ;
echo " <input type='text' class='formfld' placeholder='Filter Name' value= \" " . strtolower ( $_REQUEST [ 'name_filter' ]) . " \" onkeyup= \" document.getElementById('name_filter').value = this.value; refresh_start(); \" onfocus='refresh_stop();'> \n " ;
echo " <input type='button' class='btn' title= \" Clear \" value= \" Clear \" onclick= \" document.getElementById('extension_filter').value = ''; document.getElementById('name_filter').value = ''; \" " . $onhover_pause_refresh . " > " ;
echo " </td> " ;
2016-04-26 03:30:23 +02:00
echo " </tr> " ;
echo " </table> " ;
echo " </td> " ;
echo " </tr> " ;
echo " </table> " ;
echo " <br> " ;
2016-05-11 17:20:10 +02:00
if ( is_array ( $activity )) foreach ( $activity as $extension => $ext ) {
2016-04-26 03:30:23 +02:00
unset ( $block );
//filter by group, if defined
if ( $_REQUEST [ 'group' ] != '' && substr_count ( $ext [ 'call_group' ], $_REQUEST [ 'group' ]) == 0 && ! in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ])) { continue ; }
2020-08-27 17:14:39 +02:00
//filter by extension or name, if defined
if ( $_REQUEST [ 'extension_filter' ] != '' && substr_count ( $ext [ 'extension' ], $_REQUEST [ 'extension_filter' ]) == 0 && ! in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ])) { continue ; }
if ( $_REQUEST [ 'name_filter' ] != '' && substr_count ( $ext [ 'filter_name' ], $_REQUEST [ 'name_filter' ]) == 0 && ! in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ])) { continue ; }
2016-04-26 03:30:23 +02:00
//check if feature code being called
$format_number = ( substr ( $ext [ 'dest' ], 0 , 1 ) == '*' ) ? false : true ;
//determine extension state, direction icon, and displayed name/number for caller/callee
if ( $ext [ 'state' ] == 'CS_EXECUTE' ) {
if (( $ext [ 'callstate' ] == 'RINGING' || $ext [ 'callstate' ] == 'EARLY' || $ext [ 'callstate' ] == 'RING_WAIT' ) && $ext [ 'direction' ] == 'inbound' ) {
$ext_state = 'ringing' ;
}
else if ( $ext [ 'callstate' ] == 'ACTIVE' && $ext [ 'direction' ] == 'outbound' ) {
$ext_state = 'active' ;
}
2020-08-28 01:58:35 +02:00
else if ( $ext [ 'callstate' ] == 'HELD' && $ext [ 'direction' ] == 'outbound' ) {
$ext_state = 'held' ;
}
2016-04-26 03:30:23 +02:00
else if ( $ext [ 'callstate' ] == 'RING_WAIT' && $ext [ 'direction' ] == 'outbound' ) {
$ext_state = 'ringing' ;
}
else if ( $ext [ 'callstate' ] == 'ACTIVE' && $ext [ 'direction' ] == 'inbound' ) {
$ext_state = 'active' ;
}
2020-08-28 01:58:35 +02:00
else if ( $ext [ 'callstate' ] == 'HELD' && $ext [ 'direction' ] == 'inbound' ) {
$ext_state = 'held' ;
}
2016-04-26 03:30:23 +02:00
if ( ! $format_number ) {
$call_name = 'System' ;
$call_number = $ext [ 'dest' ];
}
else {
$call_name = $activity [ $ext [ 'dest' ]][ 'effective_caller_id_name' ];
$call_number = format_phone ( $ext [ 'dest' ]);
}
$dir_icon = 'outbound' ;
}
else if ( $ext [ 'state' ] == 'CS_HIBERNATE' ) {
if ( $ext [ 'callstate' ] == 'ACTIVE' ) {
$ext_state = 'active' ;
if ( $ext [ 'direction' ] == 'inbound' ) {
$call_name = $activity [ $ext [ 'dest' ]][ 'effective_caller_id_name' ];
$call_number = format_phone ( $ext [ 'dest' ]);
$dir_icon = 'outbound' ;
}
else if ( $ext [ 'direction' ] == 'outbound' ) {
$call_name = $activity [ $ext [ 'cid_num' ]][ 'effective_caller_id_name' ];
$call_number = format_phone ( $ext [ 'cid_num' ]);
$dir_icon = 'inbound' ;
}
}
}
else if ( $ext [ 'state' ] == 'CS_CONSUME_MEDIA' || $ext [ 'state' ] == 'CS_EXCHANGE_MEDIA' ) {
if ( $ext [ 'state' ] == 'CS_CONSUME_MEDIA' && $ext [ 'callstate' ] == 'RINGING' && $ext [ 'direction' ] == 'outbound' ) {
$ext_state = 'ringing' ;
}
else if ( $ext [ 'state' ] == 'CS_EXCHANGE_MEDIA' && $ext [ 'callstate' ] == 'ACTIVE' && $ext [ 'direction' ] == 'outbound' ) {
$ext_state = 'active' ;
}
2020-08-28 01:58:35 +02:00
else if ( $ext [ 'state' ] == 'CS_CONSUME_MEDIA' && $ext [ 'callstate' ] == 'HELD' && $ext [ 'direction' ] == 'outbound' ) {
$ext_state = 'held' ;
}
else if ( $ext [ 'state' ] == 'CS_EXCHANGE_MEDIA' && $ext [ 'callstate' ] == 'HELD' && $ext [ 'direction' ] == 'outbound' ) {
$ext_state = 'held' ;
}
2016-04-26 03:30:23 +02:00
$dir_icon = 'inbound' ;
$call_name = $activity [ $ext [ 'cid_num' ]][ 'effective_caller_id_name' ];
$call_number = format_phone ( $ext [ 'cid_num' ]);
}
else {
unset ( $ext_state , $dir_icon , $call_name , $call_number );
}
2020-08-27 17:14:39 +02:00
//determin extension register status
$extension_number = $extension . '@' . $_SESSION [ 'domain_name' ];
$found_count = 0 ;
if ( is_array ( $registrations )) {
foreach ( $registrations as $array ) {
if ( $extension_number == $array [ 'user' ]) {
$found_count ++ ;
}
}
}
if ( $found_count > 0 ) {
//determine block style by state (if any) and register status
$style = ( $ext_state != '' ) ? " op_ext op_state_ " . $ext_state : " op_ext " ;
} else {
$style = " off_ext " ;
}
unset ( $extension_number , $found_count , $array );
2016-04-26 03:30:23 +02:00
//determine the call identifier passed on drop
if ( $ext [ 'uuid' ] == $ext [ 'call_uuid' ] && $ext [ 'variable_bridge_uuid' ] == '' ) { // transfer an outbound internal call
$call_identifier = $activity [ $call_number ][ 'uuid' ];
}
else if (( $ext [ 'variable_call_direction' ] == 'outbound' || $ext [ 'variable_call_direction' ] == 'local' ) && $ext [ 'variable_bridge_uuid' ] != '' ) { // transfer an outbound external call
$call_identifier = $ext [ 'variable_bridge_uuid' ];
}
else {
if ( $ext [ 'call_uuid' ] ) {
$call_identifier = $ext [ 'call_uuid' ]; // transfer all other call types
}
else {
$call_identifier = $ext [ 'uuid' ]; // e.g. voice menus
}
}
//determine extension draggable state
if ( permission_exists ( 'operator_panel_manage' )) {
if ( ! in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ])) {
//other extension
if ( $ext_state == " ringing " ) {
if ( $_GET [ 'vd_ext_from' ] == '' && $dir_icon == 'inbound' ) {
$draggable = true ; // selectable - is ringing and not outbound so can transfer away the call (can set as vd_ext_from)
}
else {
$draggable = false ; // unselectable - is ringing so can't send a call to the ext (can't set as vd_ext_to)
}
}
else if ( $ext_state == 'active' ) {
$draggable = false ; // unselectable - on a call already so can't transfer or send a call to the ext (can't set as vd_ext_from or vd_ext_to)
}
else { // idle
if ( $_GET [ 'vd_ext_from' ] == '' ) {
$draggable = false ; // unselectable - is idle, but can't initiate a call from the ext as is not assigned to user (can't set as vd_ext_from)
}
else {
$draggable = true ; // selectable - is idle, so can transfer a call in to ext (can set as vd_ext_to).
}
}
}
else {
//user extension
if ( $ext [ 'uuid' ] != '' && $ext [ 'uuid' ] == $ext [ 'call_uuid' ] && $ext [ 'variable_bridge_uuid' ] == '' ) {
$draggable = false ;
}
else if ( $ext_state == 'ringing' && $ext [ 'variable_call_direction' ] == 'local' ) {
$draggable = false ;
}
else if ( $ext_state != '' && ! $format_number ) {
$draggable = false ;
}
else {
$draggable = true ;
}
}
}
else {
$draggable = false ;
}
//determine extension (user) status
$ext_status = ( in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ])) ? $ext_user_status [ $_SESSION [ 'user_uuid' ]] : $ext_user_status [ $ext [ 'user_uuid' ]];
switch ( $ext_status ) {
case " Available " :
$status_icon = " available " ;
$status_hover = $text [ 'label-status_available' ];
break ;
case " Available (On Demand) " :
$status_icon = " available_on_demand " ;
$status_hover = $text [ 'label-status_available_on_demand' ];
break ;
case " On Break " :
$status_icon = " on_break " ;
$status_hover = $text [ 'label-status_on_break' ];
break ;
case " Do Not Disturb " :
$status_icon = " do_not_disturb " ;
$status_hover = $text [ 'label-status_do_not_disturb' ];
break ;
default :
$status_icon = " logged_out " ;
$status_hover = $text [ 'label-status_logged_out_or_unknown' ];
2020-08-27 17:14:39 +02:00
}
2016-04-26 03:30:23 +02:00
2020-08-27 17:14:39 +02:00
$block .= " <div id=' " . escape ( $extension ) . " ' class=' " . $style . " ' " . (( $_GET [ 'vd_ext_from' ] == $extension || $_GET [ 'vd_ext_to' ] == $extension ) ? " style='border-style: dotted;' " : null ) . " " . (( $ext_state != 'active' && $ext_state != 'ringing' ) ? " ondrop='drop(event, this.id);' ondragover='allowDrop(event, this.id);' ondragleave='discardDrop(event, this.id);' " : null ) . " > " ; // DRAG TO
$block .= " <table class=' " . $style . " '> " ;
2016-04-26 03:30:23 +02:00
$block .= " <tr> " ;
$block .= " <td class='op_ext_icon'> " ;
2019-08-10 17:56:11 +02:00
$block .= " <span name=' " . escape ( $extension ) . " '> " ; // DRAG FROM
$block .= " <img id=' " . escape ( $call_identifier ) . " ' class='op_ext_icon' src='resources/images/status_ " . $status_icon . " .png' title=' " . $status_hover . " ' " . (( $draggable ) ? " draggable='true' ondragstart= \" drag(event, this.parentNode.getAttribute('name')); \" onclick= \" virtual_drag(' " . escape ( $call_identifier ) . " ', ' " . escape ( $extension ) . " '); \" " : " onfocus='this.blur();' draggable='false' style='cursor: not-allowed;' " ) . " > " ;
2016-04-26 03:30:23 +02:00
$block .= " </span> " ;
$block .= " </td> " ;
$block .= " <td class='op_ext_info " . $style . " '> " ;
if ( $dir_icon != '' ) {
$block .= " <img src='resources/images/ " . $dir_icon . " .png' align='right' style='margin-top: 3px; margin-right: 1px; width: 12px; height: 12px; cursor: help;' draggable='false' alt= \" " . $text [ 'label-call_direction' ] . " \" title= \" " . $text [ 'label-call_direction' ] . " \" > " ;
}
$block .= " <span class='op_user_info'> " ;
2019-08-10 17:56:11 +02:00
if ( $ext [ 'effective_caller_id_name' ] != '' && escape ( $ext [ 'effective_caller_id_name' ]) != $extension ) {
$block .= " <strong class='strong'> " . escape ( $ext [ 'effective_caller_id_name' ]) . " </strong> ( " . escape ( $extension ) . " ) " ;
2016-04-26 03:30:23 +02:00
}
else {
2019-08-10 17:56:11 +02:00
$block .= " <strong class='strong'> " . escape ( $extension ) . " </strong> " ;
2016-04-26 03:30:23 +02:00
}
$block .= " </span><br> " ;
if ( $ext_state != '' ) {
$block .= " <span class='op_caller_info'> " ;
$block .= " <table align='right'><tr><td style='text-align: right;'> " ;
2019-08-10 17:56:11 +02:00
$block .= " <span class='op_call_info'> " . escape ( $ext [ 'call_length' ]) . " </span><br> " ;
2016-04-26 03:30:23 +02:00
$block .= " <span class='call_control'> " ;
//record
if ( permission_exists ( 'operator_panel_record' ) && $ext_state == 'active' ) {
$call_identifier_record = $ext [ 'call_uuid' ];
2020-12-09 18:42:21 +01:00
$rec_file = $_SESSION [ 'switch' ][ 'recordings' ][ 'dir' ] . " / " . $_SESSION [ 'domain_name' ] . " /archive/ " . date ( " Y " ) . " / " . date ( " M " ) . " / " . date ( " d " ) . " / " . escape ( $call_identifier_record ) . " .wav " ;
2016-04-26 03:30:23 +02:00
if ( file_exists ( $rec_file )) {
$block .= " <img src='resources/images/recording.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: help;' title= \" " . $text [ 'label-recording' ] . " \" " . $onhover_pause_refresh . " > " ;
}
else {
$block .= " <img src='resources/images/record.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title= \" " . $text [ 'label-record' ] . " \" onclick= \" record_call(' " . $call_identifier_record . " '); \" " . $onhover_pause_refresh . " > " ;
}
}
//eavesdrop
if ( permission_exists ( 'operator_panel_eavesdrop' ) && $ext_state == 'active' && sizeof ( $_SESSION [ 'user' ][ 'extensions' ]) > 0 && ! in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ])) {
2019-08-10 17:56:11 +02:00
$block .= " <img src='resources/images/eavesdrop.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title=' " . $text [ 'label-eavesdrop' ] . " ' onclick= \" eavesdrop_call(' " . escape ( $ext [ 'destination' ]) . " ',' " . escape ( $call_identifier ) . " '); \" " . $onhover_pause_refresh . " > " ;
2016-04-26 03:30:23 +02:00
}
2019-07-12 18:42:41 +02:00
//hangup
if ( permission_exists ( 'operator_panel_hangup' ) || in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ])) {
2016-04-26 03:30:23 +02:00
if ( $ext [ 'variable_bridge_uuid' ] == '' && $ext_state == 'ringing' ) {
2019-07-12 18:42:41 +02:00
$call_identifier_hangup_uuid = $ext [ 'uuid' ];
2016-04-26 03:30:23 +02:00
}
else if ( $dir_icon == 'outbound' ) {
2019-07-12 18:42:41 +02:00
$call_identifier_hangup_uuid = $ext [ 'uuid' ];
2016-04-26 03:30:23 +02:00
}
else {
2019-07-12 18:42:41 +02:00
$call_identifier_hangup_uuid = $call_identifier ;
2016-04-26 03:30:23 +02:00
}
2019-08-10 17:56:11 +02:00
$block .= " <img src='resources/images/kill.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title=' " . $text [ 'label-hangup' ] . " ' onclick= \" hangup_call(' " . escape ( $call_identifier_hangup_uuid ) . " '); \" " . $onhover_pause_refresh . " > " ;
2016-04-26 03:30:23 +02:00
}
$block .= " </span> " ;
//transfer
if ( in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ]) && $ext_state == 'active' ) {
2019-08-10 17:56:11 +02:00
$block .= " <img id='destination_control_ " . escape ( $extension ) . " _transfer' class='destination_control' src='resources/images/keypad_transfer.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' onclick= \" toggle_destination(' " . escape ( $extension ) . " ', 'transfer'); \" " . $onhover_pause_refresh . " > " ;
2016-04-26 03:30:23 +02:00
}
$block .= " </td></tr></table> " ;
2018-05-04 04:46:37 +02:00
if ( permission_exists ( 'operator_panel_call_details' )) {
2019-08-10 17:56:11 +02:00
$block .= " <span id='op_caller_details_ " . escape ( $extension ) . " '><strong> " . escape ( $call_name ) . " </strong><br> " . escape ( $call_number ) . " </span> " ;
2018-05-04 04:46:37 +02:00
}
2016-04-26 03:30:23 +02:00
$block .= " </span> " ;
//transfer
if ( in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ]) && $ext_state == 'active' ) {
$call_identifier_transfer = $ext [ 'variable_bridge_uuid' ];
2019-08-10 17:56:11 +02:00
$block .= " <form id='frm_destination_ " . escape ( $extension ) . " _transfer' onsubmit= \" go_destination(' " . escape ( $extension ) . " ', document.getElementById('destination_ " . escape ( $extension ) . " _transfer').value, 'transfer', ' " . escape ( $call_identifier_transfer ) . " '); return false; \" > " ;
$block .= " <input type='text' class='formfld' id='destination_ " . escape ( $extension ) . " _transfer' style='width: 100px; min-width: 100px; max-width: 100px; margin-top: 3px; text-align: center; display: none;' onblur= \" toggle_destination(' " . escape ( $extension ) . " ', 'transfer'); \" > " ;
2016-04-26 03:30:23 +02:00
$block .= " </form> \n " ;
}
}
else {
//call
if ( in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ])) {
2019-08-10 17:56:11 +02:00
$block .= " <img id='destination_control_ " . escape ( $extension ) . " _call' class='destination_control' src='resources/images/keypad_call.png' style='width: 12px; height: 12px; border: none; margin-top: 26px; margin-right: 1px; cursor: pointer;' align='right' onclick= \" toggle_destination(' " . escape ( $extension ) . " ', 'call'); \" " . $onhover_pause_refresh . " > " ;
$block .= " <form id='frm_destination_ " . escape ( $extension ) . " _call' onsubmit= \" go_destination(' " . escape ( $extension ) . " ', document.getElementById('destination_ " . escape ( $extension ) . " _call').value, 'call'); return false; \" > " ;
$block .= " <input type='text' class='formfld' id='destination_ " . escape ( $extension ) . " _call' style='width: 100px; min-width: 100px; max-width: 100px; margin-top: 10px; text-align: center; display: none;' onblur= \" toggle_destination(' " . escape ( $extension ) . " ', 'call'); \" > " ;
2016-04-26 03:30:23 +02:00
$block .= " </form> \n " ;
}
}
$block .= " </td> " ;
$block .= " </tr> " ;
$block .= " </table> " ;
if ( if_group ( " superadmin " ) && isset ( $_GET [ 'debug' ])) {
$block .= " <span style='font-size: 10px;'> " ;
2019-08-10 17:56:11 +02:00
$block .= " From ID<br> <strong style='color: maroon'> " . escape ( $extension ) . " </strong><br> " ;
$block .= " uuid<br> <strong style='color: " . ( $call_identifier == $ext [ 'uuid' ] ? 'blue' : 'black' ) . " ;'> " . escape ( $ext [ 'uuid' ]) . " </strong><br> " ;
$block .= " call_uuid<br> <strong style='color: " . ( $call_identifier == $ext [ 'call_uuid' ] ? 'blue' : 'black' ) . " ;'> " . escape ( $ext [ 'call_uuid' ]) . " </strong><br> " ;
$block .= " variable_bridge_uuid<br> <strong style='color: " . ( $call_identifier == $ext [ 'variable_bridge_uuid' ] ? 'blue' : 'black' ) . " ;'> " . escape ( $ext [ 'variable_bridge_uuid' ]) . " </strong><br> " ;
$block .= " direction<br> <strong style='color: black;'> " . escape ( $ext [ 'direction' ]) . " </strong><br> " ;
$block .= " variable_call_direction<br> <strong style='color: black;'> " . escape ( $ext [ 'variable_call_direction' ]) . " </strong><br> " ;
$block .= " state<br> <strong style='color: black;'> " . escape ( $ext [ 'state' ]) . " </strong><br> " ;
$block .= " cid_num<br> <strong style='color: black;'> " . escape ( $ext [ 'cid_num' ]) . " </strong><br> " ;
$block .= " dest<br> <strong style='color: black;'> " . escape ( $ext [ 'dest' ]) . " </strong><br> " ;
$block .= " context<br> <strong style='color: black;'> " . escape ( $ext [ 'context' ]) . " </strong><br> " ;
$block .= " presence_id<br> <strong style='color: black;'> " . escape ( $ext [ 'presence_id' ]) . " </strong><br> " ;
$block .= " callstate<br> <strong style='color: black;'> " . escape ( $ext [ 'callstate' ]) . " </strong><br> " ;
2016-04-26 03:30:23 +02:00
$block .= " </span> " ;
}
$block .= " </div> " ;
if ( in_array ( $extension , $_SESSION [ 'user' ][ 'extensions' ])) {
$user_extensions [] = $block ;
}
else {
$other_extensions [] = $block ;
}
}
2020-02-13 19:12:14 +01:00
if ( is_array ( $user_extensions ) && @ sizeof ( $user_extensions ) > 0 ) {
2016-04-26 03:30:23 +02:00
echo " <table width='100%'><tr><td> " ;
2016-05-11 17:20:10 +02:00
if ( is_array ( $user_extensions )) foreach ( $user_extensions as $ext_block ) {
2016-04-26 03:30:23 +02:00
echo $ext_block ;
}
echo " </td></tr></table> " ;
}
if ( $_REQUEST [ 'group' ] != '' ) {
2020-02-13 19:12:14 +01:00
if ( is_array ( $user_extensions ) && @ sizeof ( $user_extensions ) > 0 ) { echo " <br> " ; }
2019-08-10 17:56:11 +02:00
echo " <strong style='color: black;'> " . ucwords ( escape ( $_REQUEST [ 'group' ])) . " </strong> " ;
2016-04-26 03:30:23 +02:00
echo " <br><br> " ;
}
2020-02-13 19:12:14 +01:00
else if ( is_array ( $user_extensions ) && @ sizeof ( $user_extensions ) > 0 ) {
2016-04-26 03:30:23 +02:00
echo " <br> " ;
echo " <strong style='color: black;'> " . $text [ 'label-other_extensions' ] . " </strong> " ;
echo " <br><br> " ;
}
if ( sizeof ( $other_extensions ) > 0 ) {
echo " <table width='100%'><tr><td> " ;
2016-05-11 17:20:10 +02:00
if ( is_array ( $other_extensions )) foreach ( $other_extensions as $ext_block ) {
2016-04-26 03:30:23 +02:00
echo $ext_block ;
}
echo " </td></tr></table> " ;
}
else {
echo $text [ 'label-no_extensions_found' ];
}
echo " <br><br> " ;
2019-04-05 21:56:45 +02:00
/*
2016-04-26 03:30:23 +02:00
if ( if_group ( " superadmin " ) && isset ( $_GET [ 'debug' ])) {
echo '$activity<br>' ;
echo " <textarea style='width: 100%; height: 600px; overflow: scroll;' onfocus='refresh_stop();' onblur='refresh_start();'> " ;
print_r ( $activity );
echo " </textarea> " ;
echo " <br><br> " ;
echo '$_SESSION<br>' ;
echo " <textarea style='width: 100%; height: 600px; overflow: scroll;' onfocus='refresh_stop();' onblur='refresh_start();'> " ;
print_r ( $_SESSION );
echo " </textarea> " ;
}
2019-04-05 21:56:45 +02:00
*/
2017-01-29 21:05:05 +01:00
2016-04-26 03:30:23 +02:00
?>