Merge pull request #69 from dkgroot/refactor_spelling

(WIP) Refactor: Spelling / PSR2 / Rename / camelCase Functions (WIP)
This commit is contained in:
Phantom 2020-04-09 17:54:46 +03:00 committed by GitHub
commit 363bfbc658
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 2221 additions and 2115 deletions

View file

@ -36,7 +36,7 @@ Make sure you have the following installed on your system:
- clang >= 3.6 (note: older not supported, higher advised) - clang >= 3.6 (note: older not supported, higher advised)
- gnu make - gnu make
- pbx: - pbx:
- asterisk >= 1.8 (absolute minimum & not recomended) - asterisk >= 1.8 (absolute minimum & not recommended)
- asterisk >= 13.7 or asterisk >= 14.0 recommended - asterisk >= 13.7 or asterisk >= 14.0 recommended
- gui: - gui:
- freepbx >= 13.0.192 - freepbx >= 13.0.192
@ -49,7 +49,7 @@ Make sure you have the following installed on your system:
- Creating mysql DB from sorce - Creating mysql DB from sorce
```mysql -u root asterisk < mysql-v5_enum.sql``` ```mysql -u root asterisk < mysql-v5_enum.sql```
- TFTP Server running under (recomended) /tftpboot/ [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/setup-tftp-service) - TFTP Server running under (recommended) /tftpboot/ [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/setup-tftp-service)
- You will need the phone settings templates. You can use the templates taken from the distribution "chan-sccp" - You will need the phone settings templates. You can use the templates taken from the distribution "chan-sccp"
```cp /usr/src/chan-sccp/conf/tftp/\*.xml\* /tftpboot/templates/``` ```cp /usr/src/chan-sccp/conf/tftp/\*.xml\* /tftpboot/templates/```

View file

