if ($id == null && !$polycom_request) { die; } if ($polycom_request) { $matches = array(); preg_match('/FileTransport Polycom([^\\/.]*)/', $_SERVER['HTTP_USER_AGENT'], $matches); if ($id == null) { sql("INSERT INTO polycom_devices (name, mac, model, lastconfig, lastip) \n\t\t\tVALUES ('Auto Added','" . $db->escapeSimple($_GET['mac']) . "','" . $db->escapeSimple($matches[1]) . "',NOW(),'" . $db->escapeSimple($_SERVER['REMOTE_ADDR']) . "')"); $id = sql("SELECT LAST_INSERT_ID()", 'getOne'); polycomphones_clear_overrides($_GET['mac']); polycomphones_save_phones_directory($_GET['mac'], array()); } else { sql("UPDATE polycom_devices SET lastconfig = NOW(), \n\t\t\tmodel = '" . $db->escapeSimple($matches[1]) . "',\n\t\t\tlastip = '" . $db->escapeSimple($_SERVER['REMOTE_ADDR']) . "'\n\t\t\tWHERE id = '" . $db->escapeSimple($id) . "'"); } } $device = polycomphones_get_phones_edit($id); $alerts = polycomphones_get_alertinfo_list(); $general = polycomphones_get_general_edit(); $exchange_module = polycomphones_check_module('exchangeum'); $parking_module = polycomphones_check_module('parking'); $features_module = polycomphones_check_module('phonefeatures'); // Lines $primary = ''; $flexiblekeys = array_reverse(polycomphones_get_flexiblekeys($device, 'line')); $i = 1; foreach ($device['lines'] as $line) { if ($line['deviceid'] != null) { $details = sql(' SELECT d.id, d.user, u.name, ssecret.data AS pass, stransport.data AS transport FROM devices AS d
$fields = array('lineKey_reassignment_enabled', 'lineKey_category_line', 'lineKey_category_blf', 'lineKey_category_favorites', 'lineKey_category_unassigned', 'softkey_feature_basicCallManagement_redundant', 'call_transfer_blindPreferred', 'call_callWaiting_ring', 'call_hold_localReminder_enabled', 'call_rejectBusyOnDnd', 'up_useDirectoryNames', 'dir_local_readonly', 'se_pat_misc_messageWaiting_inst', 'apps_ucdesktop_adminEnabled', 'up_headsetMode', 'up_analogHeadsetOption', 'attendant_ringType', 'feature_directedCallPickup_enabled', 'attendant_spontaneousCallAppearances_normal', 'attendant_spontaneousCallAppearances_automata', 'powerSaving_enable', 'up_backlight_idleIntensity', 'up_backlight_onIntensity', 'feature_corporateDirectory_enabled', 'feature_exchangeCalendar_enabled'); foreach ($fields as $field) { $device['settings'][$field] = $_POST[$field]; } polycomphones_save_phones_edit($_GET['edit'], $device); polycomphones_multiple_check(); // Push config sends HTTP request to the IP address of the phone // Works for internal phones even when they don't have a SIP registration if (polycomphones_push_checkconfig($_GET['edit']) !== true) { // Fallback to SIP notify which will work for external phones with a SIP registration polycomphones_checkconfig($_GET['edit']); } redirect('config.php?type=setup&display=polycomphones&polycomphones_form=phones_list'); } $features_module = polycomphones_check_module('phonefeatures'); $device = polycomphones_get_phones_edit($_GET['edit']); foreach ($device['lines'] as $key => $line) { if ($line['deviceid'] != null) { $device['lines'][$key]['line'] = 'freepbx_' . $line['deviceid']; } elseif ($line['externalid'] != null) { $device['lines'][$key]['line'] = 'external_' . $line['externalid']; } } foreach ($device['attendants'] as $key => $attendant) { $device['attendants'][$key]['attendant'] = $attendant['keyword'] . '_' . $attendant['value']; } require 'modules/polycomphones/views/polycomphones_phones_edit.php'; break; case 'phones_directory': if (isset($_POST['action']) && $_POST['action'] == 'edit') { $fields = array('fn', 'ln', 'ct', 'sd', 'rt', 'bw');