$combined = 0; # Retrieve status for all configured indexes $array_night = Aastra_manage_daynight_Asterisk('get_all', ''); # Get last Day/Night status $data = Aastra_get_user_context($user, 'daynight'); # Prepare display update require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); # Each configured index foreach ($array_night as $index => $value) { # Combined state if ($value['night'] == '1') { $combined = '1'; } # User notified for this index? if (Aastra_is_daynight_notify_allowed_Asterisk($user, $index)) { # Update needed by default $update = 1; # Get current Day/Night status $night = $value['night']; $last = $data['last'][$index]; # Update Day/Night status if ($last != $night) { $data['last'][$index] = $night; $context = True; } # Update needed? if ($action == 'check' and $night == $last) { $update = 0; } if ($action == 'register' and $night == 0) {
function Aastra_propagate_daynight_Asterisk($device, $index) { global $ASTERISK_LOCATION; # Get the list of devices $sip_array = Aastra_readINIfile($ASTERISK_LOCATION . 'sip_additional.conf', ';', '='); foreach ($sip_array as $key => $value) { if ($value['callerid'] != '') { $array_device[] = $key; } } # Remove current device $array_device = array_flip($array_device); unset($array_device[$device]); unset($array_device['']); $array_device = array_flip($array_device); # Remove the devices without the application foreach ($array_device as $key => $value) { if (!Aastra_is_daynight_notify_allowed_Asterisk(Aastra_get_userdevice_Asterisk($value), $index)) { unset($array_device[$key]); } else { $data = Aastra_get_user_context($value, 'notify'); $data['daynight'] = '1'; Aastra_save_user_context($value, 'notify', $data); } } # Send Notification Aastra_send_SIP_notify_Asterisk('aastra-xml', $array_device); }
function sync_apps($user, $action) { global $XML_SERVER_PATH; global $AA_AUTOLOGOUT; global $AA_AUTOLOGOUT_MSG; global $AA_FREEPBX_MODE; # Get phone information $header = Aastra_decode_HTTP_header(); # Retrieve feature keys $cfwd = Aastra_get_user_context($user, 'cfwd'); $dnd = Aastra_get_user_context($user, 'dnd'); $away = Aastra_get_user_context($user, 'away'); $agent = Aastra_get_user_context($user, 'agent'); $parking = Aastra_get_user_context($user, 'parking'); $vmail = Aastra_get_user_context($user, 'vmail'); $follow = Aastra_get_user_context($user, 'follow'); $logout = Aastra_get_user_context($user, 'autologout'); # Update DND, CFWD, DAYNIGHT, PRESENCE, AGENT, PARKING, VMAIL and FOLLOW-ME require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); if ($cfwd['key'] != '' or $header['mac'] == 'Aastra51i') { $object->addEntry($XML_SERVER_PATH . 'cfwd.php?action=' . $action . '&user='******'key'] != '' or $header['mac'] == 'Aastra51i') { $object->addEntry($XML_SERVER_PATH . 'dnd.php?action=' . $action . '&user='******'daynight.php?action=' . $action . '&user='******'key'] != '' or $header['mac'] == 'Aastra51i') { $object->addEntry($XML_SERVER_PATH . 'away.php?action=' . $action . '&user='******'key'] != '' or $header['mac'] == 'Aastra51i') { $object->addEntry($XML_SERVER_PATH . 'agent.php?action=' . $action . '&agent=' . $user); } if ($follow['key'] != '' or $header['mac'] == 'Aastra51i') { $object->addEntry($XML_SERVER_PATH . 'follow.php?action=' . $action . '&user='******'1' and Aastra_is_sip_notify_supported() and $AA_AUTOLOGOUT and $AA_AUTOLOGOUT_MSG) { $object->addEntry($XML_SERVER_PATH . 'logout.php?action=' . $action . '&user='******'register' and Aastra_is_ledcontrol_supported()) { if ($parking['key'] != '') { $status = Aastra_get_user_context('parking', 'status'); if ($status == '') { $status = 'off'; } $object->addEntry('Led: ' . $parking['key'] . '=' . $status); } $status = Aastra_get_user_context('vmail', 'user'); foreach ($vmail as $box => $key) { $object->addEntry('Led: ' . $key['key'] . '=' . $status[$box]['status']); } } $object->addEntry(''); # Return object return $object; }