@ -48,7 +48,7 @@ Make sure you have the following installed on your system:
- clang >= 3.6 (note: older not supported, higher advised) - clang >= 3.6 (note: older not supported, higher advised)
- gnu make - gnu make
- pbx: - pbx:
- asterisk >= 1.8 (absolute minimum & not recomended) - asterisk >= 1.8 (absolute minimum & not recommended)
- asterisk >= 13.7 or asterisk >= 14.0 or asterisk >= 15.0 (Тестировалось на стендах) - asterisk >= 13.7 or asterisk >= 14.0 or asterisk >= 15.0 (Тестировалось на стендах)
- gui: - gui:
- freepbx >= 13.0.192 (http://wiki.freepbx.org/display/FOP/Install+FreePBX) - freepbx >= 13.0.192 (http://wiki.freepbx.org/display/FOP/Install+FreePBX)

File diff suppressed because it is too large Load diff

View file

@ -12,109 +12,127 @@ namespace FreePBX\modules\Sccp_manager\aminterface;
// ************************************************************************** Event ********************************************* // ************************************************************************** Event *********************************************
abstract class Event extends IncomingMessage { abstract class Event extends IncomingMessage
{
protected $_events; protected $_events;
public function getName() { public function getName()
{
return $this->getKey('Event'); return $this->getKey('Event');
} }
public function __construct($rawContent) { public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
$this->_events = array(); $this->_events = array();
$this->_eventsCount = 0; $this->_eventsCount = 0;
// $this->_completed = !$this->isList(); // $this->_completed = !$this->isList();
} }
} }
class UnknownEvent extends Event { class UnknownEvent extends Event
public function __construct($rawContent='') { {
public function __construct($rawContent = '')
{
print_r($rawContent); print_r($rawContent);
// die(); // die();
} }
} }
class TableStart_Event extends Event { class TableStart_Event extends Event
{
public function getTableName() { public function getTableName()
{
return $this->getKey('TableName'); return $this->getKey('TableName');
} }
} }
class TableEnd_Event extends Event { class TableEnd_Event extends Event
{
public function getTableName() { public function getTableName()
{
return $this->getKey('TableName'); return $this->getKey('TableName');
} }
} }
class SCCPSoftKeySetEntry_Event extends Event { class SCCPSoftKeySetEntry_Event extends Event
{
protected $_data; protected $_data;
public function __construct($rawContent) { public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
return null; return null;
} }
} }
class SCCPShowSoftKeySetsComplete_Event extends Event { class SCCPShowSoftKeySetsComplete_Event extends Event
{
public function getListItems() { public function getListItems()
{
return intval($this->getKey('ListItems')); return intval($this->getKey('ListItems'));
} }
} }
class ExtensionStatus_Event extends Event { class ExtensionStatus_Event extends Event
{
public function getPrivilege() { public function getPrivilege()
{
return $this->getKey('Privilege'); return $this->getKey('Privilege');
} }
public function getExtension() { public function getExtension()
{
return $this->getKey('Exten'); return $this->getKey('Exten');
} }
public function getContext() { public function getContext()
{
return $this->getKey('Context'); return $this->getKey('Context');
} }
public function getHint() { public function getHint()
{
return $this->getKey('Hint'); return $this->getKey('Hint');
} }
public function getStatus() { public function getStatus()
{
return $this->getKey('Status'); return $this->getKey('Status');
} }
}
class SCCPDeviceEntry_Event extends Event
{
} }
class SCCPDeviceEntry_Event extends Event { class SCCPShowDeviceComplete_Event extends Event
{
} public function getListItems()
{
class SCCPShowDeviceComplete_Event extends Event {
public function getListItems() {
return intval($this->getKey('ListItems')); return intval($this->getKey('ListItems'));
} }
public function __construct($rawContent) { public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
$this->_completed = $this->getKey('EventList'); $this->_completed = $this->getKey('EventList');
// return null; // return null;
} }
} }
class SCCPShowDevice_Event extends Event { class SCCPShowDevice_Event extends Event
{
public function getCapabilities() { public function getCapabilities()
{
$ret = array(); $ret = array();
$codecs = explode(", ", substr($this->getKey('Capabilities'), 1, -1)); $codecs = explode(", ", substr($this->getKey('Capabilities'), 1, -1));
foreach ($codecs as $codec) { foreach ($codecs as $codec) {
@ -124,7 +142,8 @@ class SCCPShowDevice_Event extends Event {
return $ret; return $ret;
} }
public function getCodecsPreference() { public function getCodecsPreference()
{
$ret = array(); $ret = array();
$codecs = explode(", ", substr($this->getKey('CodecsPreference'), 1, -1)); $codecs = explode(", ", substr($this->getKey('CodecsPreference'), 1, -1));
foreach ($codecs as $codec) { foreach ($codecs as $codec) {
@ -133,25 +152,30 @@ class SCCPShowDevice_Event extends Event {
} }
return $ret; return $ret;
} }
} }
class SCCPShowDevicesComplete_Event extends Event { class SCCPShowDevicesComplete_Event extends Event
{
public function getListItems() { public function getListItems()
{
return intval($this->getKey('ListItems')); return intval($this->getKey('ListItems'));
} }
} }
class SCCPDeviceButtonEntry_Event extends Event { class SCCPDeviceButtonEntry_Event extends Event
{
} }
class SCCPDeviceLineEntry_Event extends Event { class SCCPDeviceLineEntry_Event extends Event
{
} }
class SCCPDeviceStatisticsEntry_Event extends Event { class SCCPDeviceStatisticsEntry_Event extends Event
{
} }
class SCCPDeviceSpeeddialEntry_Event extends Event { class SCCPDeviceSpeeddialEntry_Event extends Event
{
} }
class ExtensionStateListComplete_Event extends Event { class ExtensionStateListComplete_Event extends Event
{
} }

View file

@ -10,11 +10,13 @@
namespace FreePBX\modules\Sccp_manager\aminterface; namespace FreePBX\modules\Sccp_manager\aminterface;
class AMIException extends \Exception { class AMIException extends \Exception
{
} }
abstract class Message { abstract class Message
{
const EOL = "\r\n"; const EOL = "\r\n";
const EOM = "\r\n\r\n"; const EOM = "\r\n\r\n";
@ -25,11 +27,12 @@ abstract class Message {
protected $createdDate; protected $createdDate;
private $_responseHandler; private $_responseHandler;
public function _ToDebug($level,$msg) { public function _ToDebug($level, $msg)
{
} }
public function getResponseHandler() { public function getResponseHandler()
{
if (strlen($this->_responseHandler) > 0) { if (strlen($this->_responseHandler) > 0) {
// throw new AMIException('Hier:' . $this->_responseHandler); // throw new AMIException('Hier:' . $this->_responseHandler);
return (string) $this->_responseHandler; return (string) $this->_responseHandler;
@ -38,7 +41,8 @@ abstract class Message {
} }
} }
public function setResponseHandler($responseHandler) { public function setResponseHandler($responseHandler)
{
if (0 == strlen($responseHandler)) { if (0 == strlen($responseHandler)) {
return; return;
} }
@ -50,7 +54,8 @@ abstract class Message {
} }
} }
public function setVariable($key, $value) { public function setVariable($key, $value)
{
$key = strtolower($key); $key = strtolower($key);
$this->variables[$key] = $value; $this->variables[$key] = $value;
/* print_r('<br>----Set Value -------<br>'); /* print_r('<br>----Set Value -------<br>');
@ -59,7 +64,8 @@ abstract class Message {
*/ */
} }
public function getVariable($key) { public function getVariable($key)
{
$key = strtolower($key); $key = strtolower($key);
if (!isset($this->variables[$key])) { if (!isset($this->variables[$key])) {
@ -68,7 +74,8 @@ abstract class Message {
return $this->variables[$key]; return $this->variables[$key];
} }
protected function setKey($key, $value) { protected function setKey($key, $value)
{
$key = strtolower((string) $key); $key = strtolower((string) $key);
$this->keys[$key] = (string) $value; $this->keys[$key] = (string) $value;
/* /*
@ -79,7 +86,8 @@ abstract class Message {
*/ */
} }
public function getKey($key) { public function getKey($key)
{
$key = strtolower($key); $key = strtolower($key);
if (!isset($this->keys[$key])) { if (!isset($this->keys[$key])) {
return null; return null;
@ -88,23 +96,28 @@ abstract class Message {
return $this->keys[$key]; return $this->keys[$key];
} }
public function getVariables() { public function getVariables()
{
return $this->variables; return $this->variables;
} }
public function getActionID() { public function getActionID()
{
return $this->getKey('ActionID'); return $this->getKey('ActionID');
} }
public function getKeys() { public function getKeys()
{
return $this->keys; return $this->keys;
} }
private function serializeVariable($key, $value) { private function serializeVariable($key, $value)
{
return "Variable: $key=$value"; return "Variable: $key=$value";
} }
protected function setSanitizedKey($key, $value) { protected function setSanitizedKey($key, $value)
{
$key = strtolower((string) $key); $key = strtolower((string) $key);
$_string_key = array('actionid', 'descr'); $_string_key = array('actionid', 'descr');
if (array_search($key, $_string_key) !== false) { if (array_search($key, $_string_key) !== false) {
@ -114,10 +127,11 @@ abstract class Message {
} }
} }
protected function sanitizeInput($value, $prefered_type = '') { protected function sanitizeInput($value, $prefered_type = '')
{
if ($prefered_type == '') { if ($prefered_type == '') {
if (!isset($value) || $value === NULL || strlen($value) == 0) { if (!isset($value) || $value === null || strlen($value) == 0) {
return NULL; return null;
} elseif (is_numeric($value)) { } elseif (is_numeric($value)) {
$prefered_type = 'numeric'; $prefered_type = 'numeric';
} elseif (is_string($value)) { } elseif (is_string($value)) {
@ -129,7 +143,7 @@ abstract class Message {
if ($prefered_type !== '') { if ($prefered_type !== '') {
switch ($prefered_type) { switch ($prefered_type) {
case 'string': case 'string':
if (!isset($value) || $value === NULL || strlen($value) == 0) { if (!isset($value) || $value === null || strlen($value) == 0) {
return ''; return '';
} }
if (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)) { if (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)) {
@ -143,7 +157,7 @@ abstract class Message {
} }
break; break;
case 'numeric': case 'numeric':
if (!isset($value) || $value === NULL || strlen($value) == 0) { if (!isset($value) || $value === null || strlen($value) == 0) {
return 0; return 0;
} }
if (filter_var($value, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX | FILTER_FLAG_ALLOW_OCTAL)) { if (filter_var($value, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX | FILTER_FLAG_ALLOW_OCTAL)) {
@ -160,11 +174,13 @@ abstract class Message {
} }
} }
protected function finishMessage($message) { protected function finishMessage($message)
{
return $message . self::EOL . self::EOL; return $message . self::EOL . self::EOL;
} }
public function serialize() { public function serialize()
{
$result = array(); $result = array();
foreach ($this->getKeys() as $k => $v) { foreach ($this->getKeys() as $k => $v) {
$result[] = $k . ': ' . $v; $result[] = $k . ': ' . $v;
@ -182,7 +198,8 @@ abstract class Message {
return $mStr; return $mStr;
} }
public function setActionID($actionID) { public function setActionID($actionID)
{
if (0 == strlen($actionID)) { if (0 == strlen($actionID)) {
throw new AMIException('ActionID cannot be empty.'); throw new AMIException('ActionID cannot be empty.');
return; return;
@ -196,38 +213,44 @@ abstract class Message {
$this->setKey('ActionID', $actionID); $this->setKey('ActionID', $actionID);
} }
public function __sleep() { public function __sleep()
{
return array('lines', 'variables', 'keys', 'createdDate'); return array('lines', 'variables', 'keys', 'createdDate');
} }
public function __construct() { public function __construct()
{
$this->lines = array(); $this->lines = array();
$this->variables = array(); $this->variables = array();
$this->keys = array(); $this->keys = array();
$this->createdDate = time(); $this->createdDate = time();
} }
} }
abstract class IncomingMessage extends Message { abstract class IncomingMessage extends Message
{
protected $rawContent; protected $rawContent;
public function getEventList() { public function getEventList()
{
return $this->getKey('EventList'); return $this->getKey('EventList');
} }
public function getRawContent() { public function getRawContent()
{
return $this->rawContent; return $this->rawContent;
} }
public function __sleep() { public function __sleep()
{
$ret = parent::__sleep(); $ret = parent::__sleep();
$ret[] = 'rawContent'; $ret[] = 'rawContent';
return $ret; return $ret;
} }
public function __construct($rawContent) { public function __construct($rawContent)
{
parent::__construct(); parent::__construct();
$this->rawContent = $rawContent; $this->rawContent = $rawContent;
$lines = explode(Message::EOL, $rawContent); $lines = explode(Message::EOL, $rawContent);
@ -243,11 +266,11 @@ abstract class IncomingMessage extends Message {
} }
} }
} }
} }
// namespace FreePBX\modules\Sccp_manager\aminterface\Message; // namespace FreePBX\modules\Sccp_manager\aminterface\Message;
class LoginAction extends ActionMessage { class LoginAction extends ActionMessage
{
/** /**
* Constructor. * Constructor.
@ -257,111 +280,122 @@ class LoginAction extends ActionMessage {
* *
* @return void * @return void
*/ */
public function __construct($user, $password) { public function __construct($user, $password)
{
parent::__construct('Login'); parent::__construct('Login');
$this->setKey('Username', $user); $this->setKey('Username', $user);
$this->setKey('Secret', $password); $this->setKey('Secret', $password);
$this->setKey('Events', 'off'); // &---- $this->setKey('Events', 'off'); // &----
$this->setResponseHandler('Login'); $this->setResponseHandler('Login');
} }
} }
abstract class ActionMessage extends Message { abstract class ActionMessage extends Message
{
public function __construct($what) { public function __construct($what)
{
parent::__construct(); parent::__construct();
$this->setKey('Action', $what); $this->setKey('Action', $what);
$this->setKey('ActionID', microtime(true)); $this->setKey('ActionID', microtime(true));
} }
} }
class CommandAction extends ActionMessage { class CommandAction extends ActionMessage
public function __construct($command) { {
public function __construct($command)
{
parent::__construct('Command'); parent::__construct('Command');
$this->setKey('Command', $command); $this->setKey('Command', $command);
$this->setResponseHandler("Command"); $this->setResponseHandler("Command");
} }
} }
class ReloadAction extends ActionMessage { class ReloadAction extends ActionMessage
{
public function __construct($module = false) { public function __construct($module = false)
{
parent::__construct('Reload'); parent::__construct('Reload');
if ($module !== false) { if ($module !== false) {
$this->setKey('Module', $module); $this->setKey('Module', $module);
$this->setResponseHandler("Generic"); $this->setResponseHandler("Generic");
} }
} }
} }
class ExtensionStateListAction extends ActionMessage { class ExtensionStateListAction extends ActionMessage
{
public function __construct() { public function __construct()
{
parent::__construct('ExtensionStateList'); parent::__construct('ExtensionStateList');
$this->setKey('Segment', 'general'); $this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command'); $this->setKey('ResultFormat', 'command');
$this->setResponseHandler("ExtensionStateList"); $this->setResponseHandler("ExtensionStateList");
} }
} }
class SCCPShowGlobalsAction extends ActionMessage { class SCCPShowGlobalsAction extends ActionMessage
{
public function __construct() public function __construct()
{ {
parent::__construct('SCCPShowGlobals'); parent::__construct('SCCPShowGlobals');
} }
} }
class SCCPShowSoftkeySetsAction extends ActionMessage { class SCCPShowSoftkeySetsAction extends ActionMessage
{
public function __construct() { public function __construct()
{
parent::__construct('SCCPShowSoftkeySets'); parent::__construct('SCCPShowSoftkeySets');
$this->setKey('Segment', 'general'); $this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command'); $this->setKey('ResultFormat', 'command');
$this->setResponseHandler("SCCPShowSoftkeySets"); $this->setResponseHandler("SCCPShowSoftkeySets");
} }
} }
class SCCPShowDeviceAction extends ActionMessage { class SCCPShowDeviceAction extends ActionMessage
{
public function __construct($devicename) { public function __construct($devicename)
{
parent::__construct('SCCPShowDevice'); parent::__construct('SCCPShowDevice');
$this->setKey('Segment', 'general'); $this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command'); $this->setKey('ResultFormat', 'command');
$this->setKey('DeviceName', $devicename); $this->setKey('DeviceName', $devicename);
$this->setResponseHandler("SCCPShowDevice"); $this->setResponseHandler("SCCPShowDevice");
} }
} }
class SCCPShowDevicesAction extends ActionMessage { class SCCPShowDevicesAction extends ActionMessage
{
public function __construct() { public function __construct()
{
parent::__construct('SCCPShowDevices'); parent::__construct('SCCPShowDevices');
$this->setKey('Segment', 'general'); $this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command'); $this->setKey('ResultFormat', 'command');
$this->setResponseHandler("SCCPShowDevices"); $this->setResponseHandler("SCCPShowDevices");
} }
} }
class SCCPTokenAckAction extends ActionMessage { class SCCPTokenAckAction extends ActionMessage
{
public function __construct($DeviceName) { public function __construct($DeviceName)
{
parent::__construct('SCCPTokenAck'); parent::__construct('SCCPTokenAck');
$this->setKey('DeviceId', $DeviceName); $this->setKey('DeviceId', $DeviceName);
$this->setResponseHandler("SCCPGeneric"); $this->setResponseHandler("SCCPGeneric");
} }
} }
class SCCPDeviceRestartAction extends ActionMessage { class SCCPDeviceRestartAction extends ActionMessage
{
public function __construct($DeviceName, $Type = "restart") { public function __construct($DeviceName, $Type = "restart")
{
parent::__construct('SCCPDeviceRestart'); parent::__construct('SCCPDeviceRestart');
$this->setResponseHandler("SCCPGeneric"); $this->setResponseHandler("SCCPGeneric");
if (empty($Type)) { if (empty($Type)) {
@ -374,7 +408,6 @@ class SCCPDeviceRestartAction extends ActionMessage {
throw new Exception('Param2 has to be one of \'restart\', \'full\', \'reset\'.'); throw new Exception('Param2 has to be one of \'restart\', \'full\', \'reset\'.');
} }
} }
} }
class SCCPConfigMetaDataAction extends ActionMessage class SCCPConfigMetaDataAction extends ActionMessage
@ -388,4 +421,3 @@ class SCCPConfigMetaDataAction extends ActionMessage
$this->setResponseHandler("SCCPGeneric"); $this->setResponseHandler("SCCPGeneric");
} }
} }

View file

@ -14,17 +14,20 @@ namespace FreePBX\modules\Sccp_manager\aminterface;
namespace FreePBX\modules\Sccp_manager\aminterface; namespace FreePBX\modules\Sccp_manager\aminterface;
abstract class Response extends IncomingMessage { abstract class Response extends IncomingMessage
{
protected $_events; protected $_events;
protected $_completed; protected $_completed;
protected $keys; protected $keys;
public function isComplete() { public function isComplete()
{
return $this->_completed; return $this->_completed;
} }
public function __sleep() { public function __sleep()
{
$ret = parent::__sleep(); $ret = parent::__sleep();
$ret[] = '_completed'; $ret[] = '_completed';
$ret[] = '_events'; $ret[] = '_events';
@ -34,8 +37,7 @@ abstract class Response extends IncomingMessage {
public function addEvent($event) public function addEvent($event)
{ {
$this->_events[] = $event; $this->_events[] = $event;
if ( if (stristr($event->getEventList(), 'complete') !== false
stristr($event->getEventList(), 'complete') !== false
|| stristr($event->getName(), 'complete') !== false || stristr($event->getName(), 'complete') !== false
|| stristr($event->getName(), 'DBGetResponse') !== false || stristr($event->getName(), 'DBGetResponse') !== false
) { ) {
@ -71,7 +73,8 @@ abstract class Response extends IncomingMessage {
} }
public function getVariable($_rawContent, $_fields='') { public function getVariable($_rawContent, $_fields = '')
{
$lines = explode(Message::EOL, $_rawContent); $lines = explode(Message::EOL, $_rawContent);
foreach ($_fields as $key => $value) { foreach ($_fields as $key => $value) {
foreach ($lines as $data) { foreach ($lines as $data) {
@ -83,37 +86,42 @@ abstract class Response extends IncomingMessage {
} }
} }
public function __construct($rawContent) { public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
$this->_events = array(); $this->_events = array();
$this->_eventsCount = 0; $this->_eventsCount = 0;
$this->_completed = !$this->isList(); $this->_completed = !$this->isList();
} }
} }
//**************************************************************************** //****************************************************************************
class Generic_Response extends Response { class Generic_Response extends Response
{
public function __construct($rawContent) { public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
// print_r('<br>---- r --<br>'); // print_r('<br>---- r --<br>');
// print_r($rawContent); // print_r($rawContent);
} }
} }
class Login_Response extends Response { class Login_Response extends Response
{
public function __construct($rawContent) { public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
return $this->isSuccess(); return $this->isSuccess();
} }
} }
class Command_Response extends Response { class Command_Response extends Response
{
private $_temptable; private $_temptable;
public function __construct($rawContent) { public function __construct($rawContent)
{
// print_r('<br>---- r --<br>'); // print_r('<br>---- r --<br>');
// print_r($rawContent); // print_r($rawContent);
// print_r('<br>---- re --<br>'); // print_r('<br>---- re --<br>');
@ -144,7 +152,8 @@ class Command_Response extends Response {
$this->_completed = $this->isSuccess(); $this->_completed = $this->isSuccess();
// return $this->isSuccess(); // return $this->isSuccess();
} }
public function getResult() { public function getResult()
{
if (stristr($this->getKey('output'), 'array') !== false) { if (stristr($this->getKey('output'), 'array') !== false) {
$result = $this->_temptable; $result = $this->_temptable;
} else { } else {
@ -152,15 +161,16 @@ class Command_Response extends Response {
} }
return $result; return $result;
} }
} }
class SCCPGeneric_Response extends Response { class SCCPGeneric_Response extends Response
{
protected $_tables; protected $_tables;
private $_temptable; private $_temptable;
public function addEvent($event) { public function addEvent($event)
{
// not eventlist (start/complete) // not eventlist (start/complete)
// print_r('<br>---- addEvent --<br>'); // print_r('<br>---- addEvent --<br>');
// print_r($event); // print_r($event);
@ -193,14 +203,14 @@ class SCCPGeneric_Response extends Response {
} }
} }
// finish eventlist // finish eventlist
if ( if (stristr($event->getEventList(), 'complete') != false || stristr($event->getName(), 'complete') != false
stristr($event->getEventList(), 'complete') != false || stristr($event->getName(), 'complete') != false
) { ) {
$this->_completed = true; $this->_completed = true;
} }
} }
protected function ConvertTableData($_tablename,$_fkey,$_fields) { protected function ConvertTableData($_tablename, $_fkey, $_fields)
{
$_rawtable = $this->Table2Array($_tablename); $_rawtable = $this->Table2Array($_tablename);
$result = array(); $result = array();
foreach ($_rawtable as $_row) { foreach ($_rawtable as $_row) {
@ -233,7 +243,8 @@ class SCCPGeneric_Response extends Response {
return $result; return $result;
} }
protected function ConvertEventData($_fkey,$_fields) { protected function ConvertEventData($_fkey, $_fields)
{
$result = array(); $result = array();
foreach ($this->_events as $_row) { foreach ($this->_events as $_row) {
@ -331,14 +342,16 @@ class SCCPGeneric_Response extends Response {
throw new AMIException("No JSON Key found to return."); throw new AMIException("No JSON Key found to return.");
} }
public function __construct($rawContent) { public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
$_fields = array("EventList" => "EventList:", "Message" => "Message:"); $_fields = array("EventList" => "EventList:", "Message" => "Message:");
// $this->getVariable($rawContent, $_fields); // $this->getVariable($rawContent, $_fields);
$this->_completed = !$this->isList(); $this->_completed = !$this->isList();
} }
public function getResult() { public function getResult()
{
if ($this->getKey('JSON') != null) { if ($this->getKey('JSON') != null) {
$result = $this->getJSON(); $result = $this->getJSON();
} else { } else {
@ -346,13 +359,13 @@ class SCCPGeneric_Response extends Response {
} }
return $result; return $result;
} }
} }
class SCCPJSON_Response extends Response { class SCCPJSON_Response extends Response
{
public function __construct($rawContent) { public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
$_fields = array("DataType" => "DataType:", "JSONRAW" => "JSON:"); $_fields = array("DataType" => "DataType:", "JSONRAW" => "JSON:");
$this->getVariable($rawContent, $_fields); $this->getVariable($rawContent, $_fields);
@ -362,70 +375,92 @@ class SCCPJSON_Response extends Response {
} }
return $this->isSuccess(); return $this->isSuccess();
} }
} }
class SCCPShowSoftkeySets_Response extends SCCPGeneric_Response { class SCCPShowSoftkeySets_Response extends SCCPGeneric_Response
public function __construct($rawContent) { {
public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
} }
public function getResult() { public function getResult()
{
$_fields = array('description'=>'description','label'=>'label','lblid'=>'lblid'); $_fields = array('description'=>'description','label'=>'label','lblid'=>'lblid');
$result = $this->ConvertTableData('SoftKeySets', array('set','mode'), $_fields); $result = $this->ConvertTableData('SoftKeySets', array('set','mode'), $_fields);
return $result; return $result;
} }
} }
class SCCPShowDevices_Response extends SCCPGeneric_Response { class SCCPShowDevices_Response extends SCCPGeneric_Response
public function __construct($rawContent) { {
public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
} }
public function getResult() { public function getResult()
{
$_fields = array('mac'=>'mac','address'=>'address','descr'=>'descr','regstate'=>'status', $_fields = array('mac'=>'mac','address'=>'address','descr'=>'descr','regstate'=>'status',
'token'=>'token','act'=>'act', 'lines'=>'lines','nat'=>'nat','regtime'=>'regtime'); 'token'=>'token','act'=>'act', 'lines'=>'lines','nat'=>'nat','regtime'=>'regtime');
$result = $this->ConvertTableData('Devices', array('mac'), $_fields); $result = $this->ConvertTableData('Devices', array('mac'), $_fields);
return $result; return $result;
} }
} }
class SCCPShowDevice_Response extends SCCPGeneric_Response { class SCCPShowDevice_Response extends SCCPGeneric_Response
public function __construct($rawContent) { {
public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
} }
public function getResult() { public function getResult()
{
$result = array(); $result = array();
$result = $this->Events2Array(); $result = $this->Events2Array();
$result['Buttons'] = $this->ConvertTableData('Buttons', array('id'), $result['Buttons'] = $this->ConvertTableData(
'Buttons',
array('id'),
array('id'=>'id','channelobjecttype'=>'channelobjecttype','inst'=>'inst', array('id'=>'id','channelobjecttype'=>'channelobjecttype','inst'=>'inst',
'typestr'=>'typestr','type'=>'type','pendupdt'=>'pendupdt','penddel'=>'penddel', 'default'=>'default')); 'typestr'=>'typestr',
$result['SpeeddialButtons'] = $this->ConvertTableData('Buttons', array('id'), 'type'=>'type',
array('id'=>'id','channelobjecttype'=>'channelobjecttype','name'=>'name','number'=>'number','hint'=>'hint')); 'pendupdt'=>'pendupdt',
$result['CallStatistics'] = $this->ConvertTableData('CallStatistics', array('type'), 'penddel'=>'penddel',
'default'=>'default')
);
$result['SpeeddialButtons'] = $this->ConvertTableData(
'Buttons',
array('id'),
array('id'=>'id','channelobjecttype'=>'channelobjecttype','name'=>'name','number'=>'number','hint'=>'hint')
);
$result['CallStatistics'] = $this->ConvertTableData(
'CallStatistics',
array('type'),
array('type'=>'type','channelobjecttype'=>'channelobjecttype','calls'=>'calls','pcktsnt'=>'pcktsnt','pcktrcvd'=>'pcktrcvd', array('type'=>'type','channelobjecttype'=>'channelobjecttype','calls'=>'calls','pcktsnt'=>'pcktsnt','pcktrcvd'=>'pcktrcvd',
'lost'=>'lost','jitter'=>'jitter','latency'=>'latency', 'quality'=>'quality','avgqual'=>'avgqual','meanqual'=>'meanqual', 'lost'=>'lost','jitter'=>'jitter','latency'=>'latency', 'quality'=>'quality','avgqual'=>'avgqual','meanqual'=>'meanqual',
'maxqual'=>'maxqual','rconceal'=>'rconceal','sconceal'=>'sconceal')); 'maxqual'=>'maxqual',
$result['SCCP_Vendor'] = Array('vendor' => strtok($result['skinnyphonetype'], ' '), 'model' => strtok('('), 'rconceal'=>'rconceal',
'sconceal'=>'sconceal')
);
$result['SCCP_Vendor'] = array('vendor' => strtok($result['skinnyphonetype'], ' '), 'model' => strtok('('),
'model_id' => strtok(')'), 'vendor_addon' => strtok($result['configphonetype'], ' '), 'model_id' => strtok(')'), 'vendor_addon' => strtok($result['configphonetype'], ' '),
'model_addon' => strtok(' ')); 'model_addon' => strtok(' '));
if (empty($result['SCCP_Vendor']['vendor']) || $result['SCCP_Vendor']['vendor'] == 'Undefined') { if (empty($result['SCCP_Vendor']['vendor']) || $result['SCCP_Vendor']['vendor'] == 'Undefined') {
$result['SCCP_Vendor'] = Array('vendor' => 'Undefined', 'model' => $result['configphonetype'], $result['SCCP_Vendor'] = array('vendor' => 'Undefined', 'model' => $result['configphonetype'],
'model_id' => '', 'vendor_addon' => $result['SCCP_Vendor']['vendor_addon'], 'model_id' => '', 'vendor_addon' => $result['SCCP_Vendor']['vendor_addon'],
'model_addon' => $result['SCCP_Vendor']['model_addon']); 'model_addon' => $result['SCCP_Vendor']['model_addon']);
} }
$result['MAC_Address'] =$result['macaddress']; $result['MAC_Address'] =$result['macaddress'];
return $result; return $result;
} }
} }
class ExtensionStateList_Response extends SCCPGeneric_Response { class ExtensionStateList_Response extends SCCPGeneric_Response
public function __construct($rawContent) { {
public function __construct($rawContent)
{
parent::__construct($rawContent); parent::__construct($rawContent);
} }
public function getResult() { public function getResult()
{
$result = $this->ConvertEventData(array('exten','context'), array('exten','context','hint','status','statustext')); $result = $this->ConvertEventData(array('exten','context'), array('exten','context','hint','status','statustext'));
return $result; return $result;
} }

View file

@ -10,8 +10,8 @@
namespace FreePBX\modules\Sccp_manager; namespace FreePBX\modules\Sccp_manager;
class aminterface
class aminterface { {
var $_socket; var $_socket;
var $_error; var $_error;
@ -29,7 +29,8 @@ class aminterface {
private $_responseFactory; private $_responseFactory;
private $debug_level = 1; private $debug_level = 1;
public function load_subspace($parent_class = null) { public function load_subspace($parent_class = null)
{
$driverNamespace = "\\FreePBX\\Modules\\Sccp_manager\\aminterface"; $driverNamespace = "\\FreePBX\\Modules\\Sccp_manager\\aminterface";
$drivers = array('Message' => 'Message.class.php', 'Response' => 'Response.class.php', 'Event' => 'Event.class.php'); $drivers = array('Message' => 'Message.class.php', 'Response' => 'Response.class.php', 'Event' => 'Event.class.php');
@ -37,7 +38,6 @@ class aminterface {
$class = $driverNamespace . "\\" . $key; $class = $driverNamespace . "\\" . $key;
$driver = __DIR__ . "/" . $value; $driver = __DIR__ . "/" . $value;
if (!class_exists($class, false)) { if (!class_exists($class, false)) {
if (file_exists($driver)) { if (file_exists($driver)) {
include(__DIR__ . "/" . $value); include(__DIR__ . "/" . $value);
} else { } else {
@ -47,7 +47,8 @@ class aminterface {
} }
} }
public function __construct($parent_class = null) { public function __construct($parent_class = null)
{
global $amp_conf; global $amp_conf;
$this->paren_class = $parent_class; $this->paren_class = $parent_class;
$this->_socket = false; $this->_socket = false;
@ -75,19 +76,23 @@ class aminterface {
} }
} }
public function status() { public function status()
{
if ($this->_config['enabled']) { if ($this->_config['enabled']) {
return true; return true;
} else {return false;} } else {
return false;
}
} }
public function info() { public function info()
{
$Ver = '13.0.4'; $Ver = '13.0.4';
if ($this->_config['enabled']) { if ($this->_config['enabled']) {
return Array('Version' => $Ver, return array('Version' => $Ver,
'about' => 'AMI data ver: ' . $Ver, 'test' => get_declared_classes()); 'about' => 'AMI data ver: ' . $Ver, 'test' => get_declared_classes());
} else { } else {
return Array('Version' => $Ver, return array('Version' => $Ver,
'about' => 'Disabled AMI ver: ' . $Ver); 'about' => 'Disabled AMI ver: ' . $Ver);
} }
} }
@ -96,15 +101,20 @@ class aminterface {
* Opens a tcp connection to ami. * Opens a tcp connection to ami.
* *
*/ */
public function open() { public function open()
{
$cString = $this->_config['tsoket'] . $this->_config['host'] . ':' . $this->_config['port']; $cString = $this->_config['tsoket'] . $this->_config['host'] . ':' . $this->_config['port'];
$this->_context = stream_context_create(); $this->_context = stream_context_create();
$errno = 0; $errno = 0;
$errstr = ''; $errstr = '';
$this->_ProcessingMessage = ''; $this->_ProcessingMessage = '';
$this->_socket = @stream_socket_client( $this->_socket = @stream_socket_client(
$cString, $errno, $errstr, $cString,
$this->_config['timeout'], STREAM_CLIENT_CONNECT, $this->_context $errno,
$errstr,
$this->_config['timeout'],
STREAM_CLIENT_CONNECT,
$this->_context
); );
if ($this->_socket === false) { if ($this->_socket === false) {
$this->_errorException('Error connecting to ami: ' . $errstr . $cString); $this->_errorException('Error connecting to ami: ' . $errstr . $cString);
@ -129,13 +139,15 @@ class aminterface {
/** /**
* Closes the connection to ami. * Closes the connection to ami.
*/ */
public function close() { public function close()
{
$this->_connect_state = false; $this->_connect_state = false;
$this->_ProcessingMessage = ''; $this->_ProcessingMessage = '';
@stream_socket_shutdown($this->_socket, STREAM_SHUT_RDWR); @stream_socket_shutdown($this->_socket, STREAM_SHUT_RDWR);
} }
public function send($message) { public function send($message)
{
$messageToSend = $message->serialize(); $messageToSend = $message->serialize();
$length = strlen($messageToSend); $length = strlen($messageToSend);
$this->_countE = 0; $this->_countE = 0;
@ -171,7 +183,8 @@ class aminterface {
$this->_errorException("Read waittime: " . ($this->socket_param['timeout']) . " exceeded (timeout).\n"); $this->_errorException("Read waittime: " . ($this->socket_param['timeout']) . " exceeded (timeout).\n");
} }
protected function getRelated($message) { protected function getRelated($message)
{
$ret = false; $ret = false;
$id = 0; $id = 0;
$id = $message->getActionID('ActionID'); $id = $message->getActionID('ActionID');
@ -185,11 +198,13 @@ class aminterface {
return $ret; return $ret;
} }
private function _messageToEvent($msg) { private function _messageToEvent($msg)
{
return $this->_eventFromRaw($msg); return $this->_eventFromRaw($msg);
} }
protected function getMessages() { protected function getMessages()
{
$msgs = array(); $msgs = array();
// Read something. // Read something.
$read = @fread($this->_socket, 65535); $read = @fread($this->_socket, 65535);
@ -207,14 +222,16 @@ class aminterface {
while (($marker = strpos($this->_ProcessingMessage, aminterface\Message::EOM))) { while (($marker = strpos($this->_ProcessingMessage, aminterface\Message::EOM))) {
$msg = substr($this->_ProcessingMessage, 0, $marker); $msg = substr($this->_ProcessingMessage, 0, $marker);
$this->_ProcessingMessage = substr( $this->_ProcessingMessage = substr(
$this->_ProcessingMessage, $marker + strlen(aminterface\Message::EOM) $this->_ProcessingMessage,
$marker + strlen(aminterface\Message::EOM)
); );
$msgs[] = $msg; $msgs[] = $msg;
} }
return $msgs; return $msgs;
} }
public function process() { public function process()
{
$msgs = $this->getMessages(); $msgs = $this->getMessages();
$this->_msgToDebug(90, $msgs); $this->_msgToDebug(90, $msgs);
$this->_countE++; $this->_countE++;
@ -233,15 +250,15 @@ class aminterface {
} elseif ($evePos !== false) { } elseif ($evePos !== false) {
$event = $this->_messageToEvent($aMsg); // Event Ok $event = $this->_messageToEvent($aMsg); // Event Ok
$this->_msgToDebug(99,'--- Responce Type 2 --- '); $this->_msgToDebug(99, '--- Response Type 2 --- ');
$this->_msgToDebug(99, $aMsg); $this->_msgToDebug(99, $aMsg);
$this->_msgToDebug(99,'--- Event Responce Type 2 --- '); $this->_msgToDebug(99, '--- Event Response Type 2 --- ');
$this->_msgToDebug(99, $event); $this->_msgToDebug(99, $event);
if ($event != null) { if ($event != null) {
$response = $this->findResponse($event); $response = $this->findResponse($event);
// print_r($response); // print_r($response);
// print_r('<br>--- E2 Responce Type 2 ----------<br>'); // print_r('<br>--- E2 Response Type 2 ----------<br>');
if ($response === false || $response->isComplete()) { if ($response === false || $response->isComplete()) {
$this->dispatch($event); // не работает $this->dispatch($event); // не работает
@ -261,10 +278,10 @@ class aminterface {
} }
} }
// print_r('<br>--- EProcecc ----------<br>'); // print_r('<br>--- EProcecc ----------<br>');
} }
private function _msgToDebug($level, $msg) { private function _msgToDebug($level, $msg)
{
if ($level > $this->debug_level) { if ($level > $this->debug_level) {
return; return;
} }
@ -273,7 +290,8 @@ class aminterface {
print_r('<br>'); print_r('<br>');
} }
private function _msgToResponse($msg) { private function _msgToResponse($msg)
{
// print_r("<br>------------hmsg----------<br>"); // print_r("<br>------------hmsg----------<br>");
// print_r($this->_lastActionClass); // print_r($this->_lastActionClass);
// print_r($this->_lastRequestedResponseHandler); // print_r($this->_lastRequestedResponseHandler);
@ -297,7 +315,8 @@ class aminterface {
* *
*/ */
public function _msgFromRaw($message, $requestingaction = false, $responseHandler = false) { public function _msgFromRaw($message, $requestingaction = false, $responseHandler = false)
{
$_className = false; $_className = false;
@ -317,7 +336,8 @@ class aminterface {
return new $responseclass($message); return new $responseclass($message);
} }
protected function _errorException($msg) { protected function _errorException($msg)
{
$this->_error[] = $msg; $this->_error[] = $msg;
} }
@ -325,7 +345,8 @@ class aminterface {
* Replace or dublicate to AMI interface * Replace or dublicate to AMI interface
*/ */
public function _eventFromRaw($message) { public function _eventFromRaw($message)
{
$eventStart = strpos($message, 'Event: ') + 7; $eventStart = strpos($message, 'Event: ') + 7;
if ($eventStart > strlen($message)) { if ($eventStart > strlen($message)) {
@ -344,7 +365,8 @@ class aminterface {
return new $className($message); return new $className($message);
} }
public function _respnceFromRaw($message, $requestingaction = false, $responseHandler = false) { public function _respnceFromRaw($message, $requestingaction = false, $responseHandler = false)
{
$responseclass = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\Response'; $responseclass = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\Response';
@ -368,7 +390,8 @@ class aminterface {
} }
// protected function findResponse(IncomingMessage $message) { // protected function findResponse(IncomingMessage $message) {
protected function findResponse($message) { protected function findResponse($message)
{
$actionId = $message->getActionId(); $actionId = $message->getActionId();
if (isset($this->_incomingQueue[$actionId])) { if (isset($this->_incomingQueue[$actionId])) {
return $this->_incomingQueue[$actionId]; return $this->_incomingQueue[$actionId];
@ -376,7 +399,8 @@ class aminterface {
return false; return false;
} }
protected function dispatch($message) { protected function dispatch($message)
{
print_r("<br>------------dispatch----------<br>"); print_r("<br>------------dispatch----------<br>");
print_r($message); print_r($message);
return false; return false;
@ -398,18 +422,19 @@ class aminterface {
} }
} }
print_r("<br>------------E dispatch----------<br>"); print_r("<br>------------E dispatch----------<br>");
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
function core_list_all_exten($keyfld = '', $filter = array()) { function core_list_all_exten($keyfld = '', $filter = array())
{
$result = array(); $result = array();
return $result; return $result;
} }
//-------------------Adaptive Function ------------------------------------------------------------ //-------------------Adaptive Function ------------------------------------------------------------
function core_list_hints() { function core_list_hints()
{
$result = array(); $result = array();
if ($this->_connect_state) { if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\ExtensionStateListAction(); $_action = new \FreePBX\modules\Sccp_manager\aminterface\ExtensionStateListAction();
@ -424,7 +449,8 @@ class aminterface {
return $result; return $result;
} }
function core_list_all_hints() { function core_list_all_hints()
{
$result = array(); $result = array();
if ($this->_connect_state) { if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\ExtensionStateListAction(); $_action = new \FreePBX\modules\Sccp_manager\aminterface\ExtensionStateListAction();
@ -439,7 +465,8 @@ class aminterface {
return $result; return $result;
} }
// --------------------- SCCP Comands // --------------------- SCCP Comands
function sccp_list_keysets() { function sccp_list_keysets()
{
$result = array(); $result = array();
if ($this->_connect_state) { if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowSoftkeySetsAction(); $_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowSoftkeySetsAction();
@ -451,7 +478,8 @@ class aminterface {
} }
return $result; return $result;
} }
function sccp_get_active_device() { function sccp_get_active_device()
{
$result = array(); $result = array();
if ($this->_connect_state) { if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDevicesAction(); $_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDevicesAction();
@ -463,7 +491,8 @@ class aminterface {
} }
return $result; return $result;
} }
function sccp_getdevice_info($devicename) { function sccp_getdevice_info($devicename)
{
$result = array(); $result = array();
if ($this->_connect_state) { if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDeviceAction($devicename); $_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDeviceAction($devicename);
@ -473,7 +502,8 @@ class aminterface {
} }
return $result; return $result;
} }
function sccp_device_reset($devicename,$action = '') { function sccpDeviceReset($devicename, $action = '')
{
if ($this->_connect_state) { if ($this->_connect_state) {
if ($action == 'tokenack') { if ($action == 'tokenack') {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPTokenAckAction($devicename); $_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPTokenAckAction($devicename);
@ -489,17 +519,19 @@ class aminterface {
} }
//------------------- Core Comands ---- //------------------- Core Comands ----
function core_sccp_reload() { function core_sccp_reload()
{
$result = array(); $result = array();
if ($this->_connect_state) { if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\ReloadAction('chan_sccp'); $_action = new \FreePBX\modules\Sccp_manager\aminterface\ReloadAction('chan_sccp');
// $_action = new \FreePBX\modules\Sccp_manager\aminterface\CommandAction('sccp reload force'); // No Responce Result !! // $_action = new \FreePBX\modules\Sccp_manager\aminterface\CommandAction('sccp reload force'); // No Response Result !!
$_response = $this->send($_action); $_response = $this->send($_action);
$result = $_response->getMessage(); $result = $_response->getMessage();
} }
return $result; return $result;
} }
function getSCCPVersion() { function getSCCPVersion()
{
$result = array(); $result = array();
if ($this->_connect_state) { if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPConfigMetaDataAction(); $_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPConfigMetaDataAction();
@ -509,7 +541,8 @@ class aminterface {
return $result; return $result;
} }
function getRealTimeStatus() { function getRealTimeStatus()
{
$result = array(); $result = array();
if ($this->_connect_state) { if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\CommandAction('realtime mysql status'); $_action = new \FreePBX\modules\Sccp_manager\aminterface\CommandAction('realtime mysql status');
@ -523,5 +556,4 @@ class aminterface {
} }
return $result; return $result;
} }
} }

View file

@ -10,18 +10,21 @@
namespace FreePBX\modules\Sccp_manager; namespace FreePBX\modules\Sccp_manager;
class oldinterface { class oldinterface
{
var $error; var $error;
public function __construct($parent_class = null) { public function __construct($parent_class = null)
{
$this->paren_class = $parent_class; $this->paren_class = $parent_class;
$this->error = ""; $this->error = "";
} }
public function info() { public function info()
{
$Ver = '13.0.4'; $Ver = '13.0.4';
return Array('Version' => $Ver, return array('Version' => $Ver,
'about' => 'Old interface data ver: ' . $Ver); 'about' => 'Old interface data ver: ' . $Ver);
} }
@ -34,7 +37,8 @@ class oldinterface {
* Replace or dublicate to AMI interface * Replace or dublicate to AMI interface
*/ */
public function sccp_core_commands($params = array()) { public function sccp_core_commands($params = array())
{
global $astman; global $astman;
$cmd_list = array('get_softkey' => array('cmd' => "sccp show softkeyssets", 'param' => ''), $cmd_list = array('get_softkey' => array('cmd' => "sccp show softkeyssets", 'param' => ''),
'get_version' => array('cmd' => "sccp show version", 'param' => ''), 'get_version' => array('cmd' => "sccp show version", 'param' => ''),
@ -77,7 +81,6 @@ class oldinterface {
if (!empty($params['name'])) { if (!empty($params['name'])) {
$astman->Command('sccp device ' . $params['name'] . ' ' . $msg); $astman->Command('sccp device ' . $params['name'] . ' ' . $msg);
} else { } else {
} }
break; break;
default: default:
@ -89,7 +92,8 @@ class oldinterface {
return $result; return $result;
} }
public function sccp_getdevice_info($dev_id) { public function sccp_getdevice_info($dev_id)
{
if (empty($dev_id)) { if (empty($dev_id)) {
return array(); return array();
} }
@ -113,9 +117,9 @@ class oldinterface {
} else { } else {
$res2 = ''; $res2 = '';
} }
$res3['SCCP_Vendor'] = Array('vendor' => strtok($res1, ' '), 'model' => strtok('('), 'model_id' => strtok(')'), 'vendor_addon' => strtok($res2, ' '), 'model_addon' => strtok(' ')); $res3['SCCP_Vendor'] = array('vendor' => strtok($res1, ' '), 'model' => strtok('('), 'model_id' => strtok(')'), 'vendor_addon' => strtok($res2, ' '), 'model_addon' => strtok(' '));
if (empty($res3['SCCP_Vendor']['vendor']) || $res3['SCCP_Vendor']['vendor'] == 'Undefined') { if (empty($res3['SCCP_Vendor']['vendor']) || $res3['SCCP_Vendor']['vendor'] == 'Undefined') {
$res3['SCCP_Vendor'] = Array('vendor' => 'Undefined', 'model' => $res4, 'model_id' => '', 'vendor_addon' => $res3['SCCP_Vendor']['vendor_addon'], 'model_addon' => $res3['SCCP_Vendor']['model_addon']); $res3['SCCP_Vendor'] = array('vendor' => 'Undefined', 'model' => $res4, 'model_id' => '', 'vendor_addon' => $res3['SCCP_Vendor']['vendor_addon'], 'model_addon' => $res3['SCCP_Vendor']['model_addon']);
// return $res4; // return $res4;
// return array(); // return array();
} }
@ -130,7 +134,8 @@ class oldinterface {
* A function should be used in the form of buttons for getting all hint. Not working. I don't know how to use properly. * A function should be used in the form of buttons for getting all hint. Not working. I don't know how to use properly.
*/ */
public function sccp_list_hints() { public function sccp_list_hints()
{
$hint_key = array(); $hint_key = array();
$hint_all = $this->sccp_list_all_hints(); $hint_all = $this->sccp_list_all_hints();
foreach ($hint_all as $value) { foreach ($hint_all as $value) {
@ -143,7 +148,8 @@ class oldinterface {
return $hint_key; return $hint_key;
} }
public function sccp_list_all_hints() { public function sccp_list_all_hints()
{
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_hints')); $ast_out = $this->sccp_core_commands(array('cmd' => 'get_hints'));
$ast_out = preg_split("/[\n]/", $ast_out['data']); $ast_out = preg_split("/[\n]/", $ast_out['data']);
$ast_key = array(); $ast_key = array();
@ -171,7 +177,8 @@ class oldinterface {
return $ast_key; return $ast_key;
} }
public function sccp_realtime_status() { public function sccp_realtime_status()
{
$ast_res = array(); $ast_res = array();
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_realtime_status')); $ast_out = $this->sccp_core_commands(array('cmd' => 'get_realtime_status'));
$ast_out = preg_split("/[\n]/", $ast_out['data']); $ast_out = preg_split("/[\n]/", $ast_out['data']);
@ -190,7 +197,8 @@ class oldinterface {
// !TODO!: -TODO-: install.php is still using the other version number. This is actually where I use another method ? // !TODO!: -TODO-: install.php is still using the other version number. This is actually where I use another method ?
public function get_compatible_sccp() { public function get_compatible_sccp()
{
$res = $this->getSCCPVersion(); $res = $this->getSCCPVersion();
if (empty($res)) { if (empty($res)) {
return 0; return 0;
@ -220,7 +228,8 @@ class oldinterface {
// return $res["vCode"]; // return $res["vCode"];
} }
public function getSCCPVersion() { public function getSCCPVersion()
{
$res = $this->getChanSCCPVersion(); $res = $this->getChanSCCPVersion();
if (empty($res)) { if (empty($res)) {
$res = $this->getCoreSCCPVersion(); $res = $this->getCoreSCCPVersion();
@ -228,7 +237,8 @@ class oldinterface {
return $res; return $res;
} }
function getCoreSCCPVersion() { function getCoreSCCPVersion()
{
$result = array(); $result = array();
$ast_out = $this->sccp_version(); $ast_out = $this->sccp_version();
$result["Version"] = $ast_out[0]; $result["Version"] = $ast_out[0];
@ -252,7 +262,8 @@ class oldinterface {
return $result; return $result;
} }
private function sccp_version() { private function sccp_version()
{
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_version')); $ast_out = $this->sccp_core_commands(array('cmd' => 'get_version'));
if (($ast_out['Response'] == 'Error') || (strpos($ast_out['data'], 'No such command') != false)) { if (($ast_out['Response'] == 'Error') || (strpos($ast_out['data'], 'No such command') != false)) {
return array('-1'); return array('-1');
@ -265,7 +276,8 @@ class oldinterface {
} }
} }
function getChanSCCPVersion() { function getChanSCCPVersion()
{
global $astman; global $astman;
$result = array(); $result = array();
if (!$astman) { if (!$astman) {
@ -285,11 +297,9 @@ class oldinterface {
$result["vCode"] = 400; $result["vCode"] = 400;
if ($version_parts[1] == "1") { if ($version_parts[1] == "1") {
$result["vCode"] = 410; $result["vCode"] = 410;
} else } elseif ($version_parts[1] == "2") {
if ($version_parts[1] == "2") {
$result["vCode"] = 420; $result["vCode"] = 420;
} else } elseif ($version_parts[1] >= "3") {
if ($version_parts[1] >= "3") {
$result["vCode"] = 430; $result["vCode"] = 430;
} }
} }
@ -338,7 +348,8 @@ class oldinterface {
return $result; return $result;
} }
public function sccp_list_keysets() { public function sccp_list_keysets()
{
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_softkey')); $ast_out = $this->sccp_core_commands(array('cmd' => 'get_softkey'));
$ast_out = preg_split("/[\n]/", $ast_out['data']); $ast_out = preg_split("/[\n]/", $ast_out['data']);
@ -364,7 +375,8 @@ class oldinterface {
return $ast_key; return $ast_key;
} }
public function sccp_get_active_device() { public function sccp_get_active_device()
{
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_device')); $ast_out = $this->sccp_core_commands(array('cmd' => 'get_device'));
$ast_out = preg_split("/[\n]/", $ast_out['data']); $ast_out = preg_split("/[\n]/", $ast_out['data']);
@ -392,20 +404,20 @@ class oldinterface {
$it++; $it++;
} while ((count($line_arr) > 3) and ( $it < count($line_arr))); } while ((count($line_arr) > 3) and ( $it < count($line_arr)));
explode(";|", implode(";|", $line_arr)); explode(";|", implode(";|", $line_arr));
list ($descr, $adress, $devname, $status, $token, $junk) = explode(";|", implode(";|", $line_arr)); list ($descr, $address, $devname, $status, $token, $junk) = explode(";|", implode(";|", $line_arr));
// list ($descr, $adress, $devname, $status, $junk) = $line_arr; // list ($descr, $address, $devname, $status, $junk) = $line_arr;
// if (strlen($ast_key[$devname]) < 1) { // if (strlen($ast_key[$devname]) < 1) {
if (strlen($devname) > 1) { if (strlen($devname) > 1) {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token); $ast_key[$devname] = array('name' => $devname, 'status' => $status, 'address' => $address, 'descr' => $descr, 'token' => $token);
} }
/* /*
if (isset($ast_key[$devname])) { if (isset($ast_key[$devname])) {
if (strlen($ast_key[$devname]) < 1) { if (strlen($ast_key[$devname]) < 1) {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $descr); $ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $address, 'descr' => $descr, 'token' => $descr);
} }
} else { } else {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token); $ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $address, 'descr' => $descr, 'token' => $token);
} }
* *
*/ */
@ -418,7 +430,8 @@ class oldinterface {
* Replace sccp_core_commands($params = array()) { * Replace sccp_core_commands($params = array()) {
*/ */
private function astman_retrieveJSFromMetaData($segment = "") { private function astman_retrieveJSFromMetaData($segment = "")
{
global $astman; global $astman;
$params = array(); $params = array();
if ($segment != "") { if ($segment != "") {
@ -434,7 +447,8 @@ class oldinterface {
} }
} }
private function strpos_array($haystack, $needles) { private function strpos_array($haystack, $needles)
{
if (is_array($needles)) { if (is_array($needles)) {
foreach ($needles as $str) { foreach ($needles as $str) {
if (is_array($str)) { if (is_array($str)) {
@ -442,22 +456,25 @@ class oldinterface {
} else { } else {
$pos = strpos($haystack, $str); $pos = strpos($haystack, $str);
} }
if ($pos !== FALSE) { if ($pos !== false) {
return $pos; return $pos;
} }
} }
} else { } else {
return strpos($haystack, $needles); return strpos($haystack, $needles);
} }
return FALSE; return false;
} }
private function loc_after($value, $inthat) { private function loc_after($value, $inthat)
if (!is_bool(strpos($inthat, $value))) {
if (!is_bool(strpos($inthat, $value))) {
return substr($inthat, strpos($inthat, $value) + strlen($value)); return substr($inthat, strpos($inthat, $value) + strlen($value));
} }
}
function getеtestChanSCC() { function getеtestChanSCC()
{
global $astman; global $astman;
// $action = Array('SCCPShowGlobals',); // $action = Array('SCCPShowGlobals',);
$params = array(); $params = array();
@ -472,7 +489,8 @@ class oldinterface {
/* /*
* [Segments] => ( [0] => general [1] => device [2] => line [3] => softkey ) * [Segments] => ( [0] => general [1] => device [2] => line [3] => softkey )
*/ */
function getеtestChanSCCP_GlablsInfo($Segment = '') { function getGlobalsFromMetaData($Segment = '')
{
global $astman; global $astman;
$params = array(); $params = array();
@ -498,5 +516,4 @@ class oldinterface {
} }
return $metadata; return $metadata;
} }
} }

View file

@ -9,24 +9,28 @@
namespace FreePBX\modules\Sccp_manager; namespace FreePBX\modules\Sccp_manager;
class dbinterface { class dbinterface
{
private $val_null = 'NONE'; /// REPLACE to null Field private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct($parent_class = null) { public function __construct($parent_class = null)
{
$this->paren_class = $parent_class; $this->paren_class = $parent_class;
} }
public function info() { public function info()
{
$Ver = '13.0.2'; $Ver = '13.0.2';
return Array('Version' => $Ver, return array('Version' => $Ver,
'about' => 'Data access interface ver: ' . $Ver); 'about' => 'Data access interface ver: ' . $Ver);
} }
/* /*
* Core Access Function * Core Access Function
*/ */
public function get_db_SccpTableByID($dataid, $data = array(), $indexField = '') { public function get_db_SccpTableByID($dataid, $data = array(), $indexField = '')
{
$resut = array(); $resut = array();
$raw = $this->get_db_SccpTableData($dataid, $data); $raw = $this->get_db_SccpTableData($dataid, $data);
if (empty($raw) || empty($indexField)) { if (empty($raw) || empty($indexField)) {
@ -39,9 +43,10 @@ class dbinterface {
return $resut; return $resut;
} }
public function get_db_SccpTableData($dataid, $data = array()) { public function get_db_SccpTableData($dataid, $data = array())
{
if ($dataid == '') { if ($dataid == '') {
return False; return false;
} }
switch ($dataid) { switch ($dataid) {
case "SccpExtension": case "SccpExtension":
@ -49,7 +54,8 @@ class dbinterface {
$sql = "SELECT * FROM `sccpline` ORDER BY `name`"; $sql = "SELECT * FROM `sccpline` ORDER BY `name`";
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC); $raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
} else { } else {
$sql = "SELECT * FROM `sccpline` WHERE `name`='" . $data['name']. "'";; $sql = "SELECT * FROM `sccpline` WHERE `name`='" . $data['name']. "'";
;
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC); $raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
} }
break; break;
@ -72,7 +78,8 @@ class dbinterface {
} }
} }
if (!empty($data['name'])) { if (!empty($data['name'])) {
$filtred = "`name`='" . $data['name']. "'";; $filtred = "`name`='" . $data['name']. "'";
;
$singlrow = true; $singlrow = true;
} }
if (!empty($data['type'])) { if (!empty($data['type'])) {
@ -141,7 +148,7 @@ class dbinterface {
$sql = 'SELECT * FROM sccpbuttonconfig WHERE ' .$sql. 'ORDER BY `instance`;'; $sql = 'SELECT * FROM sccpbuttonconfig WHERE ' .$sql. 'ORDER BY `instance`;';
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC); $raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
} else { } else {
$raw_settings = Array(); $raw_settings = array();
} }
break; break;
} }
@ -149,13 +156,15 @@ class dbinterface {
return $raw_settings; return $raw_settings;
} }
public function get_db_SccpSetting() { public function get_db_SccpSetting()
{
$sql = "SELECT `keyword`, `data`, `type`, `seq` FROM `sccpsettings` ORDER BY `type`, `seq`"; $sql = "SELECT `keyword`, `data`, `type`, `seq` FROM `sccpsettings` ORDER BY `type`, `seq`";
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC); $raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
return $raw_settings; return $raw_settings;
} }
public function get_db_sysvalues() { public function get_db_sysvalues()
{
$sql = "SHOW VARIABLES LIKE '%group_concat%'"; $sql = "SHOW VARIABLES LIKE '%group_concat%'";
$raw_settings = sql($sql, "getRow", DB_FETCHMODE_ASSOC); $raw_settings = sql($sql, "getRow", DB_FETCHMODE_ASSOC);
return $raw_settings; return $raw_settings;
@ -165,7 +174,8 @@ class dbinterface {
* Get Sccp Device Model information * Get Sccp Device Model information
*/ */
function getDb_model_info($get = "all", $format_list = "all", $filter = array()) { function getDb_model_info($get = "all", $format_list = "all", $filter = array())
{
global $db; global $db;
switch ($format_list) { switch ($format_list) {
case "model": case "model":
@ -230,7 +240,8 @@ class dbinterface {
return $raw_settings; return $raw_settings;
} }
function sccp_save_db($db_name = "", $save_value = array(), $mode = 'update', $key_fld = "", $hwid = "") { function write($db_name = "", $save_value = array(), $mode = 'update', $key_fld = "", $hwid = "")
{
// mode clear - Empty tabele before update // mode clear - Empty tabele before update
// mode update - update / replace record // mode update - update / replace record
global $db; global $db;
@ -317,7 +328,8 @@ class dbinterface {
* My be Replace by SccpTables ??! * My be Replace by SccpTables ??!
* *
*/ */
public function dump_sccp_tables($data_path, $database, $user, $pass ) { public function dump_sccp_tables($data_path, $database, $user, $pass)
{
$filename = $data_path.'/sccp_backup_'.date('G_a_m_d_y').'.sql'; $filename = $data_path.'/sccp_backup_'.date('G_a_m_d_y').'.sql';
$result = exec('mysqldump '.$database.' --password='.$pass.' --user='.$user.' --single-transaction >'.$filename, $output); $result = exec('mysqldump '.$database.' --password='.$pass.' --user='.$user.' --single-transaction >'.$filename, $output);
return $filename; return $filename;
@ -326,7 +338,8 @@ class dbinterface {
/* /*
* Check Table structure * Check Table structure
*/ */
public function validate() { public function validate()
{
global $db; global $db;
$check_fields = array('430' => array('_hwlang' => "varchar(12)"), '431' => array('private'=> "enum('on','off')"), '433' => array('directed_pickup'=>'') ); $check_fields = array('430' => array('_hwlang' => "varchar(12)"), '431' => array('private'=> "enum('on','off')"), '433' => array('directed_pickup'=>'') );
$sql = "DESCRIBE `sccpdevice`;"; $sql = "DESCRIBE `sccpdevice`;";
@ -361,5 +374,4 @@ class dbinterface {
return $result; return $result;
} }
} }

View file

@ -6,19 +6,23 @@
namespace FreePBX\modules\Sccp_manager; namespace FreePBX\modules\Sccp_manager;
class extconfigs { class extconfigs
{
public function __construct($parent_class = null) { public function __construct($parent_class = null)
{
$this->paren_class = $parent_class; $this->paren_class = $parent_class;
} }
public function info() { public function info()
{
$Ver = '13.0.3'; $Ver = '13.0.3';
return Array('Version' => $Ver, return array('Version' => $Ver,
'about' => 'Default Setings and Enums ver: ' . $Ver); 'about' => 'Default Setings and Enums ver: ' . $Ver);
} }
public function getextConfig($id = '', $index = '') { public function getextConfig($id = '', $index = '')
{
switch ($id) { switch ($id) {
case 'keyset': case 'keyset':
$result = $this->keysetdefault; $result = $this->keysetdefault;
@ -103,7 +107,8 @@ class extconfigs {
} }
} }
private function get_cisco_time_zone($tzc){ private function get_cisco_time_zone($tzc)
{
if ((empty($tzc)) or (!array_key_exists($tzc, $this->cisco_timezone))) { if ((empty($tzc)) or (!array_key_exists($tzc, $this->cisco_timezone))) {
// return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich'); // return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
@ -223,7 +228,7 @@ class extconfigs {
'South Africa' => array('offset' => '120', 'daylight' => ''), 'South Africa' => array('offset' => '120', 'daylight' => ''),
'Jerusalem' => array('offset' => '120', 'daylight' => 'Daylight'), 'Jerusalem' => array('offset' => '120', 'daylight' => 'Daylight'),
'Saudi Arabia' => array('offset' => '180', 'daylight' => ''), 'Saudi Arabia' => array('offset' => '180', 'daylight' => ''),
/* Russion Regions */ /* Russian Regions */
'Russian/Kaliningrad' => array('offset' => '120', 'daylight' => '', 'cisco_code' => 'South Africa Standard Time'), 'Russian/Kaliningrad' => array('offset' => '120', 'daylight' => '', 'cisco_code' => 'South Africa Standard Time'),
'Russian/Moscow' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'), 'Russian/Moscow' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'),
'Russian/St.Peterburg' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'), 'Russian/St.Peterburg' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'),
@ -237,7 +242,7 @@ class extconfigs {
'Russian/Sakhalin' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'), 'Russian/Sakhalin' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'),
'Russian/Magadan' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'), 'Russian/Magadan' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'),
'Russian/Kamchatka' => array('offset' => '720', 'daylight' => '', 'cisco_code' => 'Fiji Standard Time'), 'Russian/Kamchatka' => array('offset' => '720', 'daylight' => '', 'cisco_code' => 'Fiji Standard Time'),
/* EnD - Russion Regions */ /* EnD - Russian Regions */
'Iran' => array('offset' => '210', 'daylight' => 'Daylight'), 'Iran' => array('offset' => '210', 'daylight' => 'Daylight'),
'Caucasus' => array('offset' => '240', 'daylight' => 'Daylight'), 'Caucasus' => array('offset' => '240', 'daylight' => 'Daylight'),
'Arabian' => array('offset' => '240', 'daylight' => ''), 'Arabian' => array('offset' => '240', 'daylight' => ''),
@ -260,35 +265,36 @@ class extconfigs {
'New Zealand' => array('offset' => '720', 'daylight' => 'Daylight') 'New Zealand' => array('offset' => '720', 'daylight' => 'Daylight')
); );
public function validate_init_path($confDir = '', $db_vars, $sccp_driver_replace = '') { public function validate_init_path($confDir = '', $db_vars, $sccp_driver_replace = '')
{
// global $db; // global $db;
// global $amp_conf; // global $amp_conf;
// *** Setings for Provision Sccp // *** Setings for Provision Sccp
$adv_config = Array('tftproot' => '', 'firmware' => 'firmware', 'settings' => 'settings', $adv_config = array('tftproot' => '', 'firmware' => 'firmware', 'settings' => 'settings',
'locales' => 'locales', 'languages' => 'languages', 'templates' => 'templates', 'dialplan' => 'dialplan', 'softkey' => 'softkey'); 'locales' => 'locales', 'languages' => 'languages', 'templates' => 'templates', 'dialplan' => 'dialplan', 'softkey' => 'softkey');
// 'pro' /tftpboot - root dir // 'pro' /tftpboot - root dir
// /tftpboot/locales/locales/%Languge_name% // /tftpboot/locales/locales/%Languge_name%
// /tftpboot/settings/XMLdefault.cnf.xml // /tftpboot/settings/XMLdefault.cnf.xml
// /tftpboot/settings/SEP[MAC].cnf.xml // /tftpboot/settings/SEP[MAC].cnf.xml
// /tftpboot/firmware/79xx/SCCPxxxx.loads // /tftpboot/firmware/79xx/SCCPxxxx.loads
$adv_tree['pro'] = Array('templates' => 'tftproot', 'settings' => 'tftproot', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'locales', 'dialplan' => 'tftproot', 'softkey' => 'tftproot'); $adv_tree['pro'] = array('templates' => 'tftproot', 'settings' => 'tftproot', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'locales', 'dialplan' => 'tftproot', 'softkey' => 'tftproot');
// 'def' /tftpboot - root dir // 'def' /tftpboot - root dir
// /tftpboot/languages/%Languge_name% // /tftpboot/languages/%Languge_name%
// /tftpboot/XMLdefault.cnf.xml // /tftpboot/XMLdefault.cnf.xml
// /tftpboot/SEP[MAC].cnf.xml // /tftpboot/SEP[MAC].cnf.xml
// /tftpboot/SCCPxxxx.loads // /tftpboot/SCCPxxxx.loads
$adv_tree['def'] = Array('templates' => 'tftproot', 'settings' => '', 'locales' => '', 'firmware' => '', 'languages' => 'tftproot', 'dialplan' => '', 'softkey' => ''); $adv_tree['def'] = array('templates' => 'tftproot', 'settings' => '', 'locales' => '', 'firmware' => '', 'languages' => 'tftproot', 'dialplan' => '', 'softkey' => '');
// $adv_tree['def'] = Array('templates' => 'tftproot', 'settings' => '', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => ''); // $adv_tree['def'] = Array('templates' => 'tftproot', 'settings' => '', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => '');
// $adv_tree['def'] = Array('templates' => 'tftproot', 'settings' => '', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'tftproot'); // $adv_tree['def'] = Array('templates' => 'tftproot', 'settings' => '', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'tftproot');
//* **************------ **** //* **************------ ****
$base_tree = Array('tftp_templates' => 'templates', 'tftp_path_store' => 'settings', 'tftp_lang_path' => 'languages', 'tftp_firmware_path' => 'firmware', 'tftp_dialplan' => 'dialplan', 'tftp_softkey' => 'softkey'); $base_tree = array('tftp_templates' => 'templates', 'tftp_path_store' => 'settings', 'tftp_lang_path' => 'languages', 'tftp_firmware_path' => 'firmware', 'tftp_dialplan' => 'dialplan', 'tftp_softkey' => 'softkey');
if (empty($confDir)) { if (empty($confDir)) {
return array('error' => 'empty СonfDir'); return array('error' => 'empty СonfDir');
} }
$base_config = Array('asterisk' => $confDir, 'sccp_conf' => $confDir . '/sccp.conf', 'tftp_path' => ''); $base_config = array('asterisk' => $confDir, 'sccp_conf' => $confDir . '/sccp.conf', 'tftp_path' => '');
// Test Base dir (/tftproot) // Test Base dir (/tftproot)
if (!empty($db_vars["tftp_path"])) { if (!empty($db_vars["tftp_path"])) {
@ -309,9 +315,9 @@ class extconfigs {
} }
if (!is_writeable($base_config["tftp_path"])) { if (!is_writeable($base_config["tftp_path"])) {
if (!empty($this->paren_class)) { if (!empty($this->paren_class)) {
$this->paren_class->class_error['tftp_path'] = 'No write permision on tftp DIR'; $this->paren_class->class_error['tftp_path'] = 'No write permission on tftp DIR';
} }
return array('error' => 'No write permision on tftp DIR'); return array('error' => 'No write permission on tftp DIR');
} }
// END Test Base dir (/tftproot) // END Test Base dir (/tftproot)
@ -409,9 +415,10 @@ class extconfigs {
return $base_config; return $base_config;
} }
public function validate_RealTime($realm = '') { public function validate_RealTime($realm = '')
{
global $amp_conf; global $amp_conf;
$res = Array(); $res = array();
if (empty($realm)) { if (empty($realm)) {
$realm = 'sccp'; $realm = 'sccp';
} }
@ -505,5 +512,4 @@ class extconfigs {
} }
return $res; return $res;
} }
} }

View file

@ -6,26 +6,30 @@
namespace FreePBX\modules\Sccp_manager; namespace FreePBX\modules\Sccp_manager;
class sipconfigs { class sipconfigs
{
// protected $database; // protected $database;
// protected $freepbx; // protected $freepbx;
public function __construct($parent_class = null) { public function __construct($parent_class = null)
{
$this->paren_class = $parent_class; $this->paren_class = $parent_class;
// $freepbx // $freepbx
// $this->database = $freepbx->Database; // $this->database = $freepbx->Database;
} }
public function info() { public function info()
{
$Ver = '13.0.4'; $Ver = '13.0.4';
return Array('Version' => $Ver, return array('Version' => $Ver,
'about' => 'Sip Setings ver: ' . $Ver); 'about' => 'Sip Setings ver: ' . $Ver);
} }
public function get_db_sip_TableData($dataid, $data = array()) { public function get_db_sip_TableData($dataid, $data = array())
{
global $db; global $db;
if ($dataid == '') { if ($dataid == '') {
return False; return false;
} }
switch ($dataid) { switch ($dataid) {
case "Device": case "Device":
@ -40,7 +44,6 @@ class sipconfigs {
$tech[$value['id']][$value['keyword']]=$value['data']; $tech[$value['id']][$value['keyword']]=$value['data'];
} }
} catch (\Exception $e) { } catch (\Exception $e) {
} }
return $tech; return $tech;
case "DeviceById": case "DeviceById":
@ -55,14 +58,13 @@ class sipconfigs {
$value = $value[0]; $value = $value[0];
} }
} catch (\Exception $e) { } catch (\Exception $e) {
} }
return $tech; return $tech;
} }
} }
public function getSipConfig() { public function getSipConfig()
{
$result = array(); $result = array();
// $def_sip_proto = 'sip'; // $def_sip_proto = 'sip';
// $def_proto = 'tcp'; // $def_proto = 'tcp';
@ -72,7 +74,7 @@ class sipconfigs {
// $result['tlsport'] = \FreePBX::Sipsettings()->getConfig('tlsbindport'); // $result['tlsport'] = \FreePBX::Sipsettings()->getConfig('tlsbindport');
// $tmp_sipsetigs = \FreePBX::Sipsettings()->getChanSipSettings(); // $tmp_sipsetigs = \FreePBX::Sipsettings()->getChanSipSettings();
$tmp_binds = \FreePBX::Sipsettings()->getBinds(); $tmp_binds = \FreePBX::Sipsettings()->getBinds();
$if_list = $this->paren_class ->getIP_information2('ip4'); $if_list = $this->paren_class ->getIpInformation('ip4');
/* /*
$tmp_bind_ip = !empty($tmp_sipsetigs['externhost_val']) ? $tmp_sipsetigs['externhost_val'] : ''; $tmp_bind_ip = !empty($tmp_sipsetigs['externhost_val']) ? $tmp_sipsetigs['externhost_val'] : '';

View file

@ -10,13 +10,15 @@
namespace FreePBX\modules\Sccp_manager; namespace FreePBX\modules\Sccp_manager;
class srvinterface { class srvinterface
{
var $error; var $error;
var $_info; var $_info;
var $ami_mode; var $ami_mode;
public function __construct($parent_class = null) { public function __construct($parent_class = null)
{
$this->paren_class = $parent_class; $this->paren_class = $parent_class;
if ($this->paren_class == null) { if ($this->paren_class == null) {
$this->paren_class = $this; $this->paren_class = $this;
@ -49,49 +51,55 @@ class srvinterface {
$this->ami_mode = $this->aminterface->status(); $this->ami_mode = $this->aminterface->status();
} }
public function info() { public function info()
{
$Ver = '14.0.1'; $Ver = '14.0.1';
$info = ''; $info = '';
foreach ($this->_info as $key => $value) { foreach ($this->_info as $key => $value) {
$info .= $value['about'] . "\n "; $info .= $value['about'] . "\n ";
} }
return Array('Version' => $Ver, return array('Version' => $Ver,
'about' => 'Server interface data ver: ' . $Ver . "\n " . $info); 'about' => 'Server interface data ver: ' . $Ver . "\n " . $info);
} }
public function sccp_device_reset($id = '') { public function sccpDeviceReset($id = '')
{
if ($this->ami_mode) { if ($this->ami_mode) {
return $this->aminterface->sccp_device_reset($id, 'reset'); return $this->aminterface->sccpDeviceReset($id, 'reset');
} else { } else {
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $id)); return $this->oldinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $id));
} }
} }
public function sccp_device_restart($id = '') { public function sccpDeviceRestart($id = '')
{
if ($this->ami_mode) { if ($this->ami_mode) {
return $this->aminterface->sccp_device_reset($id, 'restart'); return $this->aminterface->sccpDeviceReset($id, 'restart');
} else { } else {
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $id)); return $this->oldinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $id));
} }
} }
public function sccp_device_reload($id = '') { public function sccp_device_reload($id = '')
{
if ($this->ami_mode) { if ($this->ami_mode) {
return $this->aminterface->sccp_device_reset($id, 'full'); return $this->aminterface->sccpDeviceReset($id, 'full');
} else { } else {
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reload_phone', 'name' => $id)); return $this->oldinterface->sccp_core_commands(array('cmd' => 'reload_phone', 'name' => $id));
} }
} }
public function sccp_reset_token($id = '') { public function sccp_reset_token($id = '')
{
if ($this->ami_mode) { if ($this->ami_mode) {
return $this->aminterface->sccp_device_reset($id, 'tokenack'); return $this->aminterface->sccpDeviceReset($id, 'tokenack');
} else { } else {
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reset_token', 'name' => $id)); return $this->oldinterface->sccp_core_commands(array('cmd' => 'reset_token', 'name' => $id));
} }
} }
public function sccp_reload() { public function sccp_reload()
{
if ($this->ami_mode) { if ($this->ami_mode) {
return $this->aminterface->core_sccp_reload(); return $this->aminterface->core_sccp_reload();
// return $this->oldinterface->sccp_core_commands(array('cmd' => 'sccp_reload')); // !!!!!!!!!!!!!!!!!!!!!!!!!--------------------------- Remove // return $this->oldinterface->sccp_core_commands(array('cmd' => 'sccp_reload')); // !!!!!!!!!!!!!!!!!!!!!!!!!--------------------------- Remove
@ -100,7 +108,8 @@ class srvinterface {
} }
} }
public function sccp_line_reload($id = '') { public function sccp_line_reload($id = '')
{
if ($this->ami_mode) { if ($this->ami_mode) {
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reload_line', 'name' => $id)); return $this->oldinterface->sccp_core_commands(array('cmd' => 'reload_line', 'name' => $id));
} else { } else {
@ -108,25 +117,26 @@ class srvinterface {
} }
} }
private function sccp_core_commands($params = array()) { private function sccp_core_commands($params = array())
{
if ($this->ami_mode) { if ($this->ami_mode) {
if (!empty($params['cmd'])) { if (!empty($params['cmd'])) {
switch ($params['cmd']) { switch ($params['cmd']) {
case 'reset_phone': case 'reset_phone':
return $this->aminterface->sccp_device_reset($params['name'], 'reset'); return $this->aminterface->sccpDeviceReset($params['name'], 'reset');
break; break;
case 'restart_phone': case 'restart_phone':
return $this->aminterface->sccp_device_reset($params['name'], 'restart'); return $this->aminterface->sccpDeviceReset($params['name'], 'restart');
break; break;
case 'reload_phone': case 'reload_phone':
return $this->aminterface->sccp_device_reset($params['name'], 'full'); return $this->aminterface->sccpDeviceReset($params['name'], 'full');
break; break;
case 'reset_token': case 'reset_token':
return $this->aminterface->sccp_device_reset($params['name'], 'tokenack'); return $this->aminterface->sccpDeviceReset($params['name'], 'tokenack');
break; break;
case 'reload_line': case 'reload_line':
// return $this->aminterface->sccp_device_reset($params['name'], 'full'); // return $this->aminterface->sccpDeviceReset($params['name'], 'full');
break; break;
// case 'get_version': // case 'get_version':
// case 'sccp_reload': // case 'sccp_reload':
@ -154,7 +164,8 @@ class srvinterface {
} }
} }
public function sccp_getdevice_info($dev_id) { public function sccp_getdevice_info($dev_id)
{
if (empty($dev_id)) { if (empty($dev_id)) {
return array(); return array();
} }
@ -165,7 +176,8 @@ class srvinterface {
} }
} }
public function sccp_list_hints() { public function sccp_list_hints()
{
if ($this->ami_mode) { if ($this->ami_mode) {
return $this->aminterface->core_list_hints(); return $this->aminterface->core_list_hints();
} else { } else {
@ -173,7 +185,8 @@ class srvinterface {
} }
} }
public function sccp_list_all_hints() { public function sccp_list_all_hints()
{
if ($this->ami_mode) { if ($this->ami_mode) {
return $this->aminterface->core_list_all_hints(); return $this->aminterface->core_list_all_hints();
@ -182,7 +195,8 @@ class srvinterface {
} }
} }
public function sccp_realtime_status() { public function sccp_realtime_status()
{
if (!$this->ami_mode) { if (!$this->ami_mode) {
return $this->oldinterface->sccp_realtime_status(); return $this->oldinterface->sccp_realtime_status();
} else { } else {
@ -199,7 +213,8 @@ class srvinterface {
} }
} }
public function get_compatible_sccp() { public function get_compatible_sccp()
{
$res = $this->getSCCPVersion(); $res = $this->getSCCPVersion();
if (empty($res)) { if (empty($res)) {
@ -230,7 +245,8 @@ class srvinterface {
// return $res["vCode"]; // return $res["vCode"];
} }
public function getSCCPVersion() { public function getSCCPVersion()
{
$res = $this->getChanSCCPVersion(); $res = $this->getChanSCCPVersion();
if (empty($res)) { if (empty($res)) {
$res = $this->oldinterface->getCoreSCCPVersion(); $res = $this->oldinterface->getCoreSCCPVersion();
@ -238,7 +254,8 @@ class srvinterface {
return $res; return $res;
} }
public function sccp_list_keysets() { public function sccp_list_keysets()
{
if ($this->ami_mode) { if ($this->ami_mode) {
return $this->aminterface->sccp_list_keysets(); return $this->aminterface->sccp_list_keysets();
@ -247,7 +264,8 @@ class srvinterface {
} }
} }
public function sccp_get_active_device() { public function sccp_get_active_device()
{
if ($this->ami_mode) { if ($this->ami_mode) {
return $this->aminterface->sccp_get_active_device(); return $this->aminterface->sccp_get_active_device();
} else { } else {
@ -255,7 +273,8 @@ class srvinterface {
} }
} }
function getChanSCCPVersion() { function getChanSCCPVersion()
{
if (!$this->ami_mode) { if (!$this->ami_mode) {
return $this->oldinterface->getChanSCCPVersion(); return $this->oldinterface->getChanSCCPVersion();
} else { } else {
@ -318,7 +337,8 @@ class srvinterface {
} }
// ---------------------------- Debug Data ------------------------------------------- // ---------------------------- Debug Data -------------------------------------------
function t_get_ami_data() { function t_get_ami_data()
{
global $amp_conf; global $amp_conf;
$fp = fsockopen("127.0.0.1", "5038", $errno, $errstr, 10); $fp = fsockopen("127.0.0.1", "5038", $errno, $errstr, 10);
if (!$fp) { if (!$fp) {
@ -383,7 +403,7 @@ class srvinterface {
$resp .= fgets($fp); $resp .= fgets($fp);
} }
$time_resp = microtime_float(); $time_resp = microtime_float();
$resp .= "\r\n\r\n Connect :".($time_send - $time_connect). " Logoff :".($time_logoff- $time_send). " Responce :".($time_resp-$time_logoff)."\r\n\r\n "; $resp .= "\r\n\r\n Connect :".($time_send - $time_connect). " Logoff :".($time_logoff- $time_send). " Response :".($time_resp-$time_logoff)."\r\n\r\n ";
// print_r(fgets($fp)); // print_r(fgets($fp));
// print_r('<br>'); // print_r('<br>');
// echo fgets($fp, 128); // echo fgets($fp, 128);
@ -391,5 +411,4 @@ class srvinterface {
fclose($fp); fclose($fp);
return $resp; return $resp;
} }
} }

View file

@ -13,21 +13,25 @@
namespace FreePBX\modules\Sccp_manager; namespace FreePBX\modules\Sccp_manager;
class xmlinterface { class xmlinterface
{
private $val_null = 'NONE'; /// REPLACE to null Field private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct($parent_class = null) { public function __construct($parent_class = null)
{
$this->paren_class = $parent_class; $this->paren_class = $parent_class;
} }
public function info() { public function info()
{
$Ver = '13.0.4'; $Ver = '13.0.4';
return Array('Version' => $Ver, return array('Version' => $Ver,
'about' => 'Create XML data interface ver: ' . $Ver); 'about' => 'Create XML data interface ver: ' . $Ver);
} }
function create_default_XML($store_path = '', $data_values = array(), $model_information = array(), $lang_info = array()) { function create_default_XML($store_path = '', $data_values = array(), $model_information = array(), $lang_info = array())
{
$data_path = $data_values['tftp_path']; $data_path = $data_values['tftp_path'];
if (empty($store_path) || empty($data_path) || empty($data_values)) { if (empty($store_path) || empty($data_path) || empty($data_values)) {
return; return;
@ -39,10 +43,9 @@ class xmlinterface {
if (file_exists($xml_template)) { if (file_exists($xml_template)) {
$xml_work = simplexml_load_file($xml_template); $xml_work = simplexml_load_file($xml_template);
$xnode = &$xml_work->callManagerGroup->members; $xnode = &$xml_work->callManagerGroup->members;
$bind_tmp = $this->get_server_sccp_bind($data_values); $bind_tmp = $this->get_server_sccp_bind($data_values);
//error_log("bind_tmp:".print_r($bind_tmp, true), 0);
$ifc = 0; $ifc = 0;
foreach ($bind_tmp as $bind_value) { foreach ($bind_tmp as $bind_value) {
$xnode_obj = clone $xnode->member; $xnode_obj = clone $xnode->member;
@ -113,7 +116,8 @@ class xmlinterface {
} }
} }
function create_SEP_XML($store_path = '', $data_values = array(), $dev_config = array(), $dev_id = '', $lang_info = array()) { function create_SEP_XML($store_path = '', $data_values = array(), $dev_config = array(), $dev_id = '', $lang_info = array())
{
$var_xml_general_fields = array('authenticationURL' => 'dev_authenticationURL', 'informationURL' => 'dev_informationURL', 'messagesURL' => 'dev_messagesURL', $var_xml_general_fields = array('authenticationURL' => 'dev_authenticationURL', 'informationURL' => 'dev_informationURL', 'messagesURL' => 'dev_messagesURL',
'servicesURL' => 'dev_servicesURL', 'directoryURL' => 'dev_directoryURL', 'proxyServerURL' => 'dev_proxyServerURL', 'idleTimeout' => 'dev_idleTimeout', 'servicesURL' => 'dev_servicesURL', 'directoryURL' => 'dev_directoryURL', 'proxyServerURL' => 'dev_proxyServerURL', 'idleTimeout' => 'dev_idleTimeout',
@ -372,10 +376,13 @@ class xmlinterface {
return time(); return time();
} }
private function get_server_sccp_bind($data_values = array()) { private function get_server_sccp_bind($data_values = array())
{
$res = array(); $res = array();
if ($data_values['bindaddr'] !== '0.0.0.0') { if ($data_values['bindaddr'] !== '0.0.0.0') {
return array('ip' => $data_values['bindaddr'], 'port' => $data_values['port']); $rkey = $data_values['bindaddr'];
$res[$rkey] = array('ip' => $data_values['bindaddr'], 'port' => $data_values['port']);
return $res;
} }
$ip_fill = true; $ip_fill = true;
if (!empty($data_values['ccm_address'])) { if (!empty($data_values['ccm_address'])) {
@ -453,7 +460,8 @@ class xmlinterface {
* *
*/ */
function create_SEP_SIP_XML($store_path = '', $data_values = array(), $dev_config = array(), $dev_id = '', $lang_info = array()) { function create_SEP_SIP_XML($store_path = '', $data_values = array(), $dev_config = array(), $dev_id = '', $lang_info = array())
{
$var_xml_general_fields = array('authenticationURL' => 'dev_authenticationURL', 'informationURL' => 'dev_informationURL', 'messagesURL' => 'dev_messagesURL', $var_xml_general_fields = array('authenticationURL' => 'dev_authenticationURL', 'informationURL' => 'dev_informationURL', 'messagesURL' => 'dev_messagesURL',
'servicesURL' => 'dev_servicesURL', 'directoryURL' => 'dev_directoryURL', 'proxyServerURL' => 'dev_proxyServerURL', 'idleTimeout' => 'dev_idleTimeout', 'servicesURL' => 'dev_servicesURL', 'directoryURL' => 'dev_directoryURL', 'proxyServerURL' => 'dev_proxyServerURL', 'idleTimeout' => 'dev_idleTimeout',
@ -771,7 +779,8 @@ class xmlinterface {
return time(); return time();
} }
function save_DialPlan($confDir, $get_settings) { function saveDialPlan($confDir, $get_settings)
{
$xmlstr = "<DIALTEMPLATE>\n"; $xmlstr = "<DIALTEMPLATE>\n";
$xmlstr .= "<versionStamp>" . time() . "</versionStamp>\n"; $xmlstr .= "<versionStamp>" . time() . "</versionStamp>\n";
$dialFelds = array('match', 'timeout', 'rewrite', 'tone'); //str -to lo ! $dialFelds = array('match', 'timeout', 'rewrite', 'tone'); //str -to lo !
@ -806,8 +815,9 @@ class xmlinterface {
} else { } else {
$errors = array('Fields Dial Plan Name is requered !!'); $errors = array('Fields Dial Plan Name is requered !!');
} }
} else } else {
$put_file = (string) $get_settings['idtemplate']; $put_file = (string) $get_settings['idtemplate'];
}
} else { } else {
$errors = array('Fields Dial Plan Name is requered !!'); $errors = array('Fields Dial Plan Name is requered !!');
} }
@ -822,7 +832,8 @@ class xmlinterface {
return $errors; return $errors;
} }
function create_xmlSoftkeyset($config, $confDir, $name) { function create_xmlSoftkeyset($config, $confDir, $name)
{
if (empty($config[$name])) { if (empty($config[$name])) {
if ($name == 'default') { if ($name == 'default') {
$typeSoft = $confDir["tftp_templates"] . '/SIPDefaultSoftKey.xml_template'; $typeSoft = $confDir["tftp_templates"] . '/SIPDefaultSoftKey.xml_template';
@ -872,22 +883,25 @@ class xmlinterface {
return $errors; return $errors;
} }
private function replaceSimpleXmlNode($xml, $element = SimpleXMLElement) { private function replaceSimpleXmlNode($xml, $element = SimpleXMLElement)
{
$dom = dom_import_simplexml($xml); $dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode( $import = $dom->ownerDocument->importNode(
dom_import_simplexml($element), TRUE dom_import_simplexml($element),
true
); );
$dom->parentNode->replaceChild($import, $dom); $dom->parentNode->replaceChild($import, $dom);
} }
private function appendSimpleXmlNode($xml, $element = SimpleXMLElement) { private function appendSimpleXmlNode($xml, $element = SimpleXMLElement)
{
$dom = dom_import_simplexml($xml); $dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode( $import = $dom->ownerDocument->importNode(
dom_import_simplexml($element), TRUE dom_import_simplexml($element),
true
); );
// $dom->parentNode->appendChild($import, $dom); // $dom->parentNode->appendChild($import, $dom);
$dom->parentNode->appendChild($import->cloneNode(true)); $dom->parentNode->appendChild($import->cloneNode(true));
} }
} }

View file

@ -12,7 +12,7 @@ param default description
conf_allow yes Allow the use of conference conf_allow yes Allow the use of conference
conf_play_general_announce yes Playback General Announcements (like: 'You are Entering/Leaving the conference') conf_play_general_announce yes Playback General Announcements (like: 'You are Entering/Leaving the conference')
conf_play_part_announce yes Playback Personal/Participant Announcements, (like: 'You have been muted / You have been kicked') conf_play_part_announce yes Playback Personal/Participant Announcements, (like: 'You have been muted / You have been kicked')
conf_mute_on_entry no Mute new participants from the start, when they enter the conference (Preventing them to talk amongst one another). The Moderator will have to UnMute a participant manually to allow them to speak. Usefull in a classroom setting. conf_mute_on_entry no Mute new participants from the start, when they enter the conference (Preventing them to talk amongst one another). The Moderator will have to UnMute a participant manually to allow them to speak. Useful in a classroom setting.
conf_music_on_hold_class 'default' Play music on hold of this class when no moderator is listening on the conference. If set to an empty string, no music on hold will be played. conf_music_on_hold_class 'default' Play music on hold of this class when no moderator is listening on the conference. If set to an empty string, no music on hold will be played.
conf_show_conflist yes Automatically show conference list to the moderator conf_show_conflist yes Automatically show conference list to the moderator
Creating a New Conference (Conf Softkey) Creating a New Conference (Conf Softkey)

View file

@ -308,7 +308,7 @@
For example, if you want to enter 411, 511, and 911 as special numbers, enter 411,511,911 in the field without spaces. For example, if you want to enter 411, 511, and 911 as special numbers, enter 411,511,911 in the field without spaces.
string string
length = 16 length = 16
comma seperated comma separated
--> -->
<PushToTalkURL></PushToTalkURL> <PushToTalkURL></PushToTalkURL>
<!-- <!--

View file

@ -30,7 +30,7 @@ permit = internal
; This General rule is valid for all incoming connections. It's the 1st filter. ; This General rule is valid for all incoming connections. It's the 1st filter.
; using 'internal' will allow the 10.0.0.0, 172.16.0.0 and 192.168.0.0 networks ; using 'internal' will allow the 10.0.0.0, 172.16.0.0 and 192.168.0.0 networks
;localnet = internal ; (MULTI-ENTRY) All RFC 1918 addresses are local networks, example '192.168.1.0/255.255.255.0' ;localnet = internal ; (MULTI-ENTRY) All RFC 1918 addresses are local networks, example '192.168.1.0/255.255.255.0'
;externip = 0.0.0.0 ; External IP Address of the firewall, required in case the PBX is running on a seperate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address. ;externip = 0.0.0.0 ; External IP Address of the firewall, required in case the PBX is running on a separate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address.
;firstdigittimeout = 16 ; Dialing timeout for the 1st digit ;firstdigittimeout = 16 ; Dialing timeout for the 1st digit
;digittimeout = 8 ; More digits ;digittimeout = 8 ; More digits
;digittimeoutchar = # ; You can force the channel to dial with this char in the dialing state ;digittimeoutchar = # ; You can force the channel to dial with this char in the dialing state
@ -44,7 +44,7 @@ permit = internal
;transfer_tone = 0 ; Confirmation tone on transfer. Works only between SCCP devices ;transfer_tone = 0 ; Confirmation tone on transfer. Works only between SCCP devices
;transfer_on_hangup = no ; Complete transfer on hangup, without pressing transfer a second time. ;transfer_on_hangup = no ; Complete transfer on hangup, without pressing transfer a second time.
; Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached. ; Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached.
; To cancel the transfer, either press resume on the transfered channel, press the 'endcall' softkey, or have the receiving party hangup first. ; To cancel the transfer, either press resume on the transferred channel, press the 'endcall' softkey, or have the receiving party hangup first.
;dnd_tone = 0x0 ; Use 0x2D, 0x31, 0x32, 0x33 to activate dnd incoming call indication when dnd silent is active ;dnd_tone = 0x0 ; Use 0x2D, 0x31, 0x32, 0x33 to activate dnd incoming call indication when dnd silent is active
;callwaiting_tone = 0x2d ; Sets to 0 to disable the callwaiting tone ;callwaiting_tone = 0x2d ; Sets to 0 to disable the callwaiting tone
;callwaiting_interval = 0 ; Callwaiting ring interval in seconds. Set to 0 to disable the callwaiting ringing interval. ;callwaiting_interval = 0 ; Callwaiting ring interval in seconds. Set to 0 to disable the callwaiting ringing interval.
@ -79,7 +79,7 @@ permit = internal
;nat = auto ; Global NAT support. ;nat = auto ; Global NAT support.
; (POSSIBLE VALUES: ["Auto","Off","(Auto)Off","On","(Auto)On"]) ; (POSSIBLE VALUES: ["Auto","Off","(Auto)Off","On","(Auto)On"])
;directrtp = no ; This option allow devices to do direct RTP sessions. ;directrtp = no ; This option allow devices to do direct RTP sessions.
;allowoverlap = no ; Enable overlap dialing support. If enabled, starts dialing immediately and sends remaing digits as DTMF/inband. ;allowoverlap = no ; Enable overlap dialing support. If enabled, starts dialing immediately and sends remaining digits as DTMF/inband.
; Use with extreme caution as it is very dialplan and provider dependent. ; Use with extreme caution as it is very dialplan and provider dependent.
callgroup = "" ; We are in caller groups 1,3,4. Valid for all lines callgroup = "" ; We are in caller groups 1,3,4. Valid for all lines
pickupgroup = "" ; We can do call pick-p for call group 1,3,4,5. Valid for all lines pickupgroup = "" ; We can do call pick-p for call group 1,3,4,5. Valid for all lines

View file

@ -1,11 +1,4 @@
/** (function ($) {
* jQuery.SelectListActions
* https://github.com/esausilva/jquery.selectlistactions.js
*
* (c) http://esausilva.com
*/
(function ($) {
//Moves selected item(s) from sourceList to destinationList //Moves selected item(s) from sourceList to destinationList
$.fn.moveToList = function (sourceList, destinationList) { $.fn.moveToList = function (sourceList, destinationList) {
var opts = $(sourceList + ' option:selected'); var opts = $(sourceList + ' option:selected');

View file

@ -140,7 +140,6 @@ $(document).ready(function () {
if (data.reload === true && old_style ===true ) { if (data.reload === true && old_style ===true ) {
location.reload(); location.reload();
} }
} else { } else {
bs_alert(data.message,data.status); bs_alert(data.message,data.status);
} }
@ -311,7 +310,6 @@ $(document).ready(function () {
$('#sccp_hw_addon').val('NONE').change(); $('#sccp_hw_addon').val('NONE').change();
} }
$('#sccp_hw_addon').attr("disabled", "disabled"); $('#sccp_hw_addon').attr("disabled", "disabled");
} else { } else {
$('#sccp_hw_addon').removeAttr('disabled'); $('#sccp_hw_addon').removeAttr('disabled');
} }
@ -328,7 +326,8 @@ $(document).ready(function () {
}); });
$('.sccp_button_hide').each(function () { // On page create !! $('.sccp_button_hide').each(function () {
// On page create !!
var dev_id = $(this).data('vhide'); var dev_id = $(this).data('vhide');
var dev_class = $(this).data('clhide'); var dev_class = $(this).data('clhide');
var dev_val = $(this).val(); var dev_val = $(this).val();
@ -391,7 +390,8 @@ $(document).ready(function () {
}); });
$('.sccp_button_disabled').each(function () { // On page create !! $('.sccp_button_disabled').each(function () {
// On page create !!
var dev_id = $(this).data('vhide'); var dev_id = $(this).data('vhide');
var dev_class = $(this).data('clhide'); var dev_class = $(this).data('clhide');
var dev_val = $(this).val(); var dev_val = $(this).val();
@ -584,7 +584,6 @@ $(document).ready(function () {
}); });
} }
console.log(datas); console.log(datas);
} }
if ($(this).data('id') === 'delete_hardware') { if ($(this).data('id') === 'delete_hardware') {
var dev_cmd = $(this).data('id'); var dev_cmd = $(this).data('id');
@ -603,7 +602,6 @@ $(document).ready(function () {
if (!confirm(_('Are you sure you wish to delete selected device ?'))) { if (!confirm(_('Are you sure you wish to delete selected device ?'))) {
dev_cmd = ''; dev_cmd = '';
} }
} }
if ($(this).data('id') === 'reset_dev' || $(this).data('id') === 'reset_token' || $(this).data('id') === 'update_button_label') { if ($(this).data('id') === 'reset_dev' || $(this).data('id') === 'reset_token' || $(this).data('id') === 'update_button_label') {
var dev_cmd = $(this).data('id'); var dev_cmd = $(this).data('id');
@ -636,11 +634,9 @@ $(document).ready(function () {
} else { } else {
dev_cmd = ''; dev_cmd = '';
} }
} }
} }
if (dev_cmd !== '') { if (dev_cmd !== '') {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd, url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
@ -676,7 +672,6 @@ $(document).ready(function () {
} }
}); });
} }
}); });
@ -763,7 +758,8 @@ $("table").on("post-body.bs.table", function () {
}); });
}); });
function load_oncliсk(e, data) { function load_oncliсk(e, data)
{
// console.log('load_oncliсk'); // console.log('load_oncliсk');
var add_softkey = false; var add_softkey = false;
@ -821,7 +817,8 @@ function load_oncliсk(e, data) {
} }
function add_dynamic_input(pe, pclass, vdefault) { function add_dynamic_input(pe, pclass, vdefault)
{
// We'd like a new one, please. // We'd like a new one, please.
pcls = pe.data('for'); pcls = pe.data('for');
pname = pe.data('id'); pname = pe.data('id');
@ -846,7 +843,8 @@ function add_dynamic_input(pe, pclass, vdefault) {
} }
} }
function del_dynamic_table(pe, pclass, vdefault) { function del_dynamic_table(pe, pclass, vdefault)
{
pcls = pe.data('for'); pcls = pe.data('for');
pname = pe.data('id'); pname = pe.data('id');
@ -865,7 +863,8 @@ function del_dynamic_table(pe, pclass, vdefault) {
} }
} }
function add_dynamic_table(pe, pclass, vdefault) { function add_dynamic_table(pe, pclass, vdefault)
{
// We'd like a new one, please. // We'd like a new one, please.
pcls = pe.data('for'); pcls = pe.data('for');
pname = pe.data('id'); pname = pe.data('id');
@ -1006,7 +1005,8 @@ var theForm = document.editIax;
return unescape(result); return unescape(result);
} }
*/ */
function bs_page_reload() { function bs_page_reload()
{
window.location.reload(false); window.location.reload(false);
} }
function bs_alert(data, status, reload) function bs_alert(data, status, reload)
@ -1059,13 +1059,15 @@ function hex2bin(hex)
{ {
var bytes = [], str; var bytes = [], str;
for (var i = 0; i < hex.length - 1; i += 2) for (var i = 0; i < hex.length - 1; i += 2) {
bytes.push(parseInt(hex.substr(i, 2), 16)); bytes.push(parseInt(hex.substr(i, 2), 16));
}
return String.fromCharCode.apply(String, bytes); return String.fromCharCode.apply(String, bytes);
} }
function sleep(milliseconds) { function sleep(milliseconds)
{
var start = new Date().getTime(); var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) { for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds) { if ((new Date().getTime() - start) > milliseconds) {

View file

@ -5,7 +5,9 @@
// Templete for Sccp Driver // Templete for Sccp Driver
// //
namespace FreePBX\modules\Core\Drivers; namespace FreePBX\modules\Core\Drivers;
class Sccp extends \FreePBX\modules\Core\Driver {
class Sccp extends \FreePBX\modules\Core\Driver
{
private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account', private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account',
"context" =>'lcontext',"incominglimit"=>'incominglimit', "context" =>'lcontext',"incominglimit"=>'incominglimit',
"callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup', "callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
@ -18,7 +20,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup' 'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup'
); );
public function getInfo() { public function getInfo()
{
return array( return array(
"rawName" => "sccp", "rawName" => "sccp",
"hardware" => "sccp_custom", "hardware" => "sccp_custom",
@ -41,7 +44,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
return true; return true;
} }
*/ */
public function addDevice($id, $settings) { public function addDevice($id, $settings)
{
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description'); $add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description');
// print_r($_REQUEST); // print_r($_REQUEST);
// echo '<br><br>'; // echo '<br><br>';
@ -73,7 +77,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
return true; return true;
} }
public function delDevice($id) { public function delDevice($id)
{
$sql = "DELETE FROM sccpline WHERE name = ?"; $sql = "DELETE FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql); $sth = $this->database->prepare($sql);
$sth->execute(array($id)); $sth->execute(array($id));
@ -81,7 +86,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
} }
public function getDevice($id) { public function getDevice($id)
{
$sccp_line = array(); $sccp_line = array();
// $sql = "SELECT name as id, name as name"; // $sql = "SELECT name as id, name as name";
$sql = "SELECT name as id, name as name "; $sql = "SELECT name as id, name as name ";
@ -97,12 +103,14 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$result = $sth->fetch(\PDO::FETCH_ASSOC); $result = $sth->fetch(\PDO::FETCH_ASSOC);
$tech = $result; $tech = $result;
$tech['dial']='SCCP/'.$id; $tech['dial']='SCCP/'.$id;
} catch(\Exception $e) {} } catch (\Exception $e) {
}
return $tech; return $tech;
} }
public function getDefaultDeviceSettings($id, $displayname, &$flag) { public function getDefaultDeviceSettings($id, $displayname, &$flag)
{
$dial = 'SCCP'; $dial = 'SCCP';
$settings = array( $settings = array(
"pin" => array( "pin" => array(
@ -173,7 +181,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
} }
# !TODO!: -TODO-: Would it not be better to put this part in the view directory (MVC) ? No, This is a template for Freepbx. # !TODO!: -TODO-: Would it not be better to put this part in the view directory (MVC) ? No, This is a template for Freepbx.
public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) { public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection)
{
$section = _("Settings"); $section = _("Settings");
$category = "general"; $category = "general";
$tmparr = array(); $tmparr = array();
@ -296,7 +305,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
unset($select); unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes'); $select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No'); $select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not suported"); $tt = _("Silence Suppression. Asterisk Not supported");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); $tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select); unset($select);

View file

@ -385,7 +385,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
unset($select); unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes'); $select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No'); $select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not suported"); $tt = _("Silence Suppression. Asterisk Not supported");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'off', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section); $tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'off', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select); unset($select);

View file

@ -301,7 +301,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$currentcomponent->addTabTranslation('sccp',_('SCCP')); $currentcomponent->addTabTranslation('sccp',_('SCCP'));
// $currentcomponent->addTabTranslation('Codec',_('Codec')); // $currentcomponent->addTabTranslation('Codec',_('Codec'));
//Fill Codecs Informations //Fill Codecs Information
$Sccp_Codec = array('gsm','slin16','alaw','ulaw','g722','g723','g726','g728','g729','ilibc','opus','h264','h263','h265','h261'); $Sccp_Codec = array('gsm','slin16','alaw','ulaw','g722','g723','g726','g728','g729','ilibc','opus','h264','h263','h265','h261');
$allCodecs = $this->freepbx->Codecs->getAudio(true); $allCodecs = $this->freepbx->Codecs->getAudio(true);
@ -501,7 +501,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
unset($select); unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes'); $select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No'); $select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not suported"); $tt = _("Silence Suppression. Asterisk Not supported");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'off', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); $tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'off', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
unset($select); unset($select);

View file

@ -283,7 +283,7 @@ and open the template in the editor. Base Version before all crash :-)
<button value="broadcast">Broadcast</button> <button value="broadcast">Broadcast</button>
<button value="multicast">Multicast</button> <button value="multicast">Multicast</button>
<button value="manycast">Manycast</button> <button value="manycast">Manycast</button>
<help>Configure NTP Server protocol time syncronization</help> <help>Configure NTP Server protocol time synchronization</help>
</item> </item>
</page_group> </page_group>

View file

@ -104,7 +104,7 @@ and open the template in the editor. Base Version before all crash :-)
<class>sccp-custom</class> <class>sccp-custom</class>
<options placeholder="Provider IP"></options> <options placeholder="Provider IP"></options>
</input> </input>
<help>External IP Address of the firewall, required in case the PBX is running on a seperate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address.</help> <help>External IP Address of the firewall, required in case the PBX is running on a separate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address.</help>
<nameseparator> / </nameseparator> <nameseparator> / </nameseparator>
</item> </item>
<item type="IE" id="5"> <item type="IE" id="5">
@ -346,7 +346,7 @@ and open the template in the editor. Base Version before all crash :-)
<default>off</default> <default>off</default>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<help>Complete transfer on hangup, without pressing transfer a second time. Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached. To cancel the transfer, either press resume on the transfered channel, press the 'endcall' softkey, or have the receiving party hangup first.</help> <help>Complete transfer on hangup, without pressing transfer a second time. Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached. To cancel the transfer, either press resume on the transferred channel, press the 'endcall' softkey, or have the receiving party hangup first.</help>
</item> </item>
<item type="IS" id="13"> <item type="IS" id="13">
<name>callanswerorder</name> <name>callanswerorder</name>
@ -472,7 +472,7 @@ and open the template in the editor. Base Version before all crash :-)
<button value="broadcast">Broadcast</button> <button value="broadcast">Broadcast</button>
<button value="multicast">Multicast</button> <button value="multicast">Multicast</button>
<button value="manycast">Manycast</button> <button value="manycast">Manycast</button>
<help>Configure NTP Server protocol time syncronization</help> <help>Configure NTP Server protocol time synchronization</help>
</item> </item>
</page_group> </page_group>

View file

@ -111,7 +111,7 @@ and open the template in the editor. Base Version before all crash :-)
<options placeholder="Host Name"></options> <options placeholder="Host Name"></options>
</input> </input>
<help>External IP Address of the firewall, required in case the PBX is running on a seperate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address. Resolve Hostname (if dynamic) that we're going to resolve when setting up the RTP media stream (only active if externip=0.0.0.0 and host is natted.)</help> <help>External IP Address of the firewall, required in case the PBX is running on a separate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address. Resolve Hostname (if dynamic) that we're going to resolve when setting up the RTP media stream (only active if externip=0.0.0.0 and host is natted.)</help>
<meta_help>1</meta_help> <meta_help>1</meta_help>
<nameseparator> / </nameseparator> <nameseparator> / </nameseparator>
externhost externhost
@ -511,7 +511,7 @@ and open the template in the editor. Base Version before all crash :-)
<button value="broadcast">Broadcast</button> <button value="broadcast">Broadcast</button>
<button value="multicast">Multicast</button> <button value="multicast">Multicast</button>
<button value="manycast">Manycast</button> <button value="manycast">Manycast</button>
<help>Configure NTP Server protocol time syncronization</help> <help>Configure NTP Server protocol time synchronization</help>
</item> </item>
</page_group> </page_group>
@ -883,7 +883,7 @@ and open the template in the editor. Base Version before all crash :-)
<default>off</default> <default>off</default>
<button value="on">Enabled</button> <button value="on">Enabled</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<help>Complete transfer on hangup, without pressing transfer a second time. Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached. To cancel the transfer, either press resume on the transfered channel, press the 'endcall' softkey, or have the receiving party hangup first.</help> <help>Complete transfer on hangup, without pressing transfer a second time. Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached. To cancel the transfer, either press resume on the transferred channel, press the 'endcall' softkey, or have the receiving party hangup first.</help>
</item> </item>
<item type="SLA-disabled" id="6"> <item type="SLA-disabled" id="6">
@ -1038,11 +1038,11 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IS" id="4" seq="90"> <item type="IS" id="4" seq="90">
<name>system_rouminguser</name> <name>system_rouminguser</name>
<label>User Rouming</label> <label>User Roaming</label>
<default>no</default> <default>no</default>
<button value="yes">Yes</button> <button value="yes">Yes</button>
<button value="no">No</button> <button value="no">No</button>
<help>Experemental Function Rouming Users</help> <help>Experemental Function Roaming Users</help>
</item> </item>
</page_group> </page_group>
@ -1609,10 +1609,10 @@ and open the template in the editor. Base Version before all crash :-)
</page_group> </page_group>
<!-- <!--
Rouming User Pages Roaming User Pages
--> -->
<page_group name="sccp_ruser"> <page_group name="sccp_ruser">
<label>Rouming User configuration</label> <label>Roaming User configuration</label>
<item type="IE" id="1" seq="99"> <item type="IE" id="1" seq="99">
<label>User ID</label> <label>User ID</label>
<input> <input>
@ -1650,7 +1650,7 @@ and open the template in the editor. Base Version before all crash :-)
</item> </item>
<item type="IS" id="13" seq="99"> <item type="IS" id="13" seq="99">
<name>roaminglogin</name> <name>roaminglogin</name>
<label>Rouming</label> <label>Roaming</label>
<default>off</default> <default>off</default>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<button value="on">Enable Single</button> <button value="on">Enable Single</button>
@ -1676,7 +1676,7 @@ and open the template in the editor. Base Version before all crash :-)
</item> </item>
</page_group> </page_group>
<!-- <!--
Rouming User Pages Roaming User Pages
--> -->
<page_group name="sccp_ruser_time"> <page_group name="sccp_ruser_time">
<label>Time Work configuration</label> <label>Time Work configuration</label>

View file

@ -222,7 +222,7 @@ and open the template in the editor. Base Version before all crash :-)
<class>sccp-custom</class> <class>sccp-custom</class>
<options placeholder="Provider IP"></options> <options placeholder="Provider IP"></options>
</input> </input>
<help>External IP Address of the firewall, required in case the PBX is running on a seperate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address.</help> <help>External IP Address of the firewall, required in case the PBX is running on a separate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address.</help>
<nameseparator> / </nameseparator> <nameseparator> / </nameseparator>
</item> </item>
<item type="IE" id="5"> <item type="IE" id="5">
@ -428,7 +428,7 @@ and open the template in the editor. Base Version before all crash :-)
<default>off</default> <default>off</default>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<help>Complete transfer on hangup, without pressing transfer a second time. Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached. To cancel the transfer, either press resume on the transfered channel, press the 'endcall' softkey, or have the receiving party hangup first.</help> <help>Complete transfer on hangup, without pressing transfer a second time. Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached. To cancel the transfer, either press resume on the transferred channel, press the 'endcall' softkey, or have the receiving party hangup first.</help>
</item> </item>
<item type="IS" id="12"> <item type="IS" id="12">
<name>callanswerorder</name> <name>callanswerorder</name>
@ -545,7 +545,7 @@ and open the template in the editor. Base Version before all crash :-)
<button value="broadcast">Broadcast</button> <button value="broadcast">Broadcast</button>
<button value="multicast">Multicast</button> <button value="multicast">Multicast</button>
<button value="manycast">Manycast</button> <button value="manycast">Manycast</button>
<help>Configure NTP Server protocol time syncronization</help> <help>Configure NTP Server protocol time synchronization</help>
</item> </item>
</page_group> </page_group>

View file

@ -224,7 +224,7 @@ and open the template in the editor. Base Version before all crash :-)
<class>sccp-custom</class> <class>sccp-custom</class>
<options placeholder="Provider IP"></options> <options placeholder="Provider IP"></options>
</input> </input>
<help>External IP Address of the firewall, required in case the PBX is running on a seperate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address.</help> <help>External IP Address of the firewall, required in case the PBX is running on a separate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address.</help>
<nameseparator> / </nameseparator> <nameseparator> / </nameseparator>
</item> </item>
<item type="IE" id="5"> <item type="IE" id="5">
@ -489,7 +489,7 @@ and open the template in the editor. Base Version before all crash :-)
<default>off</default> <default>off</default>
<button value="on">Enabled</button> <button value="on">Enabled</button>
<button value="off">Disabled</button> <button value="off">Disabled</button>
<help>Complete transfer on hangup, without pressing transfer a second time. Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached. To cancel the transfer, either press resume on the transfered channel, press the 'endcall' softkey, or have the receiving party hangup first.</help> <help>Complete transfer on hangup, without pressing transfer a second time. Will complete transfer, when the transferer puts the receiver on hook, after the destination has been reached. To cancel the transfer, either press resume on the transferred channel, press the 'endcall' softkey, or have the receiving party hangup first.</help>
</item> </item>
<item type="SLA-disabled" id="6"> <item type="SLA-disabled" id="6">
@ -658,7 +658,7 @@ and open the template in the editor. Base Version before all crash :-)
<button value="broadcast">Broadcast</button> <button value="broadcast">Broadcast</button>
<button value="multicast">Multicast</button> <button value="multicast">Multicast</button>
<button value="manycast">Manycast</button> <button value="manycast">Manycast</button>
<help>Configure NTP Server protocol time syncronization</help> <help>Configure NTP Server protocol time synchronization</help>
</item> </item>
</page_group> </page_group>

View file

@ -22,41 +22,52 @@
*/ */
function after($this, $inthat) { function after($this, $inthat)
if (!is_bool(strpos($inthat, $this))) {
if (!is_bool(strpos($inthat, $this))) {
return substr($inthat, strpos($inthat, $this) + strlen($this)); return substr($inthat, strpos($inthat, $this) + strlen($this));
} }
function after_last($this, $inthat) {
if (!is_bool(strrevpos($inthat, $this)))
return substr($inthat, strrevpos($inthat, $this) + strlen($this));
} }
function before($this, $inthat) { function after_last($this, $inthat)
{
if (!is_bool(strrevpos($inthat, $this))) {
return substr($inthat, strrevpos($inthat, $this) + strlen($this));
}
}
function before($this, $inthat)
{
return substr($inthat, 0, strpos($inthat, $this)); return substr($inthat, 0, strpos($inthat, $this));
} }
function before_last($this, $inthat) { function before_last($this, $inthat)
{
return substr($inthat, 0, strrevpos($inthat, $this)); return substr($inthat, 0, strrevpos($inthat, $this));
} }
function between($this, $that, $inthat) { function between($this, $that, $inthat)
{
return before($that, after($this, $inthat)); return before($that, after($this, $inthat));
} }
function between_last($this, $that, $inthat) { function between_last($this, $that, $inthat)
{
return after_last($this, before_last($that, $inthat)); return after_last($this, before_last($that, $inthat));
} }
function strrevpos($instr, $needle) { function strrevpos($instr, $needle)
{
$rev_pos = strpos(strrev($instr), strrev($needle)); $rev_pos = strpos(strrev($instr), strrev($needle));
if ($rev_pos === false) if ($rev_pos === false) {
return false; return false;
else } else {
return strlen($instr) - $rev_pos - strlen($needle); return strlen($instr) - $rev_pos - strlen($needle);
} }
}
function strpos_array($haystack, $needles) { function strpos_array($haystack, $needles)
{
if (is_array($needles)) { if (is_array($needles)) {
foreach ($needles as $str) { foreach ($needles as $str) {
if (is_array($str)) { if (is_array($str)) {
@ -64,14 +75,12 @@ function strpos_array($haystack, $needles) {
} else { } else {
$pos = strpos($haystack, $str); $pos = strpos($haystack, $str);
} }
if ($pos !== FALSE) { if ($pos !== false) {
return $pos; return $pos;
} }
} }
} else { } else {
return strpos($haystack, $needles); return strpos($haystack, $needles);
} }
return FALSE; return false;
} }
?>

View file

@ -143,7 +143,7 @@ msgid "External Ip"
msgstr "" msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "External IP Address of the firewall, required in case the PBX is running on a seperatehost behind it. IP Address that we're going to notify in RTP media stream as the pbx source address." msgid "External IP Address of the firewall, required in case the PBX is running on a separatehost behind it. IP Address that we're going to notify in RTP media stream as the pbx source address."
msgstr "" msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
@ -395,7 +395,7 @@ msgid "NTP Server name or IP"
msgstr "" msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "Configure NTP Server protocol time syncronization" msgid "Configure NTP Server protocol time synchronization"
msgstr "" msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
@ -967,7 +967,7 @@ msgid "Close"
msgstr "" msgstr ""
#: views/server.model: #: views/server.model:
msgid "Add New model whithout Enabled" msgid "Add New model without Enabled"
msgstr "" msgstr ""
#: views/server.model: #: views/server.model:

View file

@ -27,7 +27,8 @@ if (class_exists($class, false)) {
$srvinterface = new $class(); $srvinterface = new $class();
} }
function Get_DB_config($sccp_compatible) { function Get_DB_config($sccp_compatible)
{
global $mobile_hw; global $mobile_hw;
$db_config_v0 = array( $db_config_v0 = array(
'sccpdevmodel' => array( 'sccpdevmodel' => array(
@ -375,7 +376,8 @@ $sccp_compatible = 0;
//$db_config = $db_config_v0; //$db_config = $db_config_v0;
$db_config = ''; $db_config = '';
function CheckSCCPManagerDBTables($table_req) { function CheckSCCPManagerDBTables($table_req)
{
global $amp_conf; global $amp_conf;
global $astman; global $astman;
global $db; global $db;
@ -391,25 +393,27 @@ global $astman;
} }
} }
function CheckSCCPManagerDBVersion() { function CheckSCCPManagerDBVersion()
{
global $db; global $db;
outn("<li>" . _("Checking for previw version Sccp_manager..") . "</li>"); outn("<li>" . _("Checking for previw version Sccp_manager..") . "</li>");
$check = $db->getRow("SELECT data FROM `sccpsettings` where keyword ='sccp_compatible'", DB_FETCHMODE_ASSOC); $check = $db->getRow("SELECT data FROM `sccpsettings` where keyword ='sccp_compatible'", DB_FETCHMODE_ASSOC);
if (DB::IsError($check)) { if (DB::IsError($check)) {
outn(_("Can't find previw version : ")); outn(_("Can't find previw version : "));
return FALSE; return false;
} }
if (!empty($check['data'])) { if (!empty($check['data'])) {
outn(_("Find DB Schema : " . $check['data'])); outn(_("Find DB Schema : " . $check['data']));
return $check['data']; return $check['data'];
} else { } else {
return FALSE; return false;
} }
} }
/* notused */ /* notused */
function CheckPermissions() { function CheckPermissions()
{
outn("<li>" . _("Checking Filesystem Permissions") . "</li>"); outn("<li>" . _("Checking Filesystem Permissions") . "</li>");
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views'; $dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views';
if (fileowner($_SERVER['DOCUMENT_ROOT']) != fileowner($dst)) { if (fileowner($_SERVER['DOCUMENT_ROOT']) != fileowner($dst)) {
@ -417,7 +421,8 @@ function CheckPermissions() {
} }
} }
function CheckAsteriskVersion() { function CheckAsteriskVersion()
{
outn("<li>" . _("Checking Asterisk Version : ") . $version . "</li>"); outn("<li>" . _("Checking Asterisk Version : ") . $version . "</li>");
$version = FreePBX::Config()->get('ASTVERSION'); $version = FreePBX::Config()->get('ASTVERSION');
if (!empty($version)) { if (!empty($version)) {
@ -436,7 +441,8 @@ function CheckAsteriskVersion() {
return $ver_compatible; return $ver_compatible;
} }
function CheckChanSCCPCompatible() { function CheckChanSCCPCompatible()
{
global $srvinterface, $astman; global $srvinterface, $astman;
if (!$astman) { if (!$astman) {
ie_freepbx('No asterisk manager connection provided!. Installation Failed'); ie_freepbx('No asterisk manager connection provided!. Installation Failed');
@ -446,7 +452,8 @@ function CheckChanSCCPCompatible() {
return $sccp_compatible; return $sccp_compatible;
} }
function InstallDB_Buttons() { function InstallDB_Buttons()
{
global $db; global $db;
outn("<li>" . _("Creating buttons table...") . "</li>"); outn("<li>" . _("Creating buttons table...") . "</li>");
// $check = $db->getRow("SELECT 1 FROM buttonconfig LIMIT 0", DB_FETCHMODE_ASSOC); // $check = $db->getRow("SELECT 1 FROM buttonconfig LIMIT 0", DB_FETCHMODE_ASSOC);
@ -467,10 +474,10 @@ function InstallDB_Buttons() {
die_freepbx("Can not create sccpbuttonconfig table, error:$check\n"); die_freepbx("Can not create sccpbuttonconfig table, error:$check\n");
} }
return true; return true;
} }
function InstallDB_sccpsettings() { function InstallDB_sccpsettings()
{
global $db; global $db;
outn("<li>" . _("Creating sccpsettings table...") . "</li>"); outn("<li>" . _("Creating sccpsettings table...") . "</li>");
$sql = "CREATE TABLE IF NOT EXISTS `sccpsettings` ( $sql = "CREATE TABLE IF NOT EXISTS `sccpsettings` (
@ -487,7 +494,8 @@ function InstallDB_sccpsettings() {
return true; return true;
} }
function InstallDB_sccpdevmodel() { function InstallDB_sccpdevmodel()
{
global $db; global $db;
outn("<li>" . _("Creating sccpdevmodel table...") . "</li>"); outn("<li>" . _("Creating sccpdevmodel table...") . "</li>");
$sql = "CREATE TABLE IF NOT EXISTS `sccpdevmodel` ( $sql = "CREATE TABLE IF NOT EXISTS `sccpdevmodel` (
@ -509,7 +517,8 @@ function InstallDB_sccpdevmodel() {
return true; return true;
} }
function InstallDB_sccpuser() { function InstallDB_sccpuser()
{
global $db; global $db;
outn("<li>" . _("Creating sccpuser table...") . "</li>"); outn("<li>" . _("Creating sccpuser table...") . "</li>");
$sql = "CREATE TABLE IF NOT EXISTS `sccpuser` ( $sql = "CREATE TABLE IF NOT EXISTS `sccpuser` (
@ -531,7 +540,8 @@ function InstallDB_sccpuser() {
return true; return true;
} }
function InstallDB_updateSchema($db_config) { function InstallDB_updateSchema($db_config)
{
global $db; global $db;
if (!$db_config) { if (!$db_config) {
die_freepbx("No db_config provided"); die_freepbx("No db_config provided");
@ -543,7 +553,7 @@ function InstallDB_updateSchema($db_config) {
$sql = "DESCRIBE " . $tabl_name . ""; $sql = "DESCRIBE " . $tabl_name . "";
$db_result = $db->getAll($sql); $db_result = $db->getAll($sql);
if (DB::IsError($db_result)) { if (DB::IsError($db_result)) {
die_freepbx("Can not add get informations from " . $tabl_name . " table\n"); die_freepbx("Can not add get information from " . $tabl_name . " table\n");
} }
foreach ($db_result as $tabl_data) { foreach ($db_result as $tabl_data) {
$fld_id = $tabl_data[0]; $fld_id = $tabl_data[0];
@ -655,7 +665,8 @@ function InstallDB_updateSchema($db_config) {
return true; return true;
} }
function InstallDB_fillsccpdevmodel() { function InstallDB_fillsccpdevmodel()
{
global $db; global $db;
outn("<li>" . _("Fill sccpdevmodel") . "</li>"); outn("<li>" . _("Fill sccpdevmodel") . "</li>");
$sql = "REPLACE INTO `sccpdevmodel` (`model`, `vendor`, `dns`, `buttons`, `loadimage`, `loadinformationid`, `enabled`, `nametemplate`) VALUES ('12 SP', 'CISCO', 1, 1, '', 'loadInformation3', 0, NULL)," . $sql = "REPLACE INTO `sccpdevmodel` (`model`, `vendor`, `dns`, `buttons`, `loadimage`, `loadinformationid`, `enabled`, `nametemplate`) VALUES ('12 SP', 'CISCO', 1, 1, '', 'loadInformation3', 0, NULL)," .
@ -678,7 +689,8 @@ function InstallDB_fillsccpdevmodel() {
return true; return true;
} }
function InstallDB_updateSccpDevice() { function InstallDB_updateSccpDevice()
{
global $db; global $db;
outn("<li>" . _("Update sccpdevice") . "</li>"); outn("<li>" . _("Update sccpdevice") . "</li>");
$sql = "UPDATE `sccpdevice` set audio_tos='0xB8',audio_cos='6',video_tos='0x88',video_cos='5' where audio_tos=NULL or audio_tos='';"; $sql = "UPDATE `sccpdevice` set audio_tos='0xB8',audio_cos='6',video_tos='0x88',video_cos='5' where audio_tos=NULL or audio_tos='';";
@ -688,7 +700,8 @@ function InstallDB_updateSccpDevice() {
} }
} }
function InstallDB_createButtonConfigTrigger() { function InstallDB_createButtonConfigTrigger()
{
global $db; global $db;
outn("<li>" . _("(Re)Create buttonconfig trigger") . "</li>"); outn("<li>" . _("(Re)Create buttonconfig trigger") . "</li>");
$sql = "DROP TRIGGER IF EXISTS sccp_trg_buttonconfig;"; $sql = "DROP TRIGGER IF EXISTS sccp_trg_buttonconfig;";
@ -722,7 +735,8 @@ function InstallDB_createButtonConfigTrigger() {
// outn("<li>" . $sql . "</li>"); // outn("<li>" . $sql . "</li>");
return true; return true;
} }
function InstallDB_updateDBVer($sccp_compatible) { function InstallDB_updateDBVer($sccp_compatible)
{
global $db; global $db;
outn("<li>" . _("Update DB Ver") . "</li>"); outn("<li>" . _("Update DB Ver") . "</li>");
$sql = "REPLACE INTO `sccpsettings` (`keyword`, `data`, `seq`, `type`), VALUES ('SccpDBmodel', '"+$sccp_compatible+ "','30','0');"; $sql = "REPLACE INTO `sccpsettings` (`keyword`, `data`, `seq`, `type`), VALUES ('SccpDBmodel', '"+$sccp_compatible+ "','30','0');";
@ -733,7 +747,8 @@ function InstallDB_updateDBVer($sccp_compatible) {
return true; return true;
} }
function InstallDB_CreateSccpDeviceConfigView($sccp_compatible) { function InstallDB_CreateSccpDeviceConfigView($sccp_compatible)
{
global $db; global $db;
outn("<li>" . _("(Re)Create sccpdeviceconfig view") . "</li>"); outn("<li>" . _("(Re)Create sccpdeviceconfig view") . "</li>");
$sql = ""; $sql = "";
@ -794,7 +809,6 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_compatible) {
FROM sccpuser FROM sccpuser
LEFT JOIN sccpbuttonconfig ON ( sccpbuttonconfig.reftype = 'sccpuser' AND sccpbuttonconfig.ref = sccpuser.id) LEFT JOIN sccpbuttonconfig ON ( sccpbuttonconfig.reftype = 'sccpuser' AND sccpbuttonconfig.ref = sccpuser.id)
GROUP BY sccpuser.name; "; GROUP BY sccpuser.name; ";
} else { } else {
$sql .= "CREATE OR REPLACE $sql .= "CREATE OR REPLACE
ALGORITHM = MERGE ALGORITHM = MERGE
@ -818,7 +832,8 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_compatible) {
} }
return true; return true;
} }
function CreateBackUpConfig() { function CreateBackUpConfig()
{
global $amp_conf; global $amp_conf;
outn("<li>" . _("Create Config BackUp") . "</li>"); outn("<li>" . _("Create Config BackUp") . "</li>");
$cnf_int = \FreePBX::Config(); $cnf_int = \FreePBX::Config();
@ -850,7 +865,8 @@ function CreateBackUpConfig() {
outn("<li>" . _("Create Config BackUp: ") . $filename ."</li>"); outn("<li>" . _("Create Config BackUp: ") . $filename ."</li>");
} }
function RenameConfig() { function RenameConfig()
{
global $amp_conf; global $amp_conf;
outn("<li>" . _("Move Old Config") . "</li>"); outn("<li>" . _("Move Old Config") . "</li>");
$cnf_int = \FreePBX::Config(); $cnf_int = \FreePBX::Config();
@ -866,7 +882,8 @@ function RenameConfig() {
} }
} }
function Setup_RealTime() { function Setup_RealTime()
{
global $amp_conf; global $amp_conf;
outn("<li>" . _("Pre config RealTime") . "</li>"); outn("<li>" . _("Pre config RealTime") . "</li>");
$cnf_int = \FreePBX::Config(); $cnf_int = \FreePBX::Config();
@ -985,8 +1002,8 @@ if (!$sccp_db_ver) {
} }
outn("<br>"); outn("<br>");
// $ss->save_submit($request); // $ss->handleSubmit($request);
// $ss->sccp_create_sccp_init(); // $ss->createDefaultSccpConfig();
// $ss->sccp_db_save_setting(); // $ss->saveSccpSettings();
// //
//} //}

View file

@ -1,5 +1,7 @@
<?php /* $Id:$ */ <?php /* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } if (!defined('FREEPBX_IS_AUTH')) {
die('No direct script access allowed');
}
// License for all code of this FreePBX module can be found in the license file inside the module directory // License for all code of this FreePBX module can be found in the license file inside the module directory
// Copyright 2015 Sangoma Technologies. // Copyright 2015 Sangoma Technologies.
// //
@ -14,10 +16,10 @@ if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
// //
$spage = FreePBX::create()->Sccp_manager; $spage = FreePBX::create()->Sccp_manager;
if (empty($spage->class_error)) { if (empty($spage->class_error)) {
$display_page = $spage->AdvServerShowPage(); $display_page = $spage->advServerShowPage();
$display_info = _("SCCP Advance Server Configuration"); $display_info = _("SCCP Advance Server Configuration");
} else { } else {
$display_page = $spage->InfoServerShowPage(); $display_page = $spage->infoServerShowPage();
$display_info = _("SCCP Server Configuration"); $display_info = _("SCCP Server Configuration");
} }
?> ?>

View file

@ -1,5 +1,7 @@
<?php /* $Id:$ */ <?php /* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } if (!defined('FREEPBX_IS_AUTH')) {
die('No direct script access allowed');
}
// License for all code of this FreePBX module can be found in the license file inside the module directory // License for all code of this FreePBX module can be found in the license file inside the module directory
// Copyright 2015 Sangoma Technologies. // Copyright 2015 Sangoma Technologies.
// //
@ -14,10 +16,10 @@ if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
// //
$spage = FreePBX::create()->Sccp_manager; $spage = FreePBX::create()->Sccp_manager;
if (empty($spage->class_error)) { if (empty($spage->class_error)) {
$display_page = $spage->PhoneShowPage(); $display_page = $spage->phoneShowPage();
$display_info = _("SCCP Phone Manager"); $display_info = _("SCCP Phone Manager");
} else { } else {
$display_page = $spage->InfoServerShowPage(); $display_page = $spage->infoServerShowPage();
$display_info = _("SCCP Server Configuration"); $display_info = _("SCCP Server Configuration");
} }

View file

@ -1,5 +1,7 @@
<?php /* $Id:$ */ <?php /* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } if (!defined('FREEPBX_IS_AUTH')) {
die('No direct script access allowed');
}
// License for all code of this FreePBX module can be found in the license file inside the module directory // License for all code of this FreePBX module can be found in the license file inside the module directory
// Copyright 2015 Sangoma Technologies. // Copyright 2015 Sangoma Technologies.
// vim: set ai ts=4 sw=4 ft=php: // vim: set ai ts=4 sw=4 ft=php:

View file

@ -30,7 +30,9 @@ function CreateBackUpConfig() {
outn("<li>" . _("Create Config BackUp: ") . $filename ."</li>"); outn("<li>" . _("Create Config BackUp: ") . $filename ."</li>");
} }
*/ */
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } if (!defined('FREEPBX_IS_AUTH')) {
die('No direct script access allowed');
}
global $db; global $db;
$version = FreePBX::Config()->get('ASTVERSION'); $version = FreePBX::Config()->get('ASTVERSION');
@ -70,5 +72,3 @@ if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
} }
echo "done<br>\n"; echo "done<br>\n";
?>

View file

@ -115,7 +115,6 @@ $keynamearray = array('onhook' => array(sname => 'ONHOOK', name =>'Display On
echo '<a href="#'.$key.'" aria-controls="'.$key.'" role="tab" data-toggle="tab">'._($key); echo '<a href="#'.$key.'" aria-controls="'.$key.'" role="tab" data-toggle="tab">'._($key);
echo '</a></li>'; echo '</a></li>';
$i ++; $i ++;
} }
?> ?>
</ul> </ul>

View file

@ -142,7 +142,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo _('Close');?></button> <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo _('Close');?></button>
<button type="button" class="btn btn-primary sccp_update" data-id="model_add" id="add_new_model" data-dismiss="modal"><?php echo _('Add New model whithout Enabled');?></button> <button type="button" class="btn btn-primary sccp_update" data-id="model_add" id="add_new_model" data-dismiss="modal"><?php echo _('Add New model without Enabled');?></button>
</div> </div>
</div> </div>
</div> </div>

View file

@ -34,17 +34,17 @@ if (!empty($_REQUEST['id'])) {
if (!empty($val)) { if (!empty($val)) {
switch ($key) { switch ($key) {
case 'type': case 'type':
$tmp_raw = $this->getSccp_model_information('byid', TRUE, 'all', array('model'=>$val)); $tmp_raw = $this->getSccpModelInformation('byid', true, 'all', array('model'=>$val));
if (!empty($tmp_raw[0])) { if (!empty($tmp_raw[0])) {
$tmp_raw = $tmp_raw[0]; $tmp_raw = $tmp_raw[0];
} }
if (!empty($tmp_raw['validate'])) { if (!empty($tmp_raw['validate'])) {
$tmpar = explode(";", $tmp_raw['validate']); $tmpar = explode(";", $tmp_raw['validate']);
if ($tmpar[0] != 'yes') { if ($tmpar[0] != 'yes') {
$device_warning['Image'] = Array('Device firmware not found : '.$tmp_raw['loadimage']); $device_warning['Image'] = array('Device firmware not found : '.$tmp_raw['loadimage']);
} }
if ($tmpar[1] != 'yes') { if ($tmpar[1] != 'yes') {
$device_warning['Template'] = Array('Missing device configuration template : '. $tmp_raw['nametemplate']); $device_warning['Template'] = array('Missing device configuration template : '. $tmp_raw['nametemplate']);
} }
} }
break; break;
@ -108,15 +108,15 @@ if (!empty($device_warning)) {
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">'; echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
} }
if (empty($dev_id)) { if (empty($dev_id)) {
echo $this->ShowGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val);
} else { } else {
echo $this->ShowGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val);
} }
echo $this->ShowGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val);
echo $this->ShowGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val);
echo $this->ShowGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
echo $this->ShowGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val);
echo $this->ShowGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
echo $this->ShowGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
?> ?>
</form> </form>

View file

@ -28,7 +28,7 @@ if (!empty($_REQUEST['ru_id'])) {
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">
<?php <?php
echo $this->ShowGroup('sccp_ruser', 1, 'sccp_ru', $def_val); echo $this->showGroup('sccp_ruser', 1, 'sccp_ru', $def_val);
echo $this->ShowGroup('sccp_ruser_time', 1, 'sccp_ru', $def_val); echo $this->showGroup('sccp_ruser_time', 1, 'sccp_ru', $def_val);
?> ?>
</form> </form>

View file

@ -34,17 +34,17 @@ if (!empty($_REQUEST['id'])) {
if (!empty($val)) { if (!empty($val)) {
switch ($key) { switch ($key) {
case 'type': case 'type':
$tmp_raw = $this->getSccp_model_information('byid', TRUE, 'all', array('model'=>$val)); $tmp_raw = $this->getSccpModelInformation('byid', true, 'all', array('model'=>$val));
if (!empty($tmp_raw[0])) { if (!empty($tmp_raw[0])) {
$tmp_raw = $tmp_raw[0]; $tmp_raw = $tmp_raw[0];
} }
if (!empty($tmp_raw['validate'])) { if (!empty($tmp_raw['validate'])) {
$tmpar = explode(";", $tmp_raw['validate']); $tmpar = explode(";", $tmp_raw['validate']);
if ($tmpar[0] != 'yes') { if ($tmpar[0] != 'yes') {
$device_warning['Image'] = Array('Device firmware not found : '.$tmp_raw['loadimage']); $device_warning['Image'] = array('Device firmware not found : '.$tmp_raw['loadimage']);
} }
if ($tmpar[1] != 'yes') { if ($tmpar[1] != 'yes') {
$device_warning['Template'] = Array('Missing device configuration template : '. $tmp_raw['nametemplate']); $device_warning['Template'] = array('Missing device configuration template : '. $tmp_raw['nametemplate']);
} }
} }
break; break;
@ -110,16 +110,16 @@ if (!empty($device_warning)) {
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">'; echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
} }
if (empty($dev_id)) { if (empty($dev_id)) {
echo $this->ShowGroup('sccp_hw_sip_dev', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_sip_dev', 1, 'sccp_hw', $def_val);
} else { } else {
echo $this->ShowGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val);
} }
echo $this->ShowGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val);
echo $this->ShowGroup('sccp_hw_sip_conf', 1, 'sccp_hw', $def_val); echo $this->showGroup('sccp_hw_sip_conf', 1, 'sccp_hw', $def_val);
// echo $this->ShowGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val); // echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val);
// echo $this->ShowGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val); // echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
// echo $this->ShowGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); // echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val);
// echo $this->ShowGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val); // echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
// echo $this->ShowGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val); // echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
?> ?>
</form> </form>

View file

@ -21,7 +21,7 @@ $feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'dev
$lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); $lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
//$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); //$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
$hint_list = $this->get_hint_info(true,array('context'=>'park-hints')) ; $hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
// print_r($hint_list); // print_r($hint_list);
$line_id =0; $line_id =0;
@ -40,12 +40,12 @@ if (!empty($_REQUEST['id'])) {
} }
if (!empty($_REQUEST['new_id'])) { if (!empty($_REQUEST['new_id'])) {
$val = $_REQUEST['type']; $val = $_REQUEST['type'];
$dev_schema = $this-> getSccp_model_information('byid', false, "all", array('model' =>$val)); $dev_schema = $this-> getSccpModelInformation('byid', false, "all", array('model' =>$val));
// $db_device = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $val)); // $db_device = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $val));
$max_buttons = $dev_schema[0]['buttons']; $max_buttons = $dev_schema[0]['buttons'];
if (!empty($_REQUEST['addon'])) { if (!empty($_REQUEST['addon'])) {
$val = $_REQUEST['addon']; $val = $_REQUEST['addon'];
$dev_schema = $this-> getSccp_model_information('byid', false, "all", array('model' =>$val)); $dev_schema = $this-> getSccpModelInformation('byid', false, "all", array('model' =>$val));
$max_buttons += $dev_schema[0]['buttons']; $max_buttons += $dev_schema[0]['buttons'];
} }
$show_buttons = $max_buttons; $show_buttons = $max_buttons;

View file

@ -6,7 +6,7 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
//$list_data = $this->get_DialPlan('dialplan'); //$list_data = $this->getDialPlan('dialplan');
//print_r($list_data); //print_r($list_data);
//$dialFelds = array('match','timeout','line','rewrite','tone'); //$dialFelds = array('match','timeout','line','rewrite','tone');
//$dialFelds = array('match','timeout','User','rewrite','tone'); //$dialFelds = array('match','timeout','User','rewrite','tone');
@ -16,7 +16,7 @@ if (!empty($_REQUEST['extdisplay'])) {
$dev_id = $_REQUEST['extdisplay']; $dev_id = $_REQUEST['extdisplay'];
} }
if ($dev_id != '*new*') { if ($dev_id != '*new*') {
$list_data= $this->get_DialPlan($dev_id); $list_data= $this->getDialPlan($dev_id);
$data_s= ''; $data_s= '';
foreach ($list_data['template'] as $key => $value) { foreach ($list_data['template'] as $key => $value) {
foreach ($dialFelds as $fld) { foreach ($dialFelds as $fld) {
@ -41,7 +41,7 @@ if ($dev_id != '*new*') {
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">
<?php <?php
if ($dev_id == '*new*') { if ($dev_id == '*new*') {
echo $this->ShowGroup('sccp_dp_new_template',0,'sccp_dial',$def_val); echo $this->showGroup('sccp_dp_new_template', 0, 'sccp_dial', $def_val);
} }
?> ?>
@ -74,7 +74,7 @@ if ($dev_id != '*new*') {
<?php <?php
// echo $this->ShowGroup('sccp_dp_new_template',0,'sccp_dial',$def_val); // echo $this->showGroup('sccp_dp_new_template',0,'sccp_dial',$def_val);
echo $this->ShowGroup('sccp_dp_template',0,'sccp_dial',$def_val); echo $this->showGroup('sccp_dp_template', 0, 'sccp_dial', $def_val);
?> ?>
</form> </form>

View file

@ -18,7 +18,7 @@ $feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'dev
//$lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); //$lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
$lines_list = $this->sipconfigs->get_db_sip_TableData('Device'); $lines_list = $this->sipconfigs->get_db_sip_TableData('Device');
//$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); //$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
$hint_list = $this->get_hint_info(true,array('context'=>'park-hints')) ; $hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
// print_r($lines_list); // print_r($lines_list);
$line_id =0; $line_id =0;
@ -37,12 +37,12 @@ if (!empty($_REQUEST['id'])) {
} }
if (!empty($_REQUEST['new_id'])) { if (!empty($_REQUEST['new_id'])) {
$val = $_REQUEST['type']; $val = $_REQUEST['type'];
$dev_schema = $this-> getSccp_model_information('byid', false, "all", array('model' =>$val)); $dev_schema = $this-> getSccpModelInformation('byid', false, "all", array('model' =>$val));
// $db_device = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $val)); // $db_device = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $val));
$max_buttons = $dev_schema[0]['buttons']; $max_buttons = $dev_schema[0]['buttons'];
if (!empty($_REQUEST['addon'])) { if (!empty($_REQUEST['addon'])) {
$val = $_REQUEST['addon']; $val = $_REQUEST['addon'];
$dev_schema = $this-> getSccp_model_information('byid', false, "all", array('model' =>$val)); $dev_schema = $this-> getSccpModelInformation('byid', false, "all", array('model' =>$val));
$max_buttons += $dev_schema[0]['buttons']; $max_buttons += $dev_schema[0]['buttons'];
} }
$show_buttons = $max_buttons; $show_buttons = $max_buttons;

View file

@ -149,7 +149,9 @@ foreach ($items as $child) {
if (empty($value->class)) { if (empty($value->class)) {
$value->class = 'form-control'; $value->class = 'form-control';
} }
if ($i > 0) echo $child->nameseparator; if ($i > 0) {
echo $child->nameseparator;
}
// //
echo '<input type="' . $value->type . '" class="' . $value->class . '" id="' . $res_id . '" name="' . $res_name . '" value="' . $value->value.'"'; echo '<input type="' . $value->type . '" class="' . $value->class . '" id="' . $res_id . '" name="' . $res_name . '" value="' . $value->value.'"';
if (isset($value->options)) { if (isset($value->options)) {
@ -157,11 +159,14 @@ foreach ($items as $child) {
echo ' '.$optkey.'="'.$optval.'"'; echo ' '.$optkey.'="'.$optval.'"';
} }
} }
if (!empty($value->min)) echo ' min="'.$value->min.'"'; if (!empty($value->min)) {
if (!empty($value->max)) echo ' max="'.$value->max.'"'; echo ' min="'.$value->min.'"';
}
if (!empty($value->max)) {
echo ' max="'.$value->max.'"';
}
echo '>'; echo '>';
$i ++; $i ++;
} }
?> ?>
</div> </div>
@ -173,7 +178,6 @@ foreach ($items as $child) {
<?php <?php
echo '<!-- END '.$child->label.' -->'; echo '<!-- END '.$child->label.' -->';
} }
if ($child['type'] == 'IED') { if ($child['type'] == 'IED') {
$res_input = ''; $res_input = '';
@ -292,7 +296,6 @@ foreach ($items as $child) {
} }
echo '> '.(string)$value['nameseparator'].' '; echo '> '.(string)$value['nameseparator'].' ';
$i2 ++; $i2 ++;
} }
if (!empty($child->add_pluss)) { if (!empty($child->add_pluss)) {
echo '<button type="button" class="btn btn-primary btn-lg input-js-add" id="'.$res_id.'-btn" data-id="'.$res_id.'" data-for="'.$res_id.'" data-max="'.$max_row.'"data-json="'.bin2hex(json_encode($opt_at)).'"><i class="fa fa-plus pull-right"></i></button>'; echo '<button type="button" class="btn btn-primary btn-lg input-js-add" id="'.$res_id.'-btn" data-id="'.$res_id.'" data-for="'.$res_id.'" data-max="'.$max_row.'"data-json="'.bin2hex(json_encode($opt_at)).'"><i class="fa fa-plus pull-right"></i></button>';
@ -321,7 +324,6 @@ foreach ($items as $child) {
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->'; echo '<!-- END '.$child->label.' -->';
} }
if ($child['type'] == 'IS') { if ($child['type'] == 'IS') {
@ -395,7 +397,6 @@ foreach ($items as $child) {
<?php <?php
echo '<!-- END '.$child->label.' -->'; echo '<!-- END '.$child->label.' -->';
} }
/* /*
@ -436,7 +437,7 @@ foreach ($items as $child) {
} }
if ($child['type'] == 'SLP') { if ($child['type'] == 'SLP') {
if (empty($dialplan_list)) { if (empty($dialplan_list)) {
foreach (\FreePBX::Sccp_manager()->get_DialPlanList() as $tmpkey) { foreach (\FreePBX::Sccp_manager()->getDialPlanList() as $tmpkey) {
$tmp_id = $tmpkey['id']; $tmp_id = $tmpkey['id'];
$dialplan_list[$tmp_id] = $tmp_id; $dialplan_list[$tmp_id] = $tmp_id;
} }
@ -480,7 +481,6 @@ foreach ($items as $child) {
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->'; echo '<!-- END '.$child->label.' -->';
} }
/* /*
* Input element Select SLS - System Language * Input element Select SLS - System Language
@ -575,7 +575,6 @@ foreach ($items as $child) {
<!--END System Language--> <!--END System Language-->
<?php <?php
echo '<!-- END '.$child->label.' -->'; echo '<!-- END '.$child->label.' -->';
} }
/* /*
* Input element Select * Input element Select
@ -741,7 +740,6 @@ foreach ($items as $child) {
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->'; echo '<!-- END '.$child->label.' -->';
} }
if ($child['type'] == 'ITED') { if ($child['type'] == 'ITED') {
$res_input = ''; $res_input = '';
@ -834,7 +832,6 @@ foreach ($items as $child) {
} }
echo '</td>'; echo '</td>';
$i2 ++; $i2 ++;
} }
echo '<td><input type="button" id="'.$res_id.'-btn" data-id="'.($i).'" data-for="'.$res_id.'" data-json="'.bin2hex(json_encode($opt_at)).'" class="table-js-add" value="+" />'; echo '<td><input type="button" id="'.$res_id.'-btn" data-id="'.($i).'" data-for="'.$res_id.'" data-json="'.bin2hex(json_encode($opt_at)).'" class="table-js-add" value="+" />';
if ($i > 0) { if ($i > 0) {
@ -846,7 +843,6 @@ foreach ($items as $child) {
} }
echo '</table>'; echo '</table>';
echo '<!-- END '.$res_id.' -->'; echo '<!-- END '.$res_id.' -->';
} }
if ($child['type'] == 'HLP') { if ($child['type'] == 'HLP') {
@ -894,7 +890,6 @@ foreach ($items as $child) {
</div> </div>
<?php <?php
echo '<!-- END '.$child->label.' -->'; echo '<!-- END '.$child->label.' -->';
} }
if ($child['type'] == 'MINFO') { if ($child['type'] == 'MINFO') {
$res_n = (string)$child ->name; $res_n = (string)$child ->name;
@ -976,15 +971,21 @@ foreach ($items as $child) {
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">'; echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
foreach ($time_zone_list as $opt_key) { foreach ($time_zone_list as $opt_key) {
$z = explode('/', $opt_key, 2); $z = explode('/', $opt_key, 2);
if (count($z) != 2 || !in_array($z[0], $time_regions)) continue; if (count($z) != 2 || !in_array($z[0], $time_regions)) {
continue;
}
if ($optgroup != $z[0]) { if ($optgroup != $z[0]) {
if ($optgroup !== '') echo '</optgroup>'; if ($optgroup !== '') {
echo '</optgroup>';
}
$optgroup = $z[0]; $optgroup = $z[0];
echo '<optgroup label="' . htmlentities($z[0]) . '">'; echo '<optgroup label="' . htmlentities($z[0]) . '">';
} }
echo '<option value="' . htmlentities($opt_key) . '" label="' . htmlentities(str_replace('_', ' ', $z[1])) . '"' . ($opt_key == $child->value ? ' selected="selected" >' : '>'). htmlentities(str_replace('_', ' ', $opt_key)) . '</option>'; echo '<option value="' . htmlentities($opt_key) . '" label="' . htmlentities(str_replace('_', ' ', $z[1])) . '"' . ($opt_key == $child->value ? ' selected="selected" >' : '>'). htmlentities(str_replace('_', ' ', $opt_key)) . '</option>';
} }
if ($optgroup !== '') echo '</optgroup>'; if ($optgroup !== '') {
echo '</optgroup>';
}
?> </select> ?> </select>
<!-- </div> --> </div> <!-- </div> --> </div>
@ -996,10 +997,7 @@ foreach ($items as $child) {
<!--END System Language--> <!--END System Language-->
<?php <?php
echo '<!-- END '.$child->label.' -->'; echo '<!-- END '.$child->label.' -->';
} }
} }
?> ?>
<?php <?php

View file

@ -12,8 +12,8 @@
<?php <?php
echo $this->ShowGroup('sccp_srst',1); echo $this->showGroup('sccp_srst', 1);
// echo $this->ShowGroup('sccp_dev_time',1); // echo $this->showGroup('sccp_dev_time',1);
?> ?>
</form> </form>

View file

@ -32,7 +32,6 @@ if (!empty($_REQUEST['id'])) {
if (!empty($db_res['disallow'])) { if (!empty($db_res['disallow'])) {
$sccp_disalow = $db_res['disallow']; $sccp_disalow = $db_res['disallow'];
} }
} else { } else {
$codec_list = $sccp_codec; $codec_list = $sccp_codec;
} }
@ -168,7 +167,7 @@ if (!empty($_REQUEST['id'])) {
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<span id="sccp_disallow-help" class="help-block fpbx-help-block"><?php echo _("Defaut : all. Plz eneter format: alaw,ulaw") ?></span> <span id="sccp_disallow-help" class="help-block fpbx-help-block"><?php echo _("Default : all. Plz eneter format: alaw,ulaw") ?></span>
</div> </div>
</div> </div>
</div> </div>

View file

@ -12,8 +12,8 @@
<?php <?php
echo $this->ShowGroup('sccp_dev_ntp',1); echo $this->showGroup('sccp_dev_ntp', 1);
echo $this->ShowGroup('sccp_dev_time',1); echo $this->showGroup('sccp_dev_time', 1);
?> ?>
</form> </form>

View file

@ -7,7 +7,7 @@
*/ */
/* /*
$data = 'none;'; $data = 'none;';
foreach ($this->get_DialPlanList() as $value) { foreach ($this->getDialPlanList() as $value) {
$data .= $value['id'].';'; $data .= $value['id'].';';
} }
if (strlen($data) >0 ){ if (strlen($data) >0 ){
@ -22,11 +22,11 @@ if (strlen($data) >0 ){
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">
<?php <?php
echo $this->ShowGroup('sccp_dev_config',1); echo $this->showGroup('sccp_dev_config', 1);
echo $this->ShowGroup('sccp_dev_group_config',1); echo $this->showGroup('sccp_dev_group_config', 1);
echo $this->ShowGroup('sccp_dev_advconfig',1); echo $this->showGroup('sccp_dev_advconfig', 1);
echo $this->ShowGroup('sccp_dev_softkey',1); echo $this->showGroup('sccp_dev_softkey', 1);
echo $this->ShowGroup('sccp_dev_url',1); echo $this->showGroup('sccp_dev_url', 1);
echo $this->ShowGroup('sccp_hotline_config',1); echo $this->showGroup('sccp_hotline_config', 1);
?> ?>
</form> </form>

View file

@ -25,7 +25,7 @@ foreach ($ast_realtime as $key => $value) {
$conf_realtime = $this->extconfigs->validate_RealTime($ast_realm); $conf_realtime = $this->extconfigs->validate_RealTime($ast_realm);
$db_Schema = $this->dbinterface->validate(); $db_Schema = $this->dbinterface->validate();
$mysql_info = $this->dbinterface->get_db_sysvalues(); $mysql_info = $this->dbinterface->get_db_sysvalues();
$compatable = $this->srvinterface->get_compatible_sccp(); $compatible = $this->srvinterface->get_compatible_sccp();
$info = array(); $info = array();
$info['srvinterface'] = $this->srvinterface->info(); $info['srvinterface'] = $this->srvinterface->info();
@ -48,16 +48,16 @@ if (!empty($this->sccpvalues['tftp_rewrite'])) {
$info['TFTP_Rewrite'] = array('Version' => 'base', 'about' => 'Rewrite Supported'); $info['TFTP_Rewrite'] = array('Version' => 'base', 'about' => 'Rewrite Supported');
} }
} }
$info['Сompatible'] = array('Version' => $compatable, 'about' => 'Ok'); $info['Сompatible'] = array('Version' => $compatible, 'about' => 'Ok');
if (!empty($this->sccpvalues['SccpDBmodel'])) { if (!empty($this->sccpvalues['SccpDBmodel'])) {
if ($compatable > $this->sccpvalues['SccpDBmodel']['data']) { if ($compatible > $this->sccpvalues['SccpDBmodel']['data']) {
$info['Сompatible']['about'] = '<div class="alert signature alert-danger"> Reinstall SCCP manager required</div>'; $info['Сompatible']['about'] = '<div class="alert signature alert-danger"> Reinstall SCCP manager required</div>';
} }
} }
if ($db_Schema == 0) { if ($db_Schema == 0) {
$info['DB_Schema'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> ERROR DB Version </div>'); $info['DB_Schema'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> ERROR DB Version </div>');
} else { } else {
$info['DB_Schema'] = array('Version' => $db_Schema, 'about' => (($compatable == $db_Schema ) ? 'Ok' : 'Incompatable Version')); $info['DB_Schema'] = array('Version' => $db_Schema, 'about' => (($compatible == $db_Schema ) ? 'Ok' : 'Incompatible Version'));
} }
if (empty($ast_realtime)) { if (empty($ast_realtime)) {
@ -96,7 +96,7 @@ if (empty($conf_realtime)) {
} }
// $mysql_info // $mysql_info
if ($mysql_info['Value'] <= '2000') { if ($mysql_info['Value'] <= '2000') {
$this->info_warning['MySql'] = Array('Increase Mysql Group Concat Max. Length', 'Step 1: Go to mysql path <br> nano /etc/my.cnf', $this->info_warning['MySql'] = array('Increase Mysql Group Concat Max. Length', 'Step 1: Go to mysql path <br> nano /etc/my.cnf',
'Step 2: And add the following line below [mysqld] as shown below <br> [mysqld] <br>group_concat_max_len = 4096 or more', 'Step 2: And add the following line below [mysqld] as shown below <br> [mysqld] <br>group_concat_max_len = 4096 or more',
'Step 3: Save and restart <br> systemctl restart mariadb.service<br> Or <br> service mysqld restart'); 'Step 3: Save and restart <br> systemctl restart mariadb.service<br> Or <br> service mysqld restart');
} }
@ -110,7 +110,7 @@ if ($cisco_tz['offset'] == 0) {
$tmp_dt = new DateTime(null, new DateTimeZone($conf_tz)); $tmp_dt = new DateTime(null, new DateTimeZone($conf_tz));
$tmp_ofset = $tmp_dt->getOffset(); $tmp_ofset = $tmp_dt->getOffset();
if (($cisco_tz['offset'] != ($tmp_ofset / 60) )) { if (($cisco_tz['offset'] != ($tmp_ofset / 60) )) {
$this->info_warning['NTP'] = Array('The selected NTP time zone is not supported by cisco devices.', 'We will use the Greenwich Time zone'); $this->info_warning['NTP'] = array('The selected NTP time zone is not supported by cisco devices.', 'We will use the Greenwich Time zone');
} }
} }
} }
@ -389,9 +389,9 @@ if ($test_ami == 1) {
$time_old += $value['old']; $time_old += $value['old'];
} }
print_r('</tbody></table></div></div></div></div>'); print_r('</tbody></table></div></div></div></div>');
print_r('<br>Ami Responce :'); print_r('<br>Ami Response :');
print_r($time_ami); print_r($time_ami);
print_r('<br>PBX Responce :'); print_r('<br>PBX Response :');
print_r($time_old); print_r($time_old);
print_r('<br>--- Stat -----------------<br>'); print_r('<br>--- Stat -----------------<br>');
} }
@ -427,7 +427,7 @@ if ($test_ami == 1) {
// $test_data = $this->srvinterface-> astman_GetRaw('ExtensionStateList'); // $test_data = $this->srvinterface-> astman_GetRaw('ExtensionStateList');
// print_r($test_data); // print_r($test_data);
// print_r($this->srvinterface-> core_list_all_exten()); // print_r($this->srvinterface-> core_list_all_exten());
// print_r($this->get_hint_info()); // print_r($this->getHintInformation());
// print_r($this->aminterface->open()); // print_r($this->aminterface->open());
// print_r($this->aminterface-> core_list_all_exten('exten')); // print_r($this->aminterface-> core_list_all_exten('exten'));
// print_r($this->aminterface->Sok_param['total']); // print_r($this->aminterface->Sok_param['total']);
@ -516,5 +516,5 @@ foreach ($info as $key => $value) {
</div> </div>
</div> </div>
<?php echo $this->ShowGroup('sccp_info', 0); ?> <?php echo $this->showGroup('sccp_info', 0); ?>

View file

@ -22,12 +22,12 @@
</div> </div>
</div> </div>
<?php <?php
echo $this->ShowGroup('sccp_general',1); echo $this->showGroup('sccp_general', 1);
echo $this->ShowGroup('sccp_dev_time_s',1); echo $this->showGroup('sccp_dev_time_s', 1);
echo $this->ShowGroup('sccp_net',1); echo $this->showGroup('sccp_net', 1);
echo $this->ShowGroup('sccp_lang',1); echo $this->showGroup('sccp_lang', 1);
echo $this->ShowGroup('sccp_qos_config',1); echo $this->showGroup('sccp_qos_config', 1);
echo $this->ShowGroup('sccp_extpath_config',1); echo $this->showGroup('sccp_extpath_config', 1);
?> ?>
@ -44,7 +44,7 @@
<div class="modal-body"> <div class="modal-body">
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<?php <?php
// echo $this->ShowGroup('add_network_1',0); // echo $this->showGroup('add_network_1',0);
?> ?>
</ul> </ul>
</div> </div>