$away = Aastra_manage_presence_Asterisk($selection, 'get', 'status'); # Labels for status $status_text = Aastra_status_config_Asterisk(); # Check notification if ($away['status'] != AA_PRESENCE_AVAILABLE) { $explodem = explode(',', $away['notifym']); $explodev = explode(',', $away['notifyv']); $real_user = Aastra_get_userdevice_Asterisk($user); if (in_array($real_user, $explodem) or in_array($real_user, $explodev)) { $notify = True; } else { $notify = False; } } else { # Dynamic status $hint = Aastra_get_user_hint_asterisk($selection); } # Use a FormattedTextScreen require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setDestroyOnExit(); # Define color based on status if ($away['status'] != AA_PRESENCE_AVAILABLE) { $color = 'red'; } else { if ($hint == 'Idle') { $color = 'green'; } else { $color = 'red'; } }
if ($away['status'] != AA_PRESENCE_AVAILABLE) { if ($away['status'] == AA_PRESENCE_DISCONNECTED) { $color = 'red'; } else { $color = 'yellow'; } $line[] = array($callerid . ' (' . $number . ')', 'double', $color); $line[] = array($status_text[$away['status']]['label'], $color); $date_time = Aastra_format_presence_dt_Asterisk($away['return']); foreach ($date_time as $value) { $line[] = array($value); } } else { $line[] = array($callerid . ' (' . $number . ')', 'double', 'green'); $line[] = array($status_text[$away['status']]['label'], 'green'); $hint = Aastra_get_user_hint_asterisk($number); $array_hint = explode('&', $hint); $array_hint = array_flip($array_hint); unset($array_hint['Ringing']); $array_hint = array_flip($array_hint); if (!strstr($array_hint[0], 'Idle') and $array_hint[0] != '') { $line[] = array(Aastra_get_label('Phone is in use', $language), 'yellow'); } } } else { # Presence disabled $line[] = array($callerid, 'double'); $line[] = array(sprintf(Aastra_get_label('Ext. %s', $language), $number)); } } else { # External call