Esempio n. 1
0
function get_user_config($user, $menu_source, $menu_mode)
{
    global $language;
    # Retrieve phone data
    $update = 0;
    $header = Aastra_decode_HTTP_header();
    $header['model'] = strtolower($header['model']);
    $is_softkeys_supported = Aastra_is_softkeys_supported();
    # Read all menu
    $all = Aastra_readINIfile($menu_source . '.menu', '#', '=');
    # Get user config
    if ($is_softkeys_supported and $menu_mode == 'dynamic') {
        $config = Aastra_get_user_context($user, 'mymenu' . '_' . $menu_source);
    } else {
        $config = NULL;
    }
    # File does not exist
    if ($config == NULL) {
        unset($all['RESERVED']);
        foreach ($all as $key => $value) {
            if ($value[$header['model']] == 'no') {
                unset($all[$key]);
            } else {
                $all[$key]['title'] = Aastra_get_label($all[$key]['title'], $language);
            }
        }
        Aastra_natsort2d($all, 'title');
        foreach ($all as $key => $value) {
            $config['menu'][] = $key;
        }
        if ($is_softkeys_supported and $menu_mode == 'dynamic') {
            $update = 1;
        }
    } else {
        # Read config file
        foreach ($config['menu'] as $key => $value) {
            if ($all[$value] == NULL or $all[$value][$header['model']] == 'no') {
                unset($config['menu'][$key]);
                $update = 1;
            }
        }
    }
    # Read final file
    if ($update == 1) {
        Aastra_save_user_context($user, 'mymenu' . '_' . $menu_source, $config);
        unset($config);
        $config = Aastra_get_user_context($user, 'mymenu' . '_' . $menu_source);
    }
    # Return array
    return $config;
}
function get_user_config($user)
{
    global $asterisk;
    if ($asterisk) {
        $array_user = Aastra_get_user_context(Aastra_get_userdevice_Asterisk($user), 'contacts');
    } else {
        $array_user = Aastra_get_user_context($user, 'contacts');
    }
    if ($array_user['display'] == '') {
        $array_user['display'] = 'firstlast';
    }
    if ($array_user['sort'] == '') {
        $array_user['sort'] = 'first';
    }
    if ($asterisk) {
        Aastra_save_user_context(Aastra_get_userdevice_Asterisk($user), 'contacts', $array_user);
    } else {
        Aastra_save_user_context($user, 'contacts', $array_user);
    }
    return $array_user;
}
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);
}
Esempio n. 4
0
function Aastra_store_signature($user)
{
    # Store the signature
    $header = Aastra_decode_HTTP_header();
    $signature['mac'] = $header['mac'];
    $signature['ip'] = $header['ip'];
    $signature['model'] = $header['model'];
    $signature['signature'] = Aastra_getphone_fingerprint();
    Aastra_save_user_context($user, 'signature', $signature);
}
Esempio n. 5
0
    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');
        } else {
            $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
        }
    }
} else {
    # Save last value requested
    $data['last'] = $zip;
    Aastra_save_user_context($user, 'weather', $data);
    # Test if we need to regenerate the static pages
    $generate = 0;
    $file_name = AASTRA_PATH_CACHE . 'w-' . $zip . '.rss';
    if (!file_exists($file_name)) {
        $generate = 1;
    } else {
        if (time() - filemtime($file_name) > 4 * 3600) {
            $generate = 1;
        }
    }
    # If need to generate
    if ($generate == 1) {
        # Check if target directory is present
        if (!is_dir(AASTRA_PATH_CACHE)) {
            @mkdir(AASTRA_PATH_CACHE);
Esempio n. 6
0
function update_user_config($user, $array_key, $header, $selection1, $selection2 = NULL, $type = 'key')
{
    # No special key yet
    $special = False;
    # Retrieve current configuration
    $array_temp = Aastra_readINIfile(AASTRA_TFTP_DIRECTORY . '/' . $header['mac'] . '.cfg', '#', ':');
    $array_user = $array_temp[''];
    # Prepare process of both keys
    if ($selection2) {
        $array_selection = array($selection1, $selection2);
    } else {
        $array_selection = array($selection1);
    }
    # Process both changes
    foreach ($array_selection as $selection) {
        # Key update
        if ($type == 'key') {
            # Update selection
            if ($array_key[$selection]['type'] != '' and $array_key[$selection]['type'] != 'empty') {
                # XML?
                if ($array_key[$selection]['type'] == 'xml') {
                    $special = True;
                }
                # Update configuration (MAC.cfg)
                $array_user[$selection . ' type'] = $array_key[$selection]['type'];
                $array_user[$selection . ' value'] = $array_key[$selection]['value'];
                $array_user[$selection . ' label'] = $array_key[$selection]['label'];
                if ($array_key[$selection]['states'] != '') {
                    $array_user[$selection . ' states'] = $array_key[$selection]['states'];
                } else {
                    unset($array_user[$selection . ' states']);
                }
                if ($array_key[$selection]['locked'] != '') {
                    $array_user[$selection . ' locked'] = $array_key[$selection]['locked'];
                } else {
                    unset($array_user[$selection . ' locked']);
                }
                # Update configuration (dynamic)
                $array_update[] = array('param' => $selection . ' type', 'value' => $array_user[$selection . ' type']);
                $array_update[] = array('param' => $selection . ' value', 'value' => $array_user[$selection . ' value']);
                $array_update[] = array('param' => $selection . ' label', 'value' => $array_user[$selection . ' label']);
                if ($array_key[$selection]['states'] != '') {
                    $array_update[] = array('param' => $selection . ' states', 'value' => $array_user[$selection . ' states']);
                }
                if ($array_key[$selection]['locked'] != '') {
                    $array_update[] = array('param' => $selection . ' locked', 'value' => $array_user[$selection . ' locked']);
                }
            } else {
                # Maybe we changed a special key
                if ($array_user[$selection . ' type'] == 'xml') {
                    $special = True;
                }
                # Key is not programmed but maybe locked
                if ($array_key[$selection]['type'] == '') {
                    unset($array_user[$selection . ' type']);
                } else {
                    $array_user[$selection . ' type'] = 'empty';
                }
                if ($array_key[$selection]['locked'] == '1') {
                    $array_user[$selection . ' locked'] = $array_key[$selection]['locked'];
                } else {
                    unset($array_user[$selection . ' locked']);
                }
                unset($array_user[$selection . ' value']);
                unset($array_user[$selection . ' label']);
                unset($array_user[$selection . ' states']);
                # Update array
                $array_update[] = array('param' => $selection . ' type', 'value' => $array_user[$selection . ' type']);
                $array_update[] = array('param' => $selection . ' value', 'value' => '');
                $array_update[] = array('param' => $selection . ' label', 'value' => '');
                $array_update[] = array('param' => $selection . ' locked', 'value' => $array_user[$selection . ' locked']);
                $array_update[] = array('param' => $selection . ' states', 'value' => '');
            }
        } else {
            # Update parameter
            $array_user[$selection] = $array_key[$selection]['value'];
            $array_update[] = array('param' => $selection, 'value' => $array_key[$selection]['value']);
        }
    }
    # Update MAC.cfg
    $write = @fopen(AASTRA_TFTP_DIRECTORY . '/' . $header['mac'] . '.cfg', 'w');
    if ($write) {
        # Dump the config file
        foreach ($array_user as $key => $value) {
            fputs($write, $key . ': ' . $value . "\n");
        }
        # Close the MAC.cfg file
        fclose($write);
        # Update the user keys
        $keys = Aastra_get_user_context($user, 'keys');
        foreach ($array_user as $key => $value) {
            if (stristr($key, 'key')) {
                $array_keys[$key] = $value;
            }
            if (stristr($key, 'expmod') and stristr($key, 'page')) {
                $array_keys[$key] = $value;
            }
        }
        $keys[$header['model']] = $array_keys;
        Aastra_save_user_context($user, 'keys', $keys);
    }
    # Update special keys
    if ($special) {
        $array_special = update_special_keys($user, $array_user);
    }
    # Save Configuration update
    if (!$special) {
        $array_selection = NULL;
        $array_special_keys = NULL;
    }
    $array_session = array('keys' => base64_encode(serialize(array($array_selection, $array_update, $array_special))));
    Aastra_save_session('key', '120', $array_session);
    # Return the need for notify
    return $special;
}
Esempio n. 7
0
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 {
        # calculate the number of days this person is alive
        $daysGone = abs(gregorianToJD($birthMonth, $birthDay, $birthYear) - gregorianToJD(date("m"), date("d"), date("Y")));
        # Get the results
        $array = getResults();
Esempio n. 8
0
 # Create list
 $object = new AastraIPPhoneTextMenu();
 $summary = False;
 $object->setTitle(Aastra_get_label('Watch List', $language));
 for ($i = 0; $i < AASTRA_MAXLINES; $i++) {
     if ($data['favorites'][$i]['source'] == '' or $data['favorites'][$i]['target'] == '') {
         $object->addEntry('...........................', $XML_SERVER . '&action=inputfav1&selection=' . $i, $i);
         $data['favorites'][$i]['source'] = '';
         $data['favorites'][$i]['target'] = '';
     } else {
         $object->addEntry(sprintf(Aastra_get_label('%s to %s', $language), $data['favorites'][$i]['source'], $data['favorites'][$i]['target']), $XML_SERVER . '&action=displayfav&selection=' . $i, $i);
         $summary = True;
     }
 }
 # Update user favorites
 Aastra_save_user_context($user, 'currency', $data);
 # Set default index
 if ($default != '') {
     $object->setDefaultIndex($default);
 }
 # Add softkeys
 if ($nb_softkeys == 6) {
     # Regular phone
     if ($page == '0') {
         $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select');
         $object->addSoftkey('2', Aastra_get_label('Move Up', $language), $XML_SERVER . '&action=up');
         if ($summary) {
             $object->addSoftkey('3', Aastra_get_label('Summary', $language), $XML_SERVER . '&action=summary');
         }
         $object->addSoftkey('4', Aastra_get_label('Edit', $language), $XML_SERVER . '&action=inputfav1&choice=fav1');
         $object->addSoftkey('5', Aastra_get_label('Move Down', $language), $XML_SERVER . '&action=down');
Esempio n. 9
0
             $object->setCancelAction($XML_SERVER . '&action=input');
             $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
         }
     }
     break;
     # Display result
 # Display result
 case 'display':
 case 'displayfav':
     # Retrieve cached data
     $data = Aastra_get_user_context($user, 'stock');
     # Simple lookup
     if ($action == 'display') {
         # Save the last request
         $data['last'] = $symbol;
         Aastra_save_user_context($user, 'stock', $data);
         # Prepare request
         $array[0] = $symbol;
     } else {
         # Prepare request
         $array[0] = $data['favorites'][$selection];
     }
     # Process request
     $return = get_quote($array);
     # Return OK
     if ($return[0]) {
         # Can we use a formatted text screen
         if (Aastra_is_formattedtextscreen_supported()) {
             # Get size of the screen
             $nb_carac = Aastra_size_display_line();
             # Create the object
Esempio n. 10
0
     $secret = $password;
 }
 $callerid = Aastra_get_callerid_Asterisk($extension);
 # Get user/device profile
 $profile = Aastra_get_startup_profile_Asterisk($extension);
 # Create mac.cfg
 if (create_mac($header['mac'], $extension, $username, $secret, $callerid, $header['model'], $profile, $tz_name, $tz_code, $cl, $lang)) {
     # If override
     if ($action == 'override') {
         # Send a SIP notify
         if (Aastra_is_user_registered_Asterisk($extension)) {
             if (Aastra_is_dynamic_sip_supported($ext_array[$extension]) or $ext_array[$extension]['model'] == 'Aastra8000i') {
                 $notify_type = 'aastra-xml';
                 $notify = Aastra_get_user_context($extension, 'notify');
                 $notify['forced_logout'] = '1';
                 Aastra_save_user_context($extension, 'notify', $notify);
             } else {
                 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);
Esempio n. 11
0
             }
         }
     }
     for ($i = 1; $i <= $last; $i++) {
         $object->addEntry($XML_SERVER . '&action=configuration&page=' . $i);
     }
     $object->addEntry($array_config['action uri startup']);
     # Clear the critical keys
     Aastra_save_user_context($user, 'cfwd', NULL);
     Aastra_save_user_context($user, 'dnd', NULL);
     Aastra_save_user_context($user, 'daynight', NULL);
     Aastra_save_user_context($user, 'away', NULL);
     Aastra_save_user_context($user, 'agent', NULL);
     Aastra_save_user_context($user, 'follow', NULL);
     Aastra_save_user_context($user, 'parking', NULL);
     Aastra_save_user_context($user, 'vmail', NULL);
 } else {
     # Erase mac.cfg
     Aastra_delete_mac($header['mac']);
     # Reboot needed
     require_once 'AastraIPPhoneExecute.class.php';
     $object = new AastraIPPhoneExecute();
     # Bug 673i
     if ($header['model'] != 'Aastra6739i') {
         $object->addEntry($XML_SERVER . '&action=display');
     } else {
         $object->setTriggerDestroyOnExit();
     }
     if (Aastra_is_local_reset_supported() and $header['model'] != 'Aastra6739i') {
         $object->addEntry('Command: ClearCallersList');
         $object->addEntry('Command: ClearDirectory');
Esempio n. 12
0
     # Initial or recurrent check
 # Initial or recurrent check
 case 'check':
 case 'register':
     # Update needed
     $update = 1;
     # Get current DND status
     $dnd = Aastra_manage_dnd_Asterisk($user, 'get');
     # Get last DND status
     $data = Aastra_get_user_context($user, 'dnd');
     $last = $data['last'];
     $key = $data['key'];
     # Save DND status
     $data['last'] = $dnd;
     if ($dnd != $last) {
         Aastra_save_user_context($user, 'dnd', $data);
     }
     # Update needed?
     if ($action == 'check' and $dnd == $last) {
         $update = 0;
     }
     if ($action == 'register' and $dnd == 0) {
         $update = 0;
     }
     # Prepare display update
     require_once 'AastraIPPhoneExecute.class.php';
     $object = new AastraIPPhoneExecute();
     if ($update == 1) {
         # Change msg status
         $object->addEntry($XML_SERVER . '&action=msg&status=' . $dnd);
         # Change LED if supported
Esempio n. 13
0
 # credentials OK
 if (Aastra_check_user_login_Asterisk($user, $password)) {
     # Retrieve user template
     $profile = Aastra_get_startup_profile_Asterisk($user);
     if (file_exists($profile . '-device-user.prf')) {
         # Store language if needed
         if ($lang != '') {
             $data['language'] = $lang;
             $data['code'] = $cl;
             $array_wl = array('fr' => 'French', 'it' => 'Italian', 'es' => 'Spanish', 'en' => 'English', 'de' => 'German', 'pt' => 'Portuguese');
             if ($array_wl[substr($lang, 0, 2)] != '') {
                 $data['clear'] = $array_wl[substr($lang, 0, 2)];
             } else {
                 $data['clear'] = '';
             }
             Aastra_save_user_context($device, 'language', $data);
         }
         # Trigger a sync on the phone
         $object = new AastraIPPhoneExecute();
         $object->setTriggerDestroyOnExit();
         $object->addEntry('Dial:loguser' . $user);
     } else {
         # Display error as a TextScreen
         $object = new AastraIPPhoneTextScreen();
         $object->setDestroyOnExit();
         $object->setTitle(Aastra_get_label('Configuration error', $language));
         $object->setText(Aastra_get_label('Configuration file cannot be generated. Please contact your administrator.', $language));
         if ($nb_softkeys) {
             if ($nb_softkeys == 6) {
                 $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
             } else {
Esempio n. 14
0
 # Update needed
 $update = 1;
 # Get global status
 if (is_agent_logged($agent)) {
     $status = 1;
 } else {
     $status = 0;
 }
 # Get last agent status
 $data = Aastra_get_user_context($agent, 'agent');
 $last = $data['last'];
 $key = $data['key'];
 # Save status if changed
 if ($status != $last) {
     $data['last'] = $status;
     Aastra_save_user_context($agent, 'agent', $data);
 }
 # Update needed?
 if ($action == 'check' and $status == $last) {
     $update = 0;
 }
 if ($action == 'register' and $status == 0) {
     $update = 0;
 }
 # Prepare display update
 require_once 'AastraIPPhoneExecute.class.php';
 $object = new AastraIPPhoneExecute();
 # Update LED if necessary
 if ($key != '' and Aastra_is_ledcontrol_supported() and $update == 1) {
     if ($status == 1) {
         $object->addEntry('Led: ' . $key . '=on');
Esempio n. 15
0
                 $object->addSoftkey('10', Aastra_get_label('Close', $language), $XML_SERVER . '&action=edit&selection=' . $selection . '&input1=' . $input1 . '&input2=' . $input2 . '&input3=' . $input3 . '&input4=' . $input4 . '&input5=' . $input5);
             }
         } else {
             $object->setDoneAction($XML_SERVER . '&action=edit&selection=' . $selection);
         }
     } else {
         # Update user data
         $data[$selection]['name'] = $input1;
         $data[$selection]['work'] = $input2;
         $data[$selection]['mobile'] = $input3;
         $data[$selection]['home'] = $input4;
         $data[$selection]['other'] = $input5;
         if ($asterisk) {
             $data = Aastra_save_user_context(Aastra_get_userdevice_Asterisk($user), 'speed', $data);
         } else {
             Aastra_save_user_context($user, 'speed', $data);
         }
         # Back to the list
         require_once 'AastraIPPhoneExecute.class.php';
         $object = new AastraIPPhoneExecute();
         $object->addEntry($XML_SERVER . '&action=list&selection=' . $selection);
     }
     break;
     # EDIT
 # EDIT
 case 'edit':
     # Multiple input fields?
     if (Aastra_is_multipleinputfields_supported()) {
         # Input Screen
         require_once 'AastraIPPhoneInputScreen.class.php';
         $object = new AastraIPPhoneInputScreen();
Esempio n. 16
0
        }
        $object->addLine('Hi-Score: ' . $yahtzee['hiscore']);
        $object->addLine('Nb of games: ' . $yahtzee['games']);
        $object->addLine('Average score: ' . $yahtzee['average']);
        break;
        # Reset Hi-Score
    # Reset Hi-Score
    case 'reset':
        # Back to 0
        $yahtzee['hiscore'] = 0;
        $yahtzee['games'] = 0;
        $yahtzee['average'] = 0;
        break;
}
# Save current data
Aastra_save_user_context($user, 'yahtzee', $yahtzee);
# Complete with softkeys
switch ($action) {
    case 'enter':
        if ($nb_softkeys == 6) {
            $object->addSoftkey('1', 'Select', 'SoftKey:Select');
            $object->addSoftkey('5', 'Cancel', $XML_SERVER);
            $object->addSoftkey('6', 'Exit', 'SoftKey:Exit');
        } else {
            $object->addSoftkey('9', 'Cancel', $XML_SERVER);
            $object->addSoftkey('10', 'Exit', 'SoftKey:Exit');
        }
        break;
    case 'hi':
        if ($nb_softkeys == 6) {
            $object->addSoftkey('1', 'Reset', $XML_SERVER . '&action=reset');
 function output($page = NULL)
 {
     # Test phone firmware / model
     Aastra_test_phone_version('1.4.2.', 0);
     Aastra_test_phone_model(array('Aastra9112i', 'Aastra9133i'), False, 0);
     # Force destroyOnExit
     $this->_destroyOnExit = 'yes';
     # Initial call?
     if (!isset($page)) {
         # Count number of entries in list
         $this->_count = count($this->_list);
         # Setup icons
         $this->_setupIcons();
         # Setup Softkeys
         $this->_setupSoftKeys();
         # Set Cancel URI
         if (!empty($this->_backCancelURL)) {
             parent::setCancelAction($this->_backCancelURL);
         }
         # Do some security / compliancy checks
         # Protect against wrap list bug in FW < R2.4.0
         if (Aastra_test_phone_version('2.4.0.', 1)) {
             $this->_wraplist = 'no';
         }
         if (!Aastra_is_wrap_title_supported()) {
             $this->_wraplist = 'no';
         }
         if (!Aastra_is_textmenu_wrapitem_supported()) {
             $this->_title_wrap = 'no';
         }
         if (!Aastra_is_style_textmenu_supported()) {
             $this->_style = '';
         }
         if (!Aastra_is_lockin_supported()) {
             $this->_lockin = 'no';
         }
         # Save object in user context (context = mac address)
         Aastra_save_user_context($this->_header['mac'], 'scrollableTextMenuData', $this);
     } else {
         # If beep is set, only beep during initial call
         $this->_beep = 'no';
     }
     # Generate the actual items of the menu for the given page
     $this->_generatePage($page);
     parent::output();
 }
Esempio n. 18
0
         if ($key != '') {
             # Change LED if supported
             if (Aastra_is_ledcontrol_supported()) {
                 if ($night == 1) {
                     $object->addEntry('Led: ' . $key . '=on');
                 } else {
                     $object->addEntry('Led: ' . $key . '=off');
                 }
             }
         }
     }
     # Do nothing
     $object->addEntry('');
     # Save Day/Night context
     if ($context) {
         Aastra_save_user_context($user, 'daynight', $data);
     }
     break;
     # Display error
 # Display error
 case 'error':
     # Display error as a TextScreen
     require_once 'AastraIPPhoneTextScreen.class.php';
     $object = new AastraIPPhoneTextScreen();
     $object->setDestroyOnExit();
     $object->setTitle($err_title);
     $object->setText($err_text);
     # Softkeys
     if ($nb_softkeys) {
         if ($nb_softkeys == 6) {
             $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
Esempio n. 19
0
     # Softkeys
     $object->addSoftkey('9', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=' . $orig_s . '&lookup=' . $lookup . '&page=' . $page . '&selection=' . $selection, 1);
     $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit', 2);
     $object->addIcon(1, 'Icon:ArrowLeft');
     $object->addIcon(2, 'Icon:CircleRed');
     $object->setCancelAction($XML_SERVER . '&action=' . $orig_s . '&lookup=' . $lookup . '&page=' . $page . '&selection=' . $selection);
     break;
     # Save speed dial value
 # Save speed dial value
 case 'set':
     # Get user context
     $conf_speed = Aastra_get_user_context(Aastra_get_userdevice_Asterisk($user), 'speed');
     # Save value
     $conf_speed[$speed]['name'] = Aastra_get_callerid_Asterisk($selection);
     $conf_speed[$speed]['work'] = $selection;
     Aastra_save_user_context(Aastra_get_userdevice_Asterisk($user), 'speed', $conf_speed);
     # Display position
     require_once 'AastraIPPhoneTextScreen.class.php';
     $object = new AastraIPPhoneTextScreen();
     $object->setDestroyOnExit();
     $object->setTitle(Aastra_get_label('List Updated', $language));
     $position = $speed + 1;
     $object->setText(sprintf(Aastra_get_label('%s stored in speed dial list at position %d.', $language), $conf_speed[$speed]['name'], $position));
     # Softkey
     $object->addSoftkey('10', Aastra_get_label('Close', $language), $XML_SERVER . '&action=' . $orig_s . '&lookup=' . $lookup . '&page=' . $page . '&selection=' . $selection, 1);
     $object->addIcon(1, 'Icon:CircleRed');
     $object->setCancelAction($XML_SERVER . '&action=' . $orig_s . '&lookup=' . $lookup . '&page=' . $page . '&selection=' . $selection);
     break;
     # Dial/Intercom
 # Dial/Intercom
 case 'dial':
Esempio n. 20
0
    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);
    # Extract result from Web page
    $fp = @fopen($src, 'r');
    if ($fp) {
        $resultSize = 0;
        while (!feof($fp)) {
            $line = fgets($fp, 4096);
            if (preg_match('/var resultSize/', $line)) {
                $found = 1;
                $nb_answers = preg_split('/var /', $line);
                $nb_answers[1] = '$' . $nb_answers[1];
                eval($nb_answers[1]);
            }
            if (preg_match('/var message/', $line)) {
Esempio n. 21
0
 case 'change_status2':
     # Toggle status
     $fm = Aastra_manage_followme_Asterisk($user, 'change_status');
     # Prepare answer
     require_once 'AastraIPPhoneExecute.class.php';
     $object = new AastraIPPhoneExecute();
     # Update LED + idle screen
     if ($fm == '2') {
         $fm = '0';
     }
     $data = Aastra_get_user_context($user, 'follow');
     $last = $data['last'];
     $key = $data['key'];
     $data['last'] = $fm;
     if ($fm != $last) {
         Aastra_save_user_context($user, 'follow', $data);
         $object->setBeep();
         $object->addEntry($XML_SERVER . '&action=msg&value=' . $fm);
         if ($key != '') {
             if (Aastra_is_ledcontrol_supported()) {
                 if ($fm == '0') {
                     $object->AddEntry('Led: ' . $key . '=off');
                 } else {
                     $object->AddEntry('Led: ' . $key . '=on');
                 }
             }
         }
     }
     # Send a SIP Notification if mode is device and user
     if (!$AA_FREEPBX_USEDEVSTATE and $AA_FREEPBX_MODE == '2') {
         Aastra_propagate_changes_Asterisk($user, Aastra_get_userdevice_Asterisk($user), array('follow'));
Esempio n. 22
0
         $selection += 2;
     } else {
         $selection = $MaxLines;
     }
 }
 if ($action == 'clear') {
     $array_fav[$selection]['index'] = '';
     $array_fav[$selection]['name'] = '';
     Aastra_save_user_context($user, 'clock', $array_fav);
     $selection++;
 }
 if ($action == 'set') {
     $key = search_index($city, $array);
     $array_fav[$rank]['index'] = $array[$key]['index'];
     $array_fav[$rank]['name'] = $array[$key]['name'];
     Aastra_save_user_context($user, 'clock', $array_fav);
     $selection = $rank + 1;
 }
 # Display the favorites
 $object = new AastraIPPhoneTextMenu();
 $object->setDestroyOnExit();
 $object->setTitle(Aastra_get_label('Favorite Cities', $language));
 $object->setDefaultIndex($selection);
 if (Aastra_is_style_textmenu_supported) {
     $object->setStyle('none');
 }
 for ($i = 0; $i < $MaxLines; $i++) {
     if ($array_fav[$i]['name'] != '') {
         $object->addEntry($array_fav[$i]['name'], $XML_SERVER . '?action=zoomfav&city=' . $array_fav[$i]['index'] . '&user='******'&selection=' . ($i + 1), $i);
     } else {
         $array[$i]['name'] = '';
Esempio n. 23
0
             break;
     }
     # Back to options
     $action = 'options';
     break;
     # Toggle auto-answer/auto-login
 # Toggle auto-answer/auto-login
 case 'autologin':
     # Toggle auto-answer
     $vmail_options = Aastra_get_user_context($ext, 'vmail-options');
     if ($vmail_options['auto_login'] == '1') {
         $vmail_options['auto_login'] = '******';
     } else {
         $vmail_options['auto_login'] = '******';
     }
     Aastra_save_user_context($ext, 'vmail-options', $vmail_options);
     # Next action
     $action = 'options';
     break;
     # Update password
 # Update password
 case 'set_password':
     # Check password
     if (strlen($paused) != 0 and is_numeric($paused)) {
         Aastra_change_vm_password($user, $paused);
         $action = 'flash';
         $flash_next = $XML_SERVER . '&action=options&origin=' . $origin;
         $flash_text = Aastra_get_label('Password updated', $language);
     } else {
         $action = 'chg_password';
     }
Esempio n. 24
0
function update_user_keys($user)
{
    # Get MAC address and type of phone
    $header = Aastra_decode_HTTP_header();
    # Read config file
    $array_temp = Aastra_readCFGfile(AASTRA_TFTP_DIRECTORY . '/' . $header['mac'] . '.cfg', '#', ':');
    $array_config = $array_temp[''];
    # Update user keys
    $keys = Aastra_get_user_context($user, 'keys');
    foreach ($array_config as $key => $value) {
        if (stristr($key, 'key')) {
            $array_key[$key] = $value;
        }
    }
    $keys[$header['model']] = $array_key;
    Aastra_save_user_context($user, 'keys', $keys);
}