$object->setType('string'); $object->setTitle(Aastra_get_label('Ask Google', $language)); $object->setPrompt(Aastra_get_label('Enter your question', $language)); $object->setParameter('question'); $object->setURL($XML_SERVER); $data = Aastra_get_user_context($user, 'google'); if ($data['last'] != NULL) { $default = $data['last']; } else { $default = 'Define SIP'; } $object->setDefault($default); # Softkeys if ($nb_softkeys > 0) { if ($nb_softkeys < 7) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('2', Aastra_get_label('Help', $language), $XML_SERVER . '&question=help'); $object->addSoftkey('3', Aastra_get_label('ABC', $language), 'SoftKey:ChangeMode'); $object->addSoftkey('4', Aastra_get_label('NextSpace', $language), 'SoftKey:NextSpace'); $object->addSoftkey('5', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } } else { # keep track $data['last'] = $question; Aastra_save_user_context($user, 'google', $data); # Prepare Web request $src = 'http://www.google.com/sms/demo?q=' . urlencode($question);
# Change password # Change password case 'chg_password': # Input Screen require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); # Input number $object->setTitle(Aastra_get_label('Password Change', $language)); $object->setType('number'); $object->setPassword(); $object->setPrompt(Aastra_get_label('New password', $language)); $object->setParameter('paused'); $object->setURL($XML_SERVER . '&action=set_password&origin=' . $origin); # Softkeys $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('5', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=options&origin=' . $origin); break; # Play/Record Greetings # Play/Record Greetings case 'play_greetings': case 'rec_greetings': # Action if ($action == 'play_greetings') { $action = 'play'; } else { $action = 'record'; } # Retrieve context $context = $action . '-' . $msg . '-vm';
if ($step == 3) { $object->setPrompt(Aastra_get_label('Enter Mobile Number', $language)); } if ($step == 4) { $object->setPrompt(Aastra_get_label('Enter Home Number', $language)); } if ($step == 5) { $object->setPrompt(Aastra_get_label('Enter Other Number', $language)); } $object->setParameter('value'); $object->setURL($XML_SERVER . '&action=set&selection=' . $selection . '&step=' . $step); $array = array('0' => 'name', '1' => 'work', '2' => 'mobile', '3' => 'home', '4' => 'other'); $object->setDefault($data[$selection][$array[$step - 1]]); # Softkeys if ($nb_softkeys) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); if ($step == 1) { $object->addSoftkey('3', Aastra_get_label('ABC', $language), 'SoftKey:ChangeMode'); $object->addSoftkey('4', Aastra_get_label('NextSpace', $language), 'SoftKey:NextSpace'); } $object->addSoftkey('5', Aastra_get_label('Done', $language), 'SoftKey:Submit'); if ($step != 1) { $step--; $object->addSoftkey('6', Aastra_get_label('Back', $language), $XML_SERVER . '&action=edit&selection=' . $selection . '&step=' . $step); } else { $object->addSoftkey('6', Aastra_get_label('Back', $language), $XML_SERVER . '&action=list&selection=' . $selection); } } else { if ($step != 1) { $step--; $object->setCancelAction($XML_SERVER . '&action=edit&selection=' . $selection . '&step=' . $step);
# Check if password configured if ($array_night[$index]['password'] != '') { # Input password require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); $object->setTitle(sprintf('%s (%d)', $array_night[$index]['desc'], $index)); $object->setPrompt(Aastra_get_label('Enter Password', $language)); $object->setParameter('password'); $object->setType('number'); $object->setPassword(); $object->setURL($XML_SERVER . '&action=set_change&index=' . $index); # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); if ($mode == 'SINGLE') { $object->addSoftkey('5', Aastra_get_label('Cancel', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('5', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=list&index=' . $index); } $object->addSoftkey('6', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); } else { if ($mode == 'SINGLE') { $object->addSoftkey('10', Aastra_get_label('Cancel', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('10', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=list&index=' . $index); $object->setCancelAction($XML_SERVER . '&action=list&index=' . $index); } } }
$object = new AastraIPPhoneInputScreen(); $object->setTitle(Aastra_get_label('Currency converter', $language)); $object->setURL($XML_SERVER . '&action=display'); $object->setDisplayMode('condensed'); $object->addField('empty'); $object->addField('string'); $object->setFieldEditable('no'); $object->setFieldPrompt(Aastra_get_label('Source', $language)); $object->setFieldDefault($data['last']['source']); $object->addField('string'); $object->setFieldEditable('no'); $object->setFieldPrompt(Aastra_get_label('Target', $language)); $object->setFieldDefault($data['last']['target']); # Softkeys if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Source', $language), $XML_SERVER . '&action=input1&choice=' . $data['last']['source']); $object->addSoftkey('2', Aastra_get_label('Target', $language), $XML_SERVER . '&action=input2&choice=' . $data['last']['target']); $object->addSoftkey('3', Aastra_get_label('Reverse', $language), $XML_SERVER . '&action=reverse'); $object->addSoftkey('4', Aastra_get_label('Watch List', $language), $XML_SERVER . '&action=favorites'); $object->addSoftkey('5', Aastra_get_label('Convert', $language), 'Softkey:Submit'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('1', Aastra_get_label('Change Source', $language), $XML_SERVER . '&action=input1&choice=' . $data['last']['source']); $object->addSoftkey('2', Aastra_get_label('Change Target', $language), $XML_SERVER . '&action=input2&choice=' . $data['last']['target']); $object->addSoftkey('3', Aastra_get_label('Reverse', $language), $XML_SERVER . '&action=reverse'); $object->addSoftkey('6', Aastra_get_label('Watch List', $language), $XML_SERVER . '&action=favorites'); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } break; # Input Source and target # Input Source and target
Aastra_test_phone_version('1.4.2.', 0); Aastra_test_php_function('imagecreate', Aastra_get_label('PHP-GD extension not installed.', $language)); $nb_softkeys = Aastra_number_softkeys_supported(); # Nothing entered if ($bdate == '') { $date = Aastra_get_user_context($user, 'biorhytm'); $object = new AastraIPPhoneInputScreen(); $object->setTitle(Aastra_get_label('Biorhythms', $language)); $object->setPrompt(Aastra_get_label('Birth Date (MM/DD/YYYY)', $language)); $object->setParameter('bdate'); $object->setType('dateUS'); $object->setURL($XML_SERVER); $object->setDefault($date); $object->setDestroyOnExit(); if ($nb_softkeys == 10) { $object->addSoftkey('10', Aastra_get_label('Exit', $language), "SoftKey:Exit"); } } else { # Save user context Aastra_save_user_context($user, 'biorhytm', $bdate); # Extract day/month/year $birthMonth = substr($bdate, 0, 2); $birthDay = substr($bdate, 3, 2); $birthYear = substr($bdate, 6, 4); # check date for validity, display error message if invalid if (!@checkDate($birthMonth, $birthDay, $birthYear)) { # Display error message $object = new AastraIPPhoneTextScreen(); $object->setTitle(Aastra_get_label('Invalid Birth Date', $language)); $object->setText(Aastra_get_label('Please enter a valid Birth Date.', $language)); } else {
//we dont have a search method either, return default to prompt for method if (!$search) { switch ($searchmethod) { case 't9': $sql = 'DELETE FROM contactdir_details WHERE extension = ? and type = ?'; $db->query($sql, array($user, 'searchmethod')); $sql = 'INSERT INTO contactdir_details (extension, type, val) VALUES (?, ?, ?)'; $db->query($sql, array($user, 'searchmethod', 't9')); $input->setTitle('Contact Directory'); $input->setPrompt('Enter first three chars.'); $input->setType('string'); $input->setParameter('search'); $input->setDefault($searchterm); $input->setURL($XML_SERVER_PATH . 'contactdir.php?searchmethod=t9'); $input->setDestroyOnExit(); $input->addSoftkey('1', 'One-Touch', $XML_SERVER_PATH . 'contactdir.php?user='******'&searchmethod=onetouch'); $input->addSoftkey('5', 'Back', $XML_SERVER_PATH . 'contactdir.php'); $input->addSoftkey('4', 'Search', 'SoftKey:Submit'); $input->addSoftkey('6', 'BKSpace', 'SoftKey:BackSpace'); $input->addSoftkey('3', 'Exit', 'SoftKey:Exit'); $input->output(); break; case 'onetouch': $sql = 'DELETE FROM contactdir_details WHERE extension = ? and type = ?'; $db->query($sql, array($user, 'searchmethod')); $sql = 'INSERT INTO contactdir_details (extension, type, val) VALUES (?, ?, ?)'; $db->query($sql, array($user, 'searchmethod', 'onetouch')); $input->setTitle('Contact Directory'); $input->setPrompt('Enter first three chars.'); $input->setType('number'); $input->setParameter('search');
# Password case 'password': # Input Password require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setTitle(sprintf(Aastra_get_label('VoiceMail Access (%s)', $language), $user)); $object->setPrompt(Aastra_get_label('Enter Password', $language)); $object->setParameter('pin'); $object->setType('number'); $object->setURL($XML_SERVER . '&user='******'&action=check'); $object->setPassword(); $object->setDestroyOnExit(); # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('4', Aastra_get_label('Chg. User', $language), $XML_SERVER); $object->addSoftkey('5', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('9', Aastra_get_label('Change User', $language), $XML_SERVER); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } break; } # Post process action switch ($action) { # Error case 'error': # New text screen
} } else { # Enter PIN require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); $object->setTitle(sprintf(Aastra_get_label('Conference Access (%s)', $language), $confno)); $object->setPrompt(Aastra_get_label('Enter Password', $language)); $object->setParameter('pin'); $object->setType('number'); $object->setURL($XML_SERVER . '&action=checkpin&confno=' . $confno); $object->setPassword(); # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('4', Aastra_get_label('Cancel', $language), $XML_SERVER . '&confno=' . $confno); $object->addSoftkey('5', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('9', Aastra_get_label('Cancel', $language), $XML_SERVER . '&confno=' . $confno); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } } } break; # Mute/unmute and kick # Mute/unmute and kick case 'mute': case 'kick':
# If password enabled if ($AA_LOGOUT_PW) { # Input password for the user require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('Logout', $language)); $object->setPrompt(Aastra_get_label('Enter password', $language)); $object->setParameter('password'); $object->setType('number'); $object->setPassword(); $object->setURL($XML_SERVER . '&action=submit'); # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('5', Aastra_get_label('Cancel', $language), 'SoftKey:Exit'); $object->addSoftkey('6', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); } else { $object->addSoftkey('9', Aastra_get_label('Cancel', $language), 'SoftKey:Exit'); } } } else { # Only if auto-logout supported if ($is_sip_notify and $AA_AUTOLOGOUT) { # Confirm logout require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setStyle('none'); $object->setTitle(Aastra_get_label('Confirm Logout', $language));
# Queue has a password if ($q_pass) { # User input require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); $object->setTitle(sprintf(Aastra_get_label('Logon to %s (%s)', $language), $q_desc, $queue)); $object->setPrompt(Aastra_get_label('Enter Password', $language)); $object->setParameter('password'); $object->setType('number'); $object->setURL($XML_SERVER . '&action=authenticate&queue=' . $queue . '&q_pass='******'&q_desc=' . $q_desc); $object->setPassword(); # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('4', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=show_queues&queue=' . $queue); $object->addSoftkey('5', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('9', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=show_queues&queue=' . $queue); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } $object->setCancelAction($XML_SERVER . '&action=show_queues&queue=' . $queue); } else { # Add agent to selected queue Aastra_queue_add_Asterisk($agent, $queue, $status['Penalty']); $update = True; } }
# Search the directory case 'search': # InputScreen require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setTitle(Aastra_get_label('Directory Lookup', $language)); $object->setURL($XML_SERVER . '&action=list'); $object->setDestroyOnExit(); $object->setType('string'); $object->setPrompt(Aastra_get_label('Letters in name', $language)); $object->setParameter('lookup'); if ($lookup != '') { $object->setDefault($lookup); } # Softkeys $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('2', 'ABC', 'SoftKey:ChangeMode'); $object->addSoftkey('5', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); if ($origin != 'presence') { $object->addSoftkey('4', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=list'); } else { $object->addSoftkey('3', Aastra_get_label('List Mode', $language), $XML_SERVER . '&action=list'); $object->addSoftkey('4', Aastra_get_label('Back', $language), $XML_SERVER_PATH . '/away.php?user='******'prefs': # Retrieve current configuration $mode = Aastra_get_user_context(Aastra_get_userdevice_Asterisk($user), 'pbx_directory');
$input->setTitle('Restricted application'); $input->setDisplayMode('condensed'); $input->setURL($XML_SERVER); $input->setDestroyOnExit(); $input->addField('empty'); $input->addField('string'); $input->setFieldSelection('1'); $input->setFieldPrompt('Username:'******'user'); $input->setFieldSelection('1'); $input->addField('number'); $input->setFieldPassword('yes'); $input->setFieldPrompt('Password:'******'password'); $input->setFieldSelection('2'); $input->addSoftkey('10', 'Exit', 'SoftKey:Exit'); $input->output(); break; case 'execute': require_once 'AastraIPPhoneExecute.class.php'; $execute = new AastraIPPhoneExecute(); $execute->setTriggerDestroyOnExit(); $execute->addEntry('Led: softkey1=on'); $execute->addEntry('Dial:7001', 'no'); $execute->output(); break; case 'configuration': require_once 'AastraIPPhoneConfiguration.class.php'; $configuration = new AastraIPPhoneConfiguration(); $configuration->addEntry('softkey1 label', 'Test'); $configuration->addEntry('softkey1 type', 'xml');
} } $object->setCancelAction($XML_SERVER); } else { # Input area code $object = new AastraIPPhoneInputScreen(); $object->setTitle(Aastra_get_label('Area code finder', $language)); $object->setPrompt(Aastra_get_label('Enter area code', $language)); $object->setParameter('area'); $object->setType('number'); $object->setURL($XML_SERVER); $object->setDestroyOnExit(); # Softkeys if ($nb_softkeys > 0) { if ($nb_softkeys < 7) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('5', Aastra_get_label('Lookup', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } } # Top title if (Aastra_is_top_title_supported()) { $object->setTopTitle(Aastra_get_label('Area code lookup'), '', '1'); $object->addIcon('1', 'http://' . $AA_XML_SERVER . '/' . $AA_XMLDIRECTORY . '/icons/area.png'); } # Display object $object->output(); exit;
# Get current status $away = Aastra_manage_presence_Asterisk($user, 'action'); # Input new number require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('Destination', $language)); $object->setPrompt(Aastra_get_label('Enter number', $language)); $object->setParameter('type'); $object->setType('number'); $object->setURL($XML_SERVER . '&action=set_number&state=' . $state . '&value1=' . AA_PRESENCE_ACT_CFWD . '&selection=' . $action); $object->setDefault($away['act_param'][$state]); # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); if ($action == 'edit_number1') { $object->addSoftkey('5', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=select_number&state=' . $state); } else { $object->addSoftkey('5', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=input_prefs2&state=' . $state); } $object->addSoftkey('6', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); } else { if ($action == 'edit_number1') { $object->addSoftkey('10', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=select_number&state=' . $state); $object->setCancelAction($XML_SERVER . '&action=select_number&state=' . $state); } else { $object->addSoftkey('10', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=input_prefs2&state=' . $state); $object->setCancelAction($XML_SERVER . '&action=input_prefs2&state=' . $state); } }
$object->setFieldParameter('lookup'); if (!empty($lookup)) { $object->setFieldDefault($lookup); } } else { # Single input $object->setType('string'); $object->setPrompt(Aastra_get_label('Letters name/company', $language)); $object->setParameter('lookup'); if (!empty($lookup)) { $object->setDefault($lookup); } } # Softkeys if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('2', Aastra_get_label('Reset', $language), $XML_SERVER . '&action=input'); $object->addSoftkey('3', Aastra_get_label('ABC', $language), 'SoftKey:ChangeMode'); $object->addSoftkey('4', Aastra_get_label('Settings', $language), $XML_SERVER . '&action=settings'); $object->addSoftkey('5', Aastra_get_label('Lookup', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('1', Aastra_get_label('Reset', $language), $XML_SERVER . '&action=input', 1); $object->addSoftkey('5', Aastra_get_label('Settings', $language), $XML_SERVER . '&action=settings', 2); $object->addSoftkey('6', Aastra_get_label('Search', $language), 'SoftKey:Submit', 5); if ($back == '1') { $object->addSoftkey('9', Aastra_get_label('Back', $language), $XML_SERVER_PATH . 'directory.php?user='******'10', Aastra_get_label('Exit', $language), 'SoftKey:Exit', 4); $object->addIcon(1, 'Icon:Delete'); $object->addIcon(2, 'Icon:Settings');
$object = new AastraIPPhoneInputScreen(); $object->setTitle(Aastra_get_label('Initial Startup', $language)); $object->setPrompt(Aastra_get_label('Enter password', $language)); $object->setParameter('password'); if ($AA_FREEPBX_MODE == '1') { $object->setType('number'); } else { $object->setType('string'); } $object->setPassword(); $object->setURL($XML_SERVER . '&action=input&step=3&extension=' . $extension); $object->setDestroyOnExit(); if (Aastra_is_lockin_supported()) { $object->setLockIn(); if ($nb_softkeys == 6) { $object->addSoftkey('3', Aastra_get_label('Reboot', $language), $XML_SERVER . '&action=reboot'); } else { $object->addSoftkey('6', Aastra_get_label('Reboot', $language), $XML_SERVER . '&action=reboot'); } } if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); if ($AA_FREEPBX_MODE == '2') { $object->addSoftkey('2', Aastra_get_label('ABC', $language), 'SoftKey:ChangeMode'); } $object->addSoftkey('6', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); } break; case '3': # Init continue $continue = True;
# Search the directory case 'search': # InputScreen require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setTitle(Aastra_get_label('Directory Lookup', $language)); $object->setURL($XML_SERVER . '&action=list'); $object->setDestroyOnExit(); $object->setType('string'); $object->setPrompt(Aastra_get_label('Letters in name', $language)); $object->setParameter('lookup'); if ($lookup != '') { $object->setDefault($lookup); } # Softkeys $object->addSoftkey('5', Aastra_get_label('List Mode', $language), $XML_SERVER . '&action=list', 1); $object->addSoftkey('6', Aastra_get_label('Search', $language), 'SoftKey:Submit', 2); $object->addSoftkey('9', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=list', 3); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit', 4); $object->setCancelAction($XML_SERVER . '&action=list'); $object->addIcon(1, 'Icon:Book'); $object->addIcon(2, 'Icon:Search'); $object->addIcon(3, 'Icon:ArrowLeft'); $object->addIcon(4, 'Icon:CircleRed'); break; # Preferences # Preferences case 'prefs': # Retrieve current configuration $mode = Aastra_get_user_context(Aastra_get_userdevice_Asterisk($user), 'pbx_directory'); # Display options
} $data = Aastra_get_user_context($user, 'stock'); if ($action == 'input') { if ($data['last'] != NULL) { $default = $data['last']; } else { $default = 'AAH.TO'; } } else { $default = $data['favorites'][$selection]; } $object->setDefault($default); # Softkeys if ($nb_softkeys > 0) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('2', '.', 'SoftKey:Dot'); if ($action == 'input') { $object->addSoftkey('3', Aastra_get_label('Watch List', $language), $XML_SERVER . '&action=favorites'); $object->addSoftkey('5', Aastra_get_label('Lookup', $language), 'SoftKey:Submit'); } else { $object->addSoftkey('4', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=favorites&selection=' . $selection); $object->addSoftkey('5', Aastra_get_label('Enter', $language), 'SoftKey:Submit'); } $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { if ($action == 'input') { $object->addSoftkey('5', Aastra_get_label('Watch List', $language), $XML_SERVER . '&action=favorites'); } else { $object->addSoftkey('8', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=favorites&selection=' . $selection); $object->setCancelAction($XML_SERVER . '&action=favorites&selection=' . $selection);
# Various labels $array_type = array('cell' => array('Cell Phone', 'Cell phone number'), 'home' => array('Home Phone', 'Home phone number'), 'other' => array('Other Phone', 'Other phone number')); # Input new call forward require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); $object->setTitle($array_type[$type][0]); $object->setPrompt($array_type[$type][1]); $object->setParameter('value'); $object->setType('number'); $object->setURL($XML_SERVER . '&action=set_info&type=' . $type); $object->setDefault($array_user[$type]); # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('5', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=info&type=' . $type); $object->addSoftkey('6', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); } else { $object->addSoftkey('10', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=info&type=' . $type); $object->setCancelAction($XML_SERVER . '&action=info&type=' . $type); } } break; # User information # User information case 'info': # Retrieve stored data $array_user = Aastra_manage_userinfo_Asterisk($user, 'get'); # All indexes $array_index = array('cell' => array('1', Aastra_get_label('(M)', $language), '1'), 'home' => array('2', Aastra_get_label('(H)', $language), '2'), 'other' => array('3', Aastra_get_label('(O)', $language), '3'));
# Next step if ($action == 'callback') { # Input Screen require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); # Input number $object->setTitle(Aastra_get_label('Edit Number', $language)); $object->setType('number'); $object->setPrompt(Aastra_get_label('Number to dial', $language)); $object->setParameter('paused'); $object->setURL($XML_SERVER . '&action=dial&msg=' . $msg . '&cause=' . $cause . '&origin=' . $origin); $object->setDefault($cause); # Softkeys if ($origin == 'list') { $object->addSoftkey('10', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=list&last_msg=' . $msg); $object->setCancelAction($XML_SERVER . '&action=list&last_msg=' . $msg); } else { $object->addSoftkey('10', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=detail&msg=' . $msg); $object->setCancelAction($XML_SERVER . '&action=detail&msg=' . $msg); } } break; # Dial # Dial case 'dial': # PhoneExecute require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); # Number not valid? if (strlen($paused) < 1 || preg_match('/[^0-9]/', $paused)) {
# Callback # Callback case 'callback': # Input Screen require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); # Input number $object->setTitle(Aastra_get_label('Edit Number', $language)); $object->setType('number'); $object->setPrompt(Aastra_get_label('Number to dial', $language)); $object->setParameter('paused'); $object->setURL($XML_SERVER . '&action=dial&msg=' . $msg . '&cause=' . $cause); $object->setDefault($cause); # Common Softkeys $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('5', Aastra_get_label('Dial', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=detail&msg=' . $msg); break; # Dial # Dial case 'dial': # PhoneExecute require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); # Number not valid? if (strlen($paused) < 1 || preg_match('/[^0-9]/', $paused)) { $object->setBeep(); $object->addEntry($XML_SERVER . '&action=callback&msg=' . $msg . '&cause=' . $cause); } else { $object->addEntry('Dial:' . $paused);
$object->setDefault($array_key[$selection]['label']); } } else { $object->setDefault(Aastra_get_callerid_Asterisk($input2)); } break; default: $object->setDefault(Aastra_get_callerid_Asterisk($input2)); break; } break; } # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('2', Aastra_get_label('ABC', $language), 'SoftKey:ChangeMode'); $object->addSoftkey('3', Aastra_get_label('NextSpace', $language), 'SoftKey:NextSpace'); $object->addSoftkey('4', Aastra_get_label('Back', $language), $XML_SERVER . '&selection=' . $selection . '&action=edit&step=2&type=' . $type . '&set=' . $set . '&input1=' . $input1 . '&input2=' . $input2); $object->addSoftkey('5', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('9', Aastra_get_label('Back', $language), $XML_SERVER . '&selection=' . $selection . '&action=edit&step=2&type=' . $type . '&set=' . $set . '&input1=' . $input1 . '&input2=' . $input2); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); $object->setCancelAction($XML_SERVER . '&selection=' . $selection . '&action=edit&step=2&type=' . $type . '&set=' . $set . '&input1=' . $input1 . '&input2=' . $input2); } } else { $object->setCancelAction($XML_SERVER . '&selection=' . $selection . '&action=edit&step=2&type=' . $type . '&set=' . $set . '&input1=' . $input1 . '&input2=' . $input2); } } else { require_once 'AastraIPPhoneExecute.class.php';