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;
}
Esempio n. 2
0
<?php

//
// Copyright (C) 2009-2035 FreePBX-Swiss Urs Rueedi
//
if (preg_match("/aastra/i", $_SERVER["HTTP_USER_AGENT"])) {
    define('DEBUG_FUNCTION', '');
}
include "../../config.php";
$header = Aastra_decode_HTTP_header();
global $debug;
$debug['aastra/dheader'][] = "(aastra 1) " . $header[0] . "-" . $header[1] . "-" . $header[2];
$remote_ip = $_SERVER['REMOTE_ADDR'];
$file = $_SERVER['REQUEST_URI'];
if (DEBUG_FUNCTION == 'd' || DEBUG_FUNCTION == 'aastra' && ($_REQUEST['phonetyp'] && $_REQUEST['mac'] && $_REQUEST['pass'] && $_REQUEST['user_agent'])) {
    $model = $_REQUEST['phonetyp'];
    $mac = str_replace(":", "", $_REQUEST['mac']);
    $firmware = $_REQUEST['user_agent'];
    $qpass = $_REQUEST['pass'];
} else {
    $nonepass = true;
    $model = $header[0];
    $mac = $header[1];
    $firmware = $header[2];
    define(DEBUG_VIEW, false);
}
$mac = strtoupper(str_replace(":", "", $mac));
global $debug;
$debug['aastra/dheader'][] = "(aastra 2) model={$model}, mac={$mac} firmware={$firmware}, remote_ip={$remote_ip}, file={$file}";
switch ($model) {
    case "Aastra6730i":
function Aastra_phone_type($header = NULL)
{
    # No type by default
    $return = '0';
    # Get header info if needed
    if (!$header) {
        $header = Aastra_decode_HTTP_header();
    }
    # Test model/version
    switch ($header['model']) {
        case 'Aastra9112i':
        case 'Aastra9133ii':
            $return = '1';
            break;
        case 'Aastra480i':
        case 'Aastra480i Cordless':
            $return = '2';
            break;
        case 'Aastra6730i':
        case 'Aastra6731i':
        case 'Aastra51i':
        case 'Aastra53i':
        case 'Aastra9143i':
            $return = '3';
            break;
        case 'Aastra55i':
        case 'Aastra57i':
        case 'Aastra57iCT':
        case 'Aastra9480i':
        case 'Aastra9480iCT':
        case 'Aastra6735i':
        case 'Aastra6737i':
            $return = '4';
            break;
        case 'Aastra6739i':
        case 'Aastra8000i':
            $return = '5';
            break;
    }
    # Return result
    return $return;
}
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);
}
 function AastraIPPhoneScrollableTextMenu()
 {
     # Get Language
     $this->_language = Aastra_get_language();
     # Decode HTTP header
     $this->_header = Aastra_decode_HTTP_header();
     # Generate new cookie
     $this->_cookie = $this->_generateCookie();
     # Generate Scroll Handler reference
     global $XML_HTTP, $AA_XML_SERVER, $AA_XMLDIRECTORY;
     $this->_scrollHandlerReference = $XML_HTTP . $AA_XML_SERVER . "/" . $AA_XMLDIRECTORY . "/include/AastraIPPhoneScrollHandler.php?listCookie=" . $this->_cookie;
     # Calculate max linex
     $this->_calculateMaxLines();
     # Modify some values for 6739i
     if (Aastra_number_softkeys_supported() == 10) {
         $this->_exitKeyPosition = 10;
         $this->_nextKeyPosition = 8;
         $this->_previousKeyPosition = 7;
         $this->_selectKeyPosition = 3;
     }
 }
Esempio n. 6
0
}
$XML_SERVER = "http://" . $amp_conf["AMPPROVSERVER"] . $_SERVER['SCRIPT_NAME'];
$AA_PROXY_SERVER = $amp_conf["AMPPROVSERVER"];
$AA_WEB_SERVER = $amp_conf["AMPPROVSERVER"];
$AA_REGISTRAR_SERVER = $amp_conf["AMPPROVSERVER"];
$ASTERISK_LOCATION = "/etc/asterisk/";
// Retrieve parameters
$extension = $_GET["extension"];
$password = $_GET["password"];
$action = $_GET["action"];
$step = $_GET["step"];
$did = $_GET["did"];
$mobilecid = $_GET["mobilecid"];
$name = umlaut($_GET["name"]);
// get MAC address and type of phone
$value = Aastra_decode_HTTP_header();
$model = $value[0];
$mac = $value[1];
$ip = $value[3];
if ($model == "Aastra51i") {
    $model = "Aastra6751i";
}
if ($model == "Aastra53i") {
    $model = "Aastra6753i";
}
if ($model == "Aastra55i") {
    $model = "Aastra6755i";
}
if ($model == "Aastra57i") {
    $model = "Aastra6757i";
}
Esempio n. 7
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);
}