$user = $header['mac']; } # Keep return URI $XML_SERVER .= '?user='******'biorhytm', 'user='******'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);
} else { $default = $input5; } $object->setFieldDefault($default); # Common Softkeys if ($nb_softkeys == 6) { $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 . '&selection=' . $selection); } else { $object->addSoftkey('9', Aastra_get_label('Cancel', $language), $XML_SERVER . '&selection=' . $selection); } } else { # Input Screen require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); # Name or number if ($step == 1) { $object->setType('string'); } else { $object->setType('number'); } # Title $object->setTitle(sprintf(Aastra_get_label('Speed Dial %d', $language), $selection + 1)); # Prompts if ($step == 1) { $object->setPrompt(Aastra_get_label('Enter Name', $language)); } if ($step == 2) { $object->setPrompt(Aastra_get_label('Enter Work Number', $language));
switch ($action) { # Set Preferences case 'set_prefs': # Update user context Aastra_save_user_context(Aastra_get_userdevice_Asterisk($user), 'pbx_directory', $speed); # Next action $action = 'list'; break; } # Process action switch ($action) { # 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->addSoftkey('9', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=change_grplist'); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); $object->setCancelAction($XML_SERVER . '&action=change_grplist'); } } break; # Edit personal numbers # Edit personal numbers case 'edit_info': # Retrieve stored data $array_user = Aastra_manage_userinfo_Asterisk($user, 'get'); # 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->setText(sprintf(Aastra_get_label('Area code %s not found.', $language), $area)); } # Softkeys if ($nb_softkeys > 0) { if ($nb_softkeys < 7) { $object->addSoftkey('4', Aastra_get_label('Back', $language), $XML_SERVER); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('9', Aastra_get_label('New Lookup', $language), $XML_SERVER); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } $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'); }
$object->addEntry(Aastra_get_label('Back', $language), $XML_SERVER_PATH . 'directory.php?user='******'input_any': # Title if ($ARRAY_CONFIG[$source]['label'] != '') { $title = $ARRAY_CONFIG[$source]['label']; } else { $title = Aastra_get_label('Contact Lookup', $language); } # Input screen require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setTitle($title); $object->setURL($XML_SERVER . '&action=lookup'); $object->setDestroyOnExit(); $object->setType('string'); $object->setPrompt(Aastra_get_label('Letters name/company', $language)); $object->setParameter('lookup'); if ($lookup != '') { $object->setDefault($lookup); } break; # Lookup # Lookup case 'lookup': # Make the search $return = lookup_directory($database, $lookup, $firstn, $lastn, $company, $ARRAY_USER);
$user = Aastra_get_userdevice_Asterisk($ext); $return = is_user_connected($confno, $user); # User connected if ($return['connected']) { # Straight to details require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); if ($return['admin']) { $object->addEntry($XML_SERVER . '&action=display&mode=admin&confno=' . $confno); } else { $object->addEntry($XML_SERVER . '&action=display&mode=user&confno=' . $confno); } } 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 {
$index = Aastra_getvar_safe('index'); $zip = Aastra_getvar_safe('zip'); # Trace Aastra_trace_call('weather', 'zip=' . $zip . ', index=' . $index); # Test User Agent Aastra_test_phone_version('1.4.2.', 0); # Get Language $language = Aastra_get_language(); # Get global compatibility $nb_softkeys = Aastra_number_softkeys_supported(); # Callback $XML_SERVER .= '?user='******'') { # Input zip code $object = new AastraIPPhoneInputScreen(); $object->setTitle(Aastra_get_label('US Local Weather', $language)); $object->setPrompt(Aastra_get_label('Enter ZIP code', $language)); $object->setParameter('zip'); $object->setType('number'); $object->setURL($XML_SERVER); $object->setDestroyOnExit(); $data = Aastra_get_user_context($user, 'weather'); if ($data['last'] != NULL) { $object->setDefault($data['last']); } if ($nb_softkeys) { if ($nb_softkeys == 6) { $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('Exit', $language), 'SoftKey:Exit');
switch ($action) { # Set Preferences case 'set_prefs': # Update user context Aastra_save_user_context(Aastra_get_userdevice_Asterisk($user), 'pbx_directory', $speed); # Next action $action = 'list'; break; } # Process action switch ($action) { # 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') {
$status = get_agent_status($queue, $agent); # Agent logged? if ($status['Logged']) { # Dynamic agent? if ($status['Type'] == 'dynamic') { # Remove agent from selected queue Aastra_queue_remove_Asterisk($agent, $queue); # Update needed $update = True; } } else { # 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->natsortByLastname(); } if (Aastra_number_softkeys_supported() == 10) { $object->setBackKeyPosition(9); } $object->setBackURI($XML_SERVER . '&lastname=' . $lastname . '&firstname=' . $firstname . '&lookup=' . $lookup); $object->setEntries($result); } break; # INIT # INIT case 'input': default: # InputScreen require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); if ($ARRAY_CONFIG[$source]['label'] == '') { $object->setTitle(Aastra_get_label('Directory Lookup', $LANGUAGE)); } else { $object->setTitle($ARRAY_CONFIG[$source]['label']); } $object->setURL($XML_SERVER . '&action=search'); # Depending on the phone if (Aastra_is_multipleinputfields_supported()) { # Multiple fields supported $object->setDisplayMode('condensed'); if (!empty($lookup)) { $object->setDefaultIndex('4'); } else { if (!empty($lastname)) {
break; case 'inputscreen2': require_once 'AastraIPPhoneInputScreen.class.php'; $input = new AastraIPPhoneInputScreen(); $input->setTitle('Title'); $input->setPrompt('Enter the date'); $input->setParameter('param'); $input->setType('dateUS'); $input->setURL('http://myserver.com/script.php'); $input->setDestroyOnExit(); $input->setCancelAction($XML_SERVER); $input->output(); break; case 'inputscreen3': require_once 'AastraIPPhoneInputScreen.class.php'; $input = new AastraIPPhoneInputScreen(); $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');
} break; # Change values # Change values case 'change': # Authenticate user if ($action == 'change') { Aastra_check_signature_Asterisk($user); } # Retrieve all status $array_night = Aastra_manage_daynight_Asterisk('get_all', ''); # 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->setTitle(Aastra_get_label('RESET', $language)); $object->setText(Aastra_get_label('Resetting Phone...', $language)); if ($nb_softkeys == 6) { $object->addSoftkey('6', '', 'SoftKey:Exit'); } break; # Get user input # Get user input case 'input': # Extensions mode if ($AA_FREEPBX_MODE == '1') { # 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');
$header = Aastra_decode_HTTP_header(); $user = $header['mac']; } $XML_SERVER .= '?user='******'google', 'user='******', question=' . $question); # Test User Agent Aastra_test_phone_version('1.4.2.', 0); # Get Phone language $language = Aastra_get_language(); # Global compatibility $nb_softkeys = Aastra_number_softkeys_supported(); # Initial call test on parameter passed if (!$question) { # Input Question $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); $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) {
$db_username = $config['']['ampdbuser']; $db_password = $config['']['ampdbpass']; $db_url = $engine . "://" . $db_username . ":" . $db_password . "@" . $db_host . "/" . $db_database; $db = DB::connect($db_url); //get arguments $user = $_GET['user']; $searchmethod = isset($_GET['searchmethod']) ? $_GET['searchmethod'] : null; //search method : onetouch or t9 $search = isset($_GET['search']) ? $_GET['search'] : null; //name of number to search for $searchterm = isset($_GET['searchterm']) ? $_GET['searchterm'] : null; // "" "" $contact = isset($_GET['contact']) ? $_GET['contact'] : null; //id of a specific contact //declare classes $input = new AastraIPPhoneInputScreen(); $menu = new AastraIPPhoneTextMenu(); $text = new AastraIPPhoneTextScreen(); $screen = new AastraIPPhoneFormattedTextScreen(); //if no $searchmethod is set, check for users perferd input method if (!$searchmethod) { $sql = 'SELECT val from contactdir_details where extension = ? and type =?'; $searchmethod = $db->getRow($sql, array($user, 'searchmethod')); if ($searchmethod) { $searchmethod = implode(",", $searchmethod); } } //step 1&2: ensure that the search term hasnt been entered yet, and promt for it. If //we dont have a search method either, return default to prompt for method if (!$search) { switch ($searchmethod) {
} else { $object->addEntry(Aastra_get_label('Enable Auto-login', $language), $XML_SERVER . '&action=autologin'); } # Softkeys $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select'); $object->addSoftkey('5', Aastra_get_label('Back', $language), $XML_SERVER); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); # Cancel Action $object->setCancelAction($XML_SERVER); break; # 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
$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; # Edit forward number # Edit forward number case 'edit_number1': case 'edit_number2': # 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);
Aastra_trace_call('directory_3_asterisk', 'user='******', action=' . $action . ', speed=' . $speed . ', selection=' . $selection); # Test User Agent Aastra_test_phone_versions(array('1' => '', '2' => '', '3' => '2.5.3.', '4' => '', '5' => ''), '0'); # Get Language $language = Aastra_get_language(); # Save return URI $XML_SERVER .= '?user='******'&origin=' . $origin; # Compute MaxLines $MaxLines = AASTRA_MAXLINES - 2; # Process action switch ($action) { # 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); } break; # Display status # Display status case 'zoom': # Retrieve user status $away = Aastra_manage_presence_Asterisk($selection, 'get', 'status');
} 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'); $object->addSoftkey('6', Aastra_get_label('Submit', $language), 'SoftKey:Submit'); } break; case '2': $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');
$object->addSoftkey('9', Aastra_get_label('Back', $language), $XML_SERVER); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } $object->setCancelAction($XML_SERVER . '&user='******'launch'; } break; # Password # 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 {
$action = 'favorites'; break; # Favorites # Favorites case 'favorites': $default = $selection + 1; break; } # Depending on action switch ($action) { # Input symbol case 'input': case 'inputfav': # Input sticker require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setType('string'); if ($action == 'input') { $object->setTitle(Aastra_get_label('Get Stock quotes', $language)); } else { $object->setTitle(sprintf(Aastra_get_label('Favorite #%s', $language), $selection + 1)); } $object->setPrompt(Aastra_get_label('Enter Ticker', $language)); $object->setParameter('symbol'); if ($action == 'input') { $object->setURL($XML_SERVER . '&action=display'); } else { $object->setURL($XML_SERVER . '&action=set&selection=' . $selection); } $data = Aastra_get_user_context($user, 'stock'); if ($action == 'input') {
# Set Target # Set Target case 'set_2': if ($input != '') { $data['last']['target'] = $input; Aastra_save_user_context($user, 'currency', $data); } $action = 'init'; break; } # Depending on action switch ($action) { # Initial screen case 'init': # Prepare result screen $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']);
# Get global compatibility $is_softkeys = Aastra_is_softkeys_supported(); $is_icons = Aastra_is_icons_supported(); $is_style_textmenu = Aastra_is_style_textmenu_supported(); # Compute MaxLines if ($is_softkeys) { $MaxLines = AASTRA_MAXLINES; } else { $MaxLines = AASTRA_MAXLINES - 2; } # PROCESS Action switch ($action) { # Input lookup case 'input': # Input object $object = new AastraIPPhoneInputScreen(); $object->setTitle(Aastra_get_label('SugarCRM Lookup', $language)); $object->setPrompt(Aastra_get_label('First letters of the name', $language)); $object->setParameter('lookup'); $object->setType('string'); $object->setURL($XML_SERVER . '?action=list'); $object->setDestroyOnExit(); if (!empty($lookup)) { $object->setDefault($lookup); } if ($is_softkeys) { $object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace'); $object->addSoftkey('3', Aastra_get_label('ABC', $language), 'SoftKey:ChangeMode'); $object->addSoftkey('5', Aastra_get_label('Lookup', $language), 'SoftKey:Submit'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); }
break; # Cancel recording # Cancel recording case 'cancel_greetings': # Cancel recording require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); $object->addEntry('Key:Goodbye'); $object->setTriggerDestroyonExit(); break; # 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); break; # Dial # Dial case 'dial': # PhoneExecute require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute();
$action = 'error'; } else { # Retrieve number $cid = Aastra_format_callerid_Asterisk($message['message']['callerid'], '2'); if ($cid['dial']) { $cause = $cid['number']; } else { $action = 'nothing'; } } } # 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; # Cancel recording # Cancel recording case 'cancel_greetings': # Cancel recording require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); $object->addEntry('Key:Goodbye'); $object->setTriggerDestroyonExit(); break; # 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
} # 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('Back', $language), $XML_SERVER . '&selection=' . $selection . '&action=edit&step=1&type=' . $type . '&set=' . $set . '&input1=' . $input1); break; } break; # Third step: label # Third step: label case '3': # Check if step 2 is properly completed if ($input2 != '') { # Input label require_once 'AastraIPPhoneInputScreen.class.php'; $object = new AastraIPPhoneInputScreen(); $object->setDestroyOnExit(); $object->setTitle($array_title[$input1]); $object->setType('string'); $object->setPrompt(Aastra_get_label('Enter key label', $language)); $object->setURL($XML_SERVER . '&selection=' . $selection . '&action=set&type=' . $type . '&set=' . $set . '&input1=' . $input1 . '&input2=' . $input2); $object->setParameter('input3'); # Default value switch ($input1) { case 'speeddial': case 'speeddialconf': case 'speeddialxfer': switch ($array_key[$selection]['type']) { case 'speeddial': case 'speeddialconf': case 'speeddialxfer':