function Aastra_get_polling_interval_Asterisk($header = NULL) { global $AA_FREEPBX_USEDEVSTATE; # 30 minutes by default $polling = '1800'; # DEVSTATE and Notify if ($AA_FREEPBX_USEDEVSTATE and Aastra_is_sip_notify_supported($header)) { $polling = '86400'; } # Return value return $polling; }
$action = Aastra_getvar_safe('action', 'main'); $state = Aastra_getvar_safe('state'); $value1 = Aastra_getvar_safe('value1'); $value2 = Aastra_getvar_safe('value2'); $step = Aastra_getvar_safe('step', '1'); $type = Aastra_getvar_safe('type'); $selection = Aastra_getvar_safe('selection'); # Trace Aastra_trace_call('away_asterisk', 'user='******', action=' . $action . ', state=' . $state . ', value1=' . $value1); # Test User Agent Aastra_test_phone_versions(array('1' => '1.4.2.', '2' => '1.4.2.', '3' => '2.5.3.', '4' => '2.5.3.', '5' => '3.0.1.'), '0'); # Get Language $language = Aastra_get_language(); # Global compatibility $nb_softkeys = Aastra_number_softkeys_supported(); $is_sip_notify = Aastra_is_sip_notify_supported(); # Check if presence is configured if (!$AA_PRESENCE_STATE and $action == 'main') { # Display error message require_once 'AastraIPPhoneTextScreen.class.php'; $object = new AastraIPPhoneTextScreen(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('System Error', $language)); $object->setText(Aastra_get_label('Presence is not enabled on your system. Please contact your administrator.', $language)); if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } }
$array_night = Aastra_manage_daynight_Asterisk('get_all', ''); # Next actions require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); # Force day or night foreach ($array_night as $i => $value) { $update = False; if ($value['night'] == '1' and $action == 'day') { $update = True; } if ($value['night'] == '0' and $action == 'night') { $update = True; } if ($update) { $night = Aastra_manage_daynight_Asterisk('change', $i); if (!$AA_FREEPBX_USEDEVSTATE or !Aastra_is_sip_notify_supported()) { # Send a SIP Notification to everybody allowd Aastra_propagate_daynight_Asterisk($user, $i); } } } # Update via the "check" mechanism $object->addEntry($XML_SERVER . '&action=check'); # Back to the list $object->addEntry($XML_SERVER . '&action=list&index=' . $index); break; # Default # Default default: # Unexpected action Aastra_debug('Unexpected action: ' . $action);
function init_special_keys($user, $array_config = NULL) { # Mode if ($array_config == NULL) { # Get MAC address and type of phone $header = Aastra_decode_HTTP_header(); # Read config file $array_temp = Aastra_readCFGfile(AASTRA_TFTP_DIRECTORY . '/' . $header['mac'] . '.cfg', '#', ':'); $array_config = $array_temp['']; } # Global parameters $is_sip_notify_supported = Aastra_is_sip_notify_supported(); # Remove the special keys $cfwd['key'] = ''; $dnd['key'] = ''; $daynight['key'] = array(); $away['key'] = ''; $agent['key'] = ''; $follow['key'] = ''; $parking['key'] = ''; $vmail = array(); Aastra_remove_parking_Asterisk($user); $count = !Aastra_is_ledcontrol_supported(); Aastra_remove_vmail_Asterisk('', $user, $count); # Some data if ($array_config != NULL) { foreach ($array_config as $key => $value) { if (strstr($value, 'dnd.php')) { $pieces = explode(' ', $key); if (stristr($pieces[0], 'expmod')) { $dnd['key'] = $pieces[0] . ' ' . $pieces[1]; } else { $dnd['key'] = $pieces[0]; } } if (strstr($value, 'cfwd.php')) { $pieces = explode(' ', $key); if (stristr($pieces[0], 'expmod')) { $cfwd['key'] = $pieces[0] . ' ' . $pieces[1]; } else { $cfwd['key'] = $pieces[0]; } } if (strstr($value, 'daynight.php')) { $pieces = explode(' ', $key); if (stristr($pieces[0], 'expmod')) { $key = $pieces[0] . ' ' . $pieces[1]; } else { $key = $pieces[0]; } $url = parse_url($value); parse_str($url['query'], $parse); if (isset($parse['index'])) { if ($parse['index'] != '') { $daynight['key'][$parse['index']] = $key; } else { $daynight['key']['ALL'] = $key; } } else { $daynight['key']['ALL'] = $key; } } if (strstr($value, 'away.php')) { $pieces = explode(' ', $key); if (stristr($pieces[0], 'expmod')) { $away['key'] = $pieces[0] . ' ' . $pieces[1]; } else { $away['key'] = $pieces[0]; } } if (strstr($value, 'agent.php')) { $pieces = explode(' ', $key); if (stristr($pieces[0], 'expmod')) { $agent['key'] = $pieces[0] . ' ' . $pieces[1]; } else { $agent['key'] = $pieces[0]; } } if (strstr($value, 'follow.php')) { $pieces = explode(' ', $key); if (stristr($pieces[0], 'expmod')) { $follow['key'] = $pieces[0] . ' ' . $pieces[1]; } else { $follow['key'] = $pieces[0]; } } if (strstr($value, 'park.php') and $is_sip_notify_supported) { $pieces = explode(' ', $key); if (stristr($pieces[0], 'expmod')) { $parking['key'] = $pieces[0] . ' ' . $pieces[1]; } else { $parking['key'] = $pieces[0]; } Aastra_add_parking_Asterisk($user); } if (strstr($value, 'vmail.php') and $is_sip_notify_supported) { $url = parse_url($value); parse_str($url['query'], $parse); if ($parse['user'] != '') { Aastra_add_vmail_Asterisk($parse['user'], $user, $count); $pieces = explode(' ', $key); if (stristr($pieces[0], 'expmod')) { $vmail[$parse['user']]['key'] = $pieces[0] . ' ' . $pieces[1]; if (isset($array_config[$pieces[0] . ' ' . $pieces[1] . ' label'])) { $vmail[$parse['user']]['label'] = $array_config[$pieces[0] . ' ' . $pieces[1] . ' label']; } else { $vmail[$parse['user']]['label'] = ''; } } else { if (stristr($pieces[0], 'key')) { $vmail[$parse['user']]['key'] = $pieces[0]; if (isset($array_config[$pieces[0] . ' label'])) { $vmail[$parse['user']]['label'] = $array_config[$pieces[0] . ' label']; } else { $vmail[$parse['user']]['label'] = ''; } } } } } } } # Cache them for the device not the user Aastra_save_user_context($user, 'cfwd', $cfwd); Aastra_save_user_context($user, 'dnd', $dnd); Aastra_save_user_context($user, 'daynight', $daynight); Aastra_save_user_context($user, 'away', $away); Aastra_save_user_context($user, 'agent', $agent); Aastra_save_user_context($user, 'follow', $follow); Aastra_save_user_context($user, 'parking', $parking); Aastra_save_user_context($user, 'vmail', $vmail); }