Initial commit
This commit is contained in:
106
php_classes/AastraIPPhone.class.php
Normal file
106
php_classes/AastraIPPhone.class.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Aastra XML API Classes - AastraIPPhone
|
||||
#
|
||||
# AastraIPPhone is the root class for all the Aastra XML objects.
|
||||
#
|
||||
# Public methods
|
||||
# setTitle(Title) to setup the title of an object
|
||||
# setDestroyOnExit() to set DestroyonExit parameter to 'yes', 'no' by default (optional)
|
||||
# setBeep() to enable a notification beep with the object (optional)
|
||||
# setRefresh(timeout,URL) to add Refresh parameters to the object (optional)
|
||||
# addSoftkey(index,label,uri) to add custom soktkeys to the object (optional)
|
||||
# output() to display the object
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
require_once('AastraIPPhoneSoftkeyEntry.class.php');
|
||||
|
||||
class AastraIPPhone {
|
||||
var $_entries;
|
||||
var $_softkeys;
|
||||
var $_title;
|
||||
var $_destroyOnExit='';
|
||||
var $_refreshTimeout=0;
|
||||
var $_refreshURL='';
|
||||
var $_beep='';
|
||||
|
||||
function AastraIPPhone()
|
||||
{
|
||||
$this->_entries = array();
|
||||
$this->_softkeys = array();
|
||||
$this->_title = '';
|
||||
}
|
||||
|
||||
function setTitle($title)
|
||||
{
|
||||
$this->_title = $title;
|
||||
}
|
||||
|
||||
function setRefresh($timeout,$URL)
|
||||
{
|
||||
$this->_refreshTimeout = $timeout;
|
||||
$this->_refreshURL = $URL;
|
||||
}
|
||||
|
||||
function setBeep()
|
||||
{
|
||||
$this->_beep='yes';
|
||||
}
|
||||
|
||||
function setDestroyOnExit()
|
||||
{
|
||||
$this->_destroyOnExit='yes';
|
||||
}
|
||||
|
||||
function output()
|
||||
{
|
||||
header("Content-type: text/xml");
|
||||
if (($this->_refreshTimeout!=0) and ($this->_refreshURL!='')) header("Refresh: ".$this->_refreshTimeout."; url=".$this->_refreshURL);
|
||||
$output=$this->render();
|
||||
header("Content-Length: ".strlen($output));
|
||||
echo($output);
|
||||
}
|
||||
|
||||
function addSoftkey($index, $label, $uri)
|
||||
{
|
||||
$this->_softkeys[] = new AastraIPPhoneSoftkeyEntry($index, $label, $uri);
|
||||
}
|
||||
|
||||
function escape($string)
|
||||
{
|
||||
return(str_replace(
|
||||
array('<', '>', '&'),
|
||||
array('<', '>', '&'),
|
||||
$string
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
124
php_classes/AastraIPPhoneDirectory.class.php
Normal file
124
php_classes/AastraIPPhoneDirectory.class.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?
|
||||
|
||||
##################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Aastra XML API Classes - AastraIPPhoneDirectory
|
||||
#
|
||||
# AastraIPPhoneDirectory object.
|
||||
#
|
||||
# Public methods
|
||||
#
|
||||
# Inherited from AastraIPPhone
|
||||
# setTitle(Title) to setup the title of an object
|
||||
# setDestroyOnExit() to set DestroyonExit parameter to 'yes', 'no' by default (optional)
|
||||
# setBeep() to enable a notification beep with the object (optional)
|
||||
# addSoftkey(index,label,uri) to add custom softkeys to the object (optional)
|
||||
# setRefresh(timeout,URL) to add Refresh parameters to the object (optional)
|
||||
# output() to display the object
|
||||
#
|
||||
# Specific to the object
|
||||
# setNext(next) to set URI of the next page, optional
|
||||
# setPrevious(previous) to set URI of the previous page, optional
|
||||
# addEntry(name,phone) to add an element in the list to be displayed, at least one is needed.
|
||||
# natsortbyname() to order the list
|
||||
#
|
||||
# Example
|
||||
# require_once('AastraIPPhoneDirectory.class.php');
|
||||
# $directory = new AastraIPPhoneDirectory();
|
||||
# $directory->setTitle('Title');
|
||||
# $directory->setNext('http://myserver.com/script.php?page=2');
|
||||
# $directory->setPrevious('http://myserver.com/script.php?page=0');
|
||||
# $directory->setDestroyOnExit();
|
||||
# $directory->addEntry('John Doe', '200');
|
||||
# $directory->addEntry('Jane Doe', '201');
|
||||
# $directory->natsortByName();
|
||||
# $directory->addSoftkey('1','Label 1','http://myserver.com/script.php?action=1');
|
||||
# $directory->addSoftkey('6','Exit','SoftKey:Exit');
|
||||
# $directory->output();
|
||||
#
|
||||
########################################################################################################
|
||||
|
||||
require_once('AastraIPPhone.class.php');
|
||||
require_once('AastraIPPhoneDirectoryEntry.class.php');
|
||||
|
||||
class AastraIPPhoneDirectory extends AastraIPPhone {
|
||||
var $_next="";
|
||||
var $_previous="";
|
||||
|
||||
function setNext($next)
|
||||
{
|
||||
$this->_next = $next;
|
||||
}
|
||||
|
||||
function setPrevious($previous)
|
||||
{
|
||||
$this->_previous = $previous;
|
||||
}
|
||||
|
||||
function addEntry($name, $telephone)
|
||||
{
|
||||
$this->_entries[] = new AastraIPPhoneDirectoryEntry($name, $telephone);
|
||||
}
|
||||
|
||||
function natsortByName()
|
||||
{
|
||||
$tmpary = array();
|
||||
foreach ($this->_entries as $id => $entry) {
|
||||
$tmpary[$id] = $entry->getName();
|
||||
}
|
||||
natsort($tmpary);
|
||||
foreach ($tmpary as $id => $name) {
|
||||
$newele[] = $this->_entries[$id];
|
||||
}
|
||||
$this->_entries = $newele;
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$title = $this->escape($this->_title);
|
||||
$next = $this->escape($this->_next);
|
||||
$previous = $this->escape($this->_previous);
|
||||
$out = '';
|
||||
$out .= "<AastraIPPhoneDirectory";
|
||||
if($previous!="") $out .= " previous=\"$previous\"";
|
||||
if($next!="") $out .= " next=\"$next\"";
|
||||
if($this->_destroyOnExit == 'yes') $out .= " destroyOnExit=\"yes\"";
|
||||
if($this->_beep=='yes') $out .= " Beep=\"yes\"";
|
||||
$out .= ">\n";
|
||||
$out .= "<Title>{$title}</Title>\n";
|
||||
$index=0;
|
||||
foreach ($this->_entries as $entry) {
|
||||
if($index<15) $out .= $entry->render();
|
||||
$index++;
|
||||
}
|
||||
foreach ($this->_softkeys as $softkey) $out .= $softkey->render();
|
||||
$out .= "</AastraIPPhoneDirectory>\n";
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
?>
|
58
php_classes/AastraIPPhoneDirectoryEntry.class.php
Normal file
58
php_classes/AastraIPPhoneDirectoryEntry.class.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Aastra XML API Classes - AastraIPPhoneDirectoryEntry
|
||||
#
|
||||
# Internal class for AastraIPPhoneDirectory object.
|
||||
########################################################################################################
|
||||
|
||||
class AastraIPPhoneDirectoryEntry extends AastraIPPhone {
|
||||
var $_name;
|
||||
var $_telephone;
|
||||
|
||||
function AastraIPPhoneDirectoryEntry($name, $telephone)
|
||||
{
|
||||
$this->_name=$name;
|
||||
$this->_telephone=$telephone;
|
||||
}
|
||||
|
||||
function getName()
|
||||
{
|
||||
return($this->_name);
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$name = $this->escape($this->_name);
|
||||
$telephone = $this->escape($this->_telephone);
|
||||
return("<MenuItem>\n<Prompt>{$name}</Prompt>\n<URI>{$telephone}</URI>\n</MenuItem>\n");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
73
php_classes/AastraIPPhoneExecute.class.php
Normal file
73
php_classes/AastraIPPhoneExecute.class.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
########################################################################################################
|
||||
# Aastra XML API Classes - AastraIPPhoneExecute
|
||||
#
|
||||
# AastraIPPhoneTextMenu object.
|
||||
#
|
||||
# Public methods
|
||||
#
|
||||
# Inherited from AastraIPPhone
|
||||
# output() to display the object
|
||||
# setBeep() to enable a notification beep with the object (optional)
|
||||
#
|
||||
# Specific to the object
|
||||
# addEntry(url) to add an action to be executed.
|
||||
#
|
||||
# Example
|
||||
# require_once('AastraIPPhoneExecute.class.php');
|
||||
# $execute = new AastraIPPhoneExecute();
|
||||
# $execute->addEntry('http://myserver.com/script.php?choice=2');
|
||||
# $execute->addEntry('Command: Reset');
|
||||
# $execute->output();
|
||||
#
|
||||
########################################################################################################
|
||||
|
||||
require_once('AastraIPPhone.class.php');
|
||||
require_once('AastraIPPhoneExecuteEntry.class.php');
|
||||
|
||||
class AastraIPPhoneExecute extends AastraIPPhone {
|
||||
|
||||
function addEntry($url)
|
||||
{
|
||||
$this->_entries[] = new AastraIPPhoneExecuteEntry($url);
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$title = $this->escape($this->_title);
|
||||
$out = "<AastraIPPhoneExecute";
|
||||
if($this->_beep=='yes') $out .= " Beep=\"yes\"";
|
||||
$out .= ">\n";
|
||||
foreach ($this->_entries as $entry) $out .= $entry->render();
|
||||
$out .= "</AastraIPPhoneExecute>\n";
|
||||
return($out);
|
||||
}
|
||||
}
|
||||
?>
|
51
php_classes/AastraIPPhoneExecuteEntry.class.php
Normal file
51
php_classes/AastraIPPhoneExecuteEntry.class.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Aastra XML API Classes - AastraIPPhoneExecuteEntry
|
||||
# Aastra 480i Firmware 1.4.1 or better
|
||||
#
|
||||
# Internal class for AastraIPPhoneExecute object.
|
||||
################################################################################
|
||||
|
||||
class AastraIPPhoneExecuteEntry extends AastraIPPhone {
|
||||
var $_url;
|
||||
|
||||
function AastraIPPhoneExecuteEntry($url)
|
||||
{
|
||||
$this->_url=$url;
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$url = $this->escape($this->_url);
|
||||
$xml = "<ExecuteItem URI=\"".$url."\"/>\n";
|
||||
return($xml);
|
||||
}
|
||||
}
|
||||
?>
|
143
php_classes/AastraIPPhoneInputScreen.class.php
Normal file
143
php_classes/AastraIPPhoneInputScreen.class.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Aastra XML API Classes - AastraIPPhoneInputScreen
|
||||
#
|
||||
# AastraIPPhoneInputScreen object.
|
||||
#
|
||||
# Public methods
|
||||
#
|
||||
# Inherited from AastraIPPhone
|
||||
# setTitle(Title) to setup the title of an object
|
||||
# setDestroyOnExit() to set DestroyonExit parameter to 'yes', 'no' by default (optional)
|
||||
# setBeep() to enable a notification beep with the object (optional)
|
||||
# addSoftkey(index,label,uri) to add custom softkeys to the object (optional)
|
||||
# output() to display the object
|
||||
#
|
||||
# Specific to the object
|
||||
# setURL() to set the URL to called after the input
|
||||
# setType(type) to set type of input ('IP', 'string'or 'number'), 'string'by default
|
||||
# setDefault(default) to set default value for the input (optional)
|
||||
# setParameter(param) to set the parameter name to be parsed after the input
|
||||
# setPassword() to set the Password parameter to 'yes', 'no' by default (optional)
|
||||
# setNotEditable() to set the editable parameter to 'no', 'yes' by default (optional)
|
||||
# setEditable() is now replaced by setNotEditable but kept for compatibility reasons (optional)
|
||||
# setPrompt(prompt) to set the prompt to be displayed for the input.
|
||||
#
|
||||
# Example
|
||||
# require_once('AastraIPPhoneInputScreen.class.php');
|
||||
# $input = new AastraIPPhoneInputScreen();
|
||||
# $input->setTitle('Title');
|
||||
# $input->setPrompt('Enter your password');
|
||||
# $input->setParameter('param');
|
||||
# $input->setType('string');
|
||||
# $input->setURL('http://myserver.com/script.php');
|
||||
# $input->setPassword();
|
||||
# $input->setDefault('');
|
||||
# $input->setDestroyOnExit();
|
||||
# $input->setNotEditable();
|
||||
# $input->addSoftkey('1','Label 1','http://myserver.com/script.php?action=1');
|
||||
# $input->addSoftkey('6','Exit','SoftKey:Exit');
|
||||
# $input->output();
|
||||
#
|
||||
########################################################################################################
|
||||
|
||||
require_once('AastraIPPhone.class.php');
|
||||
|
||||
class AastraIPPhoneInputScreen extends AastraIPPhone {
|
||||
var $_url;
|
||||
var $_type='string';
|
||||
var $_parameter;
|
||||
var $_prompt;
|
||||
var $_editable='';
|
||||
var $_default='';
|
||||
var $_password='';
|
||||
|
||||
function setURL($url)
|
||||
{
|
||||
$this->_url=$url;
|
||||
}
|
||||
function setType($type)
|
||||
{
|
||||
$this->_type=$type;
|
||||
}
|
||||
|
||||
function setEditable()
|
||||
{
|
||||
$this->_editable='no';
|
||||
}
|
||||
|
||||
function setNotEditable()
|
||||
{
|
||||
$this->_editable='no';
|
||||
}
|
||||
|
||||
function setDefault($default)
|
||||
{
|
||||
$this->_default=$default;
|
||||
}
|
||||
|
||||
function setParameter($parameter)
|
||||
{
|
||||
$this->_parameter=$parameter;
|
||||
}
|
||||
|
||||
function setPassword()
|
||||
{
|
||||
$this->_password='yes';
|
||||
}
|
||||
|
||||
function setPrompt($prompt)
|
||||
{
|
||||
$this->_prompt=$prompt;
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$title = $this->escape($this->_title);
|
||||
$prompt = $this->escape($this->_prompt);
|
||||
$url = $this->escape($this->_url);
|
||||
$out = '';
|
||||
$out .= "<AastraIPPhoneInputScreen type=\"$this->_type\"";
|
||||
if($this->_password == 'yes') $out .= " password=\"yes\"";
|
||||
if($this->_destroyOnExit == 'yes') $out .= " destroyOnExit=\"yes\"";
|
||||
if($this->_editable == 'no') $out .= " editable=\"no\"";
|
||||
if($this->_beep=='yes') $out .= " Beep=\"yes\"";
|
||||
$out .= ">\n";
|
||||
$out .= "<Title>{$title}</Title>\n";
|
||||
$out .= "<Prompt>{$prompt}</Prompt>\n";
|
||||
$out .= "<URL>{$url}</URL>\n";
|
||||
$out .= "<Parameter>{$this->_parameter}</Parameter>\n";
|
||||
$out .= "<Default>{$this->_default}</Default>\n";
|
||||
foreach ($this->_softkeys as $softkey) $out .= $softkey->render();
|
||||
$out .= "</AastraIPPhoneInputScreen>\n";
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
?>
|
57
php_classes/AastraIPPhoneSoftkeyEntry.class.php
Normal file
57
php_classes/AastraIPPhoneSoftkeyEntry.class.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Aastra XML API Classes - AastraIPSoftkeyEntry
|
||||
# Aastra 480i Firmware 1.4.1 or better
|
||||
#
|
||||
# Internal class for AastraIPPhone object.
|
||||
################################################################################
|
||||
|
||||
class AastraIPPhoneSoftkeyEntry extends AastraIPPhone {
|
||||
var $_index;
|
||||
var $_label;
|
||||
var $_uri;
|
||||
|
||||
function AastraIPPhoneSoftkeyEntry($index, $label, $uri)
|
||||
{
|
||||
$this->_index=$index;
|
||||
$this->_label=$label;
|
||||
$this->_uri=$uri;
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$index = $this->_index;
|
||||
$uri = $this->escape($this->_uri);
|
||||
$label = $this->escape($this->_label);
|
||||
$xml = "<SoftKey index=\"$index\">\n<Label>{$label}</Label>\n<URI>{$uri}</URI>\n</SoftKey>\n";
|
||||
return($xml);
|
||||
}
|
||||
}
|
||||
?>
|
83
php_classes/AastraIPPhoneStatus.class.php
Normal file
83
php_classes/AastraIPPhoneStatus.class.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Aastra XML API Classes - AastraIPPhoneStatus
|
||||
#
|
||||
# AastraIPPhoneStatus object.
|
||||
#
|
||||
# Public methods
|
||||
#
|
||||
# Inherited from AastraIPPhone
|
||||
# output() to display the object
|
||||
# setBeep() to enable a notification beep with the object (optional)
|
||||
#
|
||||
# Specific to the object
|
||||
# setSession(session) to setup the session ID
|
||||
# addEntry(index,message,type,timeout) to add a message to be displayed on the idle screen.
|
||||
#
|
||||
# Example
|
||||
# require_once('AastraIPPhoneStatus.class.php');
|
||||
# $status = new AastraIPPhoneStatus();
|
||||
# $status->setSession('Session');
|
||||
# $status->setBeep();
|
||||
# $status->addEntry('1','Message 1','',0);
|
||||
# $status->addEntry('2','Message 2','alert',5);
|
||||
# $status->output();
|
||||
#
|
||||
########################################################################################################
|
||||
|
||||
require_once('AastraIPPhone.class.php');
|
||||
require_once('AastraIPPhoneStatusEntry.class.php');
|
||||
|
||||
class AastraIPPhoneStatus extends AastraIPPhone {
|
||||
var $_session;
|
||||
|
||||
function setSession($session)
|
||||
{
|
||||
$this->_session=$session;
|
||||
}
|
||||
|
||||
function addEntry($index, $message, $type='', $timeout=NULL)
|
||||
{
|
||||
$this->_entries[] = new AastraIPPhoneStatusEntry($index, $message, $type, $timeout);
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$session = $this->escape($this->_session);
|
||||
$out = "<AastraIPPhoneStatus";
|
||||
if($this->_beep=='yes') $out .= " Beep=\"yes\"";
|
||||
$out .= ">\n";
|
||||
$out .= "<Session>".$session."</Session>\n";
|
||||
foreach ($this->_entries as $entry) $out .= $entry->render();
|
||||
$out .= "</AastraIPPhoneStatus>\n";
|
||||
return($out);
|
||||
}
|
||||
}
|
||||
?>
|
66
php_classes/AastraIPPhoneStatusEntry.class.php
Normal file
66
php_classes/AastraIPPhoneStatusEntry.class.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
##################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
##################################################################################################
|
||||
# Aastra XML API Classes - AastraIPPhoneStatusEntry
|
||||
# Aastra 480i Firmware 1.4.1 or better
|
||||
#
|
||||
# Internal class for AastraIPPhoneStatus object.
|
||||
##################################################################################################
|
||||
|
||||
class AastraIPPhoneStatusEntry extends AastraIPPhone {
|
||||
var $_index;
|
||||
var $_message;
|
||||
var $_type='';
|
||||
var $_timeout=NULL;
|
||||
|
||||
function AastraIPPhoneStatusEntry($index, $message, $type, $timeout)
|
||||
{
|
||||
$this->_index=$index;
|
||||
$this->_message=$message;
|
||||
$this->_type=$type;
|
||||
$this->_timeout=$timeout;
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$index = $this->escape($this->_index);
|
||||
$message = $this->escape($this->_message);
|
||||
$type = $this->_type;
|
||||
$timeout = $this->_timeout;
|
||||
$xml = "<Message index=\"{$index}\"";
|
||||
if ($type!='')
|
||||
{
|
||||
$xml .= " type=\"{$type}\"";
|
||||
if ($timeout!=NULL) $xml .= " Timeout=\"{$timeout}\"";
|
||||
}
|
||||
$xml .= ">{$message}</Message>\n";
|
||||
return($xml);
|
||||
}
|
||||
}
|
||||
?>
|
114
php_classes/AastraIPPhoneTextMenu.class.php
Normal file
114
php_classes/AastraIPPhoneTextMenu.class.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Aastra XML API Classes - AastraIPPhoneTextMenu
|
||||
#
|
||||
# AastraIPPhoneTextMenu object.
|
||||
#
|
||||
# Public methods
|
||||
#
|
||||
# Inherited from AastraIPPhone
|
||||
# setTitle(Title) to setup the title of an object
|
||||
# setDestroyOnExit() to set DestroyOnExit parameter to "yes" (optional)
|
||||
# setBeep() to enable a notification beep with the object (optional)
|
||||
# addSoftkey(index,label,uri) to add custom softkeys to the object (optional)
|
||||
# setRefresh(timeout,URL) to add Refresh parameters to the object (optional)
|
||||
# output() to display the object
|
||||
#
|
||||
# Specific to the object
|
||||
# setDestroyOnExit() to set DestroyOnExit parameter to "yes", optional
|
||||
# addEntry(name,url,selection) to add an element in the list to be displayed, at
|
||||
# least one is needed.
|
||||
# natsortbyname() to order the list
|
||||
#
|
||||
# Example
|
||||
# require_once('AastraIPPhoneTextMenu.class.php');
|
||||
# $menu = new AastraIPPhoneTextMenu();
|
||||
# $menu->setTitle('Title');
|
||||
# $menu->setDestroyOnExit();
|
||||
# $menu->setDefaultIndex();
|
||||
# $menu->addEntry('Choice 2', 'http://myserver.com/script.php?choice=2','');
|
||||
# $menu->addEntry('Choice 1', 'http://myserver.com/script.php?choice=1','');
|
||||
# $menu->addEntry('Choice 3', 'http://myserver.com/script.php?choice=3','');
|
||||
# $menu->natsortByName();
|
||||
# $menu->addSoftkey('1','Label 1','http://myserver.com/script.php?action=1');
|
||||
# $menu->addSoftkey('6','Exit','SoftKey:Exit');
|
||||
# $menu->output();
|
||||
#
|
||||
####################################################################################################
|
||||
|
||||
require_once('AastraIPPhone.class.php');
|
||||
require_once('AastraIPPhoneTextMenuEntry.class.php');
|
||||
|
||||
class AastraIPPhoneTextMenu extends AastraIPPhone {
|
||||
var $_defaultIndex="";
|
||||
|
||||
function setDefaultIndex($defaultIndex)
|
||||
{
|
||||
$this->_defaultIndex = $defaultIndex;
|
||||
}
|
||||
|
||||
function addEntry($name, $url, $selection=NULL)
|
||||
{
|
||||
$this->_entries[] = new AastraIPPhoneTextMenuEntry($name, $url, $selection);
|
||||
}
|
||||
|
||||
function natsortByName()
|
||||
{
|
||||
$tmpary = array();
|
||||
foreach ($this->_entries as $id => $entry) {
|
||||
$tmpary[$id] = $entry->getName();
|
||||
}
|
||||
natsort($tmpary);
|
||||
foreach ($tmpary as $id => $name) {
|
||||
$newele[] = $this->_entries[$id];
|
||||
}
|
||||
$this->_entries = $newele;
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$title = $this->escape($this->_title);
|
||||
$out = "<AastraIPPhoneTextMenu ";
|
||||
if ($this->_destroyOnExit=='yes') $out .= "destroyOnExit=\"yes\" ";
|
||||
if ($this->_defaultIndex!="") $out .= "defaultIndex=\"{$this->_defaultIndex}\"";
|
||||
if($this->_beep=='yes') $out .= " Beep=\"yes\"";
|
||||
$out .= ">\n";
|
||||
$out .= "<Title>".$title."</Title>\n";
|
||||
$index=0;
|
||||
foreach ($this->_entries as $entry) {
|
||||
if($index<15) $out .= $entry->render();
|
||||
$index++;
|
||||
}
|
||||
foreach ($this->_softkeys as $softkey) $out .= $softkey->render();
|
||||
$out .= "</AastraIPPhoneTextMenu>\n";
|
||||
return($out);
|
||||
}
|
||||
}
|
||||
?>
|
64
php_classes/AastraIPPhoneTextMenuEntry.class.php
Normal file
64
php_classes/AastraIPPhoneTextMenuEntry.class.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Aastra XML API Classes - AastraIPTextMenuEntry
|
||||
# Aastra 480i Firmware 1.4.1 or better
|
||||
#
|
||||
# Internal class for AastraIPPhoneTextMenu object.
|
||||
###################################################################################################
|
||||
|
||||
class AastraIPPhoneTextMenuEntry extends AastraIPPhone {
|
||||
var $_name;
|
||||
var $_url;
|
||||
var $_selection;
|
||||
|
||||
function AastraIPPhoneTextMenuEntry($name, $url, $selection)
|
||||
{
|
||||
$this->_name=$name;
|
||||
$this->_url=$url;
|
||||
$this->_selection=$selection;
|
||||
}
|
||||
|
||||
function getName()
|
||||
{
|
||||
return($this->_name);
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$name = $this->escape($this->_name);
|
||||
$url = $this->escape($this->_url);
|
||||
$selection = $this->escape($this->_selection);
|
||||
$xml = "<MenuItem>\n<Prompt>{$name}</Prompt>\n<URI>{$url}</URI>\n";
|
||||
if($selection!=NULL) $xml .= "<Selection>{$selection}</Selection>\n";
|
||||
$xml .= "</MenuItem>\n";
|
||||
return($xml);
|
||||
}
|
||||
}
|
||||
?>
|
85
php_classes/AastraIPPhoneTextScreen.class.php
Normal file
85
php_classes/AastraIPPhoneTextScreen.class.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Aastra XML API Classes - AastraIPPhoneTextScreen
|
||||
#
|
||||
# AastraIPPhoneTextScreen object.
|
||||
#
|
||||
# Public methods
|
||||
#
|
||||
# Inherited from AastraIPPhone
|
||||
# setTitle(Title) to setup the title of an object
|
||||
# setDestroyOnExit() to set DestroyonExit parameter to 'yes', 'no' by default (optional)
|
||||
# setBeep() to enable a notification beep with the object (optional)
|
||||
# addSoftkey(index, label, uri) to add custom softkeys to the object (optional)
|
||||
# setRefresh(timeout,URL) to add Refresh parameters to the object (optional)
|
||||
# output() to display the object
|
||||
#
|
||||
# Specific to the object
|
||||
# setText(text) to set the text to be displayed.
|
||||
#
|
||||
# Example
|
||||
# require_once('AastraIPPhoneTextScreen.class.php');
|
||||
# $text = new AastraIPPhoneTextScreen();
|
||||
# $text->setTitle('Title');
|
||||
# $text->setText('Text to be displayed.');
|
||||
# $text->setDestroyOnExit();
|
||||
# $text->addSoftkey('1','Label 1','http://myserver.com/script.php?action=1');
|
||||
# $text->addSoftkey('6','Exit','SoftKey:Exit');
|
||||
# $text->output();
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
require_once('AastraIPPhone.class.php');
|
||||
|
||||
class AastraIPPhoneTextScreen extends AastraIPPhone {
|
||||
var $_text;
|
||||
|
||||
function setText($text)
|
||||
{
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
function render()
|
||||
{
|
||||
$title = $this->escape($this->_title);
|
||||
$text = $this->escape($this->_text);
|
||||
$out = '';
|
||||
$out .= "<AastraIPPhoneTextScreen";
|
||||
if($this->_destroyOnExit == 'yes') $out .= " destroyOnExit=\"yes\"";
|
||||
if($this->_beep=='yes') $out .= " Beep=\"yes\"";
|
||||
$out .= ">\n";
|
||||
$out .= "<Title>{$title}</Title>\n";
|
||||
$out .= "<Text>{$text}</Text>\n";
|
||||
foreach ($this->_softkeys as $softkey) $out .= $softkey->render();
|
||||
$out .= "</AastraIPPhoneTextScreen>\n";
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
?>
|
24
php_classes/License.txt
Normal file
24
php_classes/License.txt
Normal file
@ -0,0 +1,24 @@
|
||||
Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
148
php_classes/sample.php
Normal file
148
php_classes/sample.php
Normal file
@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
###################################################################################################
|
||||
# Copyright (c) 2006 Aastra Telecom US, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of Aastra Telecom US, Inc. may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY AASTRA TELECOM US, INC. ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL AASTRA TELECOM US, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
###################################################################################################
|
||||
# Sample php applications using the Aastra XML API Classes
|
||||
# Aastra SIP Phones Firmware 1.4.1 or better
|
||||
#
|
||||
# @param type, type of XML object to display
|
||||
# type=textmenu AastraIPPhoneTextMenu
|
||||
# type=textscreen AastraIPPhoneTextScreen
|
||||
# type=directory AastraIPPhoneDirectory
|
||||
# type=input AastraIPPhoneInputScreen
|
||||
# type=status AastraIPPhoneStatus
|
||||
# type=execute AastraIPPhoneExecute
|
||||
#
|
||||
##########################################################
|
||||
|
||||
##########################################################
|
||||
# Retrieve type parameter
|
||||
$type=$_GET['type'];
|
||||
$type='inputscreen';
|
||||
|
||||
# Display the object
|
||||
switch($type)
|
||||
{
|
||||
case 'textmenu':
|
||||
require_once('AastraIPPhoneTextMenu.class.php');
|
||||
$menu = new AastraIPPhoneTextMenu();
|
||||
$menu->setTitle('Title');
|
||||
# $menu->setDestroyOnExit();
|
||||
$menu->setDeFaultIndex('3');
|
||||
$menu->addEntry('Choice 2', 'http://65.205.71.13/php_classes/php_classes_1.4.1/sample.php', 'Value=2');
|
||||
$menu->addEntry('Choice 1', 'http://65.205.71.13/php_classes/php_classes_1.4.1/sample.php', 'Value=1');
|
||||
$menu->addEntry('Choice 3', 'http://65.205.71.13/php_classes/php_classes_1.4.1/sample.php', 'Value=3');
|
||||
$menu->output();
|
||||
|
||||
|
||||
# $menu = new AastraIPPhoneTextMenu();
|
||||
# $menu->setTitle('Title');
|
||||
# $menu->setDestroyOnExit();
|
||||
# $menu->setDeFaultIndex('3');
|
||||
# $menu->addEntry('Choice 2', 'http://myserver.com/script.php?choice=2', 'Value=2');
|
||||
# $menu->addEntry('Choice 1', 'http://myserver.com/script.php?choice=1', 'Value=1');
|
||||
# $menu->addEntry('Choice 3', 'http://myserver.com/script.php?choice=3', 'Value=3');
|
||||
# $menu->natsortByName();
|
||||
# $menu->addSoftkey('1', 'Label', 'http://myserver.com/script.php?action=1');
|
||||
# $menu->addSoftkey('6', 'Exit', 'SoftKey:Exit');
|
||||
# $menu->output();
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'textscreen':
|
||||
require_once('AastraIPPhoneTextScreen.class.php');
|
||||
$text = new AastraIPPhoneTextScreen();
|
||||
$text->setTitle('Title');
|
||||
$text->setText('Text to be displayed.');
|
||||
$text->setDestroyOnExit();
|
||||
$text->addSoftkey('1', 'Label', 'http://myserver.com/script.php?action=1');
|
||||
$text->addSoftkey('6', 'Exit', 'SoftKey:Exit');
|
||||
$text->output();
|
||||
break;
|
||||
|
||||
case 'inputscreen':
|
||||
require_once('AastraIPPhoneInputScreen.class.php');
|
||||
$input = new AastraIPPhoneInputScreen();
|
||||
$input->setTitle('Test Input');
|
||||
$input->setPrompt('Pin code');
|
||||
$input->setParameter('password');
|
||||
$input->setType('number');
|
||||
$input->setURL('http://192.168.0.49/VoIPer/Default.aspx?type=T001&user=TEST&number=');
|
||||
$input->setPassword();
|
||||
$input->setDestroyOnExit();
|
||||
$input->output();
|
||||
|
||||
# $input = new AastraIPPhoneInputScreen();
|
||||
# $input->setTitle('Title');
|
||||
# $input->setPrompt('Enter your password');
|
||||
# $input->setParameter('param');
|
||||
# $input->setType('string');
|
||||
# $input->setURL('http://myserver.com/script.php');
|
||||
# $input->setPassword();
|
||||
# $input->setDestroyOnExit();
|
||||
# $input->setDefault('Default');
|
||||
# $input->addSoftkey('1', 'Label', 'http://myserver.com/script.php?action=1');
|
||||
# $input->addSoftkey('6', 'Exit', 'SoftKey:Exit');
|
||||
# $input->output();
|
||||
break;
|
||||
|
||||
case 'directory':
|
||||
require_once('AastraIPPhoneDirectory.class.php');
|
||||
$directory = new AastraIPPhoneDirectory();
|
||||
$directory->setTitle('Title');
|
||||
$directory->setNext('http://myserver.com/script.php?page=2');
|
||||
$directory->setPrevious('http://myserver.com/script.php?page=0');
|
||||
$directory->setDestroyOnExit();
|
||||
$directory->addEntry('John Doe', '200');
|
||||
$directory->addEntry('Jane Doe', '201');
|
||||
$directory->natsortByName();
|
||||
$directory->addSoftkey('1', 'Label', 'http://myserver.com/script.php?action=1');
|
||||
$directory->addSoftkey('6', 'Exit', 'SoftKey:Exit');
|
||||
$directory->output();
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
require_once('AastraIPPhoneStatus.class.php');
|
||||
$status = new AastraIPPhoneStatus();
|
||||
$status->setSession('Session');
|
||||
$status->setBeep();
|
||||
$status->addEntry('1','Message 1',"alert",5);
|
||||
$status->addEntry('2','Message 2');
|
||||
$status->output();
|
||||
break;
|
||||
|
||||
case 'execute':
|
||||
require_once('AastraIPPhoneExecute.class.php');
|
||||
$execute = new AastraIPPhoneExecute();
|
||||
$execute->addEntry('http://myserver.com/script.php?choice=2');
|
||||
$execute->addEntry('Command: Reset');
|
||||
$execute->output();
|
||||
break;
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user