Aastra_delete_mac($ext_array[$extension]['mac']); $notify_type = 'aastra-check-cfg'; } Aastra_send_SIP_notify_Asterisk($notify_type, array($extension)); } else { if ($ext_array[$extension]['model'] != 'Aastra8000i') { Aastra_delete_mac($ext_array[$extension]['mac']); } } # Send an email Aastra_send_HDmail($ext_array[$extension], $callerid, 'FORCED LOGOUT', $AA_EMAIL, $AA_SENDER); } # Update config file Aastra_update_HDconfig_file(AASTRA_PATH_CACHE . 'startup_asterisk.cfg', $extension, $header); # Save signature Aastra_store_signature($extension); # Send an email Aastra_send_HDmail($header, $callerid . ' ' . $extension, 'LOGIN', $AA_EMAIL, $AA_SENDER); # Set status to Available if ($AA_FREEPBX_MODE == '1' and $AA_PRESENCE_STATE) { if (Aastra_manage_presence_Asterisk($extension, 'status') == AA_PRESENCE_DISCONNECTED) { Aastra_manage_presence_Asterisk($extension, 'set', 'status', AA_PRESENCE_AVAILABLE); $away = Aastra_manage_presence_Asterisk($extension, 'action'); switch ($away['action'][AA_PRESENCE_DISCONNECTED]) { case AA_PRESENCE_ACT_FM: Aastra_manage_followme_Asterisk($extension, 'disable'); break; case AA_PRESENCE_ACT_CFWD: Aastra_manage_cf_Asterisk($extension, 'cancel'); break; }
function Aastra_check_signature_Asterisk($user) { global $AA_FREEPBX_MODE; global $AA_PHONE_SIGNATURE; # Return if device/user mode if ($AA_FREEPBX_MODE == '2' or !$AA_PHONE_SIGNATURE) { return; } # Retrieve stored signature $signature = Aastra_read_signature($user); # Maybe a first time if ($signature['signature'] == '') { # Store the signature Aastra_store_signature($user); } else { # Check signature if (Aastra_getphone_fingerprint() != $signature['signature']) { # Debug Aastra_debug('function=Aastra_check_signature, Phone fingerprint mismatch. Stored=' . $signature['signature'] . ' Current= ' . Aastra_getphone_fingerprint()); # Display Error $output = "<AastraIPPhoneTextScreen>\n"; $output .= "<Title>Authentication Error</Title>\n"; $output .= "<Text>You are not authorized to use this application. Please contact your administrator.</Text>\n"; $output .= "</AastraIPPhoneTextScreen>\n"; header("Content-Type: text/xml"); header("Content-Length: " . strlen($output)); echo $output; exit; } } }
$register = Aastra_get_user_context($user, 'register'); $time = time(); if ($time - $register < 2) { require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); $object->addEntry(''); $object->output(); exit; } else { Aastra_save_user_context($user, 'register', $time); } } # User and extension mode if ($AA_FREEPBX_MODE == '1') { # Store the signature and update phone data Aastra_store_signature($user); Aastra_update_HDconfig_file(AASTRA_PATH_CACHE . 'startup_asterisk.cfg', $user, $header); # Init keys from MAC.cfg init_special_keys($user); # Update user keys update_user_keys($user); # Sync applications $object = sync_apps($user, 'register'); } else { # Retrieve device and user $device = $user; $user = Aastra_get_userdevice_Asterisk($device); # Get device context $data = Aastra_get_user_context($device, 'login_out'); $last_user = $data['user']; # Generate the dynamic configuration