Compare commits

..

No commits in common. "develop" and "Release13.2" have entirely different histories.

95 changed files with 13598 additions and 17582 deletions

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. Useful 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. Usefull 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 separated comma seperated
--> -->
<PushToTalkURL></PushToTalkURL> <PushToTalkURL></PushToTalkURL>
<!-- <!--
@ -471,12 +471,6 @@
<deviceSecurityMode>1</deviceSecurityMode> <deviceSecurityMode>1</deviceSecurityMode>
<phonePersonalization>1</phonePersonalization> <phonePersonalization>1</phonePersonalization>
<!--
ToDo Three options. Must be numeric. actual numerics need to be confirmed
0 Disabled-The user cannot customize the Cisco Unified IP Phone by using Phone Designer.
1 Enabled-The user can use Phone Designer to customize the phone.
2 Default-The phone uses the configuration from the Phone Personalization enterprise parameter if you choose Default in both the Phone Configuration and Common Phone Profile Configuration windows. If you choose Default in the Common Phone Profile Configuration window but not in the Phone Configuration window, the phone uses the configuration that you specify in the Phone Configuration window.
-->
<singleButtonBarge>1</singleButtonBarge> <singleButtonBarge>1</singleButtonBarge>
<joinAcrossLines>1</joinAcrossLines> <joinAcrossLines>1</joinAcrossLines>
<autoCallPickupEnable>false</autoCallPickupEnable> <autoCallPickupEnable>false</autoCallPickupEnable>

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 separate 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 seperate 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 transferred channel, press the 'endcall' softkey, or have the receiving party hangup first. ; To cancel the transfer, either press resume on the transfered 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 remaining digits as DTMF/inband. ;allowoverlap = no ; Enable overlap dialing support. If enabled, starts dialing immediately and sends remaing 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

114
README.md
View file

@ -1,52 +1,55 @@
## Welcome to Develop Chan_SCCP GUI Manager for FreePBX ## Welcome to Develop Chan_SCCP GUI Manager for FreePBX
| [English :gb:/:us:](README.md) | [Russian :ru:](README.ru.md) | [Previous Stable Releases](https://github.com/PhantomVl/sccp_manager/tree/master) | [English](README.md) | [Russian](README.ru.md) | [OLD Stable Release](https://github.com/PhantomVl/sccp_manager/tree/master)
![Gif](https://github.com/chan-sccp/sccp_manager/raw/develop/.dok/image/Demo_1s5.gif) ![Gif](https://github.com/PhantomVl/sccp_manager/raw/develop/.dok/image/Demo_1s5.gif)
* [Installation](https://github.com/chan-sccp/sccp_manager#installation) * [Installation](https://github.com/PhantomVl/sccp_manager#installation)
* [Prerequisites](https://github.com/chan-sccp/sccp_manager#prerequisites) * [Prerequisites](https://github.com/PhantomVl/sccp_manager#prerequisites)
* [Links](https://github.com/chan-sccp/sccp_manager#link) * [Links](https://github.com/PhantomVl/sccp_manager#link)
* [Wiki](https://github.com/chan-sccp/sccp_manager/wiki) * [Wiki](https://github.com/PhantomVl/sccp_manager/wiki)
## Link ## Link
[![Download Sccp-Mamager](https://img.shields.io/badge/SccpGUI-build-ff69b4.svg)](https://github.com/chan-sccp/sccp_manager/archive/tarball/develop) [![Download Sccp-Mamager](https://img.shields.io/badge/SccpGUI-build-ff69b4.svg)](https://github.com/PhantomVl/sccp_manager/archive/master.zip)
[![Download Chan-SCCP channel driver for Asterisk](https://img.shields.io/sourceforge/dt/chan-sccp-b.svg)](https://github.com/chan-sccp/chan-sccp/releases/latest) [![Download Chan-SCCP channel driver for Asterisk](https://img.shields.io/sourceforge/dt/chan-sccp-b.svg)](https://github.com/chan-sccp/chan-sccp/releases/latest)
[![Chan-SCCP Documentation] (https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/chan-sccp/chan-sccp/wiki) [![Chan-SCCP Documentation] (https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/chan-sccp/chan-sccp/wiki)
This FreePBX module has been developed to help IT Staff with their Asterisk-Cisco infrastructure deployment, This module has been developed to help IT Staff with their Asterisk-Cisco infrastructure deployment,
providing easy provisioning and management of Cisco IP phones and extensions in a similar way to Cisco CallManager. providing easily provisioning and managing Cisco IP phones and extensions in a similar way as it does with Cisco CallManager.
The idea of creating a module is borrowed from (https://github.com/Cynjut/SCCP_Manager), and was further developed and managed The idea of creating a module is borrowed from (https://github.com/Cynjut/SCCP_Manager)
by PhantomVl (https://github.com/PhantomVl/sccp_manager) who has been unavailable for some time. sccp_manager relies heavily
on chan-sccp, so having the same repository will help improve integration.
SCCP Manager is free software. Please see the file COPYING for details. SCCP Manager is free software. Please see the file COPYING for details.
This module will suit you if you are planing the to migrate from CallManager to Asterisk (or have already done it). SCCP-Manager allows you to administer This module has been developed to help IT Staff with their Asterisk-Cisco infrastructure deployment,
SCCP extensions and a wide range of Cisco phone types (including IP Communicator). providing easily provisioning and managing Cisco IP phones and extensions in a similar way as it does with Cisco CallManager.
This module will suit you if you are planing the to migrate from CallManager to Asterisk (or did it), SCCP-Manager allows you to administer SCCP extensions and a wide range of Cisco phone types (including IP Communicator).
You can control phone buttons (depending on the phone model) assigning multiple lines, speeddials and BLFs. You can control phone buttons (depending on the phone model) assigning multiple lines, speeddials and BLFs.
And you can use the driver functions "sccp_chain" from the GUI module. And you can use the driver functions "sccp_chain" from the GUI module.
### Wiki ### Wiki
You can find more information and documentation on our [![SCCP Manager Wiki](https://img.shields.io/badge/Wiki-new-blue.svg)](https://github.com/chan-sccp/wiki) You can find more information and documentation on our [![SCCP Manager Wiki](https://img.shields.io/badge/Wiki-new-blue.svg)](https://github.com/PhantomVl/sccp_manager/wiki)
## Prerequisites ## Prerequisites
Make sure you have the following installed on your system: Make sure you have the following installed on your system:
- c-compiler:
- gcc >= 4.4 (note: older not supported, higher advised)
- clang >= 3.6 (note: older not supported, higher advised)
- gnu make
- pbx:
- asterisk >= 1.8 (absolute minimum & not recomended)
- asterisk >= 13.7 or asterisk >= 14.0 recommended
- gui: - gui:
- freepbx >= 13.0.192 - freepbx >= 13.0.192
- a working version of [chan-sccp](https://github.com/chan-sccp/chan-sccp) - standard posix compatible applications like sed, awk, tr
- PHPx.x-zip has to be installed (where x.x is the installed version of PHP).
For example, on Debian, using PHP7.3
```
apt-get install PHP7.3-zip
```
### Requirements ### Requirements
- chan-sccp module 4.3.4 (or later) channel driver for Asterisk: [See our WIKI](https://github.com/chan-sccp/chan-sccp/wiki/Building-and-Installation-Guide) - Chan_SCCP module 4.3.1 (or later) channel driver for Asterisk: [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/Building-and-Installation-Guide)
- sccp_manager expects these configure flags to be set during compilation: - expected configure flags:
```./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate --enable-video``` ```./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate```
- Creating mysql DB from sorce
```mysql -u root asterisk < mysql-v5_enum.sql```
- TFTP Server running under (recommended) /tftpboot/ [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/setup-tftp-service) - TFTP Server running under (recomended) /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/```
@ -62,56 +65,28 @@ apt-get install PHP7.3-zip
## Installation ## Installation
How to install sccp_manager 1. Download module into your local system. (/var/www/html/admin/modules/)
----- 2. Goto FreePBX Admin -> Module Admin.
1. Log in to FreePBX
2. Go to Admin -> Module Admin
3. Click Upload Modules. 3. Click Upload Modules.
4. Enter one of the following urls: 4. Browse to the location of the module on your computer and select Upload.
5. Click Manage Local Modules.
Stable - Version 14.3. 6. Find and click SCCP Manager. Check Install. Click Process button.
7. Confirm installation.
This is the latest version of sccp_manager and has many bug fixes. It is targetted for FreePbx 16 and as such requires PHP > 7.3. It works fine with FreePbx 15 as long as you can upgrade PHP (this cannot be done if you use commercial modules). There are changes to the database structure, and so this cannot be easily reverted to prior versions without using a backup, which the installer will create. If you are using a VM, it is recommended to take a snapshot before upgrading. 8. Close Status window.
Upgrades via FreePbx module admin are enabled in this release, but do not work because of a FreePbx issue (a patch has been posted). To workaround this, if you see that an upgrade is available, you can download it via the command line console which is unaffected by this issue 9. Apply Config to FreePBX.
```
fwconsole ma upgrade sccp_manager
```
```
https://github.com/chan-sccp/sccp_manager/archive/refs/tags/14.3.0.13.zip
```
Stable (For PHP < 7 only)
```
https://github.com/chan-sccp/sccp_manager/archive/refs/tags/v14.2.0.11.zip
```
Develop.
This version can be updated through module admin as modifications are made (pending fix by FreePbx)
_This is development software and so may have issues_
```
https://github.com/chan-sccp/sccp_manager/archive/refs/heads/develop.zip
```
5. Click Download From Web.
6. Click Manage Local Modules.
7. Find and click SCCP Manager. Check Install. Click Process button.
8. Confirm installation.
9. Close Status window.
10. Apply Config to FreePBX.
11. Continue to [Using-SCCP_Manager-to-Manage-chan-sccp](https://github.com/chan-sccp/chan-sccp/wiki/Using-SCCP_Manager-to-Manage-chan-sccp)
### Module update to latest state ### Module update to latest state
1. Goto to module into your local system. (/var/www/html/admin/modules/sccp_manager/)
If you installed any version >14.3.0.13, the module can be updated to the latest version via FreePBX. The GUI version FreePBX -> Admin -> Module Admin currently has a reported bug, but the upgrade can be made via the command line using > cd /var/www/html/admin/modules/sccp_manager/
``` > git fetch
fwconsole ma upgrade sccp_manager > git pull
``` > git checkout develop
### IMPORTANT NOTES: ### IMPORTANT NOTES:
- If something stops working, use the Stable branch as described in [Installation](https://github.com/chan-sccp/sccp_manager#installation) - !!! If something stops working, use the master branch [master](https://github.com/PhantomVl/sccp_manager/tree/master)
!!! master branch does not support changes into chan-sccp made after October 2018.
- This system assumes/requires that you are using the Asterisk realtime database. If you are not yet using the realtime database, - This system assumes/requires that you are using the Asterisk realtime database. If you are not yet using the realtime database,
you will have to set it up for this module to work ([See](https://github.com/chan-sccp/chan-sccp/wiki/Realtime-Configuration)). you will have to set it up for this module to work ([See](https://github.com/chan-sccp/chan-sccp/wiki/Realtime-Configuration)).
- For the cisco phones to work correctly, they should be provisioned with the latest firmware (v8.1 or higher) - For the cisco phones to work correctly, they should be provisioned with the latest firmware (v8.1 or higher)
@ -119,3 +94,4 @@ you will have to set it up for this module to work ([See](https://github.com/cha
### Chat ### Chat
[![Gitter](https://badges.gitter.im/chan-sccp/chan-sccp.svg)](https://gitter.im/sccp_manager/community) [![Gitter](https://badges.gitter.im/chan-sccp/chan-sccp.svg)](https://gitter.im/sccp_manager/community)

View file

@ -1,118 +1,96 @@
## Добро пожаловать странник на SCCP страницу веб интерфейса для FreePBX (SCCP Manager) ## Welcome to Develop Chan_SCCP GUI Manager for FreePBX
| [English :gb:/:us:](README.md) | [Russian :ru:](README.ru.md) | [Старая страница проекта](https://github.com/PhantomVl/sccp_manager/tree/master) | [English](README.md) | [Russian](README.ru.md) | [OLD Stable Release](https://github.com/PhantomVl/sccp_manager/tree/master)
![Gif](https://github.com/chan-sccp/sccp_manager/raw/develop/.dok/image/Demo_1s5.gif) ![Gif](https://github.com/PhantomVl/sccp_manager/raw/develop/.dok/image/Demo_1s5.gif)
* [Installation](https://github.com/chan-sccp/sccp_manager#installation) * [Installation](https://github.com/PhantomVl/sccp_manager#installation)
* [Prerequisites](https://github.com/chan-sccp/sccp_manager#prerequisites) * [Prerequisites](https://github.com/PhantomVl/sccp_manager#prerequisites)
* [Links](https://github.com/chan-sccp/sccp_manager#link) * [Links](https://github.com/PhantomVl/sccp_manager#link)
* [Wiki](https://github.com/chan-sccp/sccp_manager/wiki) * [Wiki](https://github.com/PhantomVl/sccp_manager/wiki)
## Link ## Link
[![Download Sccp-Mamager](https://img.shields.io/badge/SccpGUI-build-ff69b4.svg)](https://github.com/chan-sccp/sccp_manager/archive/tarball/develop) [![Download Sccp-Mamager](https://img.shields.io/badge/SccpGUI-build-ff69b4.svg)](https://github.com/PhantomVl/sccp_manager/archive/master.zip)и традиционно добалены новые баги
[![Download Chan-SCCP channel driver for Asterisk](https://img.shields.io/sourceforge/dt/chan-sccp-b.svg)](https://github.com/chan-sccp/chan-sccp/releases/latest) [![Download Chan-SCCP channel driver for Asterisk](https://img.shields.io/sourceforge/dt/chan-sccp-b.svg)](https://github.com/chan-sccp/chan-sccp/releases/latest)
[![Chan-SCCP Documentation] (https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/chan-sccp/chan-sccp/wiki) [![Chan-SCCP Documentation] (https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/chan-sccp/chan-sccp/wiki)
### История ### История
.... давнем давно в далеком прошлом .... Корни идея создания этого проекта лежат в несовершенстве уже существующего и заброшенного проекта.
Группа программистов пыталось быстро бороться с несовершенством продуктов CISCO, но повседневные дела угробили проект. Для желающих попробовать себя на просторах программирования ссылка на проект (https://github.com/Cynjut/SCCP_Manager).
Но на помощь им пришел молодой программист и возродил идею уже заброшенного проекта.
Для желающих попробовать себя в этой борьбе на просторах программирования ссылка на проект (https://github.com/Cynjut/SCCP_Manager).
### Кому это надо... ### Кому это надо...
Ну в первую очередь для Себя любимого ну и для тех, у кого есть куча телефонного хлама от компании Cisco. Ну в первую очередь для себя, а заодно и для тех у кого есть куча телефонного хлама от компании Cisco.
Если вы планируете использовать Aserisk + FreePBX, то я надеюсь, что данный модуль существенно упростит управление и настройки телефонами от Cisco. Если вы планируете использовать Aserisk + FreePBX, то я надеюсь, что данный модуль существенно упростит управление и настройки телефонами от Cisco.
В интернете существует замечательный проект (IMHO), который интегрирует проприетарный протокол Cisco в Asterisk, конечно, он пока далек от идеала, В интернете, существует замечательный проект (IMHO) который интегрирует проприетарный протокол Cisco в Asterisk, конечно он пока далек от идеала,
но все же это замечательная замена серверам CCME, СCM, СUСM ! но все же это замечательная замена серверам CCME, СCM, СUСM !
Ну я совершенно не представляю себе, сколько времени данный проект будет поддерживаться. Ну я совершенно не представляю себе, сколько времени данный проект будет поддерживаться.
### Ну если ты еще с нами ... ### Если ты еще с нами ...
Как я говорил выше, это дополнение к (Aserisk + FreePBX), но нам еще потребуется : Как я говорил выше, это дополнение к (Aserisk + FreePBX), но нам еще потребуется :
1. У меня не получилось поставить добиться работы с дисками Aserisk и FreePBX - собираем из исходников 1. У меня не получилось поставить добиться работы с дисками Aserisk и FreePBX - собираем из исходников
1.1. Замечательная копания freepbx. Теперь с SNG7-PBX-64bit-... все работает! 1.1. Замечательная копания freepbx. Теперь с SNG7-PBX-64bit-1805 все работает !
2. Mysql (Maria) 2. Mysql (Maria)
3. Драйвер протокола SCCP страница (https://github.com/chan-sccp/chan-sccp/) 3. Драйвер протокола SCCP страница (https://github.com/chan-sccp/chan-sccp/)
4. Этот модуль. 4. Ну и этот модуль.
5. Руки
6. Возможно еще несколько проектов
### Вжно! В этой ветке лежат самые последне нововведения и обновления, и самые последние БАГИ ! ### Вжно! В этой ветке лежат самые последне нововведения и обновления, и самые последние БАГИ !
Пользуйся и наслождайся. Так же не забывай писать нам об ошибках, которые ты нашел ! Пользуйся и наслождайся. Так же не забывай писать нам об ошибках, которые ты нашел !
Это очень нам поможет, Я с радостью исправлю то, что ты нашел и добалю новых. Это очень нам поможет, Я с радостью исправлю то что ты нашел и добалю новых.
### Wiki - Основные Инструкции по настройке ### Wiki - Основные Инструкции по настройке
Вся документация по проекту пока лежит на старой Вики [![SCCP Manager Wiki](https://img.shields.io/badge/Wiki-new-blue.svg)](https://github.com/PhantomVl/sccp_manager/wiki) Вся документация лежит на Вики [![SCCP Manager Wiki](https://img.shields.io/badge/Wiki-new-blue.svg)](https://github.com/PhantomVl/sccp_manager/wiki)
Вся документация по драйверу Chan-SCCP [![SCCP Manager Wiki](https://img.shields.io/badge/Wiki-new-blue.svg)](https://github.com/chan-sccp/wiki)
Ну и как водится у на SCCP Manager это бесплатное дополнение. И помни "(C)" означает "Копия верна". Please see the file COPYING for details.
### Prerequisites - как говориться все, что хуже этого возможно работать тоже будет .... но только вопрос как ? ### Prerequisites - как говориться все, что хуже этого возможно работать тоже будет .... но только вопрос как ?
Make sure you have the following installed on your system: Make sure you have the following installed on your system:
- PHPx.x-zip has to be installed (where x.x is the installed version of PHP). - c-compiler: (мне то он не нужен, но как собирать все остальное ?)
For example, on Debian, using PHP7.3 - gcc >= 4.4 (note: older not supported, higher advised)
- clang >= 3.6 (note: older not supported, higher advised)
- gnu make
- pbx: - pbx:
- asterisk >= 1.8 (absolute minimum & not recommended) - asterisk >= 1.8 (absolute minimum & not recomended)
- 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)
- standard posix compatible applications like sed, awk, tr - standard posix compatible applications like sed, awk, tr
- a working version of [chan-sccp](https://github.com/chan-sccp/chan-sccp)
- PHPx.x Ну тут уж как повезет, 5.6 от freepbx, но мы уже пишем под PHP7.3
```
apt-get install PHP7.3-zip
```
### Installation Очень короткая инструкция ### Installation Очень короткая инструкция
- открой полную инструкцию [Полная версия инструкции] (https://github.com/PhantomVl/sccp_manager/wiki/step-by-step-instlation) ###### [Полная версия инструкции] (https://github.com/PhantomVl/sccp_manager/wiki/step-by-step-instlation)
- Chan_SCCP module 4.3.1 (or later) [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/Building-and-Installation-Guide)
> git clone https://github.com/chan-sccp/chan-sccp.git
> git checkout develop
### Installation Другие инструкции по установке :-) - Собираем с флагами и создаем БД для работы:
- [Setting up a FreePBX system](http://wiki.freepbx.org/display/FOP/Install+FreePBX) > ./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate
- [Setting up Chan-Sccp](https://github.com/chan-sccp/chan-sccp/wiki/How-to-setup-the-chan_sccp-Module) > mysql -u root asterisk < mysql-v5_enum.sql
- [See chan-sccp wiki](https://github.com/chan-sccp/chan-sccp/wiki/Realtime-Configuration).
- Настраиваем TFTP Server, он нужен для телефонов /tftpboot/ [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/setup-tftp-service)
- Настраиваем DHCP serve, как ни странно он тоже нужен [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/setup-dhcp-service)
## Установка в Веб морде - Установка модуля
> cd /var/www/html/admin/modules/
> git clone https://github.com/PhantomVl/sccp_manager.git
> cd /var/www/html/admin/modules/sccp_manager/
> git checkout develop
> amportal chown
> amportal a ma install sccp_manager
----- - Настройка модуля
1. Открываем "SCCP Connectivity" -> "Server Config" и делаем все, что вам нужно.
2. Жмем "Сохранить" ..... И Все ! Дальше настройки в рамках концепции Freepbx.
1. Log in to FreePBX - Обновление модуля
2. Go to Admin -> Module Admin > cd /var/www/html/admin/modules/sccp_manager/
3. Click Upload Modules. > git fetch
4. Enter one of the following urls: > git pull
> git checkout develop
Мы решили, что это стабильная версия:
```
https://github.com/chan-sccp/sccp_manager/archive/refs/heads/Legacy.zip
```
Для тех, кто ищет нового и интересного:
_This is development software and so may have issues_
```
https://github.com/chan-sccp/sccp_manager/archive/refs/heads/develop.zip
```
5. Жми Download From Web.
6. Открывай Manage Local Modules.
7. Практически в конце списка "SCCP Manager". Тут и так понятно, выбрать "Install", и нажать "Process".
8. "Confirm installation".
9. "Close" Status window.
10. Красная кнопка "Apply" в правом верхнем углу.
11. Далее вопрос ни одного научного труда [Using-SCCP_Manager-to-Manage-chan-sccp](https://github.com/chan-sccp/chan-sccp/wiki/Using-SCCP_Manager-to-Manage-chan-sccp)
### Важно: ### Важно:
- !!! Если это это проект не заработал на твоей системе - переключись на ветку мастер [master](https://github.com/PhantomVl/sccp_manager) - !!! Если это это проект не заработал на твоей системе - переключись на ветку мастер [master](https://github.com/PhantomVl/sccp_manager/tree/master)
!!! Но есть ограничение - ветка master не поддерживает изменения в chan-sccp сделаные после октября 2018 г. !!! Но есть ограничение - ветка master не поддерживает изменения в chan-sccp сделаные после октября 2018 г.
- И чуть не забыл настраиваем Realtime-Configuration ([See](https://github.com/chan-sccp/chan-sccp/wiki/Realtime-Configuration)).
- Желательно иметь Firmware телефонов Cisco, языковые пакеты ну всякое разное. - Желательно иметь Firmware телефонов Cisco, языковые пакеты ну всякое разное.
- Возможно, ты найдешь, то, что ищешь, в проекте (https://github.com/dkgroot/provision_sccp) - Возможно, ты найдешь, то что ищешь, в проекте (https://github.com/dkgroot/provision_sccp)
- Если что-то не так [Wiki GUI] (https://github.com/PhantomVl/sccp_manager), [Wiki chan-sccp] (https://github.com/chan-sccp/chan-sccp/wiki), - Если что-то не так [Wiki GUI] (https://github.com/PhantomVl/sccp_manager), [Wiki chan-sccp] (https://github.com/chan-sccp/chan-sccp/wiki),
[Wiki FreePbx] (https://wiki.freepbx.org/display/FOP/Install+FreePBX)
### Chat
[![Gitter](https://badges.gitter.im/chan-sccp/chan-sccp.svg)](https://gitter.im/sccp_manager/community)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,263 @@
<?php
/**
*
* Core Comsnd Interface
*
*
*/
namespace FreePBX\modules\Sccp_manager;
class dbinterface {
private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct($parent_class = null) {
$this->paren_class = $parent_class;
}
public function info() {
$Ver = '13.0.2';
return Array('Version' => $Ver,
'about' => 'Data access interface ver: ' . $Ver);
}
/*
* Core Access Function
*/
public function get_db_SccpTableData($dataid, $data = array()) {
if ($dataid == '') {
return False;
}
switch ($dataid) {
case "SccpExtension":
if (empty($data['name'])) {
$sql = "SELECT * FROM `sccpline` ORDER BY `name`";
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
} else {
$sql = "SELECT * FROM `sccpline` WHERE `name`=" . $data['name'];
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
}
break;
case "SccpDevice":
// $sql = "SELECT * FROM `sccpdeviceconfig` ORDER BY `name`";
$sql = "select `name`,`name` as `mac`, `type`, `button`, `addon` from `sccpdeviceconfig` ORDER BY `name`";
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
break;
case "HWDevice":
$raw_settings = $this->getDb_model_info($get = "phones", $format_list = "model");
break;
case "HWextension":
$raw_settings = $this->getDb_model_info($get = "extension", $format_list = "model");
break;
case "get_colums_sccpdevice":
$sql = "DESCRIBE sccpdevice";
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
break;
case "get_sccpdevice_byid":
$sql = 'SELECT t1.*, types.dns, types.buttons, types.loadimage, types.nametemplate as nametemplate, '
. 'addon.buttons as addon_buttons FROM sccpdevice AS t1 '
. 'LEFT JOIN sccpdevmodel as types ON t1.type=types.model '
. 'LEFT JOIN sccpdevmodel as addon ON t1.addon=addon.model WHERE name="' . $data['id'] . '";';
$raw_settings = sql($sql, "getRow", DB_FETCHMODE_ASSOC);
break;
case "get_sccpdevice_buttons":
$sql = 'SELECT * FROM buttonconfig WHERE device="' . $data['id'] . '";';
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
break;
}
return $raw_settings;
}
public function get_db_SccpSetting() {
$sql = "SELECT `keyword`, `data`, `type`, `seq` FROM `sccpsettings` ORDER BY `type`, `seq`";
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
return $raw_settings;
}
/*
* Get Sccp Device Model information
*/
function getDb_model_info($get = "all", $format_list = "all", $filter = array()) {
global $db;
switch ($format_list) {
case "model":
$sel_inf = "model, vendor, dns, buttons";
break;
case "all":
default:
$sel_inf = "*";
break;
}
$sel_inf .= ", '0' as 'validate'";
switch ($get) {
case "byciscoid":
if (!empty($filter)) {
if (!empty($filter['model'])) {
if (strpos($filter['model'], 'loadInformation')) {
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`loadinformationid` ='" . $filter['model'] . "') ORDER BY model ";
} else {
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`loadinformationid` ='loadInformation" . $filter['model'] . "') ORDER BY model ";
}
} else {
// $sql = "SELECT ".$filter['model'];
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel ORDER BY model ";
}
break;
}
break;
case "byid":
if (!empty($filter)) {
if (!empty($filter['model'])) {
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`model` ='" . $filter['model'] . "') ORDER BY model ";
} else {
// $sql = "SELECT ".$filter['model'];
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel ORDER BY model ";
}
break;
}
break;
case "extension":
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (dns = 0)ORDER BY model ";
break;
case "enabled":
case "phones":
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (dns > 0) and (enabled > 0) ORDER BY model ";
// $sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (enabled > 0) ORDER BY model ";
break;
case "all":
default:
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel ORDER BY model ";
break;
}
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
return $raw_settings;
}
function sccp_save_db($db_name = "", $save_value = array(), $mode = 'update', $key_fld = "", $hwid = "") {
// mode clear - Empty tabele before update
// mode update - update / replace record
global $db;
// global $amp_conf;
$result = "Error";
switch ($db_name) {
case 'sccpsettings':
if ($mode == 'clear') {
$sql = 'truncate `sccpsettings`';
$stmt = $db->prepare($sql);
$stmt->execute();
$stmt = $db->prepare('INSERT INTO `sccpsettings` (`keyword`, `data`, `seq`, `type`) VALUES (?,?,?,?)');
$result = $db->executeMultiple($stmt, $save_value);
} else {
$stmt = $db->prepare('REPLACE INTO `sccpsettings` (`keyword`, `data`, `seq`, `type`) VALUES (?,?,?,?)');
$result = $db->executeMultiple($stmt, $save_value);
}
break;
case 'sccpdevmodel':
case 'sccpdevice':
$sql_db = $db_name;
$sql_key = "";
$sql_var = "";
foreach ($save_value as $key_v => $data) {
if (!empty($sql_var)) {
$sql_var .= ', ';
}
if ($data === $this->val_null) {
$sql_var .= '`' . $key_v . '`=NULL';
} else {
$sql_var .= '`' . $key_v . '`="' . $data . '"';
}
if ($key_fld == $key_v) {
$sql_key = '`' . $key_v . '`="' . $data . '"';
}
}
if (!empty($sql_var)) {
if ($mode == 'delete') {
$req = 'DELETE FROM `' . $sql_db . '` WHERE ' . $sql_key . ';';
} else {
if ($mode == 'update') {
$req = 'UPDATE `' . $sql_db . '` SET ' . $sql_var . ' WHERE ' . $sql_key . ';';
} else {
$req = 'REPLACE INTO `' . $sql_db . '` SET ' . $sql_var . ';';
}
}
}
$stmt = $db->prepare($req);
$result = $stmt->execute();
break;
case 'sccpbuttons':
if (($mode == 'clear') || ($mode == 'delete')) {
$sql = 'DELETE FROM `buttonconfig` WHERE device="' . $hwid . '";';
$stmt = $db->prepare($sql);
$stmt->execute();
}
if ($mode == 'delete') {
break;
}
if (!empty($save_value)) {
$sql = 'INSERT INTO `buttonconfig` (`device`, `instance`, `type`, `name`, `options`) VALUES (?,?,?,?,?);';
$stmt = $db->prepare($sql);
$res = $db->executeMultiple($stmt, $save_value);
}
break;
}
return $result;
}
/*
* My be Replace by SccpTables ??!
*
*/
public function dump_sccp_tables($data_path, $database, $user, $pass ) {
$filename = $data_path.'/sccp_backup_'.date('G_a_m_d_y').'.sql';
$result = exec('mysqldump '.$database.' --password='.$pass.' --user='.$user.' --single-transaction >'.$filename ,$output);
return $filename;
}
/*
* Check Table structure
*/
public function validate() {
global $db;
$check_fields = array('430' => array('_hwlang' => "varchar(12)"), '431' => array('private'=> "enum('on','off')"), '433' => array('directed_pickup'=>'') );
$sql = "DESCRIBE `sccpdevice`;";
$raw_result = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
$result = 0;
foreach ($raw_result as $value) {
$id_result[$value['Field']] = $value['Type'];
}
foreach ($check_fields as $key => $value) {
$sub_result = true;
foreach($value as $skey => $svalue) {
if (!empty($svalue) ) {
if (empty($id_result[$skey])) {
$sub_result = false;
} else {
if (strtolower($id_result[$skey]) != strtolower($svalue)) {
$sub_result = false;
}
}
} else {
if (!empty($id_result[$skey])) {
$sub_result = false;
}
}
}
if ($sub_result) {
$result = $key;
} else {
break;
}
}
return $result;
}
}

View file

@ -0,0 +1,446 @@
<?php
/**
*
*/
namespace FreePBX\modules\Sccp_manager;
class extconfigs {
public function __construct($parent_class = null) {
$this->paren_class = $parent_class;
}
public function info() {
$Ver = '13.0.3';
return Array('Version' => $Ver,
'about' => 'Default Setings and Enums ver: ' . $Ver);
}
public function getextConfig($id = '', $index = '') {
switch ($id) {
case 'keyset':
$result = $this->keysetdefault;
break;
case 'sccp_lang':
$result = $this->cisco_language;
break;
case 'sccpDefaults':
$result = $this->sccpDefaults;
break;
case 'sccp_timezone':
$result = array();
foreach ($this->cisco_timezone as $key => $value) {
$cisco_code = $key . ' Standard' . ((empty($value['daylight'])) ? '' : '/' . $value['daylight']) . ' Time';
if (isset($value['cisco_code'])) {
$cisco_code = (empty($value['cisco_code'])) ? $cisco_code : $value['cisco_code'];
}
$result[$key] = array('offset' => $value['offset'], 'daylight' => $value['daylight'], 'cisco_code' => $cisco_code);
}
break;
/* case 'cisco_time':
$result = array();
foreach ($this->cisco_timezone as $key => $value) {
$result[] = array('id'=> ($value['offset']/60) ,'val'=>$key.((empty($value['daylight']))? '': '/'.$value['daylight']));
}
break;
*/
case 'cisco_timezone':
$result = array();
foreach ($this->cisco_timezone as $key => $value) {
$result[] = array('id' => $key, 'val' => $key . ((empty($value['daylight'])) ? '' : '/' . $value['daylight']));
// $result[$key] =$key.((empty($value['daylight']))? '': '/'.$value['daylight']);
}
break;
default:
return array('noId');
break;
}
if (empty($index)) {
return $result;
} else {
if (isset($result[$index])) {
return $result[$index];
} else {
return array();
}
}
}
private $sccpDefaults = array(
"servername" => 'VPBXSCCP',
"bindaddr" => '0.0.0.0', "port" => '2000', # chan_sccp also supports ipv6
# bindaddr = "::" will support ipv6 and ipv4 at the same time
"deny" => '0.0.0.0/0.0.0.0',
"permit" => '0.0.0.0/0.0.0.0', # !TODO!: please change this to 'internal' which would mean:
# permit:127.0.0.0/255.0.0.0,permit:10.0.0.0/255.0.0.0,permit:172.0.0.0/255.224.0.0,permit:192.168.0.0/255.255.0.0"
"dateformat" => 'D.M.Y', # This is the german default format. Should be "D/M/Y" or "D/M/YA" instead
"disallow" => 'all', "allow" => 'alaw;ulaw',
"hotline_enabled" => 'off',
"hotline_context" => 'default', # !TODO!: Should this not be from-internal on FreePBX ?
"hotline_extension" => '*60', # !TODO!: Is this a good default extension to dial for hotline ?
"hotline_label" => 'hotline',
"devicetable" => 'sccpdevice',
"linetable" => 'sccpline',
"tftp_path" => '/tftpboot'
);
private $keysetdefault = array('onhook' => 'redial,newcall,cfwdall,dnd,pickup,gpickup,private',
'connected' => 'hold,endcall,park,vidmode,select,cfwdall,cfwdbusy,idivert',
'onhold' => 'resume,newcall,endcall,transfer,conflist,select,dirtrfr,idivert,meetme',
'ringin' => 'answer,endcall,transvm,idivert',
'offhook' => 'redial,endcall,private,cfwdall,cfwdbusy,pickup,gpickup,meetme,barge',
'conntrans' => 'hold,endcall,transfer,conf,park,select,dirtrfr,vidmode,meetme,cfwdall,cfwdbusy',
'digitsfoll' => 'back,endcall,dial',
'connconf' => 'conflist,newcall,endcall,hold,vidmode',
'ringout' => 'empty,endcall,transfer,cfwdall,idivert',
'offhookfeat' => 'redial,endcall',
'onhint' => 'redial,newcall,pickup,gpickup,barge',
'onstealable' => 'redial,newcall,cfwdall,pickup,gpickup,dnd,intrcpt',
'holdconf' => 'resume,newcall,endcall,join',
'uriaction' => 'default');
// Cisco Language Code / Directory
private $cisco_language = array('ar_SA' => array('code' => 'ar', 'language' => 'Arabic', 'locale' => 'Arabic_Saudi_Arabia'),
'bg_BG' => array('code' => 'bg', 'language' => 'Bulgarian', 'locale' => 'Bulgarian_Bulgaria'),
'cz_CZ' => array('code' => 'cz', 'language' => 'Czech', 'locale' => 'Czech_Czech_Republic'),
'da_DK' => array('code' => 'da', 'language' => 'Danish', 'locale' => 'Danish_Denmark'),
'de_DE' => array('code' => 'de', 'language' => 'German', 'locale' => 'German_Germany'),
'el_GR' => array('code' => 'el', 'language' => 'Greek', 'locale' => 'Greek_Greece'),
'en_AU' => array('code' => 'en', 'language' => 'English', 'locale' => 'AU_English_United_States'),
'en_GB' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_Kingdom'),
'en_US' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_States'),
'es_ES' => array('code' => 'es', 'language' => 'Spanish', 'locale' => 'Spanish_Spain'),
'et_EE' => array('code' => 'et', 'language' => 'Estonian', 'locale' => 'Estonian_Estonia'),
'fi_FI' => array('code' => 'fi', 'language' => 'Finnish', 'locale' => 'Finnish_Finland'),
'fr_CA' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_Canada'),
'fr_FR' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_France'),
'he_IL' => array('code' => 'he', 'language' => 'Hebrew', 'locale' => 'Hebrew_Israel'),
'hr_HR' => array('code' => 'hr', 'language' => 'Croatian', 'locale' => 'Croatian_Croatia'),
'hu_HU' => array('code' => 'hu', 'language' => 'Hungarian', 'locale' => 'Hungarian_Hungary'),
'it_IT' => array('code' => 'it', 'language' => 'Italian', 'locale' => 'Italian_Italy'),
'ja_JP' => array('code' => 'ja', 'language' => 'Japanese', 'locale' => 'Japanese_Japan'),
'ko_KO' => array('code' => 'ko', 'language' => 'Korean', 'locale' => 'Korean_Korea_Republic'),
'lt_LT' => array('code' => 'lt', 'language' => 'Lithuanian', 'locale' => 'Lithuanian_Lithuania'),
'lv_LV' => array('code' => 'lv', 'language' => 'Latvian', 'locale' => 'Latvian_Latvia'),
'nl_NL' => array('code' => 'nl', 'language' => 'Dutch', 'locale' => 'Dutch_Netherlands'),
'no_NO' => array('code' => 'no', 'language' => 'Norwegian', 'locale' => 'Norwegian_Norway'),
'pl_PL' => array('code' => 'pl', 'language' => 'Polish', 'locale' => 'Polish_Poland'),
'pt_BR' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Brazil'),
'pt_PT' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Portugal'),
'ro_RO' => array('code' => 'ro', 'language' => 'Romanian', 'locale' => 'Romanian_Romania'),
'ru_RU' => array('code' => 'ru', 'language' => 'Russian', 'locale' => 'Russian_Russian_Federation'),
'sk_SK' => array('code' => 'sk', 'language' => 'Slovakian', 'locale' => 'Slovak_Slovakia'),
'sl_SL' => array('code' => 'sl', 'language' => 'Slovenian', 'locale' => 'Slovenian_Slovenia'),
'sr_ME' => array('code' => 'sr', 'language' => 'Serbian', 'locale' => 'Serbian_Republic_of_Montenegro'),
'sr_RS' => array('code' => 'rs', 'language' => 'Serbian', 'locale' => 'Serbian_Republic_of_Serbia'),
'sv_SE' => array('code' => 'sv', 'language' => 'Swedish', 'locale' => 'Swedish_Sweden'),
'th_TH' => array('code' => 'th', 'language' => 'Thailand', 'locale' => 'Thai_Thailand'),
'tr_TR' => array('code' => 'tr', 'language' => 'Turkish', 'locale' => 'Turkish_Turkey'),
'zh_CN' => array('code' => 'cn', 'language' => 'Chinese', 'locale' => 'Chinese_China'),
'zh_TW' => array('code' => 'zh', 'language' => 'Chinese', 'locale' => 'Chinese_Taiwan')
);
private $cisco_timezone = array(
'Dateline' => array('offset' => '-720', 'daylight' => ''),
'Samoa' => array('offset' => '-660', 'daylight' => ''),
'Hawaiian' => array('offset' => '-600', 'daylight' => ''),
'Alaskan' => array('offset' => '-540', 'daylight' => 'Daylight'),
'Pacific' => array('offset' => '-480', 'daylight' => 'Daylight'),
'Mountain' => array('offset' => '-420', 'daylight' => 'Daylight'),
'US Mountain' => array('offset' => '-420', 'daylight' => ''),
'Central' => array('offset' => '-360', 'daylight' => 'Daylight'),
'Mexico' => array('offset' => '-360', 'daylight' => 'Daylight'),
'Canada Central' => array('offset' => '-360', 'daylight' => ''),
'SA Pacific' => array('offset' => '-300', 'daylight' => ''),
'Eastern' => array('offset' => '-300', 'daylight' => 'Daylight'),
'US Eastern' => array('offset' => '-300', 'daylight' => ''),
'Atlantic' => array('offset' => '-240', 'daylight' => 'Daylight'),
'SA Western' => array('offset' => '-240', 'daylight' => ''),
'Pacific SA' => array('offset' => '-240', 'daylight' => ''),
'Newfoundland' => array('offset' => '-210', 'daylight' => 'Daylight'),
'E. South America' => array('offset' => '-180', 'daylight' => 'Daylight'),
'SA Eastern' => array('offset' => '-180', 'daylight' => ''),
'Pacific SA' => array('offset' => '-180', 'daylight' => 'Daylight'),
'Mid-Atlantic' => array('offset' => '-120', 'daylight' => 'Daylight'),
'Azores' => array('offset' => '-060', 'daylight' => 'Daylight'),
'GMT' => array('offset' => '00', 'daylight' => 'Daylight'),
'Greenwich' => array('offset' => '00', 'daylight' => ''),
'W. Europe' => array('offset' => '60', 'daylight' => 'Daylight'),
'GTB' => array('offset' => '60', 'daylight' => 'Daylight'),
'Egypt' => array('offset' => '60', 'daylight' => 'Daylight'),
'E. Europe' => array('offset' => '60', 'daylight' => 'Daylight'),
'Romance' => array('offset' => '120', 'daylight' => 'Daylight'),
'Central Europe' => array('offset' => '120', 'daylight' => 'Daylight'),
'South Africa' => array('offset' => '120', 'daylight' => ''),
'Jerusalem' => array('offset' => '120', 'daylight' => 'Daylight'),
'Saudi Arabia' => array('offset' => '180', 'daylight' => ''),
/* Russion Regions */
'Russian/Kaliningrad' => array('offset' => '120', 'daylight' => '', 'cisco_code' => 'South Africa 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/Samara' => array('offset' => '240', 'daylight' => '', 'cisco_code' => 'Arabian Standard Time'),
'Russian/Novosibirsk' => array('offset' => '300', 'daylight' => '', 'cisco_code' => 'Ekaterinburg Standard Time'),
'Russian/Ekaterinburg' => array('offset' => '300', 'daylight' => '', 'cisco_code' => 'Ekaterinburg Standard Time'),
'Russian/Irkutsk' => array('offset' => '480', 'daylight' => '', 'cisco_code' => 'China Standard Time'),
'Russian/Yakutsk' => array('offset' => '540', 'daylight' => '', 'cisco_code' => 'Tokyo Standard Time'),
'Russian/Khabarovsk' => array('offset' => '600', 'daylight' => '', 'cisco_code' => 'West Pacific Standard Time'),
'Russian/Vladivostok' => array('offset' => '600', 'daylight' => '', 'cisco_code' => 'West 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/Kamchatka' => array('offset' => '720', 'daylight' => '', 'cisco_code' => 'Fiji Standard Time'),
/* EnD - Russion Regions */
'Iran' => array('offset' => '210', 'daylight' => 'Daylight'),
'Caucasus' => array('offset' => '240', 'daylight' => 'Daylight'),
'Arabian' => array('offset' => '240', 'daylight' => ''),
'Afghanistan' => array('offset' => '270', 'daylight' => ''),
'West Asia' => array('offset' => '300', 'daylight' => ''),
'India' => array('offset' => '330', 'daylight' => ''),
'Central Asia' => array('offset' => '360', 'daylight' => ''),
'SE Asia' => array('offset' => '420', 'daylight' => ''),
'China' => array('offset' => '480', 'daylight' => ''),
'Taipei' => array('offset' => '480', 'daylight' => ''),
'Tokyo' => array('offset' => '540', 'daylight' => ''),
'Cen. Australia' => array('offset' => '570', 'daylight' => 'Daylight'),
'AUS Central' => array('offset' => '570', 'daylight' => ''),
'E. Australia' => array('offset' => '600', 'daylight' => ''),
'AUS Eastern' => array('offset' => '600', 'daylight' => 'Daylight'),
'West Pacific' => array('offset' => '600', 'daylight' => ''),
'Tasmania' => array('offset' => '600', 'daylight' => 'Daylight'),
'Central Pacific' => array('offset' => '660', 'daylight' => ''),
'Fiji' => array('offset' => '720', 'daylight' => ''),
'New Zealand' => array('offset' => '720', 'daylight' => 'Daylight')
);
public function validate_init_path($confDir = '', $db_vars, $sccp_driver_replace = '') {
// global $db;
// global $amp_conf;
// *** Setings for Provision Sccp
$adv_config = Array('tftproot' => '', 'firmware' => 'firmware', 'settings' => 'settings',
'locales' => 'locales', 'languages' => 'languages', 'templates' => 'templates');
$adv_tree['pro'] = Array('templates' => 'tftproot', 'settings' => 'tftproot', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'locales');
// $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');
//* **************------ ****
$base_tree = Array('tftp_templates' => 'templates', 'tftp_path_store' => 'settings', 'tftp_lang_path' => 'languages', 'tftp_firmware_path' => 'firmware');
if (empty($confDir)) {
return array('error' => 'empty СonfDir');
}
$base_config = Array('asterisk' => $confDir, 'sccp_conf' => $confDir . '/sccp.conf', 'tftp_path' => '');
// Test Base dir (/tftproot)
if (!empty($db_vars["tftp_path"])) {
if (file_exists($db_vars["tftp_path"]["data"])) {
$base_config["tftp_path"] = $db_vars["tftp_path"]["data"];
}
}
if (empty($base_config["tftp_path"])) {
if (file_exists($this->getextConfig('sccpDefaults', "tftp_path"))) {
$base_config["tftp_path"] = $this->getextConfig('sccpDefaults', "tftp_path");
}
}
if (empty($base_config["tftp_path"])) {
if (!empty($this->paren_class)) {
$this->paren_class->class_error['tftp_path'] = 'Tftp path not defined';
}
return array('error' => 'empty tftp_path');
}
if (!is_writeable($base_config["tftp_path"])) {
if (!empty($this->paren_class)) {
$this->paren_class->class_error['tftp_path'] = 'No write permision on tftp DIR';
}
return array('error' => 'No write permision on tftp DIR');
}
// END Test Base dir (/tftproot)
if (!empty($db_vars['tftp_rewrite_path'])) {
$adv_ini = $db_vars['tftp_rewrite_path']["data"];
}
$adv_tree_mode = 'def';
if (empty($db_vars["tftp_rewrite"])) {
$db_vars["tftp_rewrite"]["data"] = "off";
}
$adv_config['tftproot'] = $base_config["tftp_path"];
if ($db_vars["tftp_rewrite"]["data"] == 'pro') {
$adv_tree_mode = 'pro';
if (!empty($adv_ini)) { // something found in external conflicts
$adv_ini .= 'index.cnf';
if (file_exists($adv_ini)) {
$adv_ini_array = parse_ini_file($adv_ini);
$adv_config = array_merge($adv_config, $adv_ini_array);
}
}
}
if ($db_vars["tftp_rewrite"]["data"] == 'on') {
$adv_tree_mode = 'def';
}
foreach ($adv_tree[$adv_tree_mode] as $key => $value) {
if (!empty($adv_config[$key])) {
if (!empty($value)) {
if (substr($adv_config[$key], 0, 1) != "/") {
$adv_config[$key] = $adv_config[$value] . '/' . $adv_config[$key];
}
} else {
$adv_config[$key] = $adv_config['tftproot'];
}
}
}
foreach ($base_tree as $key => $value) {
$base_config[$key] = $adv_config[$value];
if (!file_exists($base_config[$key])) {
if (!mkdir($base_config[$key], 0777, true)) {
die('Error creating dir : ' . $base_config[$key]);
}
}
}
// $base_config['External_ini'] = $adv_config;
// $base_config['External_mode'] = $adv_tree_mode;
/*
if (!empty($this->sccppath["tftp_path"])) {
$this->sccppath["tftp_DP"] = $this->sccppath["tftp_path"] . '/Dialplan';
if (!file_exists($this->sccppath["tftp_DP"])) {
if (!mkdir($this->sccppath["tftp_DP"], 0777, true)) {
die('Error creating DialPlan template dir');
}
}
}
*/
// TFTP -REWrite double model
if (empty($_SERVER['DOCUMENT_ROOT'])) {
if (!empty($this->paren_class)) {
$this->paren_class->class_error['DOCUMENT_ROOT'] = 'Empty DOCUMENT_ROOT';
}
$base_config['error'] = 'Empty DOCUMENT_ROOT';
return $base_config;
}
if (!file_exists($base_config["tftp_templates"] . '/XMLDefault.cnf.xml_template')) {
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/';
$dst_path = $base_config["tftp_templates"] . '/';
foreach (glob($src_path . '*.*_template') as $filename) {
copy($filename, $dst_path . basename($filename));
}
}
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
if (!file_exists($dst) || $sccp_driver_replace == 'yes') {
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst) . '.v' . $db_vars['sccp_compatible']['data'];
if (file_exists($src_path)) {
copy($src_path, $dst);
} else {
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst);
copy($src_path, $dst);
}
}
if (!file_exists($base_config["sccp_conf"])) { // System re Config
$sccpfile = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/sccp.conf');
file_put_contents($base_config["sccp_conf"], $sccpfile);
}
return $base_config;
}
public function validate_RealTime($realm = '') {
global $amp_conf;
$res = Array();
if (empty($realm) ) {
$realm = 'sccp';
}
$cnf_int = \FreePBX::Config();
$cnf_wr = \FreePBX::WriteConfig();
$cnf_read = \FreePBX::LoadConfig();
$def_config = array('sccpdevice' => 'mysql,'.$realm.',sccpdeviceconfig', 'sccpline' => 'mysql,'.$realm.',sccpline');
$backup_ext = array('_custom.conf', '.conf', '_additional.conf');
$def_bd_config = array('dbhost' => $amp_conf['AMPDBHOST'], 'dbname' => $amp_conf['AMPDBNAME'],
'dbuser' => $amp_conf['AMPDBUSER'], 'dbpass' => $amp_conf['AMPDBPASS'],
'dbport' => '3306', 'dbsock' => '/var/lib/mysql/mysql.sock');
$def_bd_sec = 'sccp';
$dir = $cnf_int->get('ASTETCDIR');
$res_conf_sql = ini_get('pdo_mysql.default_socket');
$res_conf_old = '';
$res_conf = '';
$ext_conf = '';
foreach ($backup_ext as $fext) {
if (file_exists($dir . '/extconfig' . $fext)) {
$ext_conf = $cnf_read->getConfig('extconfig' . $fext);
if (!empty($ext_conf['settings']['sccpdevice'])) {
// Add chek line
if (strtolower($ext_conf['settings']['sccpdevice']) == strtolower($def_config['sccpdevice'])){
$res['sccpdevice'] = 'OK';
$res['extconfigfile'] = 'extconfig'. $fext;
} else {
$res['sccpdevice'] = 'Error in line sccpdevice '. $res['sccpdevice'];
}
}
if (!empty($ext_conf['settings']['sccpline'])) {
if (strtolower($ext_conf['settings']['sccpline']) == strtolower($def_config['sccpline'])){
$res['sccpline'] = 'OK';
} else {$res['sccpline'] = 'Error in line sccpline';}
}
}
}
$res['extconfig'] = 'OK';
if (empty($res['sccpdevice'])) {
$res['extconfig'] = ' Options "Sccpdevice" not config ';
}
if (empty($res['sccpline'])) {
$res['extconfig'] = ' Options "Sccpline" not config ';
}
if (empty($res['extconfigfile'])) {
$res['extconfig'] = 'File extconfig.conf not exist';
}
if (!empty($res_conf_sql)) {
if (file_exists($res_conf_sql)) {
$def_bd_config['dbsock'] = $res_conf_sql;
}
}
if (file_exists($dir . '/res_mysql.conf')) {
$res_conf = $cnf_read->getConfig('res_mysql.conf');
if (empty($res_conf[$realm])) {
$res['mysqlconfig'] = 'Not Config in file: res_mysql.conf';
} else {
if ($res_conf[$realm]['dbsock'] != $def_bd_config['dbsock']) {
$res['mysqlconfig'] = 'Mysql Soket Error in file: res_mysql.conf';
}
}
if (empty($res['mysqlconfig'])) {
$res['mysqlconfig'] = 'OK';
}
}
if (file_exists($dir . '/res_config_mysql.conf')) {
$res_conf = $cnf_read->getConfig('res_config_mysql.conf');
if (empty($res_conf[$realm])) {
$res['mysqlconfig'] = 'Not Config in file: res_config_mysql.conf';
} else {
if ($res_conf[$realm]['dbsock'] != $def_bd_config['dbsock']) {
$res['mysqlconfig'] = 'Mysql Soket Error in file: res_config_mysql.conf';
}
}
if (empty($res['mysqlconfig'])) {
$res['mysqlconfig'] = 'OK';
}
}
if (empty($res['mysqlconfig'])) {
$res['mysqlconfig'] = 'Realtime Error: not found res_config_mysql.conf or res_mysql.conf configutation on the path :' . $dir;
}
return $res;
}
}

View file

@ -0,0 +1,696 @@
<?php
/**
*
* Core Comsnd Interface
*
* https://www.voip-info.org/asterisk-manager-example-php/
*/
/* !TODO!: Re-Indent this file. -TODO-: What do you mean? coreaccessinterface ?? */
namespace FreePBX\modules\Sccp_manager;
class srvinterface {
var $socket;
var $error;
public function __construct($parent_class = null) {
global $amp_conf;
$this->paren_class = $parent_class;
$this->socket = FALSE;
$this->error = "";
/*
if (isset($amp_conf[AMPMGRUSER])) {
$this->astLogin('localhost', $amp_conf[AMPMGRUSER],$amp_conf[AMPMGRPASS]);
}
*/
}
public function info() {
$Ver = '13.0.3';
return Array('Version' => $Ver,
'about' => 'Server interface data ver: ' . $Ver);
}
/*
Core Access Function
*/
/*
* Replace or dublicate to AMI interface
*/
public function sccp_core_commands($params = array()) {
global $astman;
$cmd_list = array('get_softkey' => array('cmd' => "sccp show softkeyssets", 'param' => ''),
'get_version' => array('cmd' => "sccp show version", 'param' => ''),
'get_device' => array('cmd' => "sccp show devices", 'param' => ''),
'get_dev_info' => array('cmd' => "sccp show device", 'param' => 'name'),
'get_hints' => array('cmd' => "core show hints", 'param' => ''),
'sccp_reload' => array('cmd' => "sccp reload force", 'param' => ''),
'reset_phone' => array('cmd' => "sccp reset ", 'param' => 'name'), // Жесткая перезагрузка
'reload_phone' => array('cmd' => "sccp reload device ", 'param' => 'name'),
'reset_token' => array('cmd' => "sccp tokenack ", 'param' => 'name'),
'get_realtime_status' => array('cmd' => "realtime mysql status", 'param' => ''),
);
$result = true;
if (!empty($params['cmd'])) {
$id_cmd = $params['cmd'];
if (!empty($cmd_list[$id_cmd])) {
$id_param = $cmd_list[$id_cmd]['param'];
if (!empty($id_param)) {
if (!empty($params[$id_param])) {
$result = $astman->Command($cmd_list[$id_cmd]['cmd'] . ' ' . $params[$id_param]);
}
} else {
$result = $astman->Command($cmd_list[$id_cmd]['cmd']);
}
} else {
switch ($params['cmd']) {
case 'phone_call':
if (!empty($params['name'])) {
$result = $astman->Command('sccp call ' . $params['name'] . ' ' . $params['call']);
}
break;
case 'phone_message':
if (!empty($params['msg'])) {
$msg = $params['msg'];
} else {
$msg = $this->sccpvalues['servername']['data'];
}
if (!empty($params['name'])) {
$astman->Command('sccp device ' . $params['name'] . ' ' . $msg);
} else {
}
break;
default:
$result = false;
break;
}
}
}
return $result;
}
public function sccp_getdevice_info($dev_id) {
if (empty($dev_id)) {
return array();
}
$res = $this->sccp_core_commands(array('cmd' => 'get_dev_info', 'name' => $dev_id));
$res1 = str_replace(array("\r\n", "\r", "\n"), ';', strip_tags((string) $res['data']));
if (strpos($res1, 'MAC-Address')) {
$res2 = substr($res1, 0, strpos($res1, '+--- Buttons '));
$res1 = explode(';', substr($res2, strpos($res2, 'MAC-Address')));
foreach ($res1 as $data) {
if (!empty($data)) {
$tmp = explode(':', $data);
$data_key = str_replace(array(" ", "-", "\t"), '_', trim($tmp[0]));
$res3[$data_key] = $tmp[1];
}
}
$res1 = $res3['Skinny_Phone_Type'];
$res4 = $res3['Config_Phone_Type'];
if (!empty($res3['Addons'])) {
$res2 = $res3['Addons'];
} else {
$res2 = '';
}
$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') {
$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 array();
}
return $res3;
} else {
return array();
}
}
/* Current not use */
/*
* 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() {
$hint_key = array();
$hint_all = $this->sccp_list_all_hints();
foreach ($hint_all as $value) {
$res = $this->loc_after('@', $value);
// array_search($res, $hint_key)) != NULL)
if (!isset($hint_key[$res])) {
$hint_key[$res] = '@'.$res;
}
}
return $hint_key;
}
public function sccp_list_all_hints() {
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_hints'));
$ast_out = preg_split("/[\n]/", $ast_out['data']);
$ast_key = array();
for ($i = 0; $i < 3; $i++) {
$ast_out[$i] = "";
}
$i = count($ast_out) - 1;
$ast_out[--$i] = "";
$ast_out[--$i] = "";
foreach ($ast_out as $line) {
if (strlen($line) > 3) {
list ($line, $junk) = explode(' ', $line);
if (!is_bool(strpos($line,':'))) {
$line = trim(substr($line, 0, strpos($line, ':')));
}
if (isset($ast_key[$line])) {
if (strlen($ast_key[$line]) < 1) {
$ast_key[$line] = $line;
}
} else {
$ast_key[$line] = $line;
}
}
}
return $ast_key;
}
public function sccp_realtime_status() {
$ast_res = array();
$ast_out = $this->sccp_core_commands(array('cmd'=>'get_realtime_status'));
$ast_out = preg_split("/[\n]/", $ast_out['data']);
if (strpos($ast_out[0], 'Privilege') !== false){
$ast_out[0] = "";
}
foreach ($ast_out as $line) {
if (strlen($line) > 3) {
$ast_key = strstr(trim($line), ' ', true);
$ast_res[$ast_key] = array('message' => $line, 'status'=> strpos($line, 'connected') ? 'OK' : 'ERROR');
}
}
return $ast_res;
}
// !TODO!: -TODO-: install.php is still using the other version number. This is actually where I use another method ?
public function get_compatible_sccp() {
$res = $this->getSCCPVersion();
if (empty($res)) {
return 0;
}
switch ($res["vCode"]) {
case 433:
return 433;
case 432:
case 431:
return 431;
default:
return 430;
}
/* if ($res["vCode"] >= 433) {
}
if ($res["vCode"] >= 431) {
return 431;
} else {
return 430;
}
*
*/
// return $res["vCode"];
}
public function getSCCPVersion() {
$res = $this->getChanSCCPVersion();
if (empty($res)) {
$res = $this->getCoreSCCPVersion();
}
return $res;
}
private function getCoreSCCPVersion() {
$result = array();
$ast_out = $this->sccp_version();
$result["Version"] = $ast_out[0];
$version_parts = explode(".", $ast_out[0]);
$result["vCode"] = implode('', $version_parts);
if (!empty($ast_out[1]) && $ast_out[1] == 'develop') {
$result["develop"] = $ast_out[1];
$res = 10;
// !TODO!: This does not work as you might expect
if (base_convert($ast_out[3], 16, 10) == base_convert('702487a', 16, 10)) {
$result["vCode"] = 431;
}
if (base_convert($ast_out[3], 16, 10) >= "10403") { // new method, RevisionNum is incremental
$result["vCode"] = 432;
}
}
return $result;
}
private function sccp_version() {
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_version'));
if (preg_match("/Release.*\(/", $ast_out['data'], $matches)) {
$ast_out = substr($matches[0], 9, -1);
return explode(' ', $ast_out);
} else {
return array('unknown');
}
}
private function getChanSCCPVersion() {
global $astman;
$result = array();
if (!$astman) {
return $result;
}
$metadata = $this->astman_retrieveJSFromMetaData("");
// return $metadata;
if ($metadata && array_key_exists("Version", $metadata)) {
$result["Version"] = $metadata["Version"];
$version_parts = explode(".", $metadata["Version"]);
$result["vCode"] = 0;
# not sure about this sccp_ver numbering. Might be better to just check "Version" and Revision
# $result["vCode"] = implode('', $version_parts);
$result["vCode"] = 0;
if ($version_parts[0] == "4") {
$result["vCode"] = 400;
if ($version_parts[1] == "1") {
$result["vCode"] = 410;
} else
if ($version_parts[1] == "2") {
$result["vCode"] = 420;
} else
if ($version_parts[1] >= "3") {
$result["vCode"] = 430;
}
}
/*
if (array_key_exists("Branch",$metadata)) {
if ($metadata["Branch"] == "master") {
} else
if ($metadata["Branch"] == "develop") {
}
}
*/
/* Revision got replaced by RevisionHash in 10404 (using the hash does not work) */
if (array_key_exists("Revision", $metadata)) {
if (base_convert($metadata["Revision"], 16, 10) == base_convert('702487a', 16, 10)) {
$result["vCode"] = 431;
}
if (base_convert($metadata["Revision"], 16, 10) >= "10403") {
$result["vCode"] = 431;
}
}
if (array_key_exists("RevisionHash", $metadata)) {
$result["RevisionHash"] = $metadata["RevisionHash"];
} else {
$result["RevisionHash"] = '';
}
if (array_key_exists("RevisionNum", $metadata)) {
$result["RevisionNum"] = $metadata["RevisionNum"];
if ($metadata["RevisionNum"] >= "10403") { // new method, RevisionNum is incremental
$result["vCode"] = 432;
}
if ($metadata["RevisionNum"] >= "10491") { // new method, RevisionNum is incremental
$result["vCode"] = 433;
}
}
if (array_key_exists("ConfigureEnabled", $metadata)) {
$result["futures"] = implode(';', $metadata["ConfigureEnabled"]);
}
} else {
return null;
die_freepbx("Version information could not be retrieved from chan-sccp, via astman::SCCPConfigMetaData");
}
return $result;
}
public function sccp_list_keysets() {
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_softkey'));
$ast_out = preg_split("/[\n]/", $ast_out['data']);
$ast_key = array();
for ($i = 0; $i < 5; $i++) {
$ast_out[$i] = "";
}
$i = count($ast_out) - 1;
$ast_out[--$i] = "";
foreach ($ast_out as $line) {
if (strlen($line) > 3) {
$line = substr($line, 2);
list ($line, $junk) = explode(' ', $line);
if (isset($ast_key[$line])) {
if (strlen($ast_key[$line]) < 1) {
$ast_key[$line] = $line;
}
} else {
$ast_key[$line] = $line;
}
}
}
return $ast_key;
}
public function sccp_get_active_device() {
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_device'));
$ast_out = preg_split("/[\n]/", $ast_out['data']);
$ast_key = array();
for ($i = 0; $i < 5; $i++) {
$ast_out[$i] = "";
}
$i = count($ast_out) - 1;
$ast_out[--$i] = "";
foreach ($ast_out as $line) {
if (strlen($line) > 3) {
$line = substr($line, 2);
$line = preg_replace("/\s{2,}/", " ", $line);
$line_arr = explode(' ', $line);
$it = 1;
do {
if ($this->strpos_array($line_arr[$it + 1], array('SEP', 'ATA', 'VG')) === false) {
// if (strpos($line_arr[$it + 1], 'SEP') === false) {
$line_arr[0] .= ' ' . $line_arr[$it];
unset($line_arr[$it]);
} else {
break;
}
$it++;
} while ((count($line_arr) > 3) and ( $it < count($line_arr)));
explode(";|", implode(";|", $line_arr));
list ($descr, $adress, $devname, $status, $token, $junk) = explode(";|", implode(";|", $line_arr));
// list ($descr, $adress, $devname, $status, $junk) = $line_arr;
// if (strlen($ast_key[$devname]) < 1) {
if (strlen($devname) > 1) {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token);
}
/*
if (isset($ast_key[$devname])) {
if (strlen($ast_key[$devname]) < 1) {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $descr);
}
} else {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token);
}
*
*/
}
}
return $ast_key;
}
/*
* Replace sccp_core_commands($params = array()) {
*/
private function astman_retrieveJSFromMetaData($segment = "") {
global $astman;
$params = array();
if ($segment != "") {
$params["Segment"] = $segment;
}
$response = $astman->send_request('SCCPConfigMetaData', $params);
if ($response["Response"] == "Success") {
//outn(_("JSON-content:").$response["JSON"]);
$decode = json_decode($response["JSON"], true);
return $decode;
} else {
return false;
}
}
private function strpos_array($haystack, $needles) {
if (is_array($needles)) {
foreach ($needles as $str) {
if (is_array($str)) {
$pos = strpos_array($haystack, $str);
} else {
$pos = strpos($haystack, $str);
}
if ($pos !== FALSE) {
return $pos;
}
}
} else {
return strpos($haystack, $needles);
}
return FALSE;
}
private function loc_after($value, $inthat)
{
if (!is_bool(strpos($inthat, $value)))
return substr($inthat, strpos($inthat, $value) + strlen($value));
}
function getеtestChanSCC() {
global $astman;
// $action = Array('SCCPShowGlobals',);
$params = array();
$action = 'SCCPShowSoftkeySets';
// $params = array('Segment' => 'device', 'ResultFormat'=>'command' );
// $params = array('Segment' => 'device');
// $params = array();
$metadata = $astman->send_request($action, $params);
return $metadata;
}
/*
* [Segments] => ( [0] => general [1] => device [2] => line [3] => softkey )
*/
function getеtestChanSCCP_GlablsInfo($Segment='') {
global $astman;
$params = array();
$response = $astman->send_request('SCCPConfigMetaData', $params);
$action = 'SCCPConfigMetaData';
if (empty($Segment)) {
$Segment = 'general';
}
$params = array('Segment' => $Segment, 'ResultFormat'=>'command' );
$metadata = $astman->send_request($action, $params);
if (!empty($metadata['data'])) {
$tmp_data = $metadata['data'];
if (strpos($tmp_data, 'JSON:')!==false ) {
$decode = json_decode(substr ($tmp_data,strpos($tmp_data, 'JSON:') + 5), true);
$result = array();
if (!empty($decode['Options'])) {
foreach ($decode['Options'] as $value) {
$result[$value['Name']] = $value;
}
return $result;
}
return $decode;
}
}
return $metadata;
}
/*
private function astLogin($host="localhost", $username="admin", $password="amp111"){
$this->socket = @fsockopen("127.0.0.1","5038", $errno, $errstr, 1);
if (!$this->socket) {
$this->error = "Could not connect - $errstr ($errno)";
return FALSE;
}else{
stream_set_timeout($this->socket, 1);
$wrets = $this->astQuery("Action: Login\r\nUserName: $username\r\nSecret: $password\r\nEvents: off\r\n\r\n");
if (strpos($wrets['raw'], "Message: Authentication accepted") != FALSE) {
return TRUE;
}else{
$this->error = "Could not login - Authentication failed ";
fclose($this->socket);
$this->socket = FALSE;
return FALSE;
}
}
}
private function astLogout(){
if ($this->socket){
fputs($this->socket, "Action: Logoff\r\n\r\n");
while (!feof($this->socket)) {
$wrets .= fread($this->socket, 8192);
}
fclose($this->socket);
$this->socket = "FALSE";
}
return;
}
private function astQuery($query, $rawdata = false){
$wrets = "";
if ($this->socket === FALSE)
return FALSE;
$parameters = array();
$data_store = 'data';
fputs($this->socket, $query);
$parameters['raw_q'] = $query;
do
{
$line = fgets($this->socket, 4096);
$parameters['raw'] .= $line;
if (!$rawdata) {
$a = strpos($line, ':');
if($a) {
$key = substr($line, 0, $a);
switch ($key) {
case 'Response':
case 'Message':
case 'EventList':
$parameters[$key] = trim(substr($line, $a + 2));
break;
case 'JSON':
$parameters[$key] = substr($line, $a + 2);
$data_store = $key;
break;
default:
$parameters[$data_store] .= $line;
break;
}
// store parameter in $parameters
} else {
$parameters[$data_store] .= $line;
}
}
$info = stream_get_meta_data($this->socket);
}while ($line != "\r\n" && $info['timed_out'] == false );
return $parameters;
}
function GetError(){
return $this->error;
}
private function astman_retrieveMeta($action = "", $parameters=array(), $rawdata = false) {
// $parameters=array()
global $amp_conf;
$option = "";
$result = array();
if ($this->socket === FALSE) {
if (!$this->astLogin(localhost, $amp_conf[AMPMGRUSER],$amp_conf[AMPMGRPASS])) {
$result["Response"] = "Faild";
$result["Error"] = $this->error;
return $result;
}
}
if (empty($action)) {
$action = 'SCCPConfigMetaData';
}
$query = "Action: $action\r\n";
foreach($parameters as $var=>$val) {
if (is_array($val)) {
foreach($val as $k => $v) {
$query .= "$var: $k=$v\r\n";
}
} else {
$query .= "$var: $val\r\n";
}
}
$result = $this->astQuery($query."\r\n",$rawdata);
if ($result["Response"] == "Success") {
if ($rawdata) {
return $result;
} else {
if (!empty($result["JSON"])) {
$decode = json_decode($response["JSON"], true);
return $decode;
} else {
return $result;
}
}
} else {
return $result;
return array();
}
}
*/
function t_get_meta_data() {
global $amp_conf;
$fp = fsockopen("127.0.0.1", "5038", $errno, $errstr, 10);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
fputs ($fp,"Action: login\r\n");
fputs ($fp,"Username: ".$amp_conf[AMPMGRUSER]."\r\n");
// fputs ($fp,"Secret: secret\r\n");
fputs ($fp,"Secret: ".$amp_conf[AMPMGRPASS]."\r\n");
fputs ($fp,"Events: on\r\n\r\n");
// fputs ($fp,"Action: SCCPShowDevices\r\n");
fputs ($fp,"Action: SCCPConfigMetaData\r\n");
// fputs ($fp,"Segment: general\r\n");
// "Segments":["general","device","line","softkey"]}
fputs ($fp,"Segment: device\r\n");
fputs ($fp,"ResultFormat: command\r\n");
fputs ($fp,"\r\n");
/*
fputs ($fp,"Action: SCCPConfigMetaData\r\n");
fputs ($fp,"\r\n");
fputs ($fp,"Action: SCCPConfigMetaData\r\n");
fputs ($fp,"Segment: general\r\n");
fputs ($fp,"\r\n");
fputs ($fp,"Action: SCCPConfigMetaData\r\n");
fputs ($fp,"Segment: general\r\n");
fputs ($fp,"ListResult: yes\r\n");
fputs ($fp,"Option: fallback\r\n");
fputs ($fp,"\r\n");
fputs ($fp,"Action: SCCPConfigMetaData\r\n");
fputs ($fp,"Segment: device\r\n");
fputs ($fp,"ListResult: freepbx\r\n");
fputs ($fp,"\r\n");
fputs ($fp,"Action: SCCPConfigMetaData\r\n");
fputs ($fp,"Segment: device\r\n");
fputs ($fp,"Option: dtmfmode\r\n");
fputs ($fp,"ListResult: yes\r\n");
fputs ($fp,"\r\n");
*/
fputs ($fp,"Action: logoff\r\n\r\n");
// print_r(fgets($fp));
$resp = '';
while (!feof($fp)) {
$resp .= fgets($fp);
}
// print_r(fgets($fp));
// print_r('<br>');
// echo fgets($fp, 128);
}
fclose($fp);
return $resp;
}
}

View file

@ -0,0 +1,391 @@
<?php
/**
*
* Core Comsnd Interface
*
*
*/
/* !TODO!: -TODO-: Would you like to use my XSD file to check if the provided template file is a correct cisco cnf.xml file ?
* !TODO!: -TODO-: I just don't understand how to use it here.. To check the incoming pattern ? To check the result of my script ?
* !TODO!: -TODO-: The most correct variant is to generate xml based on XSD template.
*/
namespace FreePBX\modules\Sccp_manager;
class xmlinterface {
private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct($parent_class = null) {
$this->paren_class = $parent_class;
}
public function info() {
$Ver = '13.0.3';
return Array('Version' => $Ver,
'about' => 'Create XML data interface ver: ' . $Ver);
}
function create_default_XML($store_path = '', $data_values = array(), $model_information = array(), $lang_info = array()) {
$data_path = $data_values['tftp_path'];
if (empty($store_path) || empty($data_path) || empty($data_values)) {
return;
}
$def_xml_fields = array('authenticationURL', 'informationURL', 'messagesURL', 'servicesURL', 'directoryURL', 'proxyServerURL', 'idleTimeout', 'idleURL');
$def_xml_locale = array('userLocale', 'networkLocaleInfo', 'networkLocale');
$xml_name = $store_path . '/XMLDefault.cnf.xml';
$xml_template = $data_values['tftp_path'] . '/templates/XMLDefault.cnf.xml_template';
if (file_exists($xml_template)) {
$xml_work = simplexml_load_file($xml_template);
$xnode = &$xml_work->callManagerGroup->members;
if ($data_values['bindaddr'] == '0.0.0.0') {
$ifc = 0;
// $xnode->member['priority'] = print_r($data_values['server_if_list'], true);
foreach ($data_values['server_if_list'] as $value) {
if (!empty($value['ip'])) {
$ip_valid = true;
if (!empty($data_values['ccm_address'])) {
if (strpos($data_values['ccm_address'], 'internal') !== false || strpos($data_values['ccm_address'], '0.0.0.0') !== false ) {
// Skip
} else {
if (strpos($data_values['ccm_address'], $value['ip']) === false) {
$ip_valid = false;
}
}
}
if (!in_array($value['ip'], array('0.0.0.0', '127.0.0.1'), true) && ($ip_valid)) {
$xnode_obj = clone $xnode->member;
$xnode_obj['priority'] = $ifc;
//$xnode_obj = &$xnode -> member -> callManager;
$xnode_obj->callManager->name = $data_values['servername'];
$xnode_obj->callManager->ports->ethernetPhonePort = $data_values['port'];
$xnode_obj->callManager->processNodeName = $value['ip'];
if ($ifc === 0) {
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
} else {
$this->appendSimpleXmlNode($xnode->member, $xnode_obj);
}
$ifc ++;
}
}
}
} else {
$xnode->member['priority'] = '0';
$xnode_obj = &$xnode->member->callManager;
$xnode_obj->name = $data_values['servername'];
$xnode_obj->ports->ethernetPhonePort = $data_values['port'];
$xnode_obj->processNodeName = $data_values['bindaddr'];
}
$this->replaceSimpleXmlNode($xml_work->callManagerGroup->members, $xnode);
foreach ($def_xml_fields as $value) {
if (!empty($data_values['dev_' . $value])) {
$xml_work->$value = trim($data_values['dev_' . $value]);
} else {
// $xml_work->$value = '';
$node = $xml_work->$value;
unset($node[0][0]);
}
}
foreach ($def_xml_locale as $key) {
if (!empty($xml_work->$key)) {
$xnode = &$xml_work->$key;
switch ($key) {
case 'userLocale':
case 'networkLocaleInfo':
if ($key == 'networkLocaleInfo') {
$lang = $data_values['netlang'];
} else {
$lang = $data_values['devlang'];
}
// configs->getConfig('sccp_lang')
if (isset($lang_info[$lang])) {
$xnode->name = $lang_info[$lang]['locale'];
$xnode->langCode = $lang_info[$lang]['code'];
} else {
$xnode->name = '';
$xnode->langCode = '';
}
// $this -> replaceSimpleXmlNode($xml_work->$key,$xnode);
break;
case 'networkLocale':
$lang = $data_values['netlang'];
if (isset($lang_info[$lang])) {
$xnode = $lang_info[$lang]['language'];
} else {
$xnode = '';
}
break;
}
//$this-> replaceSimpleXmlNode($xml_work->$value, $xnode );
}
}
foreach ($model_information as $var) {
if (!empty($var['loadinformationid'])) {
$node = $xml_work->addChild($var['loadinformationid'], $var['loadimage']);
$node->addAttribute('model', $var['vendor'] . ' ' . $var['model']);
}
}
$xml_work->asXml($xml_name); // Save XMLDefault1.cnf.xml
}
}
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',
'servicesURL' => 'dev_servicesURL', 'directoryURL' => 'dev_directoryURL', 'proxyServerURL' => 'dev_proxyServerURL', 'idleTimeout' => 'dev_idleTimeout',
'idleURL' => 'dev_idleURL', 'sshUserId' => 'dev_sshUserId', 'sshPassword' => 'dev_sshPassword', 'deviceProtocol' => 'dev_deviceProtocol',
'phonePersonalization' => 'phonePersonalization'
);
$var_xml_general_vars = array('capfAuthMode' => 'null', 'capfList' => 'null', 'mobility' => 'null',
'phoneServices' => 'null', 'certHash' => 'null',
'deviceSecurityMode' => '1');
// $var_hw_config = $this->dbinterface->get_db_SccpTableData("get_sccpdevice_byid", array('id' => $dev_id));
if (empty($dev_config)) {
return false;
}
$data_path = $dev_config['tftp_path'];
if (empty($store_path) || empty($data_path) || empty($data_values) || empty($dev_id)) {
return;
}
if (!empty($dev_config['nametemplate'])) {
$xml_template = $data_path . '/templates/' . $dev_config['nametemplate'];
} else {
$xml_template = $data_path . '/templates/SEP0000000000.cnf.xml_79df_template';
}
$xml_name = $store_path . '/' . $dev_id . '.cnf.xml';
if (file_exists($xml_template)) {
$xml_work = simplexml_load_file($xml_template);
foreach ($var_xml_general_vars as $key => $data) {
if (isset($xml_work->$key)) {
if ($data != 'null') {
$xml_work->$key = $data;
} else {
$node = $xml_work->$key;
unset($node[0][0]);
}
}
}
foreach ($xml_work as $key => $data) {
// Set System global Values
if (!empty($var_xml_general_fields[$key])) {
$xml_work->$key = $data_values[$var_xml_general_fields[$key]];
}
// Set section Values
$xml_node = $xml_work->$key;
switch ($key) {
case 'devicePool':
$xml_node = $xml_work->$key;
foreach ($xml_work->$key->children() as $dkey => $ddata) {
switch ($dkey) {
case 'dateTimeSetting':
$xnode = &$xml_node->$dkey;
$tz_id = $data_values['ntp_timezone'];
$TZdata = $data_values['ntp_timezone_id'];
if (empty($TZdata)) {
$TZdata = array('offset' => '0', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
}
$xnode->name = $tz_id;
$xnode->dateTemplate = $data_values['dateformat'];
$xnode->timeZone = $TZdata['cisco_code'];
// $xnode->timeZone = $tz_id.' Standard'.((empty($TZdata['daylight']))? '': '/'.$TZdata['daylight']).' Time';
if ($data_values['ntp_config_enabled'] == 'yes') {
$xnode->ntps->ntp->name = $data_values['ntp_server'];
$xnode->ntps->ntp->ntpMode = $data_values['ntp_server_mode'];
} else {
$xnode->ntps = '';
}
// Ntp Config
break;
case 'srstInfo':
if ($data_values['srst_Option'] == 'user') {
break;
}
$xnode = &$xml_node->$dkey;
$xnode->name = $data_values['srst_Name'];
$xnode->srstOption = $data_values['srst_Option'];
$xnode->userModifiable = $data_values['srst_userModifiable'];
$xnode->isSecure = $data_values['srst_isSecure'];
$srst_fld = array('srst_ip' => array('ipAddr', 'port'));
// $srst_fld = array('srst_ip' => array('ipAddr','port') , 'srst_sip' => array('sipIpAddr','sipPort') );
foreach ($srst_fld as $srst_pro => $srs_put) {
$srst_data = explode(';', $data_values[$srst_pro]);
$si = 1;
// $xnode['test'] = $srst_data[0];
foreach ($srst_data as $value) {
$srs_val = explode('/', $value);
$nod = $srs_put[0] . $si;
$xnode->$nod = $srs_val[0];
$nod = $srs_put[1] . $si;
$xnode->$nod = $srs_val[1];
$si ++;
}
while ($si < 4) {
$nod = $srs_put[0] . $si;
$xnode->$nod = '';
$nod = $srs_put[1] . $si;
$xnode->$nod = '';
$si ++;
}
}
break;
case 'connectionMonitorDuration':
$xml_node->$dkey = strval(intval(intval($data_values['keepalive']) * 0.75));
break;
case 'callManagerGroup':
$xnode = &$xml_node->$dkey->members;
if ($data_values['bindaddr'] == '0.0.0.0') {
$ifc = 0;
foreach ($data_values['server_if_list'] as $value) {
if (!empty($value['ip'])) {
$ip_valid = true;
if (!empty($data_values['ccm_address'])) {
if (strpos($data_values['ccm_address'], 'internal') !== false || strpos($data_values['ccm_address'], '0.0.0.0') !== false ) {
// Skip
} else {
if (strpos($data_values['ccm_address'], $value['ip']) === false) {
$ip_valid = false;
}
}
}
if (!in_array($value['ip'], array('0.0.0.0', '127.0.0.1'), true) && ($ip_valid)) {
$xnode_obj = clone $xnode->member;
// $xnode_obj = $xnode -> member;
// $xnode_obj = $xnode -> addChild($xnode->member);
$xnode_obj['priority'] = $ifc;
//$xnode_obj = &$xnode -> member -> callManager;
$xnode_obj->callManager->name = $data_values['servername'];
$xnode_obj->callManager->ports->ethernetPhonePort = $data_values['port'];
$xnode_obj->callManager->processNodeName = $value['ip'];
if ($ifc === 0) {
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
} else {
$this->appendSimpleXmlNode($xnode->member, $xnode_obj);
}
$ifc ++;
}
}
}
} else {
$xnode->member['priority'] = '0';
$xnode_obj = &$xnode->member->callManager;
$xnode_obj->name = $data_values['servername'];
$xnode_obj->ports->ethernetPhonePort = $data_values['port'];
$xnode_obj->processNodeName = $data_values['bindaddr'];
}
break;
}
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'versionStamp':
$xml_work->$key = time();
break;
case 'loadInformation':
// Set Path Image ????
if (isset($dev_config["tftp_firmware"])) {
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["tftp_firmware"].$dev_config["loadimage"] : '';
} else {
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["loadimage"] : '';
}
// $xml_work->$key = $dev_config["loadimage"];
if (!empty($dev_config['addon'])) {
$xnode = $xml_work->addChild('addOnModules');
$ti = 1;
foreach ($dev_config['addon_info'] as $add_key => $add_val) {
$xnode_obj = $xnode->addChild('addOnModule');
$xnode_obj->addAttribute('idx', $ti);
$xnode_obj->addChild('loadInformation', $add_val);
$ti ++;
}
// $this->appendSimpleXmlNode($xml_work , $xnode_obj);
}
break;
case 'commonProfile':
$xml_node->phonePassword = $data_values['dev_sshPassword'];
$xml_node->backgroundImageAccess = (($data_values['backgroundImageAccess'] =='on') || ($data_values['backgroundImageAccess'] =='true') ) ? 'true':'false';
$xml_node->callLogBlfEnabled = $data_values['callLogBlfEnabled'];
break;
case 'userLocale':
case 'networkLocaleInfo':
case 'networkLocale':
$hwlang = '';
$lang = '';
if (!empty($dev_config["_hwlang"])) {
$hwlang = explode(':', $dev_config["_hwlang"]);
}
if (($key == 'networkLocaleInfo') || ($key == 'networkLocale')) {
$lang = (empty($hwlang[0])) ? $data_values['netlang'] : $hwlang[0];
} else {
$lang = (empty($hwlang[1])) ? $data_values['devlang'] : $hwlang[1];
}
if (($lang != 'null') && (!empty($lang))) {
if ($key == 'networkLocale') {
$xml_work->$key = $lang;
} else {
if (isset($lang_info[$lang])) {
$xml_node->name = $lang_info[$lang]['locale'];
$xml_node->langCode = $lang_info[$lang]['code'];
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
}
}
} else {
$xml_work->$key = '';
}
break;
// Move all set to $var_xml_general_vars
// case 'mobility':
// case 'capfList':
// break;
// case 'phoneServices':
// break;
// $xml_work->$key = '';
default:
break;
}
}
// print_r($xml_work);
$xml_work->asXml($xml_name); // Save
} else {
die('Error Hardware template :' . $xml_template . ' not found');
}
return time();
}
private function replaceSimpleXmlNode($xml, $element = SimpleXMLElement) {
$dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode(
dom_import_simplexml($element), TRUE
);
$dom->parentNode->replaceChild($import, $dom);
}
private function appendSimpleXmlNode($xml, $element = SimpleXMLElement) {
$dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode(
dom_import_simplexml($element), TRUE
);
// $dom->parentNode->appendChild($import, $dom);
$dom->parentNode->appendChild($import->cloneNode(true));
}
}

View file

@ -1,91 +0,0 @@
Config Structure & Handling explained
-------------------------------------
Asterisk has a config parsing system that provides a generic interface to
config sections and paramater, this system has multiple backends like
ini, ldap, database that all present their data in a unified structure.
From chan-sccp's view all the config sections and parameters looks exactly
the same. In principal we don't have to know where the settings are coming
from, we just need to be able to handle three cases:
- requested section+paramater does not exist -> error
- requested section+parameter exists and returns a value
- requested section+parameter exists and returns NULL (ie: no field present in
ini/table or is set to NULL)
Based on this simple view of the world we built sccp_config.c and it's
primary source of information sccp_config_entries.hh. The latter contains:
- all valid config sections and parameters
- their links to the in memory entity structures (POD's)
- flags:
- their deprecated/obsolete status
- their value inheritance structure, device or lines can inherit values from
the [general] section if they are not provided (See more about inheritance
below)
- what to do when a value changes (either directly or through inheritance)
- ultimate fallback value for parameter that cannot be/work `unspecified`
- dedicated parser required to process the value, if a generic parser would
not work (for example handling codecs, deny/permit)
- help descriptions for each parameter
Config value inheritance
------------------------
sccp_config_entries.hh contains universal fallback values for parameters
that cannot work without one. Without this ultimate fallback
value, chan-sccp would crash/not work. For example chan-sccp would not know
what tcp-port to use for it's listerning connection, if not provided.
They are built-in fallback values fixed at compile time.
sccpdevices or sccplines can inherit values from the general section
in sccp.conf. The parameters in the general section are further backed by
the sccp_config_entries.hh with it's fallback value, in case they
are not provided.
So for example:
If sccpdevice:keepalive is not set, it will get it's value from
general:keepalive, which if not set, will fallback to the value provided
in sccp_config_entries.hh. The actual sccpdevice:keepalive is on evaluated
at the moment the device is connecting and registering to chan-sccp, at
which moment the value trickles down. So let's assume this situation:
sccp.conf:
```
[general]
;keepalive=120
[SEPxxxxx]
;keepalive=140
```
In this case the universal default will be provided by
sccp_config_entries.hh. When we now set general:keepalive to 120 and issue
`sccp reload`, all devices will have to be restart (RESTART_REQUIRED flag
is set for keepalive in sccp_config_entries.hh). They will start to connect
again, and the keepalive parameter is reevalueated, they will now see that
they do not have a personal keepalive parameter provided and will use the
general one, instead.
Note: inheritance is specifically specified in the sccp_config_entries.hh
file and just not automatically happen just based on the parameter name for
example.
You can think of the sccp_config_entries.hh and a universal section in the
sccp.conf that has a slew of fallback values that are there to have your
back. It will allow you to get by with a minimal config file without having
to worry about chan-sccp not working, becasue you forgot to set the port
number for example.
So mentally you can think of it like this:
```
[universal]
keepalive=60
[general]
;keepalive=120
[SEPxxxxx]
;keepalive=140
```
Note: changing sccp_config_entries.hh after the binary has been build, will
not do anything, the fallback values are backed into the final binary at
compile time.

View file

@ -1 +0,0 @@
https://github.com/chan-sccp/chan-sccp/wiki/Monitor-and-Pickup-Incoming-Calls-via-Speeddial-Using-Custom-Devstate

View file

@ -16,3 +16,4 @@ and open the template in the editor.
min-height: 10px; min-height: 10px;
padding: 1px 1px; padding: 1px 1px;
} }

View file

@ -1,4 +1,11 @@
(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

@ -1,5 +1,4 @@
$(document).ready(function () { $(document).ready(function () {
$('.sortable').sortable({ $('.sortable').sortable({
update: function (event, ui) { update: function (event, ui) {
// console.log(ui.item.find('input').val(), ui.item.index()) // console.log(ui.item.find('input').val(), ui.item.index())
@ -7,7 +6,7 @@ $(document).ready(function () {
}, },
}); });
$('#ajaxcancel').on('click', function (e) { $('#ajaxcancel').on('click', function (e) {
console.log('Cancel'); // console.log('Calncel');
if ($(this).data('hash') != null) { if ($(this).data('hash') != null) {
location.hash = $(this).data('hash'); location.hash = $(this).data('hash');
} }
@ -24,22 +23,46 @@ $(document).ready(function () {
location.reload(); location.reload();
} }
}); });
// ajaxsubmit2 is "Save and continue" - saves form data and stays on form
/*
$('#ajaxbackup').on('click', function (e) {
var vdata = '';
var snd_command = 'backupsettings';
$('.fpbx-submit').each(function () {
vdata = vdata + $(this).serialize() + '&';
});
$.ajax({
type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + snd_command,
data: vdata,
success: function (data) {
if (data.status === true) {
if (data.message) {
alert(data.message);
} else {
alert('Data Save');
}
} else {
if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(entry, 'error', 'error');
});
}
}
}
});
});
*/
$('#ajaxsubmit2').on('click', function (e) { $('#ajaxsubmit2').on('click', function (e) {
var vdata = ''; var vdata = '';
var snd_command = 'savesettings'; var snd_command = 'savesettings';
console.log($('.fpbx-submit').data('id'));
$('.fpbx-submit').each(function () { $('.fpbx-submit').each(function () {
vdata = vdata + $(this).serialize() + '&'; vdata = vdata + $(this).serialize() + '&';
}); });
if ($('.fpbx-submit').data('id') == "hw_edit") { if ($('.fpbx-submit').data('id') == "hw_edit") {
snd_command = 'save_device'; snd_command = 'save_hardware';
}
if ($('.fpbx-submit').data('id') == "hw_sedit") {
snd_command = 'save_sip_device';
}
if ($('.fpbx-submit').data('id') == "ruser_edit") {
snd_command = 'save_ruser';
} }
if ($('.fpbx-submit').data('id') == "dial_template") { if ($('.fpbx-submit').data('id') == "dial_template") {
snd_command = 'save_dialplan_template'; snd_command = 'save_dialplan_template';
@ -52,17 +75,21 @@ $(document).ready(function () {
success: function (data) { success: function (data) {
if (data.status === true) { if (data.status === true) {
if (data.message) { if (data.message) {
bs_alert(data.message,data.status); alert(data.message);
} else { } else {
fpbxToast(_('Data saved'),'', 'success'); alert('Data Save');
} }
} else { } else {
bs_alert(data.message,data.status); if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(entry, 'error', 'error');
});
}
} }
} }
}); });
}); });
// ajaxsubmit is save and close form
$('#ajaxsubmit').on('click', function (e) { $('#ajaxsubmit').on('click', function (e) {
var vdata = ''; var vdata = '';
var snd_command = 'savesettings'; var snd_command = 'savesettings';
@ -70,13 +97,7 @@ $(document).ready(function () {
vdata = vdata + $(this).serialize() + '&'; vdata = vdata + $(this).serialize() + '&';
}); });
if ($('.fpbx-submit').data('id') == "hw_edit") { if ($('.fpbx-submit').data('id') == "hw_edit") {
snd_command = 'save_device'; snd_command = 'save_hardware';
}
if ($('.fpbx-submit').data('id') == "hw_sedit") {
snd_command = 'save_sip_device';
}
if ($('.fpbx-submit').data('id') == "ruser_edit") {
snd_command = 'save_ruser';
} }
if ($('.fpbx-submit').data('id') == "dial_template") { if ($('.fpbx-submit').data('id') == "dial_template") {
snd_command = 'save_dialplan_template'; snd_command = 'save_dialplan_template';
@ -87,35 +108,43 @@ $(document).ready(function () {
data: vdata, data: vdata,
success: function (data) { success: function (data) {
if (data.status === true) { if (data.status === true) {
if (data.message) {
alert(data.message);
}
if (data.table_reload === true) { if (data.table_reload === true) {
$('table').bootstrapTable('refresh'); $('table').bootstrapTable('refresh');
} }
var newLocation = location.href; if (data.hash != null) {
newLocation = ('path' in data && data.path !== '') ? data.path : location.pathname; location.hash = data.hash;
newLocation += ('search' in data && data.search !== '') ? `${data.search}` : `${location.search}`; }
// location.hash is set by (".change-tab") at line 198 for settings if (data.href != null) {
newLocation += ('hash' in data && data.hash !== '' ) ? data.hash : location.hash; location.href = data.href;
if (data.message) { }
fpbxToast(_(data.message),'', data.toastFlag); if (data.path != null) {
// If posting warning, allow time to read location.path = data.path;
var toastDelay = (data.toastFlag == 'success') ? 500 : 1500; }
if (data.search != null) {
location.search = data.search;
}
if (data.reload === true) { if (data.reload === true) {
setTimeout(function(){
location.replace(newLocation);
if (data.search == `?display=sccpsettings`) {
location.reload(); location.reload();
} }
},
toastDelay);
}
}
} else { } else {
bs_alert(data.message,data.status); if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(entry, 'error', 'error');
});
}
} }
} }
}); });
}); });
$(".input-js-add").click(function(){
add_dynamic_input($(this),$(this).data('for'),"","");
});
$(".table").on('click','.table-js-add', function (e) { $(".table").on('click','.table-js-add', function (e) {
add_dynamic_table($(this),$(this).data('for'),"",""); add_dynamic_table($(this),$(this).data('for'),"","");
}); });
@ -124,6 +153,7 @@ $(document).ready(function () {
del_dynamic_table($(this),$(this).data('for')); del_dynamic_table($(this),$(this).data('for'));
}); });
$(".table").on('click','.btn-item-delete', function (e) { $(".table").on('click','.btn-item-delete', function (e) {
var dev_cmd = ''; var dev_cmd = '';
var dev_id = $(this).data('id'); var dev_id = $(this).data('id');
@ -147,26 +177,30 @@ $(document).ready(function () {
} }
// console.log("delete : " + data); // console.log("delete : " + data);
if (dev_cmd != '') { if (dev_cmd != '') {
if (confirm(_('Are you sure you wish to delete "' + dev_id.toString().toUpperCase() + '" information?'))) { if (confirm(_('Are you sure you wish to delete "' + dev_id.toString().toUpperCase() + '" inormation ?'))) {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd, url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
command: dev_cmd, command: dev_cmd,
data: ext_data, data: ext_data,
success: function (data) { success: function (data) {
// console.log(data);
if (data.status === true) { if (data.status === true) {
if (data.message) {
alert(data.message);
}
if (data.table_reload === true) { if (data.table_reload === true) {
$('table').bootstrapTable('refresh'); $('table').bootstrapTable('refresh');
} }
if (data.message) {
fpbxToast(data.message,_('Operation Result'), 'success');
if (data.reload === true) { if (data.reload === true) {
//Need setTimout or reload will kill Toast location.reload();
setTimeout(function(){location.reload();},500);
}
} }
} else { } else {
bs_alert(data.message,data.status); if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(entry, 'error', 'error');
});
}
} }
} }
@ -189,11 +223,6 @@ $(document).ready(function () {
}); });
// --------------------------------------- // ---------------------------------------
// Set location.hash when changing tabs so that can return to same tab after reload.
$(".change-tab").click(function(){
window.location.hash = '#' + $(this).attr('data-name');
});
$('.btnMultiselect').click(function (e) { $('.btnMultiselect').click(function (e) {
var kid = $(this).data('id'); var kid = $(this).data('id');
if ($(this).data('key') === 'Right') { if ($(this).data('key') === 'Right') {
@ -210,145 +239,104 @@ $(document).ready(function () {
} }
e.preventDefault(); e.preventDefault();
}); });
// Set focus on the mac entry field. It will not stay but ensures that focusout brings it back
$('#sccp_hw_mac').focus();
$('#sccp_hw_mac').focusout(function() {
var value = $(this).val();
const regex = new RegExp('^([0-9A-Fa-f]{2}[:.-]?){5}([0-9A-Fa-f]{2})$');
if ( regex.test(value) === false ) {
$('#ajaxsubmit2').attr('disabled', 'disabled');
$('#ajaxsubmit').attr('disabled', 'disabled');
fpbxToast(_('Invalid Mac Address'),_('Invalid Mac Address'), 'warning');
setTimeout(function(){ $('#sccp_hw_mac').focus();},2000);
} else {
$('#ajaxsubmit2').removeAttr('disabled');
$('#ajaxsubmit').removeAttr('disabled');
};
});
// Form.buttons - Form.adddevice // Form.buttons - Form.adddevice
$('.futuretype').change(function (e) {
$('.lineselect').change(function (e) {
var kid = $(this).data('id'); var kid = $(this).data('id');
var kval = $(this).val(); var kval = $(this).val();
$('.lineid_' + kid).each(function () { $('.lineselect_' + kid).each(function () {
var lval = $(this).data('type');
if (lval == 'featurep') {
if ( kval == 'parkinglot') {
$(this).removeClass('hidden');
} else {
$(this).addClass('hidden');
}
}
});
});
$('.buttontype').change(function (e) {
var kid = $(this).data('id');
var kval = $(this).val();
$('.lineid_' + kid).each(function () {
var lval = $(this).data('type');
var class_id = [kval];
switch (kval) { switch (kval) {
case 'silent': case 'silent':
case 'monitor': case 'monitor':
case 'line': case 'line':
class_id = ['line'];
break;
case 'adv.line': case 'adv.line':
class_id = ['line','adv_line']; $(this).removeClass('hidden');
break; break;
case 'service': case 'service':
case 'feature': case 'feature':
if (lval == 'featurep') {
if ($('.futuretype').val() == 'parkinglot') {
class_id = [kval,lval];
}
}
break;
case 'speeddial': case 'speeddial':
class_id = ['speeddial','hintline'];
break;
case 'empty': case 'empty':
class_id = []; $(this).addClass('hidden');
break; break;
} }
var pos = class_id.indexOf(lval); });
if (pos >= 0) { $('.linevalue_' + kid).each(function () {
switch (kval) {
case 'service':
case 'speeddial':
$(this).removeClass('hidden');
break;
case 'feature':
case 'silent':
case 'monitor':
case 'empty':
case 'adv.line':
case 'line':
$(this).addClass('hidden');
break;
}
});
$('.linefeature_' + kid).each(function () {
switch (kval) {
case 'feature':
$(this).removeClass('hidden');
break;
case 'adv.line':
case 'service':
case 'speeddial':
case 'silent':
case 'monitor':
case 'empty':
case 'line':
$(this).addClass('hidden');
break;
}
});
$('.lineadv_' + kid).each(function () {
if (kval == 'adv.line') {
$(this).removeClass('hidden');
} else {
$(this).addClass('hidden');
}
});
$('.linespeed_' + kid).each(function () {
if (kval == 'speeddial') {
$(this).removeClass('hidden'); $(this).removeClass('hidden');
} else { } else {
console.log(lval);
$(this).addClass('hidden'); $(this).addClass('hidden');
} }
}); });
}); });
// Form.adddevice // Form.adddevice
$('.hw_select').mouseover(function (e) {
var type_id = $('#sccp_hw_type').find(':selected').data('id');
if (type_id == null) {
var type_id = $('#addonCnt').val();
}
if (type_id == 1) {
if ($('#sccp_hw_addon').val() !== 'NONE') {
$('#sccp_hw_addon').val('NONE').change();
}
$('#sccp_hw_addon').attr("disabled", "disabled");
} else {
$('#sccp_hw_addon').prop('disabled',false);
}
});
$('.hw_select').change(function (e) { $('.hw_select').change(function (e) {
// data-val contains the number of buttons for this type // console.log('HwSelect');
// data-id contains the max number of addons (1 = 0, 3 = 2)
var type_id = $('#sccp_hw_type').find(':selected').data('id'); var type_id = $('#sccp_hw_type').find(':selected').data('id');
var btn_dev = $('#sccp_hw_type').find(':selected').data('val'); var btn_dev = $('#sccp_hw_type').find(':selected').data('val');
// when edit, btn_dev is undefined as no select, so send btn_dev and type_id with page // var btn_add=$('#sccp_hw_addon').find(':selected').data('val');
if (btn_dev == null) {
var btn_dev = $('#devButtonCnt').val(); if (type_id === 1) {
var type_id = $('#addonCnt').val();
}
if (type_id == 1) {
if ($('#sccp_hw_addon').val() !== 'NONE') { if ($('#sccp_hw_addon').val() !== 'NONE') {
$('#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').prop('disabled',false); $('#sccp_hw_addon').removeAttr('disabled');
} }
var btn_add = $('#sccp_hw_addon').find(':selected').data('val'); var btn_add = $('#sccp_hw_addon').find(':selected').data('val');
// btn_add is empty if none selected
if ((btn_add == null) || (btn_add == '')) {
var btn_add = 0;
}
var totButtons = parseInt(btn_dev, 10) + parseInt(btn_add, 10);
$('#buttonscount').attr('value', totButtons);
$('.line_button').each(function () { $('.line_button').each(function () {
if ($(this).data('id') < totButtons) { if ($(this).data('id') < btn_dev + btn_add) {
$(this).removeClass('hidden'); $(this).removeClass('hidden');
$(this).removeAttr('hidden'); $(this).removeAttr('hidden')
} else { } else {
$(this).addClass('hidden'); $(this).addClass('hidden');
$(this).attr('hidden', true);
} }
}); });
}); });
$('.lineSelect').change(function (e) { $('.sccp_button_hide').each(function () { // On page create !!
var line_id = $('#sccp_hw_defaultLine option:selected').val();
$("select.lineid_0 option:selected").prop("selected",false);
$("select.lineid_0 option[value=" + line_id + "]").prop("selected",true);
});
$('#button0_line').change(function (e) {
var line_id = $('#button0_line option:selected').val();
$("#sccp_hw_defaultLine option:selected").prop("selected",false);
$("#sccp_hw_defaultLine option[value=" + line_id + "]").prop("selected",true);
});
$('.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();
@ -411,8 +399,7 @@ $(document).ready(function () {
}); });
$('.sccp_button_disabled').each(function () { $('.sccp_button_disabled').each(function () { // On page create !!
// 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();
@ -525,7 +512,6 @@ $(document).ready(function () {
$('.sccp_update').on('click', function (e) { $('.sccp_update').on('click', function (e) {
// console.log($(this).data('id')); // console.log($(this).data('id'));
@ -557,6 +543,7 @@ $(document).ready(function () {
} }
// ----------------------- Server.model form ---------------- // ----------------------- Server.model form ----------------
if ($(this).data('id') === 'model_add') { if ($(this).data('id') === 'model_add') {
var dev_cmd = 'model_add'; var dev_cmd = 'model_add';
// var dev_fld = ["model","vendor","dns","buttons","loadimage","loadinformationid","validate","enabled"]; // var dev_fld = ["model","vendor","dns","buttons","loadimage","loadinformationid","validate","enabled"];
@ -572,8 +559,7 @@ $(document).ready(function () {
} }
if ($(this).data('id') === 'model_apply') { if ($(this).data('id') === 'model_apply') {
var dev_cmd = 'model_update'; var dev_cmd = 'model_update';
//var dev_fld = ["model", "loadimage", "nametemplate"]; var dev_fld = ["model", "loadimage", "nametemplate"];
var dev_fld = ["model", "vendor", "dns", "buttons", "loadimage", "loadinformationid", "nametemplate"];
datas = ''; datas = '';
for (var i = 0; i < dev_fld.length; i++) { for (var i = 0; i < dev_fld.length; i++) {
datas = datas + dev_fld[i] + '=' + $('#editd_' + dev_fld[i]).val() + '&'; datas = datas + dev_fld[i] + '=' + $('#editd_' + dev_fld[i]).val() + '&';
@ -594,69 +580,35 @@ $(document).ready(function () {
// ----------------------- form ---------------- // ----------------------- form ----------------
if ($(this).data('id') === 'create-cnf') { if ($(this).data('id') === 'create-cnf') {
var dev_cmd = 'create_hw_tftp'; var dev_cmd = 'create_hw_tftp';
var datas = '';
var i = 0;
$('#table-sccp').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'idn[' + i + ']=' + entry['name'] + '&';
i++;
});
if (document.getElementById('table-sip') != null ) {
$('#table-sip').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'idn[' + i + ']=' + entry['name'] + '&';
i++;
});
}
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');
var datas = ''; var datas = '';
var i = 0; var i = 0;
$('#table-sccp').bootstrapTable('getSelections').forEach(function (entry) { $('table').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'idn[' + i + ']=' + entry['name'] + '&'; datas = datas + 'idn[' + i + ']=' + entry['name'] + '&';
i++; i++;
}); });
if (document.getElementById('table-sip') != null ) {
$('#table-sip').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'idn[' + i + ']=' + entry['name'] + '&';
i++;
});
}
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') {
var dev_cmd = $(this).data('id'); var dev_cmd = $(this).data('id');
var datas = ''; var datas = '';
var i = 0; var i = 0;
var conf_msg = '??????'; $('table').bootstrapTable('getSelections').forEach(function (entry) {
if ($(this).data('id') === 'reset_dev') {
conf_msg = 'Reset ALL devices ?';
}
if ($(this).data('id') === 'reset_token') {
conf_msg = 'Reset Token on ALL devices ?';
}
if ($(this).data('id') === 'update_button_label') {
conf_msg = 'Update Button Labels on ALL devices ?';
}
$('#table-sccp').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'name[' + i + ']=' + entry['name'] + '&'; datas = datas + 'name[' + i + ']=' + entry['name'] + '&';
i++; i++;
}); });
if (document.getElementById('table-sip') != null ) {
$('#table-sip').bootstrapTable('getSelections').forEach(function (entry) {
datas = datas + 'name[' + i + ']=' + entry['name'] + '&';
i++;
});
}
if (datas === '') { if (datas === '') {
if (confirm(conf_msg)) { if (confirm('Resaet All device')) {
datas = 'name[0]=all'; datas = 'name[0]=all';
} else { } else {
dev_cmd = ''; dev_cmd = '';
} }
} }
} }
if (dev_cmd !== '') { if (dev_cmd !== '') {
@ -665,29 +617,28 @@ $(document).ready(function () {
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd, url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
data: datas, data: datas,
success: function (data) { success: function (data) {
// console.log(data);
if (data.status === true) { if (data.status === true) {
if (data.message) {
alert(data.message);
}
if (data.table_reload === true) { if (data.table_reload === true) {
$('table').bootstrapTable('refresh'); $('table').bootstrapTable('refresh');
} }
if (data.message) {
fpbxToast(data.message,_('Operation Result'), 'success');
if (data.reload === true) { if (data.reload === true) {
//Need setTimout or reload will kill Toast location.reload();
setTimeout(function(){location.reload();},500);
}
} }
} else { } else {
if (Array.isArray(data.message)) { if (Array.isArray(data.message)) {
data.message.forEach(function (entry) { data.message.forEach(function (entry) {
fpbxToast(data.message[1],_('Error Result'), 'warning'); fpbxToast(entry, 'error', 'error');
}); });
} else { } else {
if (data.message) { if (data.message) {
fpbxToast(data.message,_('Error Result'), 'warning'); alert(data.message);
} else { } else {
if (data) { if (data) {
bs_alert(data,data.status); alert(data);
} }
} }
} }
@ -698,89 +649,11 @@ $(document).ready(function () {
} }
}); });
$('.sccp_get_ext').on('click', function (e) {
// console.log($(this).data('id'));
// ----------------------- Get external Files----------------
if ($(this).data('id') === 'get_ext_files') {
var dev_cmd = 'get_ext_files';
var dev_fld = ["device", "locale", "country"];
datas = 'type=' + $(this).data('type') + '&' + 'name=' + '&';
for (var i = 0; i < dev_fld.length; i++) {
datas = datas + dev_fld[i] + '=' + $('#ext_' + dev_fld[i]).val() + '&';
}
;
}
if (dev_cmd !== '') {
$.ajax({
// Need to modify xhr here to add listener
xhr: function() {
const controller = new AbortController();
var xhr = new XMLHttpRequest();
xhr.addEventListener('progress', function(evt) {
var result = evt.srcElement.responseText.split(',');
var percentComplete = result[result.length - 2]; //last element is empty.
$('#progress-bar').css('width', percentComplete + '%');
if (percentComplete == 100 ) {
controller.abort();
}
}, true, { signal: controller.signal });
return xhr;
},
type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
data: datas,
success: function (data) {
$('#pleaseWaitDialog').modal('hide');
console.log(data);
data = JSON.parse(data.replace(/^(.*\{)/,"\{"));
console.log(data);
if (data.status === true) {
if (data.table_reload === true) {
$('table').bootstrapTable('refresh');
}
if (data.message) {
fpbxToast(data.message,_('Operation Result'), 'success');
if (data.reload === true) {
//Need setTimout or reload will kill Toast
setTimeout(function(){location.reload();},500);
}
}
} else {
if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(data.message[1],_('Error Result'), 'warning');
});
} else {
if (data.message) {
fpbxToast(data.message,_('Error Result'), 'warning');
} else {
if (data) {
bs_alert(data,data.status);
}
}
}
}
}
});
}
});
$('#cr_sccp_phone_xml').on('click', function (e) { $('#cr_sccp_phone_xml').on('click', function (e) {
// console.log("asasdasdasdasd"); // console.log("asasdasdasdasd");
// console.log($('#update-sccp-phone').find(':selected').data('val')); // console.log($('#update-sccp-phone').find(':selected').data('val'));
}); });
}); });
@ -792,7 +665,7 @@ $(document).ready(function () {
//}); //});
// Bootstrap table Enable / Disable buttons ( class="btn-tab-select") // Bootstrap table Enabled / Disabled buttons ( class="btn-tab-select")
$("table").on('check-all.bs.table', function (rows) { $("table").on('check-all.bs.table', function (rows) {
var id_fld = $(this).data('id'); var id_fld = $(this).data('id');
$(".btn-tab-select").each(function () { $(".btn-tab-select").each(function () {
@ -851,15 +724,14 @@ $("table").on("post-body.bs.table", function () {
}); });
toggle_reload_button("show"); toggle_reload_button("show");
} else { } else {
bs_alert(data.message, data.status); alert(data.message);
} }
}); });
} }
}); });
}); });
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;
@ -916,54 +788,33 @@ function load_oncliсk(e, data)
} }
} }
// call from here not document.ready as have dynamic content
$(document).on('click', ".input-js-remove" , function () {
// delete the current row
var pname = $(this).data('id');
$('#' + pname).remove();
});
$(document).on('click', ".input-js-add" , function () { function add_dynamic_input(pe, pclass, vdefault) {
// Add new row to networks or ip array // We'd like a new one, please.
var pcls = $(this).data('for'), pcls = pe.data('for');
pname = $(this).data('id'), pname = pe.data('id');
pmax = $(this).data('max'), pmax = pe.data('max');
prow = $(this).data('row'), jdata = JSON.parse(hex2bin(pe.data('json')));
pcount = $("." + pcls).length;
if (pcount == pmax){
//already reached max elements
return;
}
jdata = JSON.parse(hex2bin($(this).data('json'))); var last = $("."+pcls+":last"),
var last = $("." + pcls).last(),
ourid = last.data('nextid'), ourid = last.data('nextid'),
nextid = ourid + 1, nextid = ourid + 1;
html = "<div class = '" + pcls + "' id ='" + pname + nextid + "' form-group form-inline' data-nextid=" + nextid + ">"; var html = "<div class = '" + pcls +" form-group form-inline' data-nextid="+nextid+">";
for (var key in jdata) { for (var key in jdata) {
html_opt = ''; html_opt = '';
html_calss = jdata[key]['class'];
for (var skey in jdata[key]['options']) { for (var skey in jdata[key]['options']) {
html_opt += ' ' + skey+'="' + jdata[key]['options'][skey] +'"'; html_opt += ' ' + skey+'="' + jdata[key]['options'][skey] +'"';
} }
html += "<input type='text' name='" + pname + "[" + nextid + "][" + key + "]' class " + html_opt + "> " + jdata[key]['nameseparator'] + " "; html += "<input type='text' name='"+pname+ "["+ourid+"]["+key+"]' class='" + html_calss + "' " + html_opt + " value='" + vdefault+"'> "+ jdata[key]['nameseparator'] + " ";
} }
// add remove button
html += "<button type='button' class='btn btn-danger btn-lg input-js-remove' id='" + pname + nextid + "-btn-remove' data-id='" + pname + nextid + "' data-for='" + pname + "'>";
html += "<i class='fa fa-minus pull-right'></i></button>";
// add plus button
html += "<button type='button' class='btn btn-primary btn-lg input-js-add' id='" + pname + nextid + "-btn-add' data-id='" + pname + "'";
html += " data-row='" + nextid + "' data-for='" + pname + "' data-max='" + pmax + "' data-json='" + $(this).data('json') + "' >";
html += "<i class='fa fa-plus pull-right'></i></button>";
html += "</div>\n"; html += "</div>\n";
if (pmax >= nextid) {
last.after(html); last.after(html);
}
}
$('#' + pname + prow + '-btn-add').remove(); 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');
@ -976,14 +827,11 @@ function del_dynamic_table(pe, pclass, vdefault)
$(this).remove(); $(this).remove();
}); });
}else{ }else{
curRow.find('input:text').each(function () { curRow.find('input:text').each(function(){$(this).val('')});
$(this).val('')
});
} }
} }
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');
@ -1124,179 +972,14 @@ var theForm = document.editIax;
return unescape(result); return unescape(result);
} }
*/ */
function bs_page_reload()
{
window.location.reload(false);
}
function bs_alert(data, status, reload)
{
if (document.getElementById('hwalert') === null) {
if (Array.isArray(data)) {
data.forEach(function (entry) {
alert(entry);
});
} else {
alert(data);
}
return true; // Old style
} else {
var modal = $("#hwalert");
if (typeof status != "undefined") {
if (status === true) {
modal.find('.modal-title').text('Operation result');
} else {
modal.find('.modal-title').text('Error operation ');
}
} else {
modal.find('.modal-title').text('Operation result');
}
// var modal2 = modal.find('.modal-title');
// console.log(modal2);
// modal.find('.modal-body').text(data);
var modal2 = modal.find('.modal-body');
var msg_html = '';
if (Array.isArray(data)) {
data.forEach(function (entry) {
msg_html = msg_html + '<p>'+ entry + '</p>';
});
} else {
msg_html = data;
}
modal2[0].innerHTML = msg_html;
if (typeof reload != "undefined") {
if (reload === true) {
$("#hwalert").on('hidden.bs.modal', bs_page_reload);
}
}
modal.modal('show');
return false;
}
}
function hex2bin(hex) 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 showProgress() {
$('#pleaseWaitDialog').modal();
}
function closeProgress() {
$('#pleaseWaitDialog').modal('hide');
}
function sleep(milliseconds)
{
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds) {
break;
}
}
}
// There are 2 dynamically created button Classes
// sccp_restore for restoring system defaults, and sccp_edit for entering
// custom values. Clicking on these buttons is handled by the 2 functions below.
$(".sccp-restore").click(function() {
//input is sent by data-for where for is an attribute
var id = $(this).data("for"), input = $("#" + id);
var edit_style = document.getElementById("edit_" + id).style;
input = document.getElementsByName(id);
if (input.length === 0) {
return;
}
if ($(this).is(":checked")) {
console.log('restore/checked');
// Restoring defaults
// show the edit block and populate with default values.
edit_style.display = 'block';
var defaultVal = $(this).data("default");
if ($(this).data("type") === 'radio') {
// simulate read only for checkboxes except default
input.forEach(
function(radioElement) {
radioElement.setAttribute('disabled', true);
if (radioElement.value === defaultVal){
radioElement.removeAttribute('disabled');
radioElement.checked = true;
} else {
radioElement.removeAttribute('checked');
}
}
);
return;
} else if ($(this).data("type") === 'text') {
if ((input[0].id === "sccp_bindaddr") || (input[0].id === "sccp_externip")) {
// TODO: This is a dirty hack as default value is wrong - need to improve
input[0].value = '0.0.0.0';
} else {
input[0].value = defaultVal;
input[0].readOnly = true;
}
}
} else {
console.log('restore/unchecked');
edit_style.display = 'none';
if ($(this).data("type") === 'radio') {
input.forEach(
function(radioElement) {
//Revert to original value as have unchecked customise.
radioElement.checked = radioElement.defaultChecked;
radioElement.name.value = radioElement.name.defaultValue;
}
);
} else if ($(this).data("type") === 'text') {
//Revert to original value as have unchecked customise.
input[0].value = input[0].defaultValue;
}
}
});
$(".sccp-edit").click(function() {
//input is sent by data-xxx where xxx is an attribute
var id = $(this).data("for"), input = $("#" + id);
var edit_style = document.getElementById("edit_" + id).style;
input = document.getElementsByName(id);
if (input.length === 0) {
return;
}
if ($(this).is(":checked")) {
// editing away from the default value
console.log('edit/checked');
edit_style.display = 'block';
if ($(this).data("type") === 'radio') {
input.forEach(
function(radioElement) {
radioElement.removeAttribute('disabled');
}
);
return;
} else if ($(this).data("type") === 'text') {
input[0].focus();
}
} else {
console.log('edit/unchecked');
edit_style.display = 'none';
if ($(this).data("type") === 'radio') {
input.forEach(
function(radioElement) {
//Revert to original value as have unchecked customise.
radioElement.checked = radioElement.defaultChecked;
}
);
} else if ($(this).data("type") === 'text') {
//Revert to original value as have unchecked customise.
input[0].value = input[0].defaultValue;
}
}
});

View file

@ -1,803 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) by Cisco Systems, Inc. (Cisco Systems, Inc.) -->
<!-- Last updated 31 Dec 20 -->
<!-- The following Cisco IP Phones implement this XML parser: 6921, 6941, 6945, 6961, 7906G, 7911G, 7921G, 7925G, 7925G-EX, 7926G, 7931G, 7941G, 7941G-GE 7942G, 7945G, 7961G, 7961G-GE, 7962G, 7965G, 7970G, 7971G-GE, 7975G, 8800 Series, 8821, 8961, 9951, and 9971.-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified" version="3.3.4">
<xsd:complexType name="CiscoIPPhoneExecuteItemType">
<xsd:attribute name="Priority" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedByte">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="URL" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneResponseItemType">
<xsd:sequence>
<xsd:element name="Status" type="xsd:short"/>
<xsd:element name="Data">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneTouchAreaMenuItemType">
<xsd:sequence>
<xsd:element name="Name" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="TouchArea" type="CiscoIPPhoneTouchAreaType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneTouchAreaType">
<xsd:attribute name="X1" type="xsd:unsignedShort" use="required"/>
<xsd:attribute name="Y1" type="xsd:unsignedShort" use="required"/>
<xsd:attribute name="X2" type="xsd:unsignedShort" use="required"/>
<xsd:attribute name="Y2" type="xsd:unsignedShort" use="required"/>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneDirectoryEntryType">
<xsd:sequence>
<xsd:element name="Name" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Telephone" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneInputItemType">
<xsd:sequence>
<xsd:element name="DisplayName" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="QueryStringParam">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="InputFlags">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="A"/>
<xsd:enumeration value="T"/>
<xsd:enumeration value="N"/>
<xsd:enumeration value="E"/>
<xsd:enumeration value="U"/>
<xsd:enumeration value="L"/>
<xsd:enumeration value="AP"/>
<xsd:enumeration value="TP"/>
<xsd:enumeration value="NP"/>
<xsd:enumeration value="EP"/>
<xsd:enumeration value="UP"/>
<xsd:enumeration value="LP"/>
<xsd:enumeration value="PA"/>
<xsd:enumeration value="PT"/>
<xsd:enumeration value="PN"/>
<xsd:enumeration value="PE"/>
<xsd:enumeration value="PU"/>
<xsd:enumeration value="PL"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="DefaultValue" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneMenuItemType">
<xsd:sequence>
<xsd:element name="Name" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="64"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneIconItemType">
<xsd:sequence>
<xsd:element name="Index" type="xsd:unsignedShort"/>
<xsd:element name="Width">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="16"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Height">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="10"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Depth">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Data" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:hexBinary">
<xsd:maxLength value="40"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneIconMenuItemType">
<xsd:sequence>
<xsd:element name="Name" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="64"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="IconIndex" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="9"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneIconFileItemType">
<xsd:sequence>
<xsd:element name="Index">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="9"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneKeyType">
<xsd:sequence>
<xsd:element name="Key">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="KeyPad0"/>
<xsd:enumeration value="KeyPad1"/>
<xsd:enumeration value="KeyPad2"/>
<xsd:enumeration value="KeyPad3"/>
<xsd:enumeration value="KeyPad4"/>
<xsd:enumeration value="KeyPad5"/>
<xsd:enumeration value="KeyPad6"/>
<xsd:enumeration value="KeyPad7"/>
<xsd:enumeration value="KeyPad8"/>
<xsd:enumeration value="KeyPad9"/>
<xsd:enumeration value="KeyPadStar"/>
<xsd:enumeration value="KeyPadPound"/>
<xsd:enumeration value="NavUp"/>
<xsd:enumeration value="NavDown"/>
<xsd:enumeration value="NavLeft"/>
<xsd:enumeration value="NavRight"/>
<xsd:enumeration value="NavSelect"/>
<xsd:enumeration value="NavBack"/>
<xsd:enumeration value="PushToTalk"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URLDown" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneSoftKeyType">
<xsd:sequence>
<xsd:element name="Name" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="32"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Position">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="8"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URLDown" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="Title" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Prompt" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="SoftKeyItem" type="CiscoIPPhoneSoftKeyType" minOccurs="0" maxOccurs="8"/>
<xsd:element name="KeyItem" type="CiscoIPPhoneKeyType" minOccurs="0" maxOccurs="32"/>
</xsd:sequence>
<xsd:attribute name="keypadTarget" use="optional" default="application">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="application"/>
<xsd:enumeration value="applicationCall"/>
<xsd:enumeration value="activeCall"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="appId" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="64"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="onAppFocusLost" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="onAppFocusGained" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="onAppMinimized" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="onAppClosed" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
<xsd:element name="CiscoIPPhoneExecute">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ExecuteItem" type="CiscoIPPhoneExecuteItemType" maxOccurs="3"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPhoneResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ResponseItem" type="CiscoIPPhoneResponseItemType" maxOccurs="3"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneError">
<xsd:complexType>
<xsd:attribute name="Number" type="xsd:unsignedShort" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneText">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="Text" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="4000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneInput">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="InputItem" type="CiscoIPPhoneInputItemType" minOccurs="0" maxOccurs="5"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneDirectory">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="DirectoryEntry" type="CiscoIPPhoneDirectoryEntryType" minOccurs="0" maxOccurs="32"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneImage">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="132"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="64"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Width">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="133"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Height">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="65"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Depth">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Data" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:hexBinary">
<xsd:maxLength value="2162"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneImageFile">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="297"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="167"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneMenu">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="MenuItem" type="CiscoIPPhoneMenuItemType" minOccurs="0" maxOccurs="100"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneIconMenu">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="MenuItem" type="CiscoIPPhoneIconMenuItemType" minOccurs="0" maxOccurs="32"/>
<xsd:element name="IconItem" type="CiscoIPPhoneIconItemType" minOccurs="0" maxOccurs="10"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneIconFileMenu">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="MenuItem" type="CiscoIPPhoneIconMenuItemType" minOccurs="0" maxOccurs="32"/>
<xsd:element name="IconItem" type="CiscoIPPhoneIconFileItemType" minOccurs="0" maxOccurs="10"/>
</xsd:sequence>
<xsd:attribute name="IconIndex" type="xsd:unsignedShort" use="optional"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneGraphicMenu">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="132"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="64"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Width">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="133"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Height">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="65"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Depth">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Data" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:hexBinary">
<xsd:maxLength value="2162"/>
<xsd:minLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="MenuItem" type="CiscoIPPhoneMenuItemType" minOccurs="0" maxOccurs="12"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneGraphicFileMenu">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="CiscoIPPhoneDisplayableType">
<xsd:sequence>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="297"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="167"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256"/>
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="MenuItem" type="CiscoIPPhoneTouchAreaMenuItemType" minOccurs="0" maxOccurs="32"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneStatus">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Text" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Timer" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="105"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="20"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Width">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="106"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Height">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="21"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Depth">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Data" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:hexBinary">
<xsd:minLength value="0"/>
<xsd:maxLength value="557"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CiscoIPPhoneStatusFile">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Text" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="0"/>
<xsd:maxLength value="32"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Timer" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:unsignedShort">
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationX" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="261"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LocationY" default="0" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:short">
<xsd:minInclusive value="-1"/>
<xsd:maxInclusive value="49"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:maxLength value="256"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View file

@ -1,300 +0,0 @@
<device>
<fullConfig>true</fullConfig>
<deviceProtocol>SIP</deviceProtocol>
<devicePool>
<dateTimeSetting>
<dateTemplate>D/M/Y</dateTemplate>
<timeZone></timeZone>
<ntps>
<ntp>
<name></name>
<ntpMode>unicast</ntpMode>
</ntp>
</ntps>
</dateTimeSetting>
<callManagerGroup>
<members>
<member priority="0">
<callManager>
<ports>
<sipPort>5060</sipPort>
<securedSipPort>5061</securedSipPort>
</ports>
<processNodeName></processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
</devicePool>
<sipProfile>
<sipProxies>
<registerWithProxy>true</registerWithProxy>
</sipProxies>
<sipCallFeatures>
<cnfJoinEnabled>true</cnfJoinEnabled>
<callForwardURI>x-cisco-serviceuri-cfwdall</callForwardURI>
<callPickupURI>x-cisco-serviceuri-pickup</callPickupURI>
<callPickupListURI>x-cisco-serviceuri-opickup</callPickupListURI>
<callPickupGroupURI>x-cisco-serviceuri-gpickup</callPickupGroupURI>
<meetMeServiceURI>x-cisco-serviceuri-meetme</meetMeServiceURI>
<abbreviatedDialURI>x-cisco-serviceuri-abbrdial</abbreviatedDialURI>
<rfc2543Hold>false</rfc2543Hold>
<callHoldRingback>1</callHoldRingback>
<localCfwdEnable>true</localCfwdEnable>
<semiAttendedTransfer>true</semiAttendedTransfer>
<anonymousCallBlock>3</anonymousCallBlock>
<callerIdBlocking>3</callerIdBlocking>
<dndControl>0</dndControl>
<remoteCcEnable>true</remoteCcEnable>
<retainForwardInformation>false</retainForwardInformation>
<uriDialingDisplayPreference>1</uriDialingDisplayPreference>
</sipCallFeatures>
<sipStack>
<sipInviteRetx>6</sipInviteRetx>
<sipRetx>10</sipRetx>
<timerInviteExpires>180</timerInviteExpires>
<timerRegisterExpires>3600</timerRegisterExpires>
<timerRegisterDelta>5</timerRegisterDelta>
<timerKeepAliveExpires>120</timerKeepAliveExpires>
<timerSubscribeExpires>120</timerSubscribeExpires>
<timerSubscribeDelta>5</timerSubscribeDelta>
<timerT1>500</timerT1>
<timerT2>4000</timerT2>
<maxRedirects>70</maxRedirects>
<remotePartyID>true</remotePartyID>
<userInfo>Phone</userInfo>
</sipStack>
<autoAnswerTimer>1</autoAnswerTimer>
<autoAnswerAltBehavior>false</autoAnswerAltBehavior>
<autoAnswerOverride>true</autoAnswerOverride>
<transferOnhookEnabled>true</transferOnhookEnabled>
<enableVad>false</enableVad>
<preferredCodec>none</preferredCodec>
<dtmfAvtPayload>101</dtmfAvtPayload>
<dtmfDbLevel>3</dtmfDbLevel>
<dtmfOutofBand>avt</dtmfOutofBand>
<alwaysUsePrimeLine>false</alwaysUsePrimeLine>
<alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail>
<kpml>0</kpml>
<phoneLabel></phoneLabel>
<stutterMsgWaiting>0</stutterMsgWaiting>
<callStats>true</callStats>
<offhookToFirstDigitTimer>15000</offhookToFirstDigitTimer>
<silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts>
<disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig>
<startMediaPort>16384</startMediaPort>
<stopMediaPort>32766</stopMediaPort>
<natEnabled>false</natEnabled>
<natReceivedProcessing>false</natReceivedProcessing>
<natAddress></natAddress>
<sipLines>
<line button="1" lineIndex="1">
<featureID>9</featureID>
<featureLabel></featureLabel>
<proxy>USECALLMANAGER</proxy>
<port>5060</port>
<name></name>
<displayName></displayName>
<autoAnswer>
<autoAnswerEnabled>0</autoAnswerEnabled>
</autoAnswer>
<callWaiting>3</callWaiting>
<authName></authName>
<authPassword></authPassword>
<contact></contact>
<sharedLine>false</sharedLine>
<messageWaitingLampPolicy>3</messageWaitingLampPolicy>
<messageWaitingAMWI>0</messageWaitingAMWI>
<messagesNumber></messagesNumber>
<ringSettingIdle>4</ringSettingIdle>
<ringSettingActive>5</ringSettingActive>
<forwardCallInfoDisplay>
<callerName>true</callerName>
<callerNumber>true</callerNumber>
<redirectedNumber>false</redirectedNumber>
<dialedNumber>true</dialedNumber>
</forwardCallInfoDisplay>
<maxNumCalls>5</maxNumCalls>
<busyTrigger>4</busyTrigger>
</line>
</sipLines>
<externalNumberMask></externalNumberMask>
<voipControlPort>5060</voipControlPort>
<dscpForAudio>184</dscpForAudio>
<ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy>
<dialTemplate></dialTemplate>
<softKeyFile></softKeyFile>
</sipProfile>
<MissedCallLoggingOption>1</MissedCallLoggingOption>
<featurePolicyFile></featurePolicyFile>
<commonProfile>
<phonePassword></phonePassword>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>2</callLogBlfEnabled>
</commonProfile>
<vendorConfig>
<defaultWallpaperFile></defaultWallpaperFile>
<disableSpeaker>false</disableSpeaker>
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
<enableMuteFeature>false</enableMuteFeature>
<enableGroupListen>true</enableGroupListen>
<holdResumeKey>1</holdResumeKey>
<recentsSoftKey>1</recentsSoftKey>
<dfBit>1</dfBit>
<pcPort>0</pcPort>
<spanToPCPort>1</spanToPCPort>
<garp>0</garp>
<rtcp>1</rtcp>
<videoRtcp>1</videoRtcp>
<voiceVlanAccess>0</voiceVlanAccess>
<videoCapability>1</videoCapability>
<hideVideoByDefault>0</hideVideoByDefault>
<separateMute>0</separateMute>
<ciscoCamera>1</ciscoCamera>
<usb1>1</usb1>
<usb2>1</usb2>
<usbClasses>0,1,2</usbClasses>
<sdio>1</sdio>
<wifi>1</wifi>
<bluetooth>1</bluetooth>
<bluetoothProfile>0,1</bluetoothProfile>
<btpbap>0</btpbap>
<bthfu>0</bthfu>
<ehookEnable>0</ehookEnable>
<autoSelectLineEnable>1</autoSelectLineEnable>
<autoCallSelect>1</autoCallSelect>
<incomingCallToastTimer>10</incomingCallToastTimer>
<dialToneFromReleaseKey>0</dialToneFromReleaseKey>
<joinAndDirectTransferPolicy>0</joinAndDirectTransferPolicy>
<minimumRingVolume></minimumRingVolume>
<simplifiedNewCall>0</simplifiedNewCall>
<actionableAlert>0</actionableAlert>
<showCallHistoryForSelectedLine>0</showCallHistoryForSelectedLine>
<kemOneColumn>0</kemOneColumn>
<lineMode>0</lineMode>
<allCallsOnPrimary>0</allCallsOnPrimary>
<softKeyControl>0</softKeyControl>
<settingsAccess>1</settingsAccess>
<webProtocol>0</webProtocol>
<webAccess>0</webAccess>
<webAdmin>1</webAdmin>
<adminPassword></adminPassword>
<sshAccess>0</sshAccess>
<detectCMConnectionFailure>0</detectCMConnectionFailure>
<g722CodecSupport>1</g722CodecSupport>
<handsetWidebandEnable>2</handsetWidebandEnable>
<headsetWidebandEnable>2</headsetWidebandEnable>
<headsetWidebandUIControl>1</headsetWidebandUIControl>
<handsetWidebandUIControl>1</handsetWidebandUIControl>
<daysDisplayNotActive>1,7</daysDisplayNotActive>
<displayOnTime>08:00</displayOnTime>
<displayOnDuration>10:00</displayOnDuration>
<displayIdleTimeout>00:10</displayIdleTimeout>
<displayOnWhenIncomingCall>1</displayOnWhenIncomingCall>
<displayRefreshRate>0</displayRefreshRate>
<daysBacklightNotActive>1,7</daysBacklightNotActive>
<backlightOnTime>08:00</backlightOnTime>
<backlightOnDuration>10:00</backlightOnDuration>
<backlightIdleTimeout>00:10</backlightIdleTimeout>
<backlightOnWhenIncomingCall>1</backlightOnWhenIncomingCall>
<recordingTone>0</recordingTone>
<recordingToneLocalVolume>100</recordingToneLocalVolume>
<recordingToneRemoteVolume>50</recordingToneRemoteVolume>
<recordingToneDuration></recordingToneDuration>
<moreKeyReversionTimer>5</moreKeyReversionTimer>
<peerFirmwareSharing>0</peerFirmwareSharing>
<loadServer></loadServer>
<problemReportUploadURL></problemReportUploadURL>
<enableCdpSwPort>1</enableCdpSwPort>
<enableCdpPcPort>0</enableCdpPcPort>
<enableLldpSwPort>1</enableLldpSwPort>
<enableLldpPcPort>0</enableLldpPcPort>
<cdpEnable>true</cdpEnable>
<outOfRangeAlert>0</outOfRangeAlert>
<scanningMode>2</scanningMode>
<applicationURL></applicationURL>
<appButtonTimer>0</appButtonTimer>
<appButtonPriority>0</appButtonPriority>
<specialNumbers></specialNumbers>
<sendKeyAction>0</sendKeyAction>
<powerOffWhenCharging>0</powerOffWhenCharging>
<homeScreen>0</homeScreen>
<accessContacts>1</accessContacts>
<accessFavorites>1</accessFavorites>
<accessVoicemail>1</accessVoicemail>
<accessApps>1</accessApps>
</vendorConfig>
<versionStamp>d902ed5a-c1e5-4233-b1d6-a960d53d1c3a</versionStamp>
<loadInformation></loadInformation>
<phoneServices useHTTPS="false">
<provisioning>2</provisioning>
<phoneService type="1" category="0">
<name>Missed Calls</name>
<url>Application:Cisco/MissedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="1" category="0">
<name>Received Calls</name>
<url>Application:Cisco/ReceivedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="1" category="0">
<name>Placed Calls</name>
<url>Application:Cisco/PlacedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="2" category="0">
<name>Voicemail</name>
<url>Application:Cisco/Voicemail</url>
<vendor></vendor>
<version></version>
</phoneService>
</phoneServices>
<userLocale>
<name></name>
<uid>1</uid>
<langCode></langCode>
<version></version>
<winCharSet>utf-8</winCharSet>
</userLocale>
<networkLocale></networkLocale>
<networkLocaleInfo>
<name></name>
<version></version>
</networkLocaleInfo>
<deviceSecurityMode>1</deviceSecurityMode>
<idleTimeout>0</idleTimeout>
<authenticationURL></authenticationURL>
<messagesURL></messagesURL>
<servicesURL></servicesURL>
<directoryURL></directoryURL>
<idleURL></idleURL>
<informationURL></informationURL>
<proxyServerURL></proxyServerURL>
<secureAuthenticationURL></secureAuthenticationURL>
<secureMessagesURL></secureMessagesURL>
<secureServicesURL></secureServicesURL>
<secureDirectoryURL></secureDirectoryURL>
<secureInformationURL></secureInformationURL>
<secureIdleURL></secureIdleURL>
<transportLayerProtocol>1</transportLayerProtocol>
<TLSResumptionTimer>3600</TLSResumptionTimer>
<phonePersonalization>1</phonePersonalization>
<autoCallPickupEnable>true</autoCallPickupEnable>
<blfAudibleAlertSettingOfIdleStation>0</blfAudibleAlertSettingOfIdleStation>
<blfAudibleAlertSettingOfBusyStation>0</blfAudibleAlertSettingOfBusyStation>
<dndCallAlert>1</dndCallAlert>
<dndReminderTimer>5</dndReminderTimer>
<advertiseG722Codec>1</advertiseG722Codec>
<rollover>0</rollover>
<joinAcrossLines>0</joinAcrossLines>
<capfAuthMode>0</capfAuthMode>
<capfList></capfList>
<certHash></certHash>
<encrConfig>false</encrConfig>
<sshUserId></sshUserId>
<sshPassword></sshPassword>
</device>

View file

@ -1,237 +0,0 @@
<?xml version="1.0"?>
<device xsi:type="axl:XIPPhone" ctiid="406" uuid="{aed907f9-9e22-72d8-c218-b7165fff6d37}">
<fullConfig>true</fullConfig>
<portalDefaultServer>x.x.x.x</portalDefaultServer>
<deviceProtocol>SCCP</deviceProtocol>
<sshUserId/>
<sshPassword/>
<ipAddressMode>0</ipAddressMode>
<allowAutoConfig>true</allowAutoConfig>
<dadEnable>true</dadEnable>
<redirectEnable>false</redirectEnable>
<echoMultiEnable>false</echoMultiEnable>
<ipPreferenceModeControl>0</ipPreferenceModeControl>
<ipMediaAddressFamilyPreference>0</ipMediaAddressFamilyPreference>
<tzdata>
<tzolsonversion>2016g</tzolsonversion>
<tzupdater>tzupdater.jar</tzupdater>
</tzdata>
<mlppDomainId>000000</mlppDomainId>
<mlppIndicationStatus>Off</mlppIndicationStatus>
<preemption>Disabled</preemption>
<executiveOverridePreemptable>false</executiveOverridePreemptable>
<devicePool uuid="{f8d7c5cb-5d3b-e6c0-0200-8608c8138e66}">
<revertPriority>0</revertPriority>
<name>MyDeviceName</name>
<dateTimeSetting uuid="{ce543907-40b1-efe8-21e1-bdd1853c9594}">
<name>timezone name</name>
<dateTemplate>M-D-Y</dateTemplate>
<timeZone/>
<olsonTimeZone>Europe/Amsterdam</olsonTimeZone>
<ntps>
<ntp>
<name>x.x.x.x</name>
<ntpMode>Directed Broadcast</ntpMode>
</ntp>
</ntps>
</dateTimeSetting>
<callManagerGroup>
<name>MyGroupName</name>
<tftpDefault>false</tftpDefault>
<members>
<member priority="0">
<callManager>
<name>My CM1 name</name>
<description>My CM Description</description>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
<sipPort>5060</sipPort>
<securedSipPort>5061</securedSipPort>
<mgcpPorts>
<listen>2427</listen>
<keepAlive>2428</keepAlive>
</mgcpPorts>
</ports>
<processNodeName>y.y.y.y</processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
<srstInfo uuid="{cd241e11-4a58-4d3d-9661-f06c912a18a3}">
<name>Disable</name>
<srstOption>Disable</srstOption>
<userModifiable>false</userModifiable>
<ipAddr1/>
<port1>2000</port1>
<ipAddr2/>
<port2>2000</port2>
<ipAddr3/>
<port3>2000</port3>
<sipIpAddr1/>
<sipPort1>5060</sipPort1>
<sipIpAddr2/>
<sipPort2>5060</sipPort2>
<sipIpAddr3/>
<sipPort3>5060</sipPort3>
<isSecure>false</isSecure>
</srstInfo>
<connectionMonitorDuration>120</connectionMonitorDuration>
</devicePool>
<commonProfile>
<phonePassword/>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>3</callLogBlfEnabled>
</commonProfile>
<loadInformation>CP7925G-1.4.8.4</loadInformation>
<vendorConfig>
<disableSpeaker>false</disableSpeaker>
<garp>0</garp>
<webAccess>2</webAccess>
<WlanProfile1>0</WlanProfile1>
<WlanProfile2>0</WlanProfile2>
<WlanProfile3>0</WlanProfile3>
<WlanProfile4>0</WlanProfile4>
<loadServer>MyAdminUsername</loadServer>
<adminPassword>MyPassword#$%^!</adminPassword>
<specialNumbers/>
<PushToTalkURL/>
<sendKeyAction>0</sendKeyAction>
<phoneBookWebAccess>0</phoneBookWebAccess>
<unlockSettingsSequence>1</unlockSettingsSequence>
<appButtonTimer>0</appButtonTimer>
<appButtonPriority>0</appButtonPriority>
<outOfRangeAlert>0</outOfRangeAlert>
<scanningMode>0</scanningMode>
<restrictDataRates>0</restrictDataRates>
<powerOffWhenCharging>0</powerOffWhenCharging>
<cdpEnable>1</cdpEnable>
<g722CodecSupport>0</g722CodecSupport>
<homeScreen>0</homeScreen>
<fipsMode>0</fipsMode>
<autoSelectLineEnable>0</autoSelectLineEnable>
<fileSystemVerificationEnable>0</fileSystemVerificationEnable>
<minimumRingVolume>0</minimumRingVolume>
<java>1</java>
</vendorConfig>
<commonConfig>
<sshAccess>1</sshAccess>
<RingLocale>0</RingLocale>
<companyPhotoDir>http://z.z.z.z/pictures/%%sAMAccountName%%.jpg</companyPhotoDir>
<ice/>
<instantMessaging/>
<desktopClient/>
</commonConfig>
<enterpriseConfig>
<ciscoCamera>1</ciscoCamera>
<energyWiseDomain>MyaAdminUsername</energyWiseDomain>
<energyWiseSecret>MyPassword#$%^!</energyWiseSecret>
<webProtocol>0</webProtocol>
<companyPhotoDir>http://z.z.z.z/pictures/%%sAMAccountName%%.jpg</companyPhotoDir>
<ice/>
<instantMessaging/>
<desktopClient/>
</enterpriseConfig>
<versionStamp>1234562241-013d4ba4-5b51-4be6-9792-b7165fff6d37</versionStamp>
<userLocale>
<name>English_United_States</name>
<uid>1</uid>
<langCode>en_US</langCode>
<version>10.0.0.0(1)</version>
<winCharSet>iso-8859-1</winCharSet>
</userLocale>
<networkLocale>United_States</networkLocale>
<networkLocaleInfo>
<name>United_States</name>
<uid>64</uid>
<version>10.0.0.0(1)</version>
</networkLocaleInfo>
<deviceSecurityMode>1</deviceSecurityMode>
<idleTimeout>0</idleTimeout>
<authenticationURL>http://z.z.z.z:8080/sccp/authenticate.php</authenticationURL>
<directoryURL>http://z.z.z.z:8080/sccp/xmldirectory.php</directoryURL>
<idleURL/>
<informationURL>http://z.z.z.z:8080/sccp/helptext.php</informationURL>
<messagesURL/>
<proxyServerURL/>
<servicesURL>http://z.z.z.z:8080/sccp/servicesmenu.php</servicesURL>
<secureAuthenticationURL>https://z.z.z.z:8443/sccp/authenticate.php</secureAuthenticationURL>
<secureDirectoryURL>https://z.z.z.z:8443/sccp/xmldirectory.php</secureDirectoryURL>
<secureIdleURL/>
<secureInformationURL>https://z.z.z.z:8443/sccp/helptext.php</secureInformationURL>
<secureMessagesURL/>
<secureServicesURL>https://z.z.z.z:8443/sccp/servicesmenu.php</secureServicesURL>
<dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig>
<dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices>
<dscpForCm2Dvce>96</dscpForCm2Dvce>
<transportLayerProtocol>1</transportLayerProtocol>
<dndCallAlert>5</dndCallAlert>
<phonePersonalization>0</phonePersonalization>
<rollover>0</rollover>
<singleButtonBarge>0</singleButtonBarge>
<joinAcrossLines>0</joinAcrossLines>
<autoCallPickupEnable>false</autoCallPickupEnable>
<blfAudibleAlertSettingOfIdleStation>0</blfAudibleAlertSettingOfIdleStation>
<blfAudibleAlertSettingOfBusyStation>0</blfAudibleAlertSettingOfBusyStation>
<capfAuthMode>0</capfAuthMode>
<capfList>
<capf>
<phonePort>3804</phonePort>
<processNodeName>y.y.y.y</processNodeName>
</capf>
</capfList>
<certHash/>
<encrConfig>false</encrConfig>
<advertiseG722Codec>0</advertiseG722Codec>
<mobility>
<handoffdn/>
<dtmfdn/>
<ivrdn/>
<dtmfHoldCode>*81</dtmfHoldCode>
<dtmfExclusiveHoldCode>*82</dtmfExclusiveHoldCode>
<dtmfResumeCode>*83</dtmfResumeCode>
<dtmfTxfCode>*84</dtmfTxfCode>
<dtmfCnfCode>*85</dtmfCnfCode>
</mobility>
<TLSResumptionTimer>3600</TLSResumptionTimer>
<userId/>
<ownerId/>
<phoneServices useHTTPS="true">
<provisioning>2</provisioning>
<phoneService type="1" category="0">
<name>Missed Calls</name>
<url>Application:Cisco/MissedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="2" category="0">
<name>Voicemail</name>
<url>Application:Cisco/Voicemail</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Received Calls</name>
<url>Application:Cisco/ReceivedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Placed Calls</name>
<url>Application:Cisco/PlacedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Personal Directory</name>
<url>Application:Cisco/PersonalDirectory</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Corporate Directory</name>
<url>Application:Cisco/CorporateDirectory</url>
<vendor/>
<version/>
</phoneService>
</phoneServices>
</device>

View file

@ -1,237 +0,0 @@
<?xml version="1.0"?>
<device ctiid="406" uuid="{aed907f9-9e22-72d8-c218-b7165fff6d37}">
<fullConfig>true</fullConfig>
<portalDefaultServer>x.x.x.x</portalDefaultServer>
<deviceProtocol>SCCP</deviceProtocol>
<sshUserId/>
<sshPassword/>
<ipAddressMode>0</ipAddressMode>
<allowAutoConfig>true</allowAutoConfig>
<dadEnable>true</dadEnable>
<redirectEnable>false</redirectEnable>
<echoMultiEnable>false</echoMultiEnable>
<ipPreferenceModeControl>0</ipPreferenceModeControl>
<ipMediaAddressFamilyPreference>0</ipMediaAddressFamilyPreference>
<tzdata>
<tzolsonversion>2016g</tzolsonversion>
<tzupdater>tzupdater.jar</tzupdater>
</tzdata>
<mlppDomainId>000000</mlppDomainId>
<mlppIndicationStatus>Off</mlppIndicationStatus>
<preemption>Disabled</preemption>
<executiveOverridePreemptable>false</executiveOverridePreemptable>
<devicePool uuid="{f8d7c5cb-5d3b-e6c0-0200-8608c8138e66}">
<revertPriority>0</revertPriority>
<name>MyDeviceName</name>
<dateTimeSetting uuid="{ce543907-40b1-efe8-21e1-bdd1853c9594}">
<name>timezone name</name>
<dateTemplate>M-D-Y</dateTemplate>
<timeZone/>
<olsonTimeZone>Europe/Amsterdam</olsonTimeZone>
<ntps>
<ntp>
<name>x.x.x.x</name>
<ntpMode>Directed Broadcast</ntpMode>
</ntp>
</ntps>
</dateTimeSetting>
<callManagerGroup>
<name>MyGroupName</name>
<tftpDefault>false</tftpDefault>
<members>
<member priority="0">
<callManager>
<name>My CM1 name</name>
<description>My CM Description</description>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
<sipPort>5060</sipPort>
<securedSipPort>5061</securedSipPort>
<mgcpPorts>
<listen>2427</listen>
<keepAlive>2428</keepAlive>
</mgcpPorts>
</ports>
<processNodeName>y.y.y.y</processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
<srstInfo uuid="{cd241e11-4a58-4d3d-9661-f06c912a18a3}">
<name>Disable</name>
<srstOption>Disable</srstOption>
<userModifiable>false</userModifiable>
<ipAddr1/>
<port1>2000</port1>
<ipAddr2/>
<port2>2000</port2>
<ipAddr3/>
<port3>2000</port3>
<sipIpAddr1/>
<sipPort1>5060</sipPort1>
<sipIpAddr2/>
<sipPort2>5060</sipPort2>
<sipIpAddr3/>
<sipPort3>5060</sipPort3>
<isSecure>false</isSecure>
</srstInfo>
<connectionMonitorDuration>120</connectionMonitorDuration>
</devicePool>
<commonProfile>
<phonePassword/>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>3</callLogBlfEnabled>
</commonProfile>
<loadInformation>CP7925G-1.4.8.4</loadInformation>
<vendorConfig>
<disableSpeaker>false</disableSpeaker>
<garp>0</garp>
<webAccess>2</webAccess>
<WlanProfile1>0</WlanProfile1>
<WlanProfile2>0</WlanProfile2>
<WlanProfile3>0</WlanProfile3>
<WlanProfile4>0</WlanProfile4>
<loadServer>MyAdminUsername</loadServer>
<adminPassword>MyPassword#$%^!</adminPassword>
<specialNumbers/>
<PushToTalkURL/>
<sendKeyAction>0</sendKeyAction>
<phoneBookWebAccess>0</phoneBookWebAccess>
<unlockSettingsSequence>1</unlockSettingsSequence>
<appButtonTimer>0</appButtonTimer>
<appButtonPriority>0</appButtonPriority>
<outOfRangeAlert>0</outOfRangeAlert>
<scanningMode>0</scanningMode>
<restrictDataRates>0</restrictDataRates>
<powerOffWhenCharging>0</powerOffWhenCharging>
<cdpEnable>1</cdpEnable>
<g722CodecSupport>0</g722CodecSupport>
<homeScreen>0</homeScreen>
<fipsMode>0</fipsMode>
<autoSelectLineEnable>0</autoSelectLineEnable>
<fileSystemVerificationEnable>0</fileSystemVerificationEnable>
<minimumRingVolume>0</minimumRingVolume>
<java>1</java>
</vendorConfig>
<commonConfig>
<sshAccess>1</sshAccess>
<RingLocale>0</RingLocale>
<companyPhotoDir>http://z.z.z.z/pictures/%%sAMAccountName%%.jpg</companyPhotoDir>
<ice/>
<instantMessaging/>
<desktopClient/>
</commonConfig>
<enterpriseConfig>
<ciscoCamera>1</ciscoCamera>
<energyWiseDomain>MyaAdminUsername</energyWiseDomain>
<energyWiseSecret>MyPassword#$%^!</energyWiseSecret>
<webProtocol>0</webProtocol>
<companyPhotoDir>http://z.z.z.z/pictures/%%sAMAccountName%%.jpg</companyPhotoDir>
<ice/>
<instantMessaging/>
<desktopClient/>
</enterpriseConfig>
<versionStamp>1234562241-013d4ba4-5b51-4be6-9792-b7165fff6d37</versionStamp>
<userLocale>
<name>English_United_States</name>
<uid>1</uid>
<langCode>en_US</langCode>
<version>10.0.0.0(1)</version>
<winCharSet>iso-8859-1</winCharSet>
</userLocale>
<networkLocale>United_States</networkLocale>
<networkLocaleInfo>
<name>United_States</name>
<uid>64</uid>
<version>10.0.0.0(1)</version>
</networkLocaleInfo>
<deviceSecurityMode>1</deviceSecurityMode>
<idleTimeout>0</idleTimeout>
<authenticationURL>http://z.z.z.z:8080/sccp/authenticate.php</authenticationURL>
<directoryURL>http://z.z.z.z:8080/sccp/xmldirectory.php</directoryURL>
<idleURL/>
<informationURL>http://z.z.z.z:8080/sccp/helptext.php</informationURL>
<messagesURL/>
<proxyServerURL/>
<servicesURL>http://z.z.z.z:8080/sccp/servicesmenu.php</servicesURL>
<secureAuthenticationURL>https://z.z.z.z:8443/sccp/authenticate.php</secureAuthenticationURL>
<secureDirectoryURL>https://z.z.z.z:8443/sccp/xmldirectory.php</secureDirectoryURL>
<secureIdleURL/>
<secureInformationURL>https://z.z.z.z:8443/sccp/helptext.php</secureInformationURL>
<secureMessagesURL/>
<secureServicesURL>https://z.z.z.z:8443/sccp/servicesmenu.php</secureServicesURL>
<dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig>
<dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices>
<dscpForCm2Dvce>96</dscpForCm2Dvce>
<transportLayerProtocol>1</transportLayerProtocol>
<dndCallAlert>5</dndCallAlert>
<phonePersonalization>0</phonePersonalization>
<rollover>0</rollover>
<singleButtonBarge>0</singleButtonBarge>
<joinAcrossLines>0</joinAcrossLines>
<autoCallPickupEnable>false</autoCallPickupEnable>
<blfAudibleAlertSettingOfIdleStation>0</blfAudibleAlertSettingOfIdleStation>
<blfAudibleAlertSettingOfBusyStation>0</blfAudibleAlertSettingOfBusyStation>
<capfAuthMode>0</capfAuthMode>
<capfList>
<capf>
<phonePort>3804</phonePort>
<processNodeName>y.y.y.y</processNodeName>
</capf>
</capfList>
<certHash/>
<encrConfig>false</encrConfig>
<advertiseG722Codec>0</advertiseG722Codec>
<mobility>
<handoffdn/>
<dtmfdn/>
<ivrdn/>
<dtmfHoldCode>*81</dtmfHoldCode>
<dtmfExclusiveHoldCode>*82</dtmfExclusiveHoldCode>
<dtmfResumeCode>*83</dtmfResumeCode>
<dtmfTxfCode>*84</dtmfTxfCode>
<dtmfCnfCode>*85</dtmfCnfCode>
</mobility>
<TLSResumptionTimer>3600</TLSResumptionTimer>
<userId/>
<ownerId/>
<phoneServices useHTTPS="true">
<provisioning>2</provisioning>
<phoneService type="1" category="0">
<name>Missed Calls</name>
<url>Application:Cisco/MissedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="2" category="0">
<name>Voicemail</name>
<url>Application:Cisco/Voicemail</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Received Calls</name>
<url>Application:Cisco/ReceivedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Placed Calls</name>
<url>Application:Cisco/PlacedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Personal Directory</name>
<url>Application:Cisco/PersonalDirectory</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Corporate Directory</name>
<url>Application:Cisco/CorporateDirectory</url>
<vendor/>
<version/>
</phoneService>
</phoneServices>
</device>

View file

@ -1,163 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<device>
<fullConfig>true</fullConfig>
<sshUserId>cisco</sshUserId>
<sshPassword>cisco</sshPassword>
<ipAddressMode>2</ipAddressMode>
<ipPreferenceModeControl>1</ipPreferenceModeControl>
<allowAutoConfig>true</allowAutoConfig>
<devicePool uuid="{1b1b9eb6-7803-11d3-bdf0-00108302ead1}">
<revertPriority>1</revertPriority>
<dateTimeSetting>
<dateTemplate>M/D/YA</dateTemplate>
<timeZone>Eastern Standard/Daylight Time</timeZone>
<ntps>
<ntp>
<name>213.109.127.195</name>
<ntpMode>Unicast</ntpMode>
</ntp>
</ntps>
</dateTimeSetting>
<callManagerGroup>
<members>
<member priority="0">
<callManager>
<name>pbxserver1</name>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
</ports>
<processNodeName>x.x.x.x</processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
<srstInfo>
<srstOption>Disable</srstOption>
<ipAddr1>x.x.x.x</ipAddr1>
<port1>2443</port1>
<ipAddr2/>
<port2/>
<isSecure>false</isSecure>
</srstInfo>
<connectionMonitorDuration>60</connectionMonitorDuration>
</devicePool>
<versionStamp>1b1b9eb6-7803-11d3-bdf0-00108302ead1</versionStamp>
<commonProfile>
<phonePassword>1234</phonePassword>
<defaultBackground>http://x.x.x.x/Chan-SCCP-b.png</defaultBackground>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>3</callLogBlfEnabled>
</commonProfile>
<vendorConfig>
<disableSpeaker>false</disableSpeaker>
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
<forwardingDelay>1</forwardingDelay>
<settingsAccess>1</settingsAccess>
<videoCapability>1</videoCapability>
<autoSelectLineEnable>0</autoSelectLineEnable>
<webAccess>0</webAccess>
<daysDisplayNotActive>1,7</daysDisplayNotActive>
<displayOnTime>08:30</displayOnTime>
<displayOnDuration>11:30</displayOnDuration>
<displayIdleTimeout>01:00</displayIdleTimeout>
<displayOnWhenIncomingCall>1</displayOnWhenIncomingCall>
<loggingDisplay>1</loggingDisplay>
<autoCallSelect>0</autoCallSelect>
<logServer>x.x.x.x:9001</logServer>
<enableCdpSwPort>1</enableCdpSwPort>
<enableCdpPcPort>1</enableCdpPcPort>
<enableLldpSwPort>1</enableLldpSwPort>
<enableLldpPcPort>1</enableLldpPcPort>
<lldpAssetId>Cisco Phone</lldpAssetId>
<powerPriority>1</powerPriority>
<detectCMConnectionFailure>0</detectCMConnectionFailure>
<g722CodecSupport>2</g722CodecSupport>
<sshAccess>0</sshAccess>
<pcPort>0</pcPort>
<spanToPCPort>0</spanToPCPort>
<callHoldRingback>1</callHoldRingback>
<rtcp>1</rtcp>
<rtpcontrolprotocol>1</rtpcontrolprotocol>
<videoRtcp>1</videoRtcp>
</vendorConfig>
<userLocale>
<name>English_United_States</name>
<uid>39</uid>
<langCode>en_US</langCode>
<version>9.3(2.9902)US</version>
<winCharSet>utf-8</winCharSet>
</userLocale>
<networkLocale>United_States</networkLocale>
<networkLocaleInfo>
<name>United_States</name>
<uid>64</uid>
<version>4.0(1)</version>
</networkLocaleInfo>
<informationURL>http://x.x.x.x/shiftkey/handle_shift.php</informationURL>
<authenticationURL>http://x.x.x.x/authenticate.php</authenticationURL>
<servicesURL>http://x.x.x.x/cisco/service.php?emcc=#EMCC#</servicesURL>
<directoryURL>http://x.x.x.x/CiscoDirectory/phonebook.php</directoryURL>
<messagesURL/>
<proxyServerURL/>
<dndCallAlert>5</dndCallAlert>
<dndReminderTimer>60</dndReminderTimer>
<phonePersonalization>0</phonePersonalization>
<rollover>0</rollover>
<singleButtonBarge>1</singleButtonBarge>
<joinAcrossLines>1</joinAcrossLines>
<autoCallPickupEnable>true</autoCallPickupEnable>
<blfAudibleAlertSettingOfIdleStation>1</blfAudibleAlertSettingOfIdleStation>
<blfAudibleAlertSettingOfBusyStation>1</blfAudibleAlertSettingOfBusyStation>
<advertiseG722Codec>1</advertiseG722Codec>
<userId>dkgroot</userId>
<transportLayerProtocol>2</transportLayerProtocol>
<deviceSecurityMode>1</deviceSecurityMode>
<dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig>
<dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices>
<dscpForCm2Dvce>184</dscpForCm2Dvce>
<phoneServices>
<provisioning>0</provisioning>
<phoneService type="1" category="0">
<name>Missed Calls</name>
<url>Application:Cisco/MissedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Received Calls</name>
<url>Application:Cisco/ReceivedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Placed Calls</name>
<url>Application:Cisco/PlacedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Personal Directory</name>
<url>Application:Cisco/PersonalDirectory</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="2" category="0">
<name>Voicemail</name>
<url>Application:Cisco/Voicemail</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="0" category="0">
<name>Services</name>
<url>http://x.x.x.x/cisco/service.php?emmcmode=#EMCC#</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="0" category="0">
<name>Login</name>
<url>http://x.x.x.x/cisco/service.php?name=#DEVICENAME#&amp;emmcmode=#EMCC#&amp;action=loginform</url>
<vendor/>
<version/>
</phoneService>
</phoneServices>
</device>

View file

@ -1,163 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<device>
<fullConfig>true</fullConfig>
<sshUserId>cisco</sshUserId>
<sshPassword>cisco</sshPassword>
<ipAddressMode>2</ipAddressMode>
<ipPreferenceModeControl>1</ipPreferenceModeControl>
<allowAutoConfig>true</allowAutoConfig>
<devicePool uuid="{1b1b9eb6-7803-11d3-bdf0-00108302ead1}">
<revertPriority>1</revertPriority>
<dateTimeSetting>
<dateTemplate>M/D/YA</dateTemplate>
<timeZone>Eastern Standard/Daylight Time</timeZone>
<ntps>
<ntp>
<name>213.109.127.195</name>
<ntpMode>Unicast</ntpMode>
</ntp>
</ntps>
</dateTimeSetting>
<callManagerGroup>
<members>
<member priority="0">
<callManager>
<name>pbxserver1</name>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
</ports>
<processNodeName>x.x.x.x</processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
<srstInfo>
<srstOption>Disable</srstOption>
<ipAddr1>x.x.x.x</ipAddr1>
<port1>2443</port1>
<ipAddr2/>
<port2/>
<isSecure>false</isSecure>
</srstInfo>
<connectionMonitorDuration>60</connectionMonitorDuration>
</devicePool>
<versionStamp>1b1b9eb6-7803-11d3-bdf0-00108302ead1</versionStamp>
<commonProfile>
<phonePassword>1234</phonePassword>
<defaultBackground>http://x.x.x.x/Chan-SCCP-b.png</defaultBackground>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>3</callLogBlfEnabled>
</commonProfile>
<vendorConfig>
<disableSpeaker>false</disableSpeaker>
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
<forwardingDelay>1</forwardingDelay>
<settingsAccess>1</settingsAccess>
<videoCapability>1</videoCapability>
<autoSelectLineEnable>0</autoSelectLineEnable>
<webAccess>0</webAccess>
<daysDisplayNotActive>1,7</daysDisplayNotActive>
<displayOnTime>08:30</displayOnTime>
<displayOnDuration>11:30</displayOnDuration>
<displayIdleTimeout>01:00</displayIdleTimeout>
<displayOnWhenIncomingCall>1</displayOnWhenIncomingCall>
<loggingDisplay>1</loggingDisplay>
<autoCallSelect>0</autoCallSelect>
<logServer>x.x.x.x:9001</logServer>
<enableCdpSwPort>1</enableCdpSwPort>
<enableCdpPcPort>1</enableCdpPcPort>
<enableLldpSwPort>1</enableLldpSwPort>
<enableLldpPcPort>1</enableLldpPcPort>
<lldpAssetId>Cisco Phone</lldpAssetId>
<powerPriority>1</powerPriority>
<detectCMConnectionFailure>0</detectCMConnectionFailure>
<g722CodecSupport>2</g722CodecSupport>
<sshAccess>0</sshAccess>
<pcPort>0</pcPort>
<spanToPCPort>0</spanToPCPort>
<callHoldRingback>1</callHoldRingback>
<rtcp>1</rtcp>
<rtpcontrolprotocol>1</rtpcontrolprotocol>
<videoRtcp>1</videoRtcp>
</vendorConfig>
<userLocale>
<name>English_United_States</name>
<uid>39</uid>
<langCode>en_US</langCode>
<version>9.3(2.9902)US</version>
<winCharSet>utf-8</winCharSet>
</userLocale>
<networkLocale>United_States</networkLocale>
<networkLocaleInfo>
<name>United_States</name>
<uid>64</uid>
<version>4.0(1)</version>
</networkLocaleInfo>
<informationURL>http://x.x.x.x/shiftkey/handle_shift.php</informationURL>
<authenticationURL>http://x.x.x.x/authenticate.php</authenticationURL>
<!--<servicesURL>http://x.x.x.x/cisco/service.php?emcc=#EMCC#</servicesURL>-->
<directoryURL>http://x.x.x.x/CiscoDirectory/phonebook.php</directoryURL>
<messagesURL/>
<proxyServerURL/>
<dndCallAlert>5</dndCallAlert>
<dndReminderTimer>60</dndReminderTimer>
<phonePersonalization>0</phonePersonalization>
<rollover>0</rollover>
<singleButtonBarge>1</singleButtonBarge>
<joinAcrossLines>1</joinAcrossLines>
<autoCallPickupEnable>true</autoCallPickupEnable>
<blfAudibleAlertSettingOfIdleStation>1</blfAudibleAlertSettingOfIdleStation>
<blfAudibleAlertSettingOfBusyStation>1</blfAudibleAlertSettingOfBusyStation>
<advertiseG722Codec>1</advertiseG722Codec>
<userId>dkgroot</userId>
<transportLayerProtocol>2</transportLayerProtocol>
<deviceSecurityMode>1</deviceSecurityMode>
<dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig>
<dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices>
<dscpForCm2Dvce>184</dscpForCm2Dvce>
<phoneServices>
<provisioning>0</provisioning>
<phoneService type="1" category="0">
<name>Missed Calls</name>
<url>Application:Cisco/MissedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Received Calls</name>
<url>Application:Cisco/ReceivedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Placed Calls</name>
<url>Application:Cisco/PlacedCalls</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="1" category="0">
<name>Personal Directory</name>
<url>Application:Cisco/PersonalDirectory</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="2" category="0">
<name>Voicemail</name>
<url>Application:Cisco/Voicemail</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="0" category="0">
<name>Services</name>
<url>http://x.x.x.x/cisco/service.php?emmcmode=#EMCC#</url>
<vendor/>
<version/>
</phoneService>
<phoneService type="0" category="0">
<name>Login</name>
<url>http://x.x.x.x/cisco/service.php?name=#DEVICENAME#&amp;emmcmode=#EMCC#&amp;action=loginform</url>
<vendor/>
<version/>
</phoneService>
</phoneServices>
</device>

View file

@ -1,255 +0,0 @@
<device>
<fullConfig>true</fullConfig>
<deviceProtocol>SIP</deviceProtocol>
<devicePool>
<dateTimeSetting>
<dateTemplate>D/M/Y</dateTemplate>
<timeZone></timeZone>
<ntps>
<ntp>
<name></name>
<ntpMode>unicast</ntpMode>
</ntp>
</ntps>
</dateTimeSetting>
<callManagerGroup>
<members>
<member priority="0">
<callManager>
<ports>
<sipPort>5060</sipPort>
<securedSipPort>5061</securedSipPort>
</ports>
<processNodeName></processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
</devicePool>
<sipProfile>
<sipProxies>
<registerWithProxy>true</registerWithProxy>
<backupProxy>$ASTERISK</backupProxy>
<backupProxyPort>5060</backupProxyPort>
<emergencyProxy>$ASTERISK</emergencyProxy>
<emergencyProxyPort>5060</emergencyProxyPort>
<outboundProxy>$ASTERISK</outboundProxy>
<outboundProxyPort>5060</outboundProxyPort>
</sipProxies>
<sipCallFeatures>
<cnfJoinEnabled>true</cnfJoinEnabled>
<callForwardURI>x-cisco-serviceuri-cfwdall</callForwardURI>
<callPickupURI>x-cisco-serviceuri-pickup</callPickupURI>
<callPickupListURI>x-cisco-serviceuri-opickup</callPickupListURI>
<callPickupGroupURI>x-cisco-serviceuri-gpickup</callPickupGroupURI>
<meetMeServiceURI>x-cisco-serviceuri-meetme</meetMeServiceURI>
<abbreviatedDialURI>x-cisco-serviceuri-abbrdial</abbreviatedDialURI>
<rfc2543Hold>false</rfc2543Hold>
<callHoldRingback>1</callHoldRingback>
<localCfwdEnable>true</localCfwdEnable>
<semiAttendedTransfer>true</semiAttendedTransfer>
<anonymousCallBlock>3</anonymousCallBlock>
<callerIdBlocking>3</callerIdBlocking>
<dndControl>0</dndControl>
<remoteCcEnable>true</remoteCcEnable>
<retainForwardInformation>false</retainForwardInformation>
</sipCallFeatures>
<sipStack>
<sipInviteRetx>6</sipInviteRetx>
<sipRetx>10</sipRetx>
<timerInviteExpires>180</timerInviteExpires>
<timerRegisterExpires>3600</timerRegisterExpires>
<timerRegisterDelta>5</timerRegisterDelta>
<timerKeepAliveExpires>120</timerKeepAliveExpires>
<timerSubscribeExpires>120</timerSubscribeExpires>
<timerSubscribeDelta>5</timerSubscribeDelta>
<timerT1>500</timerT1>
<timerT2>4000</timerT2>
<maxRedirects>70</maxRedirects>
<remotePartyID>true</remotePartyID>
<userInfo>Phone</userInfo>
</sipStack>
<autoAnswerTimer>1</autoAnswerTimer>
<autoAnswerAltBehavior>false</autoAnswerAltBehavior>
<autoAnswerOverride>true</autoAnswerOverride>
<transferOnhookEnabled>true</transferOnhookEnabled>
<enableVad>false</enableVad>
<preferredCodec>g711alaw</preferredCodec>
<dtmfAvtPayload>101</dtmfAvtPayload>
<dtmfDbLevel>3</dtmfDbLevel>
<dtmfOutofBand>avt</dtmfOutofBand>
<alwaysUsePrimeLine>false</alwaysUsePrimeLine>
<alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail>
<kpml>0</kpml>
<phoneLabel></phoneLabel>
<stutterMsgWaiting>0</stutterMsgWaiting>
<callStats>true</callStats>
<offhookToFirstDigitTimer>15000</offhookToFirstDigitTimer>
<silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts>
<disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig>
<startMediaPort>16384</startMediaPort>
<stopMediaPort>32766</stopMediaPort>
<natEnabled>false</natEnabled>
<natReceivedProcessing>false</natReceivedProcessing>
<natAddress></natAddress>
<sipLines>
<line button="1" lineIndex="1">
<featureID>9</featureID>
<featureLabel></featureLabel>
<proxy>USECALLMANAGER</proxy>
<port>5060</port>
<name></name>
<displayName></displayName>
<autoAnswer>
<autoAnswerEnabled>0</autoAnswerEnabled>
</autoAnswer>
<callWaiting>3</callWaiting>
<authName></authName>
<authPassword></authPassword>
<contact></contact>
<sharedLine>false</sharedLine>
<messageWaitingLampPolicy>3</messageWaitingLampPolicy>
<messageWaitingAMWI>0</messageWaitingAMWI>
<messagesNumber></messagesNumber>
<ringSettingIdle>4</ringSettingIdle>
<ringSettingActive>5</ringSettingActive>
<forwardCallInfoDisplay>
<callerName>true</callerName>
<callerNumber>true</callerNumber>
<redirectedNumber>false</redirectedNumber>
<dialedNumber>true</dialedNumber>
</forwardCallInfoDisplay>
<maxNumCalls>5</maxNumCalls>
<busyTrigger>4</busyTrigger>
</line>
</sipLines>
<externalNumberMask></externalNumberMask>
<voipControlPort>5060</voipControlPort>
<dscpForAudio>184</dscpForAudio>
<ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy>
<dialTemplate></dialTemplate>
<softKeyFile></softKeyFile>
</sipProfile>
<MissedCallLoggingOption>1</MissedCallLoggingOption>
<commonProfile>
<phonePassword></phonePassword>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>2</callLogBlfEnabled>
</commonProfile>
<vendorConfig>
<disableSpeaker>false</disableSpeaker>
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
<enableMuteFeature>false</enableMuteFeature>
<enableGroupListen>true</enableGroupListen>
<pcPort>0</pcPort>
<spanToPCPort>1</spanToPCPort>
<garp>0</garp>
<rtcp>1</rtcp>
<voiceVlanAccess>0</voiceVlanAccess>
<videoCapability>1</videoCapability>
<ehookEnable>0</ehookEnable>
<autoSelectLineEnable>1</autoSelectLineEnable>
<autoCallSelect>1</autoCallSelect>
<minimumRingVolume></minimumRingVolume>
<settingsAccess>1</settingsAccess>
<webProtocol>0</webProtocol>
<webAccess>0</webAccess>
<sshAccess>0</sshAccess>
<detectCMConnectionFailure>0</detectCMConnectionFailure>
<g722CodecSupport>1</g722CodecSupport>
<handsetWidebandEnable>2</handsetWidebandEnable>
<headsetWidebandEnable>2</headsetWidebandEnable>
<headsetWidebandUIControl>1</headsetWidebandUIControl>
<handsetWidebandUIControl>1</handsetWidebandUIControl>
<daysDisplayNotActive>1,7</daysDisplayNotActive>
<displayOnTime>08:00</displayOnTime>
<displayOnDuration>10:00</displayOnDuration>
<displayIdleTimeout>00:10</displayIdleTimeout>
<displayOnWhenIncomingCall>1</displayOnWhenIncomingCall>
<displayRefreshRate>0</displayRefreshRate>
<recordingTone>0</recordingTone>
<recordingToneLocalVolume>100</recordingToneLocalVolume>
<recordingToneRemoteVolume>50</recordingToneRemoteVolume>
<recordingToneDuration></recordingToneDuration>
<moreKeyReversionTimer>5</moreKeyReversionTimer>
<peerFirmwareSharing>0</peerFirmwareSharing>
<loadServer></loadServer>
<enableCdpSwPort>1</enableCdpSwPort>
<enableCdpPcPort>0</enableCdpPcPort>
<enableLldpSwPort>1</enableLldpSwPort>
<enableLldpPcPort>0</enableLldpPcPort>
</vendorConfig>
<versionStamp>d902ed5a-c1e5-4233-b1d6-a960d53d1c3a</versionStamp>
<loadInformation></loadInformation>
<phoneServices useHTTPS="false">
<provisioning>2</provisioning>
<phoneService type="1" category="0">
<name>Missed Calls</name>
<url>Application:Cisco/MissedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="1" category="0">
<name>Received Calls</name>
<url>Application:Cisco/ReceivedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="1" category="0">
<name>Placed Calls</name>
<url>Application:Cisco/PlacedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="2" category="0">
<name>Voicemail</name>
<url>Application:Cisco/Voicemail</url>
<vendor></vendor>
<version></version>
</phoneService>
</phoneServices>
<userLocale>
<name></name>
<uid>1</uid>
<langCode></langCode>
<version>10</version>
<winCharSet>utf-8</winCharSet>
</userLocale>
<networkLocale></networkLocale>
<networkLocaleInfo>
<name></name>
<version>10</version>
</networkLocaleInfo>
<deviceSecurityMode>1</deviceSecurityMode>
<idleTimeout>0</idleTimeout>
<authenticationURL></authenticationURL>
<messagesURL></messagesURL>
<servicesURL></servicesURL>
<directoryURL></directoryURL>
<idleURL></idleURL>
<informationURL></informationURL>
<proxyServerURL></proxyServerURL>
<secureAuthenticationURL></secureAuthenticationURL>
<secureMessagesURL></secureMessagesURL>
<secureServicesURL></secureServicesURL>
<secureDirectoryURL></secureDirectoryURL>
<secureInformationURL></secureInformationURL>
<secureIdleURL></secureIdleURL>
<transportLayerProtocol>1</transportLayerProtocol>
<TLSResumptionTimer>3600</TLSResumptionTimer>
<phonePersonalization>1</phonePersonalization>
<autoCallPickupEnable>true</autoCallPickupEnable>
<blfAudibleAlertSettingOfIdleStation>0</blfAudibleAlertSettingOfIdleStation>
<blfAudibleAlertSettingOfBusyStation>0</blfAudibleAlertSettingOfBusyStation>
<dndCallAlert>1</dndCallAlert>
<dndReminderTimer>5</dndReminderTimer>
<advertiseG722Codec>1</advertiseG722Codec>
<rollover>0</rollover>
<joinAcrossLines>0</joinAcrossLines>
<capfAuthMode>0</capfAuthMode>
<capfList></capfList>
<certHash></certHash>
<encrConfig>false</encrConfig>
<sshUserId></sshUserId>
<sshPassword></sshPassword>
</device>

View file

@ -1,300 +0,0 @@
<device>
<fullConfig>true</fullConfig>
<deviceProtocol>SIP</deviceProtocol>
<devicePool>
<dateTimeSetting>
<dateTemplate>D/M/Y</dateTemplate>
<timeZone></timeZone>
<ntps>
<ntp>
<name></name>
<ntpMode>unicast</ntpMode>
</ntp>
</ntps>
</dateTimeSetting>
<callManagerGroup>
<members>
<member priority="0">
<callManager>
<ports>
<sipPort>5060</sipPort>
<securedSipPort>5061</securedSipPort>
</ports>
<processNodeName></processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
</devicePool>
<sipProfile>
<sipProxies>
<registerWithProxy>true</registerWithProxy>
</sipProxies>
<sipCallFeatures>
<cnfJoinEnabled>true</cnfJoinEnabled>
<callForwardURI>x-cisco-serviceuri-cfwdall</callForwardURI>
<callPickupURI>x-cisco-serviceuri-pickup</callPickupURI>
<callPickupListURI>x-cisco-serviceuri-opickup</callPickupListURI>
<callPickupGroupURI>x-cisco-serviceuri-gpickup</callPickupGroupURI>
<meetMeServiceURI>x-cisco-serviceuri-meetme</meetMeServiceURI>
<abbreviatedDialURI>x-cisco-serviceuri-abbrdial</abbreviatedDialURI>
<rfc2543Hold>false</rfc2543Hold>
<callHoldRingback>1</callHoldRingback>
<localCfwdEnable>true</localCfwdEnable>
<semiAttendedTransfer>true</semiAttendedTransfer>
<anonymousCallBlock>3</anonymousCallBlock>
<callerIdBlocking>3</callerIdBlocking>
<dndControl>0</dndControl>
<remoteCcEnable>true</remoteCcEnable>
<retainForwardInformation>false</retainForwardInformation>
<uriDialingDisplayPreference>1</uriDialingDisplayPreference>
</sipCallFeatures>
<sipStack>
<sipInviteRetx>6</sipInviteRetx>
<sipRetx>10</sipRetx>
<timerInviteExpires>180</timerInviteExpires>
<timerRegisterExpires>3600</timerRegisterExpires>
<timerRegisterDelta>5</timerRegisterDelta>
<timerKeepAliveExpires>120</timerKeepAliveExpires>
<timerSubscribeExpires>120</timerSubscribeExpires>
<timerSubscribeDelta>5</timerSubscribeDelta>
<timerT1>500</timerT1>
<timerT2>4000</timerT2>
<maxRedirects>70</maxRedirects>
<remotePartyID>true</remotePartyID>
<userInfo>Phone</userInfo>
</sipStack>
<autoAnswerTimer>1</autoAnswerTimer>
<autoAnswerAltBehavior>false</autoAnswerAltBehavior>
<autoAnswerOverride>true</autoAnswerOverride>
<transferOnhookEnabled>true</transferOnhookEnabled>
<enableVad>false</enableVad>
<preferredCodec>none</preferredCodec>
<dtmfAvtPayload>101</dtmfAvtPayload>
<dtmfDbLevel>3</dtmfDbLevel>
<dtmfOutofBand>avt</dtmfOutofBand>
<alwaysUsePrimeLine>false</alwaysUsePrimeLine>
<alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail>
<kpml>0</kpml>
<phoneLabel></phoneLabel>
<stutterMsgWaiting>0</stutterMsgWaiting>
<callStats>true</callStats>
<offhookToFirstDigitTimer>15000</offhookToFirstDigitTimer>
<silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts>
<disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig>
<startMediaPort>16384</startMediaPort>
<stopMediaPort>32766</stopMediaPort>
<natEnabled>false</natEnabled>
<natReceivedProcessing>false</natReceivedProcessing>
<natAddress></natAddress>
<sipLines>
<line button="1" lineIndex="1">
<featureID>9</featureID>
<featureLabel></featureLabel>
<proxy>USECALLMANAGER</proxy>
<port>5060</port>
<name></name>
<displayName></displayName>
<autoAnswer>
<autoAnswerEnabled>0</autoAnswerEnabled>
</autoAnswer>
<callWaiting>3</callWaiting>
<authName></authName>
<authPassword></authPassword>
<contact></contact>
<sharedLine>false</sharedLine>
<messageWaitingLampPolicy>3</messageWaitingLampPolicy>
<messageWaitingAMWI>0</messageWaitingAMWI>
<messagesNumber></messagesNumber>
<ringSettingIdle>4</ringSettingIdle>
<ringSettingActive>5</ringSettingActive>
<forwardCallInfoDisplay>
<callerName>true</callerName>
<callerNumber>true</callerNumber>
<redirectedNumber>false</redirectedNumber>
<dialedNumber>true</dialedNumber>
</forwardCallInfoDisplay>
<maxNumCalls>5</maxNumCalls>
<busyTrigger>4</busyTrigger>
</line>
</sipLines>
<externalNumberMask></externalNumberMask>
<voipControlPort>5060</voipControlPort>
<dscpForAudio>184</dscpForAudio>
<ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy>
<dialTemplate></dialTemplate>
<softKeyFile></softKeyFile>
</sipProfile>
<MissedCallLoggingOption>1</MissedCallLoggingOption>
<featurePolicyFile></featurePolicyFile>
<commonProfile>
<phonePassword></phonePassword>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>2</callLogBlfEnabled>
</commonProfile>
<vendorConfig>
<defaultWallpaperFile></defaultWallpaperFile>
<disableSpeaker>false</disableSpeaker>
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
<enableMuteFeature>false</enableMuteFeature>
<enableGroupListen>true</enableGroupListen>
<holdResumeKey>1</holdResumeKey>
<recentsSoftKey>1</recentsSoftKey>
<dfBit>1</dfBit>
<pcPort>0</pcPort>
<spanToPCPort>1</spanToPCPort>
<garp>0</garp>
<rtcp>1</rtcp>
<videoRtcp>1</videoRtcp>
<voiceVlanAccess>0</voiceVlanAccess>
<videoCapability>1</videoCapability>
<hideVideoByDefault>0</hideVideoByDefault>
<separateMute>0</separateMute>
<ciscoCamera>1</ciscoCamera>
<usb1>1</usb1>
<usb2>1</usb2>
<usbClasses>0,1,2</usbClasses>
<sdio>1</sdio>
<wifi>1</wifi>
<bluetooth>1</bluetooth>
<bluetoothProfile>0,1</bluetoothProfile>
<btpbap>0</btpbap>
<bthfu>0</bthfu>
<ehookEnable>0</ehookEnable>
<autoSelectLineEnable>1</autoSelectLineEnable>
<autoCallSelect>1</autoCallSelect>
<incomingCallToastTimer>10</incomingCallToastTimer>
<dialToneFromReleaseKey>0</dialToneFromReleaseKey>
<joinAndDirectTransferPolicy>0</joinAndDirectTransferPolicy>
<minimumRingVolume></minimumRingVolume>
<simplifiedNewCall>0</simplifiedNewCall>
<actionableAlert>0</actionableAlert>
<showCallHistoryForSelectedLine>0</showCallHistoryForSelectedLine>
<kemOneColumn>0</kemOneColumn>
<lineMode>0</lineMode>
<allCallsOnPrimary>0</allCallsOnPrimary>
<softKeyControl>0</softKeyControl>
<settingsAccess>1</settingsAccess>
<webProtocol>0</webProtocol>
<webAccess>0</webAccess>
<webAdmin>1</webAdmin>
<adminPassword></adminPassword>
<sshAccess>0</sshAccess>
<detectCMConnectionFailure>0</detectCMConnectionFailure>
<g722CodecSupport>1</g722CodecSupport>
<handsetWidebandEnable>2</handsetWidebandEnable>
<headsetWidebandEnable>2</headsetWidebandEnable>
<headsetWidebandUIControl>1</headsetWidebandUIControl>
<handsetWidebandUIControl>1</handsetWidebandUIControl>
<daysDisplayNotActive>1,7</daysDisplayNotActive>
<displayOnTime>08:00</displayOnTime>
<displayOnDuration>10:00</displayOnDuration>
<displayIdleTimeout>00:10</displayIdleTimeout>
<displayOnWhenIncomingCall>1</displayOnWhenIncomingCall>
<displayRefreshRate>0</displayRefreshRate>
<daysBacklightNotActive>1,7</daysBacklightNotActive>
<backlightOnTime>08:00</backlightOnTime>
<backlightOnDuration>10:00</backlightOnDuration>
<backlightIdleTimeout>00:10</backlightIdleTimeout>
<backlightOnWhenIncomingCall>1</backlightOnWhenIncomingCall>
<recordingTone>0</recordingTone>
<recordingToneLocalVolume>100</recordingToneLocalVolume>
<recordingToneRemoteVolume>50</recordingToneRemoteVolume>
<recordingToneDuration></recordingToneDuration>
<moreKeyReversionTimer>5</moreKeyReversionTimer>
<peerFirmwareSharing>0</peerFirmwareSharing>
<loadServer></loadServer>
<problemReportUploadURL></problemReportUploadURL>
<enableCdpSwPort>1</enableCdpSwPort>
<enableCdpPcPort>0</enableCdpPcPort>
<enableLldpSwPort>1</enableLldpSwPort>
<enableLldpPcPort>0</enableLldpPcPort>
<cdpEnable>true</cdpEnable>
<outOfRangeAlert>0</outOfRangeAlert>
<scanningMode>2</scanningMode>
<applicationURL></applicationURL>
<appButtonTimer>0</appButtonTimer>
<appButtonPriority>0</appButtonPriority>
<specialNumbers></specialNumbers>
<sendKeyAction>0</sendKeyAction>
<powerOffWhenCharging>0</powerOffWhenCharging>
<homeScreen>0</homeScreen>
<accessContacts>1</accessContacts>
<accessFavorites>1</accessFavorites>
<accessVoicemail>1</accessVoicemail>
<accessApps>1</accessApps>
</vendorConfig>
<versionStamp>d902ed5a-c1e5-4233-b1d6-a960d53d1c3a</versionStamp>
<loadInformation></loadInformation>
<phoneServices useHTTPS="false">
<provisioning>2</provisioning>
<phoneService type="1" category="0">
<name>Missed Calls</name>
<url>Application:Cisco/MissedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="1" category="0">
<name>Received Calls</name>
<url>Application:Cisco/ReceivedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="1" category="0">
<name>Placed Calls</name>
<url>Application:Cisco/PlacedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="2" category="0">
<name>Voicemail</name>
<url>Application:Cisco/Voicemail</url>
<vendor></vendor>
<version></version>
</phoneService>
</phoneServices>
<userLocale>
<name></name>
<uid>1</uid>
<langCode></langCode>
<version></version>
<winCharSet>utf-8</winCharSet>
</userLocale>
<networkLocale></networkLocale>
<networkLocaleInfo>
<name></name>
<version></version>
</networkLocaleInfo>
<deviceSecurityMode>1</deviceSecurityMode>
<idleTimeout>0</idleTimeout>
<authenticationURL></authenticationURL>
<messagesURL></messagesURL>
<servicesURL></servicesURL>
<directoryURL></directoryURL>
<idleURL></idleURL>
<informationURL></informationURL>
<proxyServerURL></proxyServerURL>
<secureAuthenticationURL></secureAuthenticationURL>
<secureMessagesURL></secureMessagesURL>
<secureServicesURL></secureServicesURL>
<secureDirectoryURL></secureDirectoryURL>
<secureInformationURL></secureInformationURL>
<secureIdleURL></secureIdleURL>
<transportLayerProtocol>1</transportLayerProtocol>
<TLSResumptionTimer>3600</TLSResumptionTimer>
<phonePersonalization>1</phonePersonalization>
<autoCallPickupEnable>true</autoCallPickupEnable>
<blfAudibleAlertSettingOfIdleStation>0</blfAudibleAlertSettingOfIdleStation>
<blfAudibleAlertSettingOfBusyStation>0</blfAudibleAlertSettingOfBusyStation>
<dndCallAlert>1</dndCallAlert>
<dndReminderTimer>5</dndReminderTimer>
<advertiseG722Codec>1</advertiseG722Codec>
<rollover>0</rollover>
<joinAcrossLines>0</joinAcrossLines>
<capfAuthMode>0</capfAuthMode>
<capfList></capfList>
<certHash></certHash>
<encrConfig>false</encrConfig>
<sshUserId></sshUserId>
<sshPassword></sshPassword>
</device>

View file

@ -1,201 +0,0 @@
<softKeyCfg>
<versionStamp>0200d4f8-e302-4315-b91e-9490e0b37fc5</versionStamp>
<typeSoftKey>
<softKeyDef keyID="Undefined">
<tag>0</tag>
<eventID>0</eventID>
<helpID>0</helpID>
</softKeyDef>
<softKeyDef keyID="Redial">
<tag>1</tag>
<eventID>1</eventID>
<helpID>301</helpID>
</softKeyDef>
<softKeyDef keyID="NewCall">
<tag>2</tag>
<eventID>2</eventID>
<helpID>302</helpID>
</softKeyDef>
<softKeyDef keyID="Hold">
<tag>3</tag>
<eventID>3</eventID>
<helpID>303</helpID>
</softKeyDef>
<softKeyDef keyID="Transfer">
<tag>4</tag>
<eventID>4</eventID>
<helpID>304</helpID>
</softKeyDef>
<softKeyDef keyID="CFwdAll">
<tag>5</tag>
<eventID>5</eventID>
<helpID>305</helpID>
</softKeyDef>
<softKeyDef keyID="&lt;&lt;">
<tag>8</tag>
<eventID>8</eventID>
<helpID>308</helpID>
</softKeyDef>
<softKeyDef keyID="EndCall">
<tag>9</tag>
<eventID>9</eventID>
<helpID>309</helpID>
</softKeyDef>
<softKeyDef keyID="Resume">
<tag>10</tag>
<eventID>10</eventID>
<helpID>310</helpID>
</softKeyDef>
<softKeyDef keyID="Answer">
<tag>11</tag>
<eventID>11</eventID>
<helpID>311</helpID>
</softKeyDef>
<softKeyDef keyID="Confrn">
<tag>13</tag>
<eventID>13</eventID>
<helpID>313</helpID>
</softKeyDef>
<softKeyDef keyID="Park">
<tag>14</tag>
<eventID>14</eventID>
<helpID>314</helpID>
</softKeyDef>
<softKeyDef keyID="Join">
<tag>15</tag>
<eventID>15</eventID>
<helpID>315</helpID>
</softKeyDef>
<softKeyDef keyID="MeetMe">
<tag>16</tag>
<eventID>16</eventID>
<helpID>316</helpID>
</softKeyDef>
<softKeyDef keyID="PickUp">
<tag>17</tag>
<eventID>17</eventID>
<helpID>317</helpID>
</softKeyDef>
<softKeyDef keyID="GPickUp">
<tag>18</tag>
<eventID>18</eventID>
<helpID>318</helpID>
</softKeyDef>
<softKeyDef keyID="RmLstC">
<tag>57</tag>
<eventID>19</eventID>
<helpID>319</helpID>
</softKeyDef>
<softKeyDef keyID="DND">
<tag>63</tag>
<eventID>69</eventID>
<helpID>369</helpID>
</softKeyDef>
<softKeyDef keyID="CallBack">
<tag>65</tag>
<eventID>20</eventID>
<helpID>320</helpID>
</softKeyDef>
<softKeyDef keyID="QRT">
<tag>75</tag>
<eventID>22</eventID>
<helpID>322</helpID>
</softKeyDef>
<softKeyDef keyID="MCID">
<tag>76</tag>
<eventID>27</eventID>
<helpID>327</helpID>
</softKeyDef>
<softKeyDef keyID="Select">
<tag>78</tag>
<eventID>29</eventID>
<helpID>329</helpID>
</softKeyDef>
<softKeyDef keyID="ConfList">
<tag>79</tag>
<eventID>30</eventID>
<helpID>330</helpID>
</softKeyDef>
<softKeyDef keyID="iDivert">
<tag>80</tag>
<eventID>31</eventID>
<helpID>331</helpID>
</softKeyDef>
<softKeyDef keyID="OPickUp">
<tag>91</tag>
<eventID>34</eventID>
<helpID>334</helpID>
</softKeyDef>
<softKeyDef keyID="HLog">
<tag>92</tag>
<eventID>35</eventID>
<helpID>335</helpID>
</softKeyDef>
<softKeyDef keyID="AbbrDial">
<tag>7740</tag>
<eventID>71</eventID>
<helpID>371</helpID>
</softKeyDef>
<softKeyDef keyID="Record">
<tag>7747</tag>
<eventID>74</eventID>
<helpID>374</helpID>
</softKeyDef>
</typeSoftKey>
<softKeySets>
<softKeySet id="On Hook">
<softKey keyID="Redial" />
<softKey keyID="NewCall" />
<softKey keyID="DND" />
<softKey keyID="CFwdAll" />
</softKeySet>
<softKeySet id="Off Hook">
<softKey keyID="Redial" />
<softKey keyID="EndCall" />
<softKey keyID="PickUp" />
</softKeySet>
<softKeySet id="Off Hook With Feature">
<softKey keyID="Redial" />
<softKey keyID="EndCall" />
</softKeySet>
<softKeySet id="Digits After First">
<softKey keyID="&lt;&lt;" />
<softKey keyID="EndCall" />
</softKeySet>
<softKeySet id="Ring Out">
<softKey keyID="Undefined" />
<softKey keyID="EndCall" />
</softKeySet>
<softKeySet id="Connected">
<softKey keyID="Hold" />
<softKey keyID="EndCall" />
<softKey keyID="Transfer" />
<softKey keyID="Confrn" />
<softKey keyID="ConfList" />
<softKey keyID="Park" />
</softKeySet>
<softKeySet id="Connected No Feature">
<softKey keyID="Undefined" />
<softKey keyID="EndCall" />
</softKeySet>
<softKeySet id="Connected Transfer">
<softKey keyID="Undefined" />
<softKey keyID="EndCall" />
<softKey keyID="Transfer" />
</softKeySet>
<softKeySet id="Connected Conference">
<softKey keyID="Undefined" />
<softKey keyID="EndCall" />
<softKey keyID="Confrn" />
<softKey keyID="ConfList" />
</softKeySet>
<softKeySet id="On Hold">
<softKey keyID="Resume" />
<softKey keyID="NewCall" />
</softKeySet>
<softKeySet id="Ring In">
<softKey keyID="Answer" />
<softKey keyID="iDivert" />
</softKeySet>
</softKeySets>
</softKeyCfg>

View file

@ -1,142 +0,0 @@
<typeSoftKey>
<softKeyDef keyID="Undefined">
<tag>0</tag>
<eventID>0</eventID>
<helpID>0</helpID>
</softKeyDef>
<softKeyDef keyID="Redial">
<tag>1</tag>
<eventID>1</eventID>
<helpID>301</helpID>
</softKeyDef>
<softKeyDef keyID="NewCall">
<tag>2</tag>
<eventID>2</eventID>
<helpID>302</helpID>
</softKeyDef>
<softKeyDef keyID="Hold">
<tag>3</tag>
<eventID>3</eventID>
<helpID>303</helpID>
</softKeyDef>
<softKeyDef keyID="Transfer">
<tag>4</tag>
<eventID>4</eventID>
<helpID>304</helpID>
</softKeyDef>
<softKeyDef keyID="CFwdAll">
<tag>5</tag>
<eventID>5</eventID>
<helpID>305</helpID>
</softKeyDef>
<softKeyDef keyID="&lt;&lt;">
<tag>8</tag>
<eventID>8</eventID>
<helpID>308</helpID>
</softKeyDef>
<softKeyDef keyID="EndCall">
<tag>9</tag>
<eventID>9</eventID>
<helpID>309</helpID>
</softKeyDef>
<softKeyDef keyID="Resume">
<tag>10</tag>
<eventID>10</eventID>
<helpID>310</helpID>
</softKeyDef>
<softKeyDef keyID="Answer">
<tag>11</tag>
<eventID>11</eventID>
<helpID>311</helpID>
</softKeyDef>
<softKeyDef keyID="Confrn">
<tag>13</tag>
<eventID>13</eventID>
<helpID>313</helpID>
</softKeyDef>
<softKeyDef keyID="Park">
<tag>14</tag>
<eventID>14</eventID>
<helpID>314</helpID>
</softKeyDef>
<softKeyDef keyID="Join">
<tag>15</tag>
<eventID>15</eventID>
<helpID>315</helpID>
</softKeyDef>
<softKeyDef keyID="MeetMe">
<tag>16</tag>
<eventID>16</eventID>
<helpID>316</helpID>
</softKeyDef>
<softKeyDef keyID="PickUp">
<tag>17</tag>
<eventID>17</eventID>
<helpID>317</helpID>
</softKeyDef>
<softKeyDef keyID="GPickUp">
<tag>18</tag>
<eventID>18</eventID>
<helpID>318</helpID>
</softKeyDef>
<softKeyDef keyID="RmLstC">
<tag>57</tag>
<eventID>19</eventID>
<helpID>319</helpID>
</softKeyDef>
<softKeyDef keyID="DND">
<tag>63</tag>
<eventID>69</eventID>
<helpID>369</helpID>
</softKeyDef>
<softKeyDef keyID="CallBack">
<tag>65</tag>
<eventID>20</eventID>
<helpID>320</helpID>
</softKeyDef>
<softKeyDef keyID="QRT">
<tag>75</tag>
<eventID>22</eventID>
<helpID>322</helpID>
</softKeyDef>
<softKeyDef keyID="MCID">
<tag>76</tag>
<eventID>27</eventID>
<helpID>327</helpID>
</softKeyDef>
<softKeyDef keyID="Select">
<tag>78</tag>
<eventID>29</eventID>
<helpID>329</helpID>
</softKeyDef>
<softKeyDef keyID="ConfList">
<tag>79</tag>
<eventID>30</eventID>
<helpID>330</helpID>
</softKeyDef>
<softKeyDef keyID="iDivert">
<tag>80</tag>
<eventID>31</eventID>
<helpID>331</helpID>
</softKeyDef>
<softKeyDef keyID="OPickUp">
<tag>91</tag>
<eventID>34</eventID>
<helpID>334</helpID>
</softKeyDef>
<softKeyDef keyID="HLog">
<tag>92</tag>
<eventID>35</eventID>
<helpID>335</helpID>
</softKeyDef>
<softKeyDef keyID="AbbrDial">
<tag>7740</tag>
<eventID>71</eventID>
<helpID>371</helpID>
</softKeyDef>
<softKeyDef keyID="Record">
<tag>7747</tag>
<eventID>74</eventID>
<helpID>374</helpID>
</softKeyDef>
</typeSoftKey>

319
conf/Sccp.class.php Normal file
View file

@ -0,0 +1,319 @@
<?php
// vim: set ai ts=4 sw=4 ft=php:
// Version for SCCP Manager 13.0.X
//
// Templete for Sccp Driver
//
namespace FreePBX\modules\Core\Drivers;
class Sccp extends \FreePBX\modules\Core\Driver {
private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account',
"context" =>'lcontext',"incominglimit"=>'incominglimit',
"callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
"transfer" => 'transfer', "echocancel" => 'echocancel',
"language" => 'language', "description" => 'callerid',
"cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'description',
"musicclass" => 'musicclass',
"dnd" => 'dnd', "silencesuppression" => 'silencesuppression',
"secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone',
'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup'
);
public function getInfo() {
return array(
"rawName" => "sccp",
"hardware" => "sccp_custom",
"prettyName" => _("Sccp Custom Driver"),
"shortName" => "SCCP",
"description" => _("Sccp Device"),
"Version" => "11.3",
"about" => "Sccp mysql class Base ver: 11.3, Sccp ver: default"
);
}
/* public function addDevice1($id, $settings) {
$sql = 'INSERT INTO sccp (id, keyword, data, flags) values (?,?,?,?)';
$sth = $this->database->prepare($sql);
$settings = is_array($settings)?$settings:array();
foreach($settings as $key => $setting) {
$sth->execute(array($id,$key,$setting['value'],$setting['flag']));
}
return true;
}
*/
public function addDevice($id, $settings) {
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description');
// print_r($_REQUEST);
// echo '<br><br>';
// die(print_r($settings));
$settings['cid_num']['value']='';
if (isset($_REQUEST)){
foreach($add_fld as $key => $val) {
if (!empty($_REQUEST[$key])){
$settings[$val]['value'] = $_REQUEST[$key];
}
}
}
if (empty($settings['cid_num']['value'])) {
$settings['cid_num']['value']= $id;
}
$sql = 'INSERT INTO sccpline (name';
$sqlv = 'values ("'.$id.'"';
foreach($this->data_fld as $key => $val) {
if (!empty($settings[$val]) ) {
if (!empty($settings[$val]['value'])){
$sql .= ', '.$key;
$sqlv .= ", '".$settings[$val]['value']."' ";
}
}
}
$sql .= ") ".$sqlv.");";
$sth = $this->database->prepare($sql);
$sth->execute();
return true;
}
public function delDevice($id) {
$sql = "DELETE FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql);
$sth->execute(array($id));
return true;
}
public function getDevice($id) {
$sccp_line = array();
// $sql = "SELECT name as id, name as name";
$sql = "SELECT name as id, name as name ";
foreach($this->data_fld as $key => $val) {
$sql .= ',`'. $key .'` as '.$val;
}
$sql .= " FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql);
$result = array();
$tech = array();
try {
$sth->execute(array($id));
$result = $sth->fetch(\PDO::FETCH_ASSOC);
$tech = $result;
$tech['dial']='SCCP/'.$id;
} catch(\Exception $e) {}
return $tech;
}
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
$dial = 'SCCP';
$settings = array(
"pin" => array(
"value" => "",
"flag" => $flag++
),
"incominglimit" => array(
"value" => "",
"flag" => $flag++
),
"lcontext" => array(
"value" => "from-internal",
"flag" => $flag++
),
"callgroup" => array(
"value" => "",
"flag" => $flag++
),
"namedcallgroup" => array(
"value" => "",
"flag" => $flag++
),
"pickupgroup" => array(
"value" => "",
"flag" => $flag++
),
"namedpickupgroup" => array(
"value" => "",
"flag" => $flag++
),
"transfer" => array(
"value" => "yes",
"flag" => $flag++
),
"adhocNumber" => array(
"value" => "",
"flag" => $flag++
),
"echocancel" => array(
"value" => "no",
"flag" => $flag++
),
"dnd" => array(
"value" => "UserDefined",
"flag" => $flag++
),
"silencesuppression" => array(
"value" => "no",
"flag" => $flag++
),
"secondary_dialtone_digits" => array(
"value" => "9",
"flag" => $flag++
),
"secondary_dialtone_tone" => array(
"value" => "0x22",
"flag" => $flag++
),
"musicclass" => array(
"value" => "default",
"flag" => $flag++
),
);
return array(
"dial" => $dial,
"settings" => $settings
);
}
# !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) {
$section = _("Settings");
$category = "general";
$tmparr = array();
$tt = _("The maximum number of incoming calls on this line.");
// $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel);
// !TODO!: Please change the default value for incominglimit to '6' or higher
$tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 1);
$tt = _("Asterisk context which this line will use to send and receive calls (Note: Only change this is you know what you are doing).");
$tmparr['lcontext'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1);
// !TODO!: -TODO-: Maybe completely remove support for old numberic callgroup/pickupgroup in favor of the named version ? See Sccp.class.php.v431
$tt = _("Phone call group (numeric only, example:1,3-4)");
$tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1);
// !TODO!: -TODO-: multiple allowed (not sure if that is implemented here). See Sccp.class.php.v431
$tt = _("Phone named call group (>asterisk-11)");
$tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1);
$tt = _("Sets the pickup group (numeric only, example:1,3-4) this line is a member of. Allows this line to pickup calls from remote phones which are in this callhroup.");
$tmparr['pickupgroup'] = array('prompttext' => _('Pickup group id'),'value' => '', 'tt' => $tt, 'level' => 1);
// !TODO!: -TODO-: multiple allowed (not sure if that is implemented here). See Sccp.class.php.v431
$tt = _("Sets the named pickup name group this line is a member of. Allows this line to pickup calls from remote phones which are in this name callgroup (>asterisk-11).");
$tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1);
$tt = _("Phone pincode (Note used)");
$tmparr['pin'] = array('value' => '', 'tt' => $tt, 'level' => 1);
$tt = _("Digits to indicate an external line to user (secondary dialtone) Sample 9 or 8 (max 9 digits)");
$tmparr['secondary_dialtone_digits'] = array('prompttext' => _('Secondary dialtone digits'), 'value' => '', 'tt' => $tt, 'level' => 1);
unset($select);
$select[] = array( 'value' => '0x21', 'text' => 'Inside Dial Tone');
$select[] = array( 'value' => '0x22', 'text' => 'Outside Dial Tone');
$select[] = array( 'value' => '0x23', 'text' => 'Line Busy Tone');
$select[] = array( 'value' => '0x24', 'text' => 'Alerting Tone');
$select[] = array( 'value' => '0x25', 'text' => 'Reorder Tone');
$select[] = array( 'value' => '0x26', 'text' => 'Recorder Warning Tone');
$select[] = array( 'value' => '0x27', 'text' => 'Recorder Detected Tone');
$select[] = array( 'value' => '0x28', 'text' => 'Reverting Tone');
$select[] = array( 'value' => '0x29', 'text' => 'Receiver OffHook Tone');
$select[] = array( 'value' => '0x2A', 'text' => 'Partial Dial Tone');
$select[] = array( 'value' => '0x2B', 'text' => 'No Such Number Tone');
$select[] = array( 'value' => '0x2C', 'text' => 'Busy Verification Tone');
$select[] = array( 'value' => '0x2D', 'text' => 'Call Waiting Tone');
$select[] = array( 'value' => '0x2E', 'text' => 'Confirmation Tone');
$select[] = array( 'value' => '0x2F', 'text' => 'Camp On Indication Tone');
$select[] = array( 'value' => '0x30', 'text' => 'Recall Dial Tone');
$select[] = array( 'value' => '0x31', 'text' => 'Zip Zip');
$select[] = array( 'value' => '0x32', 'text' => 'Zip');
$select[] = array( 'value' => '0x33', 'text' => 'Beep Bonk');
$select[] = array( 'value' => '0x34', 'text' => 'Music Tone');
$select[] = array( 'value' => '0x35', 'text' => 'Hold Tone');
$select[] = array( 'value' => '0x36', 'text' => 'Test Tone');
$select[] = array( 'value' => '0x37', 'text' => 'DT Monitor Warning Tone');
$select[] = array( 'value' => '0x40', 'text' => 'Add Call Waiting');
$select[] = array( 'value' => '0x41', 'text' => 'Priority Call Wait');
$select[] = array( 'value' => '0x42', 'text' => 'Recall Dial');
$select[] = array( 'value' => '0x43', 'text' => 'Barg In');
$select[] = array( 'value' => '0x44', 'text' => 'Distinct Alert');
$select[] = array( 'value' => '0x45', 'text' => 'Priority Alert');
$select[] = array( 'value' => '0x46', 'text' => 'Reminder Ring');
$select[] = array( 'value' => '0x47', 'text' => 'Precedence RingBank');
$select[] = array( 'value' => '0x48', 'text' => 'Pre-EmptionTone');
$select[] = array( 'value' => '0x67', 'text' => '2105 HZ');
$select[] = array( 'value' => '0x68', 'text' => '2600 HZ');
$select[] = array( 'value' => '0x69', 'text' => '440 HZ');
$select[] = array( 'value' => '0x6A', 'text' => '300 HZ');
$select[] = array( 'value' => '0x77', 'text' => 'MLPP Pala');
$select[] = array( 'value' => '0x78', 'text' => 'MLPP Ica');
$select[] = array( 'value' => '0x79', 'text' => 'MLPP Vca');
$select[] = array( 'value' => '0x7A', 'text' => 'MLPP Bpa');
$select[] = array( 'value' => '0x7B', 'text' => 'MLPP Bnea');
$select[] = array( 'value' => '0x7C', 'text' => 'MLPP Upa');
/* !TODO!: +TODO+: I would remove the values below this line, except for 'No Tone' */
// $select[] = array( 'value' => '0x7F', 'text' => 'No Tone');
$select[] = array( 'value' => '0x80', 'text' => 'Meetme Greeting Tone');
$select[] = array( 'value' => '0x81', 'text' => 'Meetme Number Invalid Tone');
$select[] = array( 'value' => '0x82', 'text' => 'Meetme Number Failed Tone');
$select[] = array( 'value' => '0x83', 'text' => 'Meetme Enter Pin Tone');
$select[] = array( 'value' => '0x84', 'text' => 'Meetme Invalid Pin Tone');
$select[] = array( 'value' => '0x85', 'text' => 'Meetme Failed Pin Tone');
$select[] = array( 'value' => '0x86', 'text' => 'Meetme CFB Failed Tone');
$select[] = array( 'value' => '0x87', 'text' => 'Meetme Enter Access Code Tone');
$select[] = array( 'value' => '0x88', 'text' => 'Meetme Access Code Invalid Tone');
$select[] = array( 'value' => '0x89', 'text' => 'Meetme Access Code Failed Tone');
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Outside dialtone frequency (defaul 0x22)");
$tmparr['secondary_dialtone_tone'] = array('prompttext' => _('Secondary dialtone'), 'value' => '0x22', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'select');
# !TODO!: -TODO-: is there no easier way to specify a boolean radio group ? No.
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Allow call transfer.");
$tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Echo cancel");
$tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'off', 'text' => 'Off');
$select[] = array('value' => 'reject', 'text' => 'Reject');
$select[] = array('value' => 'silent', 'text' => 'Silent');
$select[] = array('value' => 'UserDefined', 'text' => 'UserDefined');
# !TODO!: -TODO-: The next entry should be "null/empty" (not UserDefined) -> to indicate the trie-state behaviour
# !TODO!: -TODO-: Userdefined is also a possible state, but it is not used or implemented (and it should not be implemented here, i think). See Sccp.class.php.v431, See Sccp.class.php - Old Style
$tt = _("DND: How will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / UserDefined").'<br>'.
_("UserDefined - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'<br>'.
_("Reject - Usesr can only switch off and on (in reject/busy mode)").'<br>'.
_("Silent - Usesr can only switch off and on (in silent mode)");
$tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'UserDefined', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not suported");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio');
unset($select);
$select[] = array('value' => 'default', 'text' => _('default'));
if (function_exists('music_list')){
$moh_list = music_list();
} else {
$moh_list = array('default');
}
foreach ($moh_list as $value) {
$select[] = array('value' => $value, 'text' => _($value));
}
$tt = _("Music on hold");
$tmparr['musicclass'] = array('prompttext' => _('Music on hold'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1);
$devopts = $tmparr;
return $devopts;
}
}

421
conf/Sccp.class.php.v431 Normal file
View file

@ -0,0 +1,421 @@
<?php
// vim: set ai ts=4 sw=4 ft=php:
// Version for SCCP Manager 13.0.X
//
// Templete for Sccp Driver
//
namespace FreePBX\modules\Core\Drivers;
class Sccp extends \FreePBX\modules\Core\Driver {
public $version;
// Key (db) = > key Settings
private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account',
"context" =>'lcontext',"incominglimit"=>'incominglimit',
// "callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup',
"transfer" => 'transfer', "echocancel" => 'echocancel',
"language" => 'language', "description" => 'callerid',
"cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'mailbox',
"musicclass" => 'musicclass',
"dnd" => 'dnd', "silencesuppression" => 'silencesuppression',
"secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone'
);
public function __construct($freepbx) {
parent::__construct($freepbx);
// $this->version = $freepbx->Config->get('ASTVERSION');
}
public function getInfo() {
return array(
"rawName" => "sccp",
"hardware" => "sccp_custom",
"prettyName" => _("Sccp Custom Driver"),
"shortName" => "SCCP",
"description" => _("Sccp Device"),
"Version" => "11.3.v432",
"about" => "Sccp mysql class Base ver: 11.3, Sccp ver: 431"
);
}
/*
public function addDevice1($id, $settings) {
$sql = 'INSERT INTO sccp (id, keyword, data, flags) values (?,?,?,?)';
$sth = $this->database->prepare($sql);
$settings = is_array($settings)?$settings:array();
foreach($settings as $key => $setting) {
$sth->execute(array($id,$key,$setting['value'],$setting['flag']));
}
return true;
}
*/
public function addDevice($id, $settings) {
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description','devinfo_mailbox'=>'mailbox');
// print_r($_REQUEST);
// echo '<br><br>';
// die(print_r($settings));
$settings['cid_num']['value']='';
$settings['mailbox']['value']= '';
if (isset($_REQUEST)){
foreach($add_fld as $key => $val) {
if (!empty($_REQUEST[$key])){
$settings[$val]['value'] = $_REQUEST[$key];
}
}
}
if (empty($settings['cid_num']['value'])) {
$settings['cid_num']['value']= $id;
}
if (!empty($_REQUEST['vm']) && ($_REQUEST['vm'] =='enabled')){ // mailbox
if (empty($settings['mailbox']['value'])) {
$settings['mailbox']['value']= $id;
}
}
// die(print_r($settings));
$sql = 'REPLACE INTO sccpline (name';
$sqlv = 'values ("'.$id.'"';
foreach($this->data_fld as $key => $val) {
switch ($key) {
case 'incominglimit':
$sql .= ', '.$key;
if (!empty($settings[$val]['value'])){
$sqlv .= ", '".$settings[$val]['value']."' ";
} else {
$sqlv .= ", DEFAULT(`".$key."`)";
}
break;
case 'secondary_dialtone_digits':
case 'secondary_dialtone_tone':
case 'dnd':
$sql .= ', '.$key;
if (!$this->is_my_blank($settings[$val]['value'])){
$sqlv .= ", '".$settings[$val]['value']."' ";
} else {
$sqlv .= ", NULL ";
// $sqlv .= ", DEFAULT(`".$key."`)";
}
break;
default:
if (!empty($settings[$val]) ) {
if (!empty($settings[$val]['value'])){
$sql .= ', '.$key;
$sqlv .= ", '".$settings[$val]['value']."' ";
}
}
break;
}
}
$sql .= ") ".$sqlv.");";
// die(print_r($sql));
$sth = $this->database->prepare($sql);
$sth->execute();
return true;
}
public function delDevice($id) {
// $sql = "DELETE FROM sccpline WHERE id = ?";
$sql = "DELETE FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql);
$sth->execute(array($id));
return true;
}
public function getDevice($id) {
$sccp_line = array();
$sql = "SELECT name as id, name as name ";
foreach($this->data_fld as $key => $val) {
$sql .= ',`'. $key .'` as '.$val;
}
// $sql .= " FROM sccpline WHERE id = ?";
$sql .= " FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql);
$result = array();
$tech = array();
try {
$sth->execute(array($id));
$result = $sth->fetch(\PDO::FETCH_ASSOC);
$tech = $result;
$tech['dial']='SCCP/'.$id;
} catch(\Exception $e) {}
// print_r($tech);
// echo '<br><br>';
// print_r($sql);
// die(print_r($id));
// echo '<br><br>';
return $tech;
}
public function getNamedGroup() {
$sql = "select namedcallgroup from sccpline group by namedcallgroup";
$sth = $this->database->prepare($sql);
$result = array();
$tech = array();
// $tech['namedcallgroup'] = '';
// $tech['namedpickupgroup'] = '';
try {
$sth->execute();
$result = $sth->fetchAll();
foreach($result as $val) {
$tech['namedcallgroup'][] = $val[0];
}
} catch(\Exception $e) {}
$sql = "select namedpickupgroup from sccpline group by namedpickupgroup";
$sth = $this->database->prepare($sql);
try {
$sth->execute();
$result = $sth->fetchAll();
foreach($result as $val) {
$tech['namedpickupgroup'][] = $val[0];
}
} catch(\Exception $e) {}
return $tech;
}
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
$dial = 'SCCP';
$settings = array(
"mailbox" => array(
"value" => "",
"flag" => $flag++
),
"incominglimit" => array(
"value" => "2",
"flag" => $flag++
),
"lcontext" => array(
"value" => "from-internal",
"flag" => $flag++
),
// "callgroup" => array(
// "value" => "from-internal",
// "flag" => $flag++
// ),
"namedcallgroup" => array(
"value" => "",
"flag" => $flag++
),
// "pickupgroup" => array(
// "value" => "",
// "flag" => $flag++
// ),
"namedpickupgroup" => array(
"value" => "",
"flag" => $flag++
),
"secondary_dialtone_digits" => array(
"value" => "9",
"flag" => $flag++
),
"secondary_dialtone_tone" => array(
"value" => "0x22",
"flag" => $flag++
),
"transfer" => array(
"value" => "on",
"flag" => $flag++
),
"echocancel" => array(
"value" => "on",
"flag" => $flag++
),
"dnd" => array(
"value" => "",
"flag" => $flag++
),
"silencesuppression" => array(
"value" => "off",
"flag" => $flag++
),
"musicclass" => array(
"value" => "default",
"flag" => $flag++
),
"pin" => array(
"value" => "",
"flag" => $flag++
),
"musicclass" => array(
"value" => "default",
"flag" => $flag++
),
);
return array(
"dial" => $dial,
"settings" => $settings
);
}
public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) {
$section = _("SCCP Extension Details");
// $category = "general";
// Assigned DID/CID
$named_group = $this->getNamedGroup();
$tmparr = array();
$tt = _("Name or id of lincked maibox");
$tmparr['mailbox'] = array('prompttext' => _('Mailbox'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("The SCCP channel number for this port. If you plaining to use this line as 'Shared' or use on several devices - leave this field blank or set limit to 10 calls.");
// $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel);
// $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
$tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("Asterisk context this device will send calls to. Only change this is you know what you are doing.");
$tmparr['lcontext'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1, 'section' => $section);
// $tt = _("Phone call group callgroup=1,3-4");
// $tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("Sets the named caller groups this line is a member of (ast111) : ");
if (!empty($named_group['namedcallgroup'])) {
foreach ($named_group['namedcallgroup'] as $val) {
$tt .= $val. ', ';
}
$tt .= '... ';
}
$tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
// $tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
// $tt = _("Phone pickup group pickupgroup=1,3-4");
// $tmparr['pickupgroup'] = array('prompttext' => _('Pickup group id'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("Name picapuroup : ");
if (!empty($named_group['namedpickupgroup'])) {
foreach ($named_group['namedpickupgroup'] as $val) {
$tt .= $val. ', ';
}
$tt .= '... ';
}
$tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
// $tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
$tt = _("Digits to indicate an external line to user (secondary dialtone) Sample 9 or 8 (max 9 digits)");
$tmparr['secondary_dialtone_digits'] = array('prompttext' => _('Secondary dialtone digits'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
unset($select);
$select[] = array( 'value' => '0x21', 'text' => 'Inside Dial Tone');
$select[] = array( 'value' => '0x22', 'text' => 'Outside Dial Tone');
$select[] = array( 'value' => '0x23', 'text' => 'Line Busy Tone');
$select[] = array( 'value' => '0x24', 'text' => 'Alerting Tone');
$select[] = array( 'value' => '0x25', 'text' => 'Reorder Tone');
$select[] = array( 'value' => '0x26', 'text' => 'Recorder Warning Tone');
$select[] = array( 'value' => '0x27', 'text' => 'Recorder Detected Tone');
$select[] = array( 'value' => '0x28', 'text' => 'Reverting Tone');
$select[] = array( 'value' => '0x29', 'text' => 'Receiver OffHook Tone');
$select[] = array( 'value' => '0x2A', 'text' => 'Partial Dial Tone');
$select[] = array( 'value' => '0x2B', 'text' => 'No Such Number Tone');
$select[] = array( 'value' => '0x2C', 'text' => 'Busy Verification Tone');
$select[] = array( 'value' => '0x2D', 'text' => 'Call Waiting Tone');
$select[] = array( 'value' => '0x2E', 'text' => 'Confirmation Tone');
$select[] = array( 'value' => '0x2F', 'text' => 'Camp On Indication Tone');
$select[] = array( 'value' => '0x30', 'text' => 'Recall Dial Tone');
$select[] = array( 'value' => '0x31', 'text' => 'Zip Zip');
$select[] = array( 'value' => '0x32', 'text' => 'Zip');
$select[] = array( 'value' => '0x33', 'text' => 'Beep Bonk');
$select[] = array( 'value' => '0x34', 'text' => 'Music Tone');
$select[] = array( 'value' => '0x35', 'text' => 'Hold Tone');
$select[] = array( 'value' => '0x36', 'text' => 'Test Tone');
$select[] = array( 'value' => '0x37', 'text' => 'DT Monitor Warning Tone');
$select[] = array( 'value' => '0x40', 'text' => 'Add Call Waiting');
$select[] = array( 'value' => '0x41', 'text' => 'Priority Call Wait');
$select[] = array( 'value' => '0x42', 'text' => 'Recall Dial');
$select[] = array( 'value' => '0x43', 'text' => 'Barg In');
$select[] = array( 'value' => '0x44', 'text' => 'Distinct Alert');
$select[] = array( 'value' => '0x45', 'text' => 'Priority Alert');
$select[] = array( 'value' => '0x46', 'text' => 'Reminder Ring');
$select[] = array( 'value' => '0x47', 'text' => 'Precedence RingBank');
$select[] = array( 'value' => '0x48', 'text' => 'Pre-EmptionTone');
$select[] = array( 'value' => '0x67', 'text' => '2105 HZ');
$select[] = array( 'value' => '0x68', 'text' => '2600 HZ');
$select[] = array( 'value' => '0x69', 'text' => '440 HZ');
$select[] = array( 'value' => '0x6A', 'text' => '300 HZ');
$select[] = array( 'value' => '0x77', 'text' => 'MLPP Pala');
$select[] = array( 'value' => '0x78', 'text' => 'MLPP Ica');
$select[] = array( 'value' => '0x79', 'text' => 'MLPP Vca');
$select[] = array( 'value' => '0x7A', 'text' => 'MLPP Bpa');
$select[] = array( 'value' => '0x7B', 'text' => 'MLPP Bnea');
$select[] = array( 'value' => '0x7C', 'text' => 'MLPP Upa');
/* !TODO!: I would remove the values below this line, except for 'No Tone' */
// $select[] = array( 'value' => '0x7F', 'text' => 'No Tone');
$select[] = array( 'value' => '0x80', 'text' => 'Meetme Greeting Tone');
$select[] = array( 'value' => '0x81', 'text' => 'Meetme Number Invalid Tone');
$select[] = array( 'value' => '0x82', 'text' => 'Meetme Number Failed Tone');
$select[] = array( 'value' => '0x83', 'text' => 'Meetme Enter Pin Tone');
$select[] = array( 'value' => '0x84', 'text' => 'Meetme Invalid Pin Tone');
$select[] = array( 'value' => '0x85', 'text' => 'Meetme Failed Pin Tone');
$select[] = array( 'value' => '0x86', 'text' => 'Meetme CFB Failed Tone');
$select[] = array( 'value' => '0x87', 'text' => 'Meetme Enter Access Code Tone');
$select[] = array( 'value' => '0x88', 'text' => 'Meetme Access Code Invalid Tone');
$select[] = array( 'value' => '0x89', 'text' => 'Meetme Access Code Failed Tone');
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Outside dialtone frequency (defaul 0x22)");
$tmparr['secondary_dialtone_tone'] = array('prompttext' => _('Secondary dialtone'), 'value' => '0x22', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'select', 'section' => $section);
unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Allow call transfer.");
// $tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section, 'category' => 'general');
$tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'on', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Echo cancel");
$tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => 'on', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'off', 'text' => 'Off');
$select[] = array('value' => 'reject', 'text' => 'Reject');
$select[] = array('value' => 'silent', 'text' => 'Silent');
$select[] = array('value' => 'user', 'text' => 'Cycle');
$tt = _("DND: Means how will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / Cycle").'<br>'.
_("Cycle - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'<br>'.
_("Reject - Usesr can only switch off and on (in reject/busy mode)").'<br>'.
_("Silent - Usesr can only switch off and on (in silent mode)");
$tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'reject', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not suported");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'off', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'default', 'text' => _('default'));
if (function_exists('music_list')){
$moh_list = music_list();
} else {
$moh_list = array('default');
}
foreach ($moh_list as $value) {
$select[] = array('value' => $value, 'text' => _($value));
}
$tt = _("Music on hold");
$tmparr['musicclass'] = array('prompttext' => _('Music on hold'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'section' => $section);
$tt = _("Sets the named pickup groups this line is a member of (this phone can pickup calls from remote phones which are in this caller group (ast111)");
$tmparr['pin'] = array('value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$devopts = $tmparr;
return $devopts;
}
public function getDeviceHeaders() {
return array(
'secret' => array('identifier' => _('Secret'), 'description' => sprintf(_('Secret [Enter "%s" to regenerate]'),"REGEN")),
);
}
public function is_my_blank($value) {
return empty($value) && !is_numeric($value);
}
}

446
conf/Sccp.class.php.v433 Normal file
View file

@ -0,0 +1,446 @@
<?php
// vim: set ai ts=4 sw=4 ft=php:
// Version for SCCP Manager 13.0.X
//
// Templete for Sccp Driver
//
namespace FreePBX\modules\Core\Drivers;
class Sccp extends \FreePBX\modules\Core\Driver {
public $version;
// Key (db) = > key Settings
private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account',
"context" =>'lcontext',"incominglimit"=>'incominglimit',
// "callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
'directed_pickup_context' => 'directed_pickup_context',
'directed_pickup' => 'directed_pickup',
'pickup_modeanswer' => 'pickup_modeanswer',
'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup',
"transfer" => 'transfer', "echocancel" => 'echocancel',
"language" => 'language', "description" => 'callerid',
"cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'mailbox',
"musicclass" => 'musicclass',
"dnd" => 'dnd', "silencesuppression" => 'silencesuppression',
"secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone'
);
public function __construct($freepbx) {
parent::__construct($freepbx);
// $this->version = $freepbx->Config->get('ASTVERSION');
}
public function getInfo() {
return array(
"rawName" => "sccp",
"hardware" => "sccp_custom",
"prettyName" => _("Sccp Custom Driver"),
"shortName" => "SCCP",
"description" => _("Sccp Device"),
"Version" => "11.3.v433",
"about" => "Sccp mysql class Base ver: 11.3, Sccp ver: 433"
);
}
/*
public function addDevice1($id, $settings) {
$sql = 'INSERT INTO sccp (id, keyword, data, flags) values (?,?,?,?)';
$sth = $this->database->prepare($sql);
$settings = is_array($settings)?$settings:array();
foreach($settings as $key => $setting) {
$sth->execute(array($id,$key,$setting['value'],$setting['flag']));
}
return true;
}
*/
public function addDevice($id, $settings) {
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description','devinfo_mailbox'=>'mailbox');
// print_r($_REQUEST);
// echo '<br><br>';
// die(print_r($settings));
$settings['cid_num']['value']='';
$settings['mailbox']['value']= '';
if (isset($_REQUEST)){
foreach($add_fld as $key => $val) {
if (!empty($_REQUEST[$key])){
$settings[$val]['value'] = $_REQUEST[$key];
}
}
}
if (empty($settings['cid_num']['value'])) {
$settings['cid_num']['value']= $id;
}
if (!empty($_REQUEST['vm']) && ($_REQUEST['vm'] =='enabled')){ // mailbox
if (empty($settings['mailbox']['value'])) {
$settings['mailbox']['value']= $id;
}
}
// die(print_r($settings));
$sql = 'REPLACE INTO sccpline (name';
$sqlv = 'values ("'.$id.'"';
foreach($this->data_fld as $key => $val) {
switch ($key) {
case 'incominglimit':
$sql .= ', '.$key;
if (!empty($settings[$val]['value'])){
$sqlv .= ", '".$settings[$val]['value']."' ";
} else {
$sqlv .= ", DEFAULT(`".$key."`)";
}
break;
case 'secondary_dialtone_digits':
case 'secondary_dialtone_tone':
case 'dnd':
$sql .= ', '.$key;
if (!$this->is_my_blank($settings[$val]['value'])){
$sqlv .= ", '".$settings[$val]['value']."' ";
} else {
$sqlv .= ", NULL ";
// $sqlv .= ", DEFAULT(`".$key."`)";
}
break;
default:
if (!empty($settings[$val]) ) {
if (!empty($settings[$val]['value'])){
$sql .= ', '.$key;
$sqlv .= ", '".$settings[$val]['value']."' ";
}
}
break;
}
}
$sql .= ") ".$sqlv.");";
// die(print_r($sql));
$sth = $this->database->prepare($sql);
$sth->execute();
return true;
}
public function delDevice($id) {
// $sql = "DELETE FROM sccpline WHERE id = ?";
$sql = "DELETE FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql);
$sth->execute(array($id));
return true;
}
public function getDevice($id) {
$sccp_line = array();
$sql = "SELECT name as id, name as name ";
foreach($this->data_fld as $key => $val) {
$sql .= ',`'. $key .'` as '.$val;
}
// $sql .= " FROM sccpline WHERE id = ?";
$sql .= " FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql);
$result = array();
$tech = array();
try {
$sth->execute(array($id));
$result = $sth->fetch(\PDO::FETCH_ASSOC);
$tech = $result;
$tech['dial']='SCCP/'.$id;
} catch(\Exception $e) {}
// print_r($tech);
// echo '<br><br>';
// print_r($sql);
// die(print_r($id));
// echo '<br><br>';
return $tech;
}
public function getNamedGroup() {
$sql = "select namedcallgroup from sccpline group by namedcallgroup";
$sth = $this->database->prepare($sql);
$result = array();
$tech = array();
// $tech['namedcallgroup'] = '';
// $tech['namedpickupgroup'] = '';
try {
$sth->execute();
$result = $sth->fetchAll();
foreach($result as $val) {
$tech['namedcallgroup'][] = $val[0];
}
} catch(\Exception $e) {}
$sql = "select namedpickupgroup from sccpline group by namedpickupgroup";
$sth = $this->database->prepare($sql);
try {
$sth->execute();
$result = $sth->fetchAll();
foreach($result as $val) {
$tech['namedpickupgroup'][] = $val[0];
}
} catch(\Exception $e) {}
return $tech;
}
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
$dial = 'SCCP';
$settings = array(
"mailbox" => array(
"value" => "",
"flag" => $flag++
),
"incominglimit" => array(
"value" => "2",
"flag" => $flag++
),
"directed_pickup_context" => array(
"value" => "from-internal",
"flag" => $flag++
),
"lcontext" => array(
"value" => "from-internal",
"flag" => $flag++
),
// "callgroup" => array(
// "value" => "from-internal",
// "flag" => $flag++
// ),
"namedcallgroup" => array(
"value" => "",
"flag" => $flag++
),
// "pickupgroup" => array(
// "value" => "",
// "flag" => $flag++
// ),
"namedpickupgroup" => array(
"value" => "",
"flag" => $flag++
),
"secondary_dialtone_digits" => array(
"value" => "9",
"flag" => $flag++
),
"secondary_dialtone_tone" => array(
"value" => "0x22",
"flag" => $flag++
),
"transfer" => array(
"value" => "on",
"flag" => $flag++
),
"echocancel" => array(
"value" => "on",
"flag" => $flag++
),
"dnd" => array(
"value" => "",
"flag" => $flag++
),
"silencesuppression" => array(
"value" => "off",
"flag" => $flag++
),
"musicclass" => array(
"value" => "default",
"flag" => $flag++
),
"pin" => array(
"value" => "",
"flag" => $flag++
),
"musicclass" => array(
"value" => "default",
"flag" => $flag++
),
);
return array(
"dial" => $dial,
"settings" => $settings
);
}
public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) {
$section = _("SCCP Extension Details");
// $category = "general";
// Assigned DID/CID
$named_group = $this->getNamedGroup();
$tmparr = array();
$tt = _("Name or id of lincked maibox");
$tmparr['mailbox'] = array('prompttext' => _('Mailbox'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("The SCCP channel number for this port. If you plaining to use this line as 'Shared' or use on several devices - leave this field blank or set limit to 10 calls.");
// $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel);
// $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
$tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("Asterisk context this device will send calls to. Only change this is you know what you are doing.");
$tmparr['lcontext'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("Asterisk context this device will can pickup calls. Only change this is you know what you are doing.");
$tmparr['directed_pickup_context'] = array('prompttext' => _('Directed PickUp Сontext '), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1, 'section' => $section);
// $tt = _("Phone call group callgroup=1,3-4");
// $tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("Sets the named caller groups this line is a member of (ast111) : ");
if (!empty($named_group['namedcallgroup'])) {
foreach ($named_group['namedcallgroup'] as $val) {
$tt .= $val. ', ';
}
$tt .= '... ';
}
$tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
// $tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
// $tt = _("Phone pickup group pickupgroup=1,3-4");
// $tmparr['pickupgroup'] = array('prompttext' => _('Pickup group id'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("Name picapuroup : ");
if (!empty($named_group['namedpickupgroup'])) {
foreach ($named_group['namedpickupgroup'] as $val) {
$tt .= $val. ', ';
}
$tt .= '... ';
}
$tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
// $tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
$tt = _("Digits to indicate an external line to user (secondary dialtone) Sample 9 or 8 (max 9 digits)");
$tmparr['secondary_dialtone_digits'] = array('prompttext' => _('Secondary dialtone digits'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
unset($select);
$select[] = array( 'value' => '0x21', 'text' => 'Inside Dial Tone');
$select[] = array( 'value' => '0x22', 'text' => 'Outside Dial Tone');
$select[] = array( 'value' => '0x23', 'text' => 'Line Busy Tone');
$select[] = array( 'value' => '0x24', 'text' => 'Alerting Tone');
$select[] = array( 'value' => '0x25', 'text' => 'Reorder Tone');
$select[] = array( 'value' => '0x26', 'text' => 'Recorder Warning Tone');
$select[] = array( 'value' => '0x27', 'text' => 'Recorder Detected Tone');
$select[] = array( 'value' => '0x28', 'text' => 'Reverting Tone');
$select[] = array( 'value' => '0x29', 'text' => 'Receiver OffHook Tone');
$select[] = array( 'value' => '0x2A', 'text' => 'Partial Dial Tone');
$select[] = array( 'value' => '0x2B', 'text' => 'No Such Number Tone');
$select[] = array( 'value' => '0x2C', 'text' => 'Busy Verification Tone');
$select[] = array( 'value' => '0x2D', 'text' => 'Call Waiting Tone');
$select[] = array( 'value' => '0x2E', 'text' => 'Confirmation Tone');
$select[] = array( 'value' => '0x2F', 'text' => 'Camp On Indication Tone');
$select[] = array( 'value' => '0x30', 'text' => 'Recall Dial Tone');
$select[] = array( 'value' => '0x31', 'text' => 'Zip Zip');
$select[] = array( 'value' => '0x32', 'text' => 'Zip');
$select[] = array( 'value' => '0x33', 'text' => 'Beep Bonk');
$select[] = array( 'value' => '0x34', 'text' => 'Music Tone');
$select[] = array( 'value' => '0x35', 'text' => 'Hold Tone');
$select[] = array( 'value' => '0x36', 'text' => 'Test Tone');
$select[] = array( 'value' => '0x37', 'text' => 'DT Monitor Warning Tone');
$select[] = array( 'value' => '0x40', 'text' => 'Add Call Waiting');
$select[] = array( 'value' => '0x41', 'text' => 'Priority Call Wait');
$select[] = array( 'value' => '0x42', 'text' => 'Recall Dial');
$select[] = array( 'value' => '0x43', 'text' => 'Barg In');
$select[] = array( 'value' => '0x44', 'text' => 'Distinct Alert');
$select[] = array( 'value' => '0x45', 'text' => 'Priority Alert');
$select[] = array( 'value' => '0x46', 'text' => 'Reminder Ring');
$select[] = array( 'value' => '0x47', 'text' => 'Precedence RingBank');
$select[] = array( 'value' => '0x48', 'text' => 'Pre-EmptionTone');
$select[] = array( 'value' => '0x67', 'text' => '2105 HZ');
$select[] = array( 'value' => '0x68', 'text' => '2600 HZ');
$select[] = array( 'value' => '0x69', 'text' => '440 HZ');
$select[] = array( 'value' => '0x6A', 'text' => '300 HZ');
$select[] = array( 'value' => '0x77', 'text' => 'MLPP Pala');
$select[] = array( 'value' => '0x78', 'text' => 'MLPP Ica');
$select[] = array( 'value' => '0x79', 'text' => 'MLPP Vca');
$select[] = array( 'value' => '0x7A', 'text' => 'MLPP Bpa');
$select[] = array( 'value' => '0x7B', 'text' => 'MLPP Bnea');
$select[] = array( 'value' => '0x7C', 'text' => 'MLPP Upa');
/* !TODO!: I would remove the values below this line, except for 'No Tone' */
// $select[] = array( 'value' => '0x7F', 'text' => 'No Tone');
$select[] = array( 'value' => '0x80', 'text' => 'Meetme Greeting Tone');
$select[] = array( 'value' => '0x81', 'text' => 'Meetme Number Invalid Tone');
$select[] = array( 'value' => '0x82', 'text' => 'Meetme Number Failed Tone');
$select[] = array( 'value' => '0x83', 'text' => 'Meetme Enter Pin Tone');
$select[] = array( 'value' => '0x84', 'text' => 'Meetme Invalid Pin Tone');
$select[] = array( 'value' => '0x85', 'text' => 'Meetme Failed Pin Tone');
$select[] = array( 'value' => '0x86', 'text' => 'Meetme CFB Failed Tone');
$select[] = array( 'value' => '0x87', 'text' => 'Meetme Enter Access Code Tone');
$select[] = array( 'value' => '0x88', 'text' => 'Meetme Access Code Invalid Tone');
$select[] = array( 'value' => '0x89', 'text' => 'Meetme Access Code Failed Tone');
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Outside dialtone frequency (defaul 0x22)");
$tmparr['secondary_dialtone_tone'] = array('prompttext' => _('Secondary dialtone'), 'value' => '0x22', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'select', 'section' => $section);
unset($select);
$select[] = array('value' => '', 'text' => 'Inherit');
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Enable/Disable the `directed` pickup softkey");
$tmparr['directed_pickup'] = array('prompttext' => _('Directed pickup'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => '', 'text' => 'Inherit');
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Should the picked/gpicked-up call be answered automatically");
$tmparr['pickup_modeanswer'] = array('prompttext' => _('Pickup Modeanswer'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => '', 'text' => 'Inherit');
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Allow call transfer.");
// $tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section, 'category' => 'general');
$tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Echo cancel");
$tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => 'on', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'off', 'text' => 'Off');
$select[] = array('value' => 'reject', 'text' => 'Reject');
$select[] = array('value' => 'silent', 'text' => 'Silent');
$select[] = array('value' => 'user', 'text' => 'Cycle');
$tt = _("DND: Means how will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / Cycle").'<br>'.
_("Cycle - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'<br>'.
_("Reject - Usesr can only switch off and on (in reject/busy mode)").'<br>'.
_("Silent - Usesr can only switch off and on (in silent mode)");
$tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'reject', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not suported");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'off', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'default', 'text' => _('default'));
if (function_exists('music_list')){
$moh_list = music_list();
} else {
$moh_list = array('default');
}
foreach ($moh_list as $value) {
$select[] = array('value' => $value, 'text' => _($value));
}
$tt = _("Music on hold");
$tmparr['musicclass'] = array('prompttext' => _('Music on hold'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'section' => $section);
$tt = _("Sets the named pickup groups this line is a member of (this phone can pickup calls from remote phones which are in this caller group (ast111)");
$tmparr['pin'] = array('value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$devopts = $tmparr;
return $devopts;
}
public function getDeviceHeaders() {
return array(
'secret' => array('identifier' => _('Secret'), 'description' => sprintf(_('Secret [Enter "%s" to regenerate]'),"REGEN")),
);
}
public function is_my_blank($value) {
return empty($value) && !is_numeric($value);
}
}

View file

@ -1,8 +0,0 @@
<dialTemplate>
<versionStamp>e68d54c1-0354-4b1a-aca4-adffc4b7de2f</versionStamp>
<TEMPLATE match="3.." timeout="1" />
<TEMPLATE match="..." timeout="2" />
<TEMPLATE match="......." timeout="2" />
<TEMPLATE match="0........" timeout="2" />
<TEMPLATE match="*" timeout="3" />
</dialTemplate>

View file

@ -1,9 +0,0 @@
#
# TFTPd Mapping Rules for SCCP_Manager Provision
#
# This file is maintained by Sccp_Manager, and will be overwritten by the installer
# a copy of the original can be found at sccpManagerRewrite.rules.bu
# For any changes to this file to be effective, the tftp server will have to be restarted.
#
# The rules below are provided by dkgroot/provision project https://github.com/dkgroot/provision_sccp
#

View file

@ -41,3 +41,10 @@ hotline_context=default
hotline_extension=111 hotline_extension=111
devicetable=sccpdevice devicetable=sccpdevice
linetable=sccpline linetable=sccpline
[KeySet1] ; Managed by sccp_manager
type=softkeyset
onhook=redial,newcall,cfwdall,dnd,pickup,gpickup,private
connected=hold,endcall,park,select,cfwdall,cfwdbusy
onhold=newcall

1018
conf/sccpgeneral.xml Normal file

File diff suppressed because it is too large Load diff

1519
conf/sccpgeneral.xml.v431 Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

1522
conf/sccpsimple.xml.v431 Normal file

File diff suppressed because it is too large Load diff

1577
conf/sccpsimple.xml.v433 Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -58,13 +58,13 @@ ri ^(P00405000700.sbn)$ firmware/7910/\1
ri ^(CP7912080004SCCP080108A.sbin)$ firmware/7912/\1 ri ^(CP7912080004SCCP080108A.sbin)$ firmware/7912/\1
# 7915 firmware (ancient) # 7915 firmware (ancient)
ri ^(B015-1-0-)(.+\.SBN)$ firmware/7915/\1\2 ri ^(B015-1-0-4.SBN)$ firmware/7915/\1
# 7916 firmware (ancient) # 7916 firmware (ancient)
ri ^(B016-1-0-)(.+\.SBN)$ firmware/7916/\1\2 ri ^(B016-1-0-4.SBN)$ firmware/7916/\1
# 7920 firmware (ancient) # 7920 firmware (ancient)
ri ^(cmterm_7920)(.+\.bin)$ firmware/7920/\1\2 ri ^(cmterm_7920.4.0-03-02.bin)$ firmware/7920/\1
# 7921_7925 firmware (ancient) # 7921_7925 firmware (ancient)
ri ^(APPS-1.4.3.4.SBN)$ firmware/7921/\1 ri ^(APPS-1.4.3.4.SBN)$ firmware/7921/\1
@ -106,10 +106,10 @@ ri ^(cmterm_7936.3-3-21-0.bin)$ firmware/7936/\1
ri ^(apps37sccp.1-4-5-7.bin)$ firmware/7937/\1 ri ^(apps37sccp.1-4-5-7.bin)$ firmware/7937/\1
# 7940_7960 firmware (ancient) # 7940_7960 firmware (ancient)
ri ^(P0030801SR)(.+\.bin)$ firmware/7940/\1\2 ri ^(P0030801SR01.bin)$ firmware/7940/\1
ri ^(P0030801SR)(.+\.loads)$ firmware/7940/\1\2 ri ^(P0030801SR01.loads)$ firmware/7940/\1
ri ^(P0030801SR)(.+\.sb2)$ firmware/7940/\1\2 ri ^(P0030801SR01.sb2)$ firmware/7940/\1
ri ^(P0030801SR)(.+\.sbn)$ firmware/7940/\1\2 ri ^(P0030801SR01.sbn)$ firmware/7940/\1
# 7941_7961 firmware (java-based) # 7941_7961 firmware (java-based)
ri ^(apps41)(.+\.sbn)$ firmware/7941/\1\2 ri ^(apps41)(.+\.sbn)$ firmware/7941/\1\2
@ -184,31 +184,20 @@ ri ^\/((SPA504G-cfg.xml)(\.enc)?(\.sgn)?)$ settings/\1
#ri ^(.+\.loads)$ firmware/\1 #ri ^(.+\.loads)$ firmware/\1
#ri ^(.+\.sbn)$ firmware/\1 #ri ^(.+\.sbn)$ firmware/\1
# Keep locales in a separate directory (optional)
ri ^(.+)\/(.+-sccp.jar)$ locales/languages/\1/\2 ri ^(.+)\/(.+-sccp.jar)$ locales/\1/\2
ri ^(.+)\/(.+-sip.jar)$ locales/languages/\1/\2 ri ^(.+)\/(.+-dictionary.xml)$ locales/\1/\2
ri ^(.+)\/(.+-dictionary.xml)$ locales/languages/\1/\2 #ri ^(.+)\/(.+-tones.xml)$ locales/countries/\1/\2
ri ^(.+)\/(.+-dictionary-ext.xml)$ locales/languages/\1/\2
#ri ^(.+)\/(.+-tones.xml)$ locales/languages/\1/\2
ri ^(.+)\/(.+-font.xml)$ locales/languages/\1/\2
ri ^(.+)\/(.+-kate.xml)$ locales/languages/\1/\2
ri ^(.+)\/(gk.+)(\.cfg)$ locales/languages/\1/\2\3
ri ^(.+)\/(.+-tones.xml)$ locales/countries/\1/\2
# Keep ring-tones in a separate directory (optional) # Keep ring-tones in a separate directory (optional)
ri ^([R|r]ing[L|l]ist)(\.xml|-wb\.xml)(\.sgn)?$ ringtones/ringlist.xml ri ^([R|r]ing[L|l]ist)(\.xml|-wb\.xml)(\.sgn)?$ ringtones/ringlist.xml
ri ^(Distinctive[R|r]ing[L|l]ist)(\.xml|-wb\.xml)(\.sgn)?$ ringtones/ringlist.xml ri ^(Distinctive[R|r]ing[L|l]ist)(\.xml|-wb\.xml)(\.sgn)?$ ringtones/ringlist.xml
ri ^(.+)(\.raw|\.rwb|\.pcm)(\.sgn)?$ ringtones/\1\2\3 ri ^(.+)(\.raw|\.rwb)(\.sgn)?$ ringtones/\1\2\3
# Rename Desktops to wallpapers (optional) # Rename Desktops to wallpapers (optional)
#ri ^Desktops/(.+)/(List\.xml)(\.sgn)?$ wallpapers/\1/\2\3 #ri ^Desktops/(.+)/(List\.xml)(\.sgn)?$ wallpapers/\1/\2\3
#ri ^Desktops/(.+)/(.+\.png)(\.sgn)?$ wallpapers/\1/\2\3 #ri ^Desktops/(.+)/(.+\.png)(\.sgn)?$ wallpapers/\1/\2\3
# Dialplan
ri ^(dialplan.xml)$ dialplan/\1
ri ^authorized_keys$ settings/authorized_keys ri ^authorized_keys$ settings/authorized_keys
# #

View file

@ -10,7 +10,7 @@ service tftp
wait = yes wait = yes
user = root user = root
server = /usr/sbin/in.tftpd server = /usr/sbin/in.tftpd
server_args = -c -s -v /tftpboot -m -m /etc/asterisk/sccpManagerRewrite.rules server_args = -c -s -v /tftpboot -m /tftpboot/rewrite.rules
disable = no disable = no
per_source = 11 per_source = 11
cps = 100 2 cps = 100 2

77
functions.inc.php Normal file
View file

@ -0,0 +1,77 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
function removeSimpleXmlNode($node)
{
$dom = dom_import_simplexml($node);
$dom->parentNode->removeChild($dom);
}
function replaceSimpleXmlNode($xml, SimpleXMLElement $element) {
$dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode(
dom_import_simplexml($element),TRUE
);
$dom->parentNode->replaceChild($import, $dom);
}
*/
function after($this, $inthat) {
if (!is_bool(strpos($inthat, $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) {
return substr($inthat, 0, strpos($inthat, $this));
}
function before_last($this, $inthat) {
return substr($inthat, 0, strrevpos($inthat, $this));
}
function between($this, $that, $inthat) {
return before($that, after($this, $inthat));
}
function between_last($this, $that, $inthat) {
return after_last($this, before_last($that, $inthat));
}
function strrevpos($instr, $needle) {
$rev_pos = strpos(strrev($instr), strrev($needle));
if ($rev_pos === false)
return false;
else
return strlen($instr) - $rev_pos - strlen($needle);
}
function strpos_array($haystack, $needles) {
if (is_array($needles)) {
foreach ($needles as $str) {
if (is_array($str)) {
$pos = strpos_array($haystack, $str);
} else {
$pos = strpos($haystack, $str);
}
if ($pos !== FALSE) {
return $pos;
}
}
} else {
return strpos($haystack, $needles);
}
return FALSE;
}
?>

View file

@ -154,7 +154,7 @@ msgstr "Внешний адрес"
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "" msgid ""
"External IP Address of the firewall, required in case the PBX is running on " "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 " "a seperatehost behind it. IP Address that we're going to notify in RTP media "
"stream as the pbx source address." "stream as the pbx source address."
msgstr "" msgstr ""
"Внешнее имя FQDN в системе DNS на внешнем интерфейсе (WAN) роутера, которое " "Внешнее имя FQDN в системе DNS на внешнем интерфейсе (WAN) роутера, которое "
@ -504,7 +504,7 @@ msgid "NTP Server name or IP"
msgstr "Адрес Сервера NTP" msgstr "Адрес Сервера NTP"
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "Configure NTP Server protocol time synchronization" msgid "Configure NTP Server protocol time syncronization"
msgstr "Настойка протокола синхронизации времени" msgstr "Настойка протокола синхронизации времени"
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
@ -910,8 +910,8 @@ msgid "General Device configuration"
msgstr "Абонентского устройство" msgstr "Абонентского устройство"
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "Device ID.[XXXXXXXXXXXX]=MAC" msgid "Device SEP ID.[XXXXXXXXXXXX]=MAC"
msgstr "Устройство ID : [XXXXXXXXXXXX]=MAC" msgstr "Устройство SEP ID : [XXXXXXXXXXXX]=MAC"
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "" msgid ""
@ -955,8 +955,8 @@ msgid "Device Label"
msgstr "Название Устройства" msgstr "Название Устройства"
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "Device ID" msgid "Device SEP ID"
msgstr "Идентификатор устройства ID" msgstr "Идентификатор устройства SEP ID"
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "The information in the upper right corner of the device screen" msgid "The information in the upper right corner of the device screen"
@ -1005,7 +1005,7 @@ msgid "Buttons Configuration"
msgstr "Настройка Кнопок" msgstr "Настройка Кнопок"
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "Device MAC." msgid "Device MAC SEP."
msgstr "Прямое подключение." msgstr "Прямое подключение."
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
@ -1306,7 +1306,7 @@ msgid "Close"
msgstr "Закрыть" msgstr "Закрыть"
#: views/server.model: #: views/server.model:
msgid "Add New model without Enabled" msgid "Add New model whithout Enabled"
msgstr "Добавить шаблон как неактивный" msgstr "Добавить шаблон как неактивный"
#: views/server.model: #: views/server.model:

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 separatehost 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 seperatehost 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 synchronization" msgid "Configure NTP Server protocol time syncronization"
msgstr "" msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
@ -679,7 +679,7 @@ msgid "General Device configuration"
msgstr "" msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "Device ID.[XXXXXXXXXXXX]=MAC" msgid "Device SEP ID.[XXXXXXXXXXXX]=MAC"
msgstr "" msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
@ -707,7 +707,7 @@ msgid "Device Label"
msgstr "" msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "Device ID" msgid "Device SEP ID"
msgstr "" msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
@ -743,7 +743,7 @@ msgid "Buttons Configuration"
msgstr "" msgstr ""
#: views/sccpgeneral.xml: #: views/sccpgeneral.xml:
msgid "Device MAC." msgid "Device MAC SEP."
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 without Enabled" msgid "Add New model whithout Enabled"
msgstr "" msgstr ""
#: views/server.model: #: views/server.model:

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,10 @@
<module> <module>
<rawname>sccp_manager</rawname> <rawname>sccp_manager</rawname>
<name>SCCP Manager</name> <name>SCCP Manager</name>
<version>14.5.0.4</version> <version>13.0.0.4</version>
<type>setup</type> <type>setup</type>
<category>SCCP Connectivity</category> <category>SCCP Connectivity</category>
<publisher>Steve Lad, Alex GP</publisher> <publisher>Alex GP</publisher>
<repo>extended</repo> <repo>extended</repo>
<description>SCCP Phone and Extension Manager</description> <description>SCCP Phone and Extension Manager</description>
<menuitems> <menuitems>
@ -15,265 +15,12 @@
<changelog> <changelog>
* Version 13.0.0.1 * - Alfa Release tested on freepbx v.13.0.192.16, v.14.0.1.5 * Version 13.0.0.1 * - Alfa Release tested on freepbx v.13.0.192.16, v.14.0.1.5
* Version 13.0.0.2 * - Release tested * Version 13.0.0.2 * - Release tested
* Version 14.0.0.1 * - Alfa Release new DB structure Add User mobility
* Version 14.1.0.1 * - Migrated to chan-sccp repo
* Version 14.2.0.1 * - Retired old interface - min chan-sccp v433
* Version 14.2.0.2 * - Fix module database definition
* Version 14.2.0.5 * - Replace Modals with fpbxToast
* Version 14.2.0.8 * - Fix uninstaller and create backup
* Version 14.2.0.9 * - Bug Fix - incorrect response class for Reset Token Device
* Version 14.2.0.10 * - Bug Fix - line not assigned on device creation
* Version 14.3.0.0 * - New Minor Version - Change DB and add new settings
* Version 14.3.0.15 * - Get masterFilesList from provisoner via installer Fix Issue 39
* Version 14.3.0.16 * - Test version for freepbx upgrader.
* Version 14.3.0.17 * - Test version for freepbx upgrader.
* Version 14.3.0.18 * - Fix Issue 42
* Version 14.3.0.22 * - Fix Issue 50
* Version 14.3.0.23 * - Fix Issue 49
* Version 14.3.0.25 * - Fix Issue 55
* Version 14.3.0.26 * - Fix Issue 54
* Version 14.3.0.27 * - Standardise treatment of SIP and SCCP hardware.
* Version 14.3.0.28 * - Fix issue with RNav which caused exception with new device
* Version 14.3.0.29 * - Fix issue reloading page after saving settings and not restarting devices.
* Version 14.3.0.30 * - Fix reversion in 29. Not returning to correct page when saving device.
* Version 14.3.0.31 * - Fix rewrite rules.
* Version 14.4.0.1 * - Modify installer to avoid data loss on existing 14.3 fields. Bump Minor version to reflect this.
* Version 14.4.0.2 * - Revert error in Installer db calls - IF EXISTS is not valid in MariaDb v5 (package DB)
* Version 14.4.0.3 * - Change method of selecting phonecodepage depending on if is java phone.
* Version 14.4.0.5 * - Fix issue #59.
* Version 14.5.0.2 * - Fix issue #32.
* Version 14.5.0.4 * - Fix issue where values with spaces are truncated. Preserve softkeys accross installs
</changelog> </changelog>
<location>https://github.com/chan-sccp/sccp_manager</location> <location></location>
<depends>
<version>15</version>
<phpversion>7.0</phpversion>
<phpcomponent>zip</phpcomponent>
</depends>
<supported> <supported>
<version>13.0.0.2M</version> <version>13.0.0.1</version>
</supported> </supported>
<info>https://github.com/chan-sccp/sccp_manager</info> <info>https://github.com/PhantomVl/sccp_manager</info>
<updateurl>https://raw.githubusercontent.com/chan-sccp/sccp_manager/develop/sccpManagerUpdater.json</updateurl>
<license>GPL</license> <license>GPL</license>
<md5sum></md5sum> <md5sum></md5sum>
<database>
<table name="sccpdevice">
<field name="name" type="string" length="15" primarykey="true"/>
<field name="type" type="string" length="15" notnull="false"/>
<field name="addon" type="string" length="45" notnull="false"/>
<field name="description" type="string" length="45" notnull="false"/>
<field name="_description" type="string" length="45" notnull="false"/>
<field name="tzoffset" type="string" length="5" notnull="false"/>
<field name="imageversion" type="string" length="31" notnull="false"/>
<field name="deny" type="string" length="100" default="0.0.0.0/0.0.0.0" notnull="false"/>
<field name="permit" type="string" length="100" default="internal" notnull="false"/>
<field name="earlyrtp" type="string" notnull="false"/>
<field name="mwilamp" type="string" default="on" notnull="false"/>
<field name="mwioncall" type="string" default="on" notnull="false"/>
<field name="dndFeature" type="string" notnull="false"/>
<field name="transfer" type="string" notnull="false"/>
<field name="cfwdall" type="string" default="on" notnull="false"/>
<field name="cfwdbusy" type="string" default="on" notnull="false"/>
<field name="private" type="string" default="off"/>
<field name="privacy" type="string" default="full"/>
<field name="nat" type="string" notnull="false"/>
<field name="directrtp" type="string" notnull="false"/>
<field name="softkeyset" type="string" length="100" default="softkeyset" notnull="false"/>
<field name="audio_tos" type="string" length="11" default="0xB8" notnull="false"/>
<field name="audio_cos" type="string" length="1" default="6" notnull="false"/>
<field name="video_tos" type="string" length="11" default="0x88" notnull="false"/>
<field name="video_cos" type="string" length="1" default="5" notnull="false"/>
<field name="conf_allow" type="string" default="on"/>
<field name="conf_play_general_announce" type="string" length="3" default="on" notnull="false"/>
<field name="conf_play_part_announce" type="string" default="on"/>
<field name="conf_mute_on_entry" type="string" default="off"/>
<field name="conf_music_on_hold_class" type="string" length="80" default="default" notnull="false"/>
<field name="conf_show_conflist" type="string" default="on"/>
<field name="force_dtmfmode" type="string" default="auto"/>
<field name="setvar" type="string" length="100" notnull="false"/>
<field name="backgroundImage" type="string" length="255" notnull="false"/>
<field name="backgroundThumbnail" type="string" length="255" notnull="false"/>
<field name="ringtone" type="string" length="255" notnull="false"/>
<field name="callhistory_answered_elsewhere" type="string" notnull="false"/>
<field name="loginname" type="string" length="20" default="NULL" notnull="false"/>
<field name="_loginname" type="string" length="20" notnull="false"/>
<field name="profileid" type="integer" default="0"/>
<field name="_profileid" type="integer" notnull="false"/>
<field name="dialrules" type="string" length="255" default="NULL" notnull="false"/>
<field name="_dialrules" type="string" length="255" notnull="false"/>
<field name="useRedialMenu" type="string" length="5" default="no" notnull="false"/>
<field name="cfwdnoanswer" type="string" default="on" notnull="false"/>
<field name="park" type="string" default="on" notnull="false"/>
<field name="monitor" type="string" notnull="false"/>
<field name="transfer_on_hangup" type="string" notnull="false"/>
<field name="phonecodepage" type="string" length="50" notnull="false"/>
<field name="logserver" type="string" length="100" default="NULL" notnull="false"/>
<field name="_logserver" type="string" length="100" notnull="false"/>
<field name="daysdisplaynotactive" type="string" length="20" default="NULL" notnull="false"/>
<field name="_daysdisplaynotactive" type="string" length="20" notnull="false"/>
<field name="displayontime" type="string" length="20" default="NULL" notnull="false"/>
<field name="_displayontime" type="string" length="20" notnull="false"/>
<field name="displayonduration" type="string" length="20" default="NULL" notnull="false"/>
<field name="_displayonduration" type="string" length="20" notnull="false"/>
<field name="displayidletimeout" type="string" length="20" default="NULL" notnull="false"/>
<field name="_displayidletimeout" type="string" length="20" notnull="false"/>
<field name="settingsaccess" type="string" default="off"/>
<field name="_settingsaccess" type="string" notnull="false"/>
<field name="videocapability" type="string" default="off"/>
<field name="_videocapability" type="string" notnull="false"/>
<field name="webaccess" type="string" default="off"/>
<field name="_webaccess" type="string" notnull="false"/>
<field name="webadmin" type="string" default="off"/>
<field name="_webadmin" type="string" notnull="false"/>
<field name="pcport" type="string" default="on"/>
<field name="_pcport" type="string" notnull="false"/>
<field name="spantopcport" type="string" default="on"/>
<field name="_spantopcport" type="string" notnull="false"/>
<field name="voicevlanaccess" type="string" default="off"/>
<field name="_voicevlanaccess" type="string" notnull="false"/>
<field name="enablecdpswport" type="string" default="off"/>
<field name="_enablecdpswport" type="string" notnull="false"/>
<field name="enablecdppcport" type="string" default="off"/>
<field name="_enablecdppcport" type="string" notnull="false"/>
<field name="enablelldpswport" type="string" default="off"/>
<field name="_enablelldpswport" type="string" notnull="false"/>
<field name="enablelldppcport" type="string" default="off"/>
<field name="_enablelldppcport" type="string" notnull="false"/>
<field name="firstdigittimeout" type="string" length="20" default="NULL" notnull="false"/>
<field name="_firstdigittimeout" type="string" length="20" notnull="false"/>
<field name="digittimeout" type="string" length="20" default="NULL" notnull="false"/>
<field name="_digittimeout" type="string" length="20" notnull="false"/>
<field name="cfwdnoanswer_timeout" type="string" length="20" default="NULL" notnull="false"/>
<field name="_cfwdnoanswer_timeout" type="string" length="20" notnull="false"/>
<field name="autoanswer_ring_time" type="string" length="20" default="NULL" notnull="false"/>
<field name="_autoanswer_ring_time" type="string" length="20" notnull="false"/>
<field name="autoanswer_tone" type="string" length="20" default="NULL" notnull="false"/>
<field name="_autoanswer_tone" type="string" length="20" notnull="false"/>
<field name="remotehangup_tone" type="string" length="20" default="NULL" notnull="false"/>
<field name="_remotehangup_tone" type="string" length="20" notnull="false"/>
<field name="transfer_tone" type="string" length="20" default="NULL" notnull="false"/>
<field name="_transfer_tone" type="string" length="20" notnull="false"/>
<field name="callwaiting_tone" type="string" length="20" default="NULL" notnull="false"/>
<field name="_callwaiting_tone" type="string" length="20" notnull="false"/>
<field name="callanswerorder" type="string" default="latestfirst"/>
<field name="_callanswerorder" type="string" notnull="false"/>
<field name="sccp_tos" type="string" length="11" default="0x68"/>
<field name="_sccp_tos" type="string" length="11" notnull="false"/>
<field name="sccp_cos" type="string" length="11" default="0x4"/>
<field name="_sccp_cos" type="string" length="11" notnull="false"/>
<field name="dev_sshPassword" type="string" length="25" default="cisco"/>
<field name="_dev_sshPassword" type="string" length="25" notnull="false"/>
<field name="dev_sshUserId" type="string" length="25" default="cisco"/>
<field name="_dev_sshUserId" type="string" length="25" notnull="false"/>
<field name="phonepersonalization" type="string" length="25" default="0"/>
<field name="_phonepersonalization" type="string" length="25" notnull="false"/>
<field name="devlang" type="string" length="50" default="NULL" notnull="false"/>
<field name="_devlang" type="string" length="50" notnull="false"/>
<field name="netlang" type="string" length="50" default="NULL" notnull="false"/>
<field name="_netlang" type="string" length="50" notnull="false"/>
<field name="keepalive" type="integer" default="60" notnull="false"/>
</table>
<table name="sccpline">
<field name="id" type="integer" autoincrement="true"/>
<field name="pin" type="string" length="7" notnull="false"/>
<field name="label" type="string" length="45" notnull="false"/>
<field name="description" type="string" length="45" notnull="false"/>
<field name="context" type="string" length="45" notnull="false"/>
<field name="incominglimit" type="integer" default="6" notnull="false"/>
<field name="transfer" type="string" notnull="false"/>
<field name="mailbox" type="string" length="45" notnull="false"/>
<field name="vmnum" type="string" length="45" default="*97" notnull="false"/>
<field name="cid_name" type="string" length="45" notnull="false"/>
<field name="cid_num" type="string" length="45" notnull="false"/>
<field name="disallow" type="string" length="255" notnull="false"/>
<field name="allow" type="string" length="255" notnull="false"/>
<field name="trnsfvm" type="string" length="45" notnull="false"/>
<field name="secondary_dialtone_digits" type="string" length="45" notnull="false"/>
<field name="secondary_dialtone_tone" type="string" length="45" notnull="false"/>
<field name="musicclass" type="string" length="45" default="default" notnull="false"/>
<field name="language" type="string" length="45" notnull="false"/>
<field name="accountcode" type="string" length="45" notnull="false"/>
<field name="echocancel" type="string" default="off"/>
<field name="silencesuppression" type="string" default="off"/>
<field name="callgroup" type="string" length="45" notnull="false"/>
<field name="pickupgroup" type="string" length="45" notnull="false"/>
<field name="namedcallgroup" type="string" length="100" notnull="false"/>
<field name="namedpickupgroup" type="string" length="100" notnull="false"/>
<field name="adhocNumber" type="string" length="45" notnull="false"/>
<field name="meetme" type="string" length="5" notnull="false"/>
<field name="meetmenum" type="string" length="45" notnull="false"/>
<field name="meetmeopts" type="string" length="45" notnull="false"/>
<field name="regexten" type="string" length="45" notnull="false"/>
<field name="directed_pickup" type="string" notnull="false"/>
<field name="directed_pickup_context" type="string" length="100" notnull="false"/>
<field name="pickup_modeanswer" type="string" notnull="false"/>
<field name="amaflags" type="string" length="45" notnull="false"/>
<field name="dnd" type="string" default="reject" notnull="false"/>
<field name="videomode" type="string" default="auto" notnull="false"/>
<field name="setvar" type="string" length="50" notnull="false"/>
<field name="name" type="string" length="40" primarykey="true"/>
<field name="phonecodepage" type="string" length="50" notnull="false"/>
<field name="regcontext" type="string" length="20" default="sccpregistration" notnull="false"/>
<field name="_regcontext" type="string" length="20" notnull="false"/>
<field name="transfer_on_hangup" type="string" default="off"/>
<field name="_transfer_on_hangup" type="string" notnull="false"/>
<field name="autoselectline_enabled" type="string" default="off"/>
<field name="_autoselectline_enabled" type="string" notnull="false"/>
<field name="autocall_select" type="string" default="off"/>
<field name="_autocall_select" type="string" notnull="false"/>
<field name="backgroundImageAccess" type="string" default="off"/>
<field name="_backgroundImageAccess" type="string" notnull="false"/>
<field name="callLogBlfEnabled" type="string" default="2"/>
<field name="_callLogBlfEnabled" type="string" notnull="false"/>
<key name="id" type="unique">
<column name="id"/>
</key>
</table>
<table name="sccpbuttonconfig">
<field name="ref" type="string" length="15" default="" primarykey="true"/>
<field name="reftype" type="string" length="15" default="sccpdevice" primarykey="true"/>
<field name="instance" type="boolean" default="0" primarykey="true"/>
<field name="buttontype" type="string" length="190" default="line" primarykey="true"/>
<field name="name" type="string" length="36" notnull="false"/>
<field name="options" type="string" length="100" notnull="false"/>
<key name="ref" type="index">
<column name="ref"/>
<column name="reftype"/>
</key>
</table>
<table name="sccpdevmodel">
<field name="model" type="string" length="20" primarykey="true"/>
<field name="vendor" type="string" length="40" notnull="false"/>
<field name="dns" type="integer" default="1" notnull="false"/>
<field name="buttons" type="integer" default="0" notnull="false"/>
<field name="loadimage" type="string" length="40" notnull="false"/>
<field name="loadinformationid" type="string" length="30" notnull="false"/>
<field name="enabled" type="integer" default="0" notnull="false"/>
<field name="nametemplate" type="string" length="50" notnull="false"/>
<key name="model" type="index">
<column name="model"/>
</key>
</table>
<table name="sccpuser">
<field name="name" type="string" length="20" primarykey="true"/>
<field name="pin" type="string" length="7" notnull="false"/>
<field name="password" type="string" length="7" notnull="false"/>
<field name="description" type="string" length="45" notnull="false"/>
<field name="roaminglogin" type="string" default="off" notnull="false"/>
<field name="devicegroup" type="string" length="7"/>
<field name="auto_logout" type="string" default="off" notnull="false"/>
<field name="homedevice" type="string" length="20" notnull="false"/>
<key name="name" type="unique">
<column name="name"/>
</key>
</table>
<table name="sccpsettings">
<field name="keyword" type="string" length="50" primarykey="true"/>
<field name="data" type="string" length="255" notnull="false"/>
<field name="seq" type="boolean" primarykey="true"/>
<field name="type" type="boolean" primarykey="true"/>
<field name="systemdefault" type="string" length="255" notnull="false"/>
</table>
</database>
</module> </module>

View file

@ -1,46 +0,0 @@
<div class="container-fluid">
<h1><?php echo $display_info?></h1>
<div class="row">
<div class="col-sm-12">
<div class="fpbx-container">
<div class="display no-border">
<div class="nav-container">
<div class="scroller scroller-left"><i class="glyphicon glyphicon-chevron-left"></i></div>
<div class="scroller scroller-right"><i class="glyphicon glyphicon-chevron-right"></i></div>
<div class="wrapper">
<ul class="nav nav-tabs list" role="tablist">
<?php foreach ($display_page as $key => $page) { ?>
<li data-name="<?php echo $key?>" class="change-tab <?php echo $key == 'general' ? 'active' : ''?>"><a href="#<?php echo $key?>" aria-controls="<?php echo $key?>" role="tab" data-toggle="tab"><?php echo $page['name']?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="tab-content display">
<?php foreach ($display_page as $key => $page) { ?>
<div id="<?php echo $key?>" class="tab-pane <?php echo $key == 'general' ? 'active' : ''?>">
<?php echo $page['content']?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal alerts-->
<div class="modal" id="hwalert" tabindex="-1" role="dialog" aria-labelledby="lhwalert">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

View file

@ -1,7 +1,5 @@
<?php /* $Id:$ */ <?php /* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) { if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
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.
// //
@ -16,12 +14,40 @@ if (!defined('FREEPBX_IS_AUTH')) {
// //
$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");
} }
// standardise code to reduce base
include('page.html.php');
?> ?>
<div class="container-fluid">
<h1><?php echo $display_info?></h1>
<div class="row">
<div class="col-sm-12">
<div class="fpbx-container">
<div class="display no-border">
<div class="nav-container">
<div class="scroller scroller-left"><i class="glyphicon glyphicon-chevron-left"></i></div>
<div class="scroller scroller-right"><i class="glyphicon glyphicon-chevron-right"></i></div>
<div class="wrapper">
<ul class="nav nav-tabs list" role="tablist">
<?php foreach($display_page as $key => $page) { ?>
<li data-name="<?php echo $key?>" class="change-tab <?php echo $key == 'general' ? 'active' : ''?>"><a href="#<?php echo $key?>" aria-controls="<?php echo $key?>" role="tab" data-toggle="tab"><?php echo $page['name']?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="tab-content display">
<?php foreach($display_page as $key => $page) { ?>
<div id="<?php echo $key?>" class="tab-pane <?php echo $key == 'general' ? 'active' : ''?>">
<?php echo $page['content']?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>

View file

@ -1,7 +1,5 @@
<?php /* $Id:$ */ <?php /* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) { if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
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.
// //
@ -16,12 +14,41 @@ if (!defined('FREEPBX_IS_AUTH')) {
// //
$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");
} }
// standardise code to reduce base
include('page.html.php');
?> ?>
<div class="container-fluid">
<h1><?php echo $display_info?></h1>
<div class="row">
<div class="col-sm-12">
<div class="fpbx-container">
<div class="display no-border">
<div class="nav-container">
<div class="scroller scroller-left"><i class="glyphicon glyphicon-chevron-left"></i></div>
<div class="scroller scroller-right"><i class="glyphicon glyphicon-chevron-right"></i></div>
<div class="wrapper">
<ul class="nav nav-tabs list" role="tablist">
<?php foreach($display_page as $key => $page) { ?>
<li data-name="<?php echo $key?>" class="change-tab <?php echo $key == 'general' ? 'active' : ''?>"><a href="#<?php echo $key?>" aria-controls="<?php echo $key?>" role="tab" data-toggle="tab"><?php echo $page['name']?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="tab-content display">
<?php foreach($display_page as $key => $page) { ?>
<div id="<?php echo $key?>" class="tab-pane <?php echo $key == 'general' ? 'active' : ''?>">
<?php echo $page['content']?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>

View file

@ -1,7 +1,5 @@
<?php /* $Id:$ */ <?php /* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) { if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
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:
@ -10,9 +8,35 @@ if (!defined('FREEPBX_IS_AUTH')) {
// AGPL v3 Licened // AGPL v3 Licened
// //
// Initialise page before to avoid double calls and improve performance $spage = FreePBX::create()->Sccp_manager;
$display_page = FreePBX::create()->Sccp_manager->settingsShowPage();
$display_info = _("SCCP Server Settings");
// standardise code to reduce base
include('page.html.php');
?> ?>
<div class="container-fluid">
<h1><?php echo _("SCCP Server Settings")?></h1>
<div class="row">
<div class="col-sm-12">
<div class="fpbx-container">
<div class="display no-border">
<div class="nav-container">
<div class="scroller scroller-left"><i class="glyphicon glyphicon-chevron-left"></i></div>
<div class="scroller scroller-right"><i class="glyphicon glyphicon-chevron-right"></i></div>
<div class="wrapper">
<ul class="nav nav-tabs list" role="tablist">
<?php foreach($spage->myShowPage() as $key => $page) { ?>
<li data-name="<?php echo $key?>" class="change-tab <?php echo $key == 'general' ? 'active' : ''?>"><a href="#<?php echo $key?>" aria-controls="<?php echo $key?>" role="tab" data-toggle="tab"><?php echo $page['name']?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="tab-content display">
<?php foreach($spage->myShowPage() as $key => $page) { ?>
<div id="<?php echo $key?>" class="tab-pane <?php echo $key == 'general' ? 'active' : ''?>">
<?php echo $page['content']?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>

View file

@ -1,482 +0,0 @@
<?php
// vim: set ai ts=4 sw=4 ft=php:
// Version for SCCP Manager 13.0.X
//
/* This is the driver for Sccp_manager in FreePBX.
It is loaded via an include, written by the installer, at
modules/core/functions.inc/drivers
and provides the following required methods. it provides the interface between
FreePBX extensions and sccp_manager lines
*
* getInfo
* addDevice
* delDevice
* getDevice - Called by core to read sccpline returning fields in data_fld
* getDefaultDeviceSettings -
* getDeviceDisplay - Called by functionsInc to load sccp tab using values from Device and getDevice.
*
*/
//
namespace FreePBX\modules\Core\Drivers;
class Sccp extends \FreePBX\modules\Core\Driver {
// This is a map between sccpline fields and FreePBX fields.
// TODO: List needs to be extended. Missing fields, not necessarily all required              
/* adhocNumber
              meetme
                meetmenum
               meetmeopts
                 regexten
          directed_pickup
  directed_pickup_context
        pickup_modeanswer
                 amaflags
setvar
            phonecodepage
                  trnsfvm
                    vmnum
*/
private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account',
"context" =>'context',"incominglimit"=>'incominglimit',
"callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
"transfer" => 'transfer', "echocancel" => 'echocancel',
"language" => 'language', "description" => 'callerid',
"cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'mailbox',
"musicclass" => 'musicclass', "allow" => 'allow',"disallow" => 'disallow',
"videomode" => 'videomode', 'pickup_modeanswer' => 'pickup_modeanswer',
"dnd" => 'dnd', "silencesuppression" => 'silencesuppression',
"secondary_dialtone_digits" => 'secondary_dialtone_digits',
"secondary_dialtone_tone" => 'secondary_dialtone_tone',
'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup',
'directed_pickup' => 'directed_pickup'
);
// These are gui defaults used by freePBX for the elements in the SCCP tab in add/edit phone.
private $guiDefaults =array(
'gui_checkset' => array( "elemname" => "",
"prompttext" => "", //ok
"helptext" => "",
"currentvalue" => "",
"valarray" => array(),
"jsonclick" => '',
"jsvalidation" => "", //ok
"failvalidationmsg" => "", //ok
"canbeempty" => true,
"maxchars" => 0,
"disable" => false, //ok
"inputgroup" => false,
"class" => "",
"cblabel" => 'Enable',
"disabled_value" => 'DEFAULT',
"check_enables" => 'true',
"cbdisable" => false,
"cbclass" => '')
);
private $line_defaults = array();
public function __construct($parent_class = null) {
$this->freepbx = $parent_class;
$this->database = $parent_class->Database();
// Get system defaults [systemdefault] and sitedefaults [data] from sccpsettings.
$stmt = $this->database->prepare("SELECT * FROM sccpsettings");
$stmt->execute();
$raw_settings = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($raw_settings as $key => $valueArray) {
$sccpDefaults[$valueArray['keyword']] = $valueArray['systemdefault'];
$siteDefaults[$valueArray['keyword']] = $valueArray['data'];
}
// This will produce an array where site defaults take precedence over system defaults
$this->line_defaults = array_intersect_key($siteDefaults,$sccpDefaults);
// If have no site codecs, use system defaults - must have a codec!
if (empty($this->line_defaults['allow'])) {
$this->line_defaults['allow'] = $sccpDefaults['allow'];
}
if (empty($this->line_defaults['disallow'])) {
$this->line_defaults['disallow'] = $sccpDefaults['disallow'];
}
unset($raw_settings, $siteDefaults, $sccpDefaults);
}
public function getInfo() {
return array(
"rawName" => "sccp",
"hardware" => "sccp_custom",
"prettyName" => _("Sccp Custom Driver"),
"shortName" => "SCCP",
"description" => _("Sccp Device"),
"Version" => "11.5",
"about" => "Sccp class Base ver: 11.5, Sccp ver: default"
);
}
public function addDevice($id, $settings) {
// This is actually save line and is used by add and edit.
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description','devinfo_mailbox'=>'mailbox');
$settings['cid_num']['value'] = '';
$settings['cid_name']['value'] = '';
$settings['mailbox']['value']= '';
// Add $_REQUEST values to settings
if (isset($_REQUEST)){
foreach($add_fld as $key => $val) {
if (!empty($_REQUEST[$key])){
$settings[$val]['value'] = $_REQUEST[$key];
}
}
}
$allow_codec = array();
foreach($settings as $key => $val) {
if (strncmp($key,'codec_',6) === 0 ) {
$allow_codec[] = str_replace('codec_','',$key);
}
}
$settings['allow']['value'] = implode(";", $allow_codec);
// Reset to line defaults if no value selected
if (empty($settings['allow']['value'])) {
$settings['allow']['value'] = $this->line_defaults['allow'];
}
// If set, parse outboundcid content into cid_num and cid_name sccpline fields
if (!empty($settings['cid_num']['value'])) {
$outboundcid = $settings['cid_num']['value'];
if (preg_match('/"(.*)"\s?<(.*)>/', $outboundcid, $matches)) {
$settings['cid_num']['value'] = $matches[2];
$settings['cid_name']['value'] = $matches[1];
} else if (is_integer($outboundcid)) {
$settings['cid_num']['value'] = $outboundcid;
}
}
if ($this->line_defaults['dndFeature'] == 'off') {
$settings['dnd']['value'] = 'off';
}
if (!empty($_REQUEST['vm']) && ($_REQUEST['vm'] =='enabled')){ // mailbox
if (empty($settings['mailbox']['value'])) {
$settings['mailbox']['value']= $id;
}
}
// only store values that have been set; if need to display a default, must show in page.
$sqlSet = "name='{$id}'";
foreach($this->data_fld as $key => $val) {
if (!empty($settings[$val]['value'])) {
$sqlSet .= ", {$key}='{$settings[$val]['value']}'";
}
}
$stmt = "INSERT INTO sccpline SET {$sqlSet} ON DUPLICATE KEY UPDATE {$sqlSet}";
$sth = $this->database->prepare($stmt);
$sth->execute();
/*
If called from SCCP Phone, redirect to SCCP Phone page on submit.
This was last function in add so should be safe.
Prefer to add in Hooks, but is not followed even if set for $currentComponent
Do nothing if called from QuickCreateExtension when display is not set
*/
if (isset($_REQUEST['display'])) {
redirect("config.php?display=sccp_phone", false);
}
// Have changed something so need to reload the device
// TODO: are we reloading the device or reloading Asterisk
$this->reload_line($id);
return true;
}
public function delDevice($id) {
//Required by FreePBX.
// Delete associated default line buttons or will leave orphans
foreach (array($id) as $openId) {
$sth = $this->database->prepare("DELETE FROM sccpbuttonconfig WHERE name LIKE :openID AND buttontype = 'line'");
$openId = "{$openId}%";
$sth->bindParam(':openID', $openId);
$sth->execute();
}
$sth = $this->database->prepare("DELETE FROM sccpline WHERE name = ?");
$sth->execute(array($id));
return true;
}
public function getDevice($id) {
// FreePBX required method
$sql = "SELECT name AS id, name AS name ";
foreach($this->data_fld as $key => $val) {
$sql .= ", {$key} AS {$val}";
}
$sql .= " FROM sccpline WHERE name = '{$id}'";
$sth = $this->database->prepare($sql);
$tech = array();
try {
$sth->execute(array($id));
$tech = $sth->fetch(\PDO::FETCH_ASSOC);
$tech['dial']="SCCP/{$id}";
} catch(\Exception $e) {}
return $tech;
}
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
// FreePBX required method
$settings = array();
$settingsFields = array('mailbox', 'incominglimit', 'context', 'directed_pickup_context', 'callgroup', 'pickupgroup', 'namedcallgroup',
'namedpickupgroup', 'adhocNumber', 'secondary_dialtone_digits', 'secondary_dialtone_tone', 'directed_pickup', 'pickup_modeanswer',
'transfer', 'echocancel', 'dnd', 'silencesuppression', 'musicclass', 'pin', 'allow', 'disallow');
foreach ($settingsFields as $key) {
$settings[$key] = array('value' => $this->line_defaults[$key], 'flag' => $flag++);
}
return array('dial' => 'SCCP', 'settings' => $settings);
}
public function getDeviceDisplay($display, $deviceInfo, $currentComponent, $primarySection) {
global $amp_conf;
$activeCodecs = array();
// load xml data to get help from same source as rest of module
$xml_vars = $amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/conf/sccpgeneral.xml.v433';
$this->xml_data = simplexml_load_file($xml_vars);
// load metainfo from chan-sccp - help information if not in xml. Only load first time as static data.
if (empty($this->sccpHelpInfo)) {
$sysConfiguration = \FreePbx::sccp_manager()->aminterface->getSCCPConfigMetaData('general');
foreach ($sysConfiguration['Options'] as $key => $valueArray) {
foreach ($valueArray['Description'] as $descKey => $descValue) {
$this->sccpHelpInfo[$valueArray['Name']] .= $descValue . '<br>';
}
}
unset($sysConfiguration);
}
$section = _("SCCP Extension Details");
$section_с = _("SCCP Codec Details");
$gn_category = "sccp";
//add sccp category
$currentComponent->addTabTranslation('sccp',_('SCCP'));
// get site and system defaults
$systemCodecs = array_fill_keys(explode(';',$this->line_defaults['allow']),true);
$siteAudioCodecs = array_intersect_key($systemCodecs, $this->freepbx->Codecs->getAudio());
$siteVideoCodecs = array_intersect_key($systemCodecs, $this->freepbx->Codecs->getVideo());
if (empty($deviceInfo['allow'])) {
// No allowed codecs so reset to site defaults
foreach ($systemCodecs as $lineCodec => $dummyVal) {
$activeCodecs[] = "devinfo_codec_{$lineCodec}";
}
} else {
// have allowed codecs for this line
foreach (explode(';',$deviceInfo['allow']) as $lineCodec) {
$activeCodecs[] = "devinfo_codec_{$lineCodec}";
}
}
// Fill Audio codecs information
foreach ($siteAudioCodecs as $key => $value) {
$audioCodecButtons[] = array('value' => "devinfo_codec_{$key}", 'text' => $key);
}
// Fill Video codecs information
foreach ($siteVideoCodecs as $key => $value) {
$videoCodecButtons[] = array('value' => "devinfo_codec_{$key}", 'text' => $key);
}
$tmparr['disallow'] = array('prompttext' => _('Disallowed Codecs'),
'value' => $this->line_defaults['disallow'],
'tt' => 'Codecs that are disallowed. Default and recommended value is all',
'level' => 1,
'section' => $section_с,
'category' => $gn_category
);
$el = array(
"elemname" => "devinfo_sccp_codec",
"prompttext" => _('Line Audio Codec:'),
"helptext" => _("Line Audio Codec. Uncheck all Audio and Video codecs to return to site defaults"),
"currentvalue" => $activeCodecs,
"valarray" => $audioCodecButtons,
"class" => $section_с,
"disable" => 0
);
// Override defaults with $el
$currentComponent->addguielem($section_с, new \gui_checkset(array_merge($this->guiDefaults['gui_checkset'],$el)), $gn_category);
unset($el);
$el = array(
"elemname" => "devinfo_sccp_vcodec",
"prompttext" => _('Line Video Codec:'),
"helptext" => _("Line Video Codec"),
"currentvalue" => $activeCodecs,
"valarray" => $videoCodecButtons,
"class" => $section_с,
"disable" => 0
);
$currentComponent->addguielem($section_с, new \gui_checkset(array_merge($this->guiDefaults['gui_checkset'],$el)), $gn_category);
$pageGroup = $this->xml_data->xpath('//page_group[@name="sccp_extension_config"]');
$elements = $pageGroup[0]->children();
foreach ($elements as $child) {
if (empty($child->help)) {
$child->help = 'Help is not available.';
$child->meta_help = '1';
}
switch ($child['type']) {
case 'IE':
$elementID = (string)$child->input[0]->name;
if (!empty($metainfo[$elementID])) {
if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metainfo[$shortId];
}
}
$tmparr[$elementID] = array('prompttext' => _((string)$child->label),
'value' => $this->line_defaults[$elementID],
'tt' => (string)$child->help,
'level' => 1,
'section' => $section,
'category' => $gn_category
);
break;
case 'IS':
$select = array();
foreach ($child->xpath('button') as $value) {
$select[] = array('value' => strtolower((string)$value[@value]), 'text' => (string)$value);
}
$hideButton = false;
if (($this->line_defaults['dndFeature'] == 'off') && ($child['id'] == 5)) {
$hideButton = true;
}
$tmparr[(string)$child->name] = array('prompttext' => _((string)$child->label),
'value' => $this->line_defaults[(string)$child->name],
'tt' => (string)$child->help,
'select' => $select,
'level' => 1,
'disable' => $hideButton,
'hidden' => $hideButton,
'type' => 'radio',
'section' => $section,
'category' => $gn_category
);
unset($select);
break;
case 'SLD':
$select = array(
array( 'value' => '0x21', 'text' => 'Inside Dial Tone'),
array( 'value' => '0x22', 'text' => 'Outside Dial Tone'),
array( 'value' => '0x23', 'text' => 'Line Busy Tone'),
array( 'value' => '0x24', 'text' => 'Alerting Tone'),
array( 'value' => '0x25', 'text' => 'Reorder Tone'),
array( 'value' => '0x26', 'text' => 'Recorder Warning Tone'),
array( 'value' => '0x27', 'text' => 'Recorder Detected Tone'),
array( 'value' => '0x28', 'text' => 'Reverting Tone'),
array( 'value' => '0x29', 'text' => 'Receiver OffHook Tone'),
array( 'value' => '0x2A', 'text' => 'Partial Dial Tone'),
array( 'value' => '0x2B', 'text' => 'No Such Number Tone'),
array( 'value' => '0x2C', 'text' => 'Busy Verification Tone'),
array( 'value' => '0x2D', 'text' => 'Call Waiting Tone'),
array( 'value' => '0x2E', 'text' => 'Confirmation Tone'),
array( 'value' => '0x2F', 'text' => 'Camp On Indication Tone'),
array( 'value' => '0x30', 'text' => 'Recall Dial Tone'),
array( 'value' => '0x31', 'text' => 'Zip Zip'),
array( 'value' => '0x32', 'text' => 'Zip'),
array( 'value' => '0x33', 'text' => 'Beep Bonk'),
array( 'value' => '0x34', 'text' => 'Music Tone'),
array( 'value' => '0x35', 'text' => 'Hold Tone'),
array( 'value' => '0x36', 'text' => 'Test Tone'),
array( 'value' => '0x37', 'text' => 'DT Monitor Warning Tone'),
array( 'value' => '0x40', 'text' => 'Add Call Waiting'),
array( 'value' => '0x41', 'text' => 'Priority Call Wait'),
array( 'value' => '0x42', 'text' => 'Recall Dial'),
array( 'value' => '0x43', 'text' => 'Barg In'),
array( 'value' => '0x44', 'text' => 'Distinct Alert'),
array( 'value' => '0x45', 'text' => 'Priority Alert'),
array( 'value' => '0x46', 'text' => 'Reminder Ring'),
array( 'value' => '0x47', 'text' => 'Precedence RingBank'),
array( 'value' => '0x48', 'text' => 'Pre-EmptionTone'),
array( 'value' => '0x67', 'text' => '2105 HZ'),
array( 'value' => '0x68', 'text' => '2600 HZ'),
array( 'value' => '0x69', 'text' => '440 HZ'),
array( 'value' => '0x6A', 'text' => '300 HZ'),
array( 'value' => '0x77', 'text' => 'MLPP Pala'),
array( 'value' => '0x78', 'text' => 'MLPP Ica'),
array( 'value' => '0x79', 'text' => 'MLPP Vca'),
array( 'value' => '0x7A', 'text' => 'MLPP Bpa'),
array( 'value' => '0x7B', 'text' => 'MLPP Bnea'),
array( 'value' => '0x7C', 'text' => 'MLPP Upa')
);
$tmparr[(string)$child->name] = array('prompttext' => _((string)$child->label),
'value' => $this->line_defaults[(string)$child->name],
'tt' => (string)$child->help,
'select' => $select,
'level' => 1,
'type' => 'select',
'section' => $section,
'category' => $gn_category
);
unset($select);
break;
case 'SLG':
$elementID = (string)$child->name;
$named_group = \FreePbx::sccp_manager()->dbinterface->getNamedGroup($elementID);
if (!empty($named_group[$elementID])) {
foreach ($named_group[$elementID] as $val) {
$select[] = array('value' => $val, 'text' => $val);
}
}
// Disable and hide list elements if there are no valid values
$tmparr[(string)$child->name] = array('prompttext' => _((string)$child->label),
'value' => $this->line_defaults[(string)$child->name],
'tt' => (string)$child->help,
'select' => $select,
'level' => 1,
'disable' => empty($named_group[$elementID][0]),
'hidden' => empty($named_group[$elementID][0]),
'section' => $section,
'category' => $gn_category
);
unset($select);
break;
case 'SLM':
if (function_exists('music_list')){
foreach (music_list() as $value) {
$select[] = array('value' => $value, 'text' => _($value));
}
} else {
$select[] = array('value' => 'default', 'text' => _('default'));
}
$tmparr[(string)$child->name] = array('prompttext' => _((string)$child->label),
'value' => $this->line_defaults[(string)$child->name],
'tt' => (string)$child->help,
'select' => $select,
'level' => 1,
'type' => 'select',
'section' => $section,
'category' => $gn_category
);
unset($select);
break;
}
}
$select[] = array('value' => 'off', 'text' => 'Off');
$select[] = array('value' => 'user', 'text' => 'User');
$select[] = array('value' => 'auto', 'text' => 'Auto');
$tt = _("Automatic or Manual video mode. Valid values are 'auto', 'user' or 'off'. When set to 'auto', video will automatically start if both parties have a compatible code enabled. In 'user' mode the user needs to press the vidmode softkey before video will be tried. Default:'auto'");
$tmparr['videomode'] = array('prompttext' => _('Video Mode '), 'value' => 'auto', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section_с, 'category' => $gn_category);
unset($select);
return $tmparr;
}
public function reload_line($id) {
global $astman;
// TODO: Change to use amInterfaceClasses
$result = $astman->Command('sccp reload line ' . $id);
return $result;
}
public function getDeviceHeaders() {
return array(
'secret' => array('identifier' => _('Secret'), 'description' => sprintf(_('Secret [Enter "%s" to regenerate]'),"REGEN")),
);
}
}

View file

@ -1,208 +0,0 @@
<?php
/**
*
* Core Comsnd Interface
*
* https://www.voip-info.org/asterisk-manager-example-php/
*/
/* !TODO!: Re-Indent this file. -TODO-: What do you mean? coreaccessinterface ?? */
namespace FreePBX\modules\Sccp_manager\aminterface;
// ************************************************************************** Event *********************************************
abstract class Event extends IncomingMessage
{
protected $_events;
public function getName()
{
return $this->getKey('Event');
}
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->_events = array();
$this->_completed = false;
}
}
class UnknownEvent extends Event
{
public function __construct($rawContent = '')
{
}
}
class TableStart_Event extends Event
{
public function getTableName()
{
return $this->getKey('TableName');
}
}
class TableEnd_Event extends Event
{
public function getTableName()
{
return $this->getKey('TableName');
}
}
class SCCPSoftKeySetEntry_Event extends Event
{
// This is a list of tables, each table is an entry
protected $_data;
}
class ExtensionStatus_Event extends Event
{
// this is a list of tables, each table is an entry
public function getPrivilege()
{
return $this->getKey('Privilege');
}
public function getExtension()
{
return $this->getKey('Exten');
}
public function getContext()
{
return $this->getKey('Context');
}
public function getHint()
{
return $this->getKey('Hint');
}
public function getStatus()
{
return $this->getKey('Status');
}
}
class SCCPDeviceEntry_Event extends Event
{
// This is a list of tables, each table is an entry
}
class SCCPShowDevice_Event extends Event
{
// This is a list of tables
public function getCapabilities()
{
// TODO unused method - to be deleted?
$ret = array();
$codecs = explode(';', substr($this->getKey('Capabilities'), 1, -1));
foreach ($codecs as $codec) {
$codec_parts = explode(" ", $codec);
$ret[] = array("name" => $codec_parts[0], "value" => substr($codec_parts[1], 1, -1));
}
return $ret;
}
public function getCodecsPreference()
{
// TODO unused method - to be deleted?
$ret = array();
$codecs = explode(';', substr($this->getKey('CodecsPreference'), 1, -1));
foreach ($codecs as $codec) {
$codec_parts = explode(" ", $codec);
$ret[] = array("name" => $codec_parts[0], "value" => substr($codec_parts[1], 1, -1));
}
return $ret;
}
}
class SCCPDeviceButtonEntry_Event extends Event
{
}
class SCCPDeviceFeatureEntry_Event extends Event
{
// Returned by SCCPShowDevice
}
class SCCPVariableEntry_Event extends Event
{
// Returned by SCCPShowDevice
}
class SCCPDeviceLineEntry_Event extends Event
{
}
class SCCPDeviceStatisticsEntry_Event extends Event
{
}
class SCCPDeviceSpeeddialEntry_Event extends Event
{
}
abstract class ClosingEvent extends Event
{
public function __construct($message) {
parent::__construct($message);
$this->_completed = true;
}
public function getListItems() {
return intval($this->getKey('ListItems'));
}
}
class ResponseComplete_Event extends ClosingEvent
{
// dummy event to avoid unnecessary testing
public function listCorrectlyReceived($_message, $_eventCount){
return true;
}
}
class SCCPShowDeviceComplete_Event extends ClosingEvent
{
public function listCorrectlyReceived($_message, $_eventCount){
// Have end of list event. Check with number of lines received and send true if match.
// Remove 9 for the start and end events, and then 4.
if ($this->getKey('listitems') === substr_count( $_message, "\n") -13) {
return true;
}
return false;
}
}
class SCCPShowDevicesComplete_Event extends ClosingEvent
{
public function listCorrectlyReceived($_message, $_eventCount) {
// Have end of list event. Check with number of events received and send true if match.
// Remove 9 for the lines in the list start and end, and the 2 blank lines.
if ($this->getKey('listitems') === substr_count( $_message, "\n") -11) {
return true;
}
return false;
}
}
class ExtensionStateListComplete_Event extends ClosingEvent
{
public function listCorrectlyReceived($_message, $_eventCount){
// Have end of list event. Check with number of events received and send true if match.
// Remove 1 as the closing event is included in the count.
if ($this->getKey('listitems') === $_eventCount -1) {
return true;
}
return false;
}
}
class SCCPShowSoftKeySetsComplete_Event extends ClosingEvent
{
public function listCorrectlyReceived($_message, $_eventCount){
// Have the end of list event. Check the number of lines received and
// return true if match. Remove 8 for the complete event.
if ($this->getKey('listitems') === substr_count( $_message, "\n") -11) {
return true;
}
return false;
}
}

View file

@ -1,428 +0,0 @@
<?php
/**
*
* Core Comsnd Interface
*
* https://www.voip-info.org/asterisk-manager-example-php/
*/
/* !TODO!: Re-Indent this file. -TODO-: What do you mean? coreaccessinterface ?? */
namespace FreePBX\modules\Sccp_manager\aminterface;
class AMIException extends \Exception
{
}
abstract class Message
{
const EOL = "\r\n";
const EOM = "\r\n\r\n";
protected $lines;
protected $variables;
protected $keys;
protected $createdDate;
private $_responseHandler;
public function __construct()
{
$this->lines = array();
$this->variables = array();
$this->keys = array();
$this->createdDate = time();
}
public function _ToDebug($level, $msg)
{
}
public function getResponseHandler()
{
if (strlen($this->_responseHandler) > 0) {
// throw new AMIException('Hier:' . $this->_responseHandler);
return (string) $this->_responseHandler;
} else {
return "";
}
}
public function setResponseHandler($responseHandler)
{
if (0 == strlen($responseHandler)) {
return;
}
$className = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\' . $responseHandler . '_Response';
if (class_exists($className, true)) {
$this->_responseHandler = $responseHandler;
} else {
return;
}
}
public function setVariable($key, $value)
{
$key = strtolower($key);
$this->variables[$key] = $value;
/* print_r('<br>----Set Value -------<br>');
print_r($key);
print_r($value);
*/
}
public function getVariable($key)
{
$key = strtolower($key);
if (!isset($this->variables[$key])) {
return null;
}
return $this->variables[$key];
}
protected function setKey($key, $value)
{
$key = strtolower((string) $key);
$this->keys[$key] = (string) $value;
/*
print_r('<br>----Set Key -------<br>');
print_r($key);
print_r($value);
*
*/
}
public function getKey($key)
{
$key = strtolower($key);
if (!isset($this->keys[$key])) {
return null;
}
//return (string)$this->keys[$key];
return $this->keys[$key];
}
public function getVariables()
{
return $this->variables;
}
public function getActionID()
{
return $this->getKey('ActionID');
}
public function getKeys()
{
return $this->keys;
}
private function serializeVariable($key, $value)
{
return "Variable: $key=$value";
}
protected function setSanitizedKey($key, $value)
{
$key = strtolower((string) $key);
$_string_key = array('actionid', 'descr');
if (array_search($key, $_string_key) !== false) {
$this->keys[$key] = (string) $this->sanitizeInput($value, 'string');
} else {
$this->keys[$key] = $this->sanitizeInput($value);
}
}
protected function sanitizeInput($value, $prefered_type = '')
{
if ($prefered_type == '') {
if (!isset($value) || $value === null || strlen($value) == 0) {
return null;
} elseif (is_numeric($value)) {
$prefered_type = 'numeric';
} elseif (is_string($value)) {
$prefered_type = 'string';
} else {
throw new AMIException("Don't know how to convert: '" . $value . "'\n");
}
}
if ($prefered_type !== '') {
switch ($prefered_type) {
case 'string':
if (!isset($value) || $value === null || strlen($value) == 0) {
return '';
}
if (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE)) {
return (boolean) $value;
} elseif (filter_var($value, FILTER_SANITIZE_STRING, FILTER_NULL_ON_FAILURE)) {
return (string) $value;
} elseif (filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_NULL_ON_FAILURE)) {
return (string) htmlspecialchars($value, ENT_QUOTES);
} else {
throw new AMIException("Incoming String is not sanitary. Skipping: '" . $value . "'\n");
}
break;
case 'numeric':
if (!isset($value) || $value === null || strlen($value) == 0) {
return 0;
}
if (filter_var($value, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX | FILTER_FLAG_ALLOW_OCTAL)) {
return intval($value, 0);
} elseif (filter_var($value, FILTER_VALIDATE_FLOAT, FILTER_FLAG_ALLOW_FRACTION | FILTER_FLAG_ALLOW_THOUSAND | FILTER_FLAG_ALLOW_SCIENTIFIC)) {
return (float) $value;
} else {
return (double) $value;
}
default:
throw new AMIException("Don't know how to convert: '" . $value . "'\n");
break;
}
}
}
protected function finishMessage($message)
{
return $message . self::EOL . self::EOL;
}
public function serialize()
{
$result = array();
foreach ($this->getKeys() as $k => $v) {
$result[] = $k . ': ' . $v;
}
foreach ($this->getVariables() as $k => $v) {
if (is_array($v)) {
foreach ($v as $singleValue) {
$result[] = $this->serializeVariable($k, $singleValue);
}
} else {
$result[] = $this->serializeVariable($k, $v);
}
}
$mStr = $this->finishMessage(implode(self::EOL, $result));
return $mStr;
}
public function setActionID($actionID)
{
if (0 == strlen($actionID)) {
throw new AMIException('ActionID cannot be empty.');
return;
}
if (strlen($actionID) > 69) {
throw new AMIException('ActionID can be at most 69 characters long.');
return;
}
$this->setKey('ActionID', $actionID);
}
public function __sleep()
{
return array('lines', 'variables', 'keys', 'createdDate');
}
}
abstract class IncomingMessage extends Message
{
protected $rawContent;
public function getEventList()
{
return $this->getKey('EventList');
}
public function getRawContent()
{
return $this->rawContent;
}
public function isComplete()
{
return $this->_completed;
}
public function __sleep()
{
$ret = parent::__sleep();
$ret[] = 'rawContent';
return $ret;
}
public function __construct($rawContent)
{
parent::__construct();
$this->rawContent = $rawContent;
$lines = explode(Message::EOL, $rawContent);
foreach ($lines as $line) {
$content = explode(':', $line);
$name = strtolower(trim($content[0]));
unset($content[0]);
$value = isset($content[1]) ? trim(implode(':', $content)) : '';
try {
$this->setSanitizedKey($name, $value);
} catch (AMIException $e) {
throw new AMIException("Error: '" . $e . "'\n Dump RawContent:\n" . $this->rawContent . "\n");
}
}
}
}
// namespace FreePBX\modules\Sccp_manager\aminterface\Message;
class LoginAction extends ActionMessage
{
/**
* Constructor.
*
* @param string $user AMI username.
* @param string $password AMI password.
*
* @return void
*/
public function __construct($user, $password)
{
parent::__construct('Login');
$this->setKey('Username', $user);
$this->setKey('Secret', $password);
$this->setKey('Events', 'off'); // &----
$this->setResponseHandler('Login');
}
}
abstract class ActionMessage extends Message
{
public function __construct($what)
{
parent::__construct();
$this->setKey('Action', $what);
$this->setKey('ActionID', microtime(true));
}
}
class CommandAction extends ActionMessage
{
public function __construct($command)
{
parent::__construct('Command');
$this->setKey('Command', $command);
$this->setResponseHandler("Command");
}
}
class ReloadAction extends ActionMessage
{
public function __construct($module = false)
{
parent::__construct('Reload');
if ($module !== false) {
$this->setKey('Module', $module);
$this->setResponseHandler("Generic");
}
}
}
class ExtensionStateListAction extends ActionMessage
{
public function __construct()
{
parent::__construct('ExtensionStateList');
$this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command');
$this->setResponseHandler("ExtensionStateList");
}
}
class SCCPShowGlobalsAction extends ActionMessage
{
public function __construct()
{
parent::__construct('SCCPShowGlobals');
}
}
class SCCPShowSoftkeySetsAction extends ActionMessage
{
public function __construct()
{
parent::__construct('SCCPShowSoftkeySets');
$this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command');
$this->setResponseHandler("SCCPShowSoftkeySets");
}
}
class SCCPShowDeviceAction extends ActionMessage
{
public function __construct($devicename)
{
parent::__construct('SCCPShowDevice');
$this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command');
$this->setKey('DeviceName', $devicename);
$this->setResponseHandler("SCCPShowDevice");
}
}
class SCCPShowDevicesAction extends ActionMessage
{
public function __construct()
{
parent::__construct('SCCPShowDevices');
$this->setKey('Segment', 'general');
$this->setKey('ResultFormat', 'command');
$this->setResponseHandler("SCCPShowDevices");
}
}
class SCCPTokenAckAction extends ActionMessage
{
public function __construct($DeviceName)
{
parent::__construct('SCCPTokenAck');
$this->setKey('DeviceId', $DeviceName);
$this->setResponseHandler("Generic");
}
}
class SCCPDeviceRestartAction extends ActionMessage
{
public function __construct($DeviceName, $Type = "restart")
{
parent::__construct('SCCPDeviceRestart');
$this->setResponseHandler("Generic");
if (empty($Type)) {
$Type = "restart";
}
$this->setKey('DeviceName', $DeviceName);
if (in_array(strtolower($Type), array('restart', 'full', 'reset'))) {
$this->setKey('Type', $Type);
} else {
throw new Exception('Param2 has to be one of \'restart\', \'full\', \'reset\'.');
}
}
}
class SCCPConfigMetaDataAction extends ActionMessage
{
public function __construct($segment = false)
{
parent::__construct('SCCPConfigMetaData');
if ($segment != false) {
$this->setKey('Segment', $segment);
}
$this->setResponseHandler("SCCPJSON");
}
}

View file

@ -1,429 +0,0 @@
<?php
/*
*
* Response class definitions
*
*/
namespace FreePBX\modules\Sccp_manager\aminterface;
// ************************************************************************** Response *********************************************
abstract class Response extends IncomingMessage
{
protected $_events;
protected $_completed;
protected $keys;
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->_events = array();
// this logic is false - even if we have an error, we will not get anymore data, so is completed.
$this->_completed = $this->isSuccess();
}
public function __sleep()
{
$ret = parent::__sleep();
$ret[] = '_completed';
$ret[] = '_events';
return $ret;
}
public function getEvents()
{
return $this->_events;
}
public function getClosingEvent() {
return $this->_events['ClosingEvent'];
}
public function removeClosingEvent() {
unset($this->_events['ClosingEvent']);
}
public function getCountOfEvents() {
return count($this->_events);
}
public function isSuccess()
{
// returns true if response message does not contain error
return stristr($this->getKey('Response'), 'Error') === false;
}
public function isList()
{
if ($this->getKey('EventList') === 'start' ) {
return true;
}
}
public function getMessage()
{
return $this->getKey('Message');
}
public function setActionId($actionId)
{
$this->setKey('ActionId', $actionId);
}
public function getVariable($_rawContent, $_fields = '')
{
$lines = explode(Message::EOL, $_rawContent);
foreach ($_fields as $key => $value) {
foreach ($lines as $data) {
$_pst = strpos($data, $value);
if ($_pst !== false) {
$this->setKey($key, substr($data, $_pst + strlen($value)));
}
}
}
}
}
class GenericResponse extends Response
{
}
//****************************************************************************
// There are two types of Response messages returned by AMI
// Self contained responses which include any data requested;
// List Responses which contain the data in event messages that follow
// the response message.Response and Event
// Following are the self contained Response classes.
//****************************************************************************
class Generic_Response extends Response
{
public function __construct($rawContent)
{
// Only used for self contained responses.
parent::__construct($rawContent);
// add dummy closing event
$this->_events['ClosingEvent'] = new ResponseComplete_Event($rawContent);
$this->_completed = true;
$this->eventListIsCompleted = true;
}
}
class Login_Response extends Generic_Response
{
}
class Command_Response extends Generic_Response
{
private $_temptable;
public function __construct($rawContent)
{
$this->_temptable = array();
parent::__construct($rawContent);
$lines = explode(Message::EOL, $rawContent);
foreach ($lines as $line) {
$content = explode(':', $line);
if (is_array($content)) {
switch (strtolower($content[0])) {
case 'actionid':
$this->_temptable['ActionID'] = trim($content[1]);
break;
case 'response':
$this->_temptable['Response'] = trim($content[1]);
break;
case 'privilege':
$this->_temptable['Privilege'] = trim($content[1]);
break;
case 'output':
// included for backward compatibility with earlier versions of chan_sccp_b. AMI api does not precede command output with Output
$this->_temptable['Output'] = explode(PHP_EOL,str_replace(PHP_EOL.'--END COMMAND--', '',trim($content[1])));
break;
default:
$this->_temptable['Output'] = explode(PHP_EOL,str_replace(PHP_EOL.'--END COMMAND--', '', trim($line)));
break;
}
}
}
}
public function getResult()
{
return $this->_temptable;
}
}
class SCCPJSON_Response extends Generic_Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->getVariable($rawContent, array("DataType" => "DataType:", "JSONRAW" => "JSON:"));
if (null !== $this->getKey('JSONRAW')) {
$this->setKey('Response', 'Success');
}
}
public function getResult()
{
if (($json = json_decode($this->getKey('JSON'), true)) != false) {
return $json;
}
}
}
//***************************************************************************//
// Following are the Response classes where the data is contained in a series.
// of event messages.
class SCCPGeneric_Response extends Response
{
protected $_tables;
private $_temptable;
public function __construct($rawContent)
{
parent::__construct($rawContent);
// Confirm that there is a list following. This overrides any setting
// made in one of the parent constructs.
$this->_completed = !$this->isList();
}
public function addEvent($event)
{
// Start of list is handled by the isList function in the Constructor
// which also defines the list end event
if ( empty($thisSetEventEntryType)) {
// This is empty as soon as we have received a TableStart.
// The next message is the first of the data sets
// We use this variable in the switch to add set entries
if (strpos($event->getName(), 'Entry')) {
$thisSetEventEntryType = $event->getName();
} else {
$thisSetEventEntryType = 'undefinedAsThisIsNotASet';
}
}
// Unknown events will cause an exception.
// All event classes must be defined within Event.class.
if (get_class($event) === 'FreePBX\modules\Sccp_manager\aminterface\UnknownEvent') {
$this->_events[] = $event;
return;
}
switch ( $event->getName()) {
case $thisSetEventEntryType :
$this->_temptable['Entries'][] = $event;
break;
case 'TableStart':
//initialise
$this->_temptable = array();
$this->_temptable['Name'] = $event->getTableName();
$this->_temptable['Entries'] = array();
$thisSetEventEntryType = '';
break;
case 'TableEnd':
//Close
if (!is_array($this->_tables)) {
$this->_tables = array();
}
$this->_tables[$event->getTableName()] = $this->_temptable;
$this->_temptable = array();
$thisSetEventEntryType = 'undefinedAsThisIsNotASet';
// Finished the table. Now check to see if everything was received
// If counts do not match return false and table will not be
//loaded
if ($event->getKey('TableEntries') != count($this->_tables[$event->getTableName()]['Entries'])) {
return false;
}
break;
//case $eventListEndEvent;
case $this->getKey('eventListEndEvent');
// Have the list end event. The correct number of entries is verified in the event constructor
$this->_events['ClosingEvent'] = $event;
$this->eventListEndEvent = null;
//return $this->_completed = true;
break;
default:
// add regular list event
$this->_events[] = $event;
}
}
protected function ConvertTableData( $_tablename, array $_fkey, array $_fields)
{
$result = array();
$_rawtable = $this->Table2Array($_tablename);
// Check that there is actually data to be converted
if (empty($_rawtable)) { return $result;}
foreach ($_rawtable as $_row) {
$all_key_ok = true;
// No need to test if $_fkey is array as array required
foreach ($_fkey as $_fid) {
if (empty($_row[$_fid])) {
$all_key_ok = false;
} else {
$set_name[$_fid] = $_row[$_fid];
}
}
$Data = &$result;
if ($all_key_ok) {
foreach ($set_name as $value_id) {
$Data = &$Data[$value_id];
}
// Label converter in case labels and keys are different
foreach ($_fields as $value_key => $value_id) {
$Data[$value_id] = $_row[$value_key];
}
}
}
return $result;
}
protected function ConvertEventData(array $_fkey, array $_fields)
{
$result = array();
foreach ($this->_events as $_row) {
$all_key_ok = true;
$tmp_result = $_row->getKeys();
$set_name = array();
// No need to test if $_fkey is arrray as array required
foreach ($_fkey as $_fid) {
if (empty($tmp_result[$_fid])) {
$all_key_ok = false;
} else {
$set_name[$_fid] = $tmp_result[$_fid];
}
}
$Data = &$result;
if ($all_key_ok) {
foreach ($set_name as $value_id) {
$Data = &$Data[$value_id];
}
// Label converter in case labels and keys are different - not actually required.
foreach ($_fields as $value_id) {
$Data[$value_id] = $tmp_result[$value_id];
}
}
}
return $result;
}
public function Table2Array( $tablename )
{
$result =array();
if (empty($tablename) || !is_array($this->_tables)) {
return $result;
}
foreach ($this->_tables[$tablename]['Entries'] as $trow) {
$result[]= $trow->getKeys();
}
return $result;
}
public function getResult()
{
return $this->getMessage();
}
}
class SCCPShowSoftkeySets_Response extends SCCPGeneric_Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->setKey('eventlistendevent', 'SCCPShowSoftKeySetsComplete');
}
public function getResult()
{
return $this->ConvertTableData(
'SoftKeySets',
array('set','mode'),
array('description'=>'description','label'=>'label','lblid'=>'lblid')
);
}
}
class SCCPShowDevices_Response extends SCCPGeneric_Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->setKey('eventlistendevent', 'SCCPShowDevicesComplete');
}
public function getResult()
{
return $this->ConvertTableData(
'Devices',
array('mac'),
array('mac'=>'name','address'=>'address','descr'=>'descr','regstate'=>'status',
'token'=>'token','act'=>'act', 'lines'=>'lines','nat'=>'nat','regtime'=>'regtime')
);
}
}
class SCCPShowDevice_Response extends SCCPGeneric_Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->setKey('eventlistendevent', 'SCCPShowDeviceComplete');
}
public function getResult()
{
// This object has a list of events _events, and a list of tables _tables.
$result = array();
foreach ($this->_events as $trow) {
$result = array_merge($result, $trow->getKeys());
}
// Now handle label changes so that keys from AMI correspond to db keys in _tables
$result['Buttons'] = $this->ConvertTableData(
'Buttons',
array('id'),
array('id'=>'id','channelobjecttype'=>'channelobjecttype','inst'=>'inst',
'typestr'=>'typestr', 'type'=>'type', 'pendupdt'=>'pendupdt', 'penddel'=>'penddel', 'default'=>'default'
)
);
$result['SpeeddialButtons'] = $this->ConvertTableData(
'SpeeddialButtons',
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',
'lost'=>'lost','jitter'=>'jitter','latency'=>'latency', 'quality'=>'quality','avgqual'=>'avgqual','meanqual'=>'meanqual',
'maxqual'=>'maxqual', 'rconceal'=>'rconceal', 'sconceal'=>'sconceal'
)
);
$result['SCCP_Vendor'] = array('vendor' => strtok($result['skinnyphonetype'], ' '), 'model' => strtok('('),
'model_id' => strtok(')'), 'vendor_addon' => strtok($result['configphonetype'], ' '),
'model_addon' => strtok(' '));
if (empty($result['SCCP_Vendor']['vendor']) || $result['SCCP_Vendor']['vendor'] == 'Undefined') {
$result['SCCP_Vendor'] = array('vendor' => 'Undefined', 'model' => $result['configphonetype'],
'model_id' => '', 'vendor_addon' => $result['SCCP_Vendor']['vendor_addon'],
'model_addon' => $result['SCCP_Vendor']['model_addon']
);
}
$result['MAC_Address'] =$result['macaddress'];
return $result;
}
}
class ExtensionStateList_Response extends SCCPGeneric_Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->setKey('eventlistendevent', 'ExtensionStateListComplete');
}
public function getResult()
{
$result = $this->ConvertEventData(array('exten','context'), array('exten','context','hint','status','statustext'));
return $result;
}
}

View file

@ -1,524 +0,0 @@
<?php
/**
*
* Core Comsnd Interface
*
* https://www.voip-info.org/asterisk-manager-example-php/
*/
namespace FreePBX\modules\Sccp_manager;
class aminterface
{
var $_socket;
var $_error;
var $_config;
var $_test;
private $_connect_state;
private $_lastActionClass;
private $_lastActionId;
private $_lastRequestedResponseHandler;
private $_ProcessingMessage;
private $_DumpMessage;
private $debug_level = 1;
private $_incomingRawMessage;
private $eventListEndEvent;
public function load_subspace($parent_class = null)
{
$driverNamespace = "\\FreePBX\\Modules\\Sccp_manager\\aminterface";
$drivers = array('Message' => 'Message.class.php',
'Response' => 'Response.class.php',
'Event' => 'Event.class.php'
);
foreach ($drivers as $key => $value) {
$class = $driverNamespace . "\\" . $key;
$driver = __DIR__ . "/amInterfaceClasses/" . $value;
if (!class_exists($class, false)) {
if (file_exists($driver)) {
include(__DIR__ . "/amInterfaceClasses/" . $value);
} else {
throw new \Exception("Class required but file not found " . $driver);
}
}
}
}
public function __construct($parent_class = null)
{
global $amp_conf;
$this->paren_class = $parent_class;
$this->_socket = false;
$this->_connect_state = false;
$this->_error = array();
$this->_config = array('host' => 'localhost',
'user' => '',
'pass' => '',
'port' => '5038',
'tsoket' => 'tcp://',
'timeout' => 30,
'enabled' => true
);
$this->_eventListeners = array();
$this->_incomingMsgObjectList = array();
$this->_lastActionId = false;
$this->_incomingRawMessage = array();
$this->eventListEndEvent = '';
$fld_conf = array('user' => 'AMPMGRUSER', 'pass' => 'AMPMGRPASS');
if (isset($amp_conf['AMPMGRUSER'])) {
foreach ($fld_conf as $key => $value) {
if (isset($amp_conf[$value])) {
$this->_config[$key] = $amp_conf[$value];
}
}
}
if ($this->_config['enabled']) {
$this->load_subspace();
}
if ($this->_config['enabled']) {
// Ami is not hard disabled in __construct line 63.
if ($this->open()) {
// Can open a connection. Now check compatibility with chan-sccp.
// will return true if compatible.
if (!$this->get_compatible_sccp(true)[1]) {
// Close the open socket as will not use
$this->close();
}
}
}
}
public function info()
{
$Ver = '13.0.4';
if ($this->_config['enabled']){
return array('Version' => $Ver,
'about' => 'AMI data ver: ' . $Ver, 'test' => get_declared_classes());
} else {
return array('Version' => $Ver,
'about' => 'Disabled AMI ver: ' . $Ver);
}
}
/*
* Opens a socket connection to ami.
*/
public function open()
{
$cString = $this->_config['tsoket'] . $this->_config['host'] . ':' . $this->_config['port'];
$this->_context = stream_context_create();
$errno = 0;
$errstr = '';
$this->_ProcessingMessage = '';
$this->_socket = @stream_socket_client(
$cString,
$errno,
$errstr,
$this->_config['timeout'],
STREAM_CLIENT_CONNECT,
$this->_context
);
if ($this->_socket === false) {
$this->_errorException('Error connecting to ami: ' . $errstr . $cString);
return false;
}
$msg = new aminterface\LoginAction($this->_config['user'], $this->_config['pass']);
$response = $this->send($msg);
if ($response != false) {
if (!$response->isSuccess()) {
$this->_errorException('Could not connect: ' . $response->getMessage());
return false;
} else {
@stream_set_blocking($this->_socket, 0);
$this->_connect_state = true;
$this->_ProcessingMessage = '';
}
}
return true;
}
/*
* Closes the connection to ami.
*/
public function close()
{
$this->_connect_state = false;
$this->_ProcessingMessage = '';
@stream_socket_shutdown($this->_socket, STREAM_SHUT_RDWR);
}
/*
* Send action message to ami, and wait for Response
*/
public function send($message)
{
$_incomingRawMessage = array();
$messageToSend = $message->serialize();
$length = strlen($messageToSend);
$this->_DumpMessage = '';
$this->_lastActionId = $message->getActionID();
$this->_lastRequestedResponseHandler = $message->getResponseHandler();
$this->_lastActionClass = $message;
$this->_incomingRawMessage[$this->_lastActionId] = '';
$this->eventListIsCompleted = array();
if (@fwrite($this->_socket, $messageToSend) < $length) {
$this->_errorException('Could not send message');
return false;
}
// Have sent a message and now have to wait for and read the reply
// The below infinite loop waits for $this->completed to be true.
// The loop calls readBuffer, which calls GetMessages, which calls Process
// This loop then continues until we have _thisComplete as an object variable
$this->eventListIsCompleted[$this->_lastActionId] = false;
while (true) {
stream_set_timeout($this->_socket, 1);
$this->readBuffer();
$info = stream_get_meta_data($this->_socket);
if ($info['timed_out'] == true) {
$this->_errorException("Read waittime: " . ($this->socket_param['timeout']) . " exceeded (timeout).\n");
return false;
}
if ($this->eventListIsCompleted[$this->_lastActionId]) {
$response = $this->_incomingMsgObjectList[$this->_lastActionId];
// need to test that the list was successfully completed here
$allReceived = $response->getClosingEvent()
->listCorrectlyReceived($this->_incomingRawMessage[$this->_lastActionId],
$response->getCountOfEvents());
// now tidy up removing any temp variables or objects
$response->removeClosingEvent();
unset($_incomingRawMessage[$this->_lastActionId]);
unset($this->_incomingMsgObjectList[$this->_lastActionId]);
unset($this->_lastActionId);
if ($allReceived) {
return $response;
}
// Something is missing from the events list received via AMI, or
// the control parameter at the end of the list has changed.
// This will cause an exception as returning a boolean instead of a Response
// Maybe should handle better, but
// need to break out of the loop as nothing more coming.
try {
throw new \invalidArgumentException("Counts do not match on returned AMI Result");
} catch ( \invalidArgumentException $e) {
echo substr(strrchr(get_class($response), '\\'), 1), " ", $e->getMessage(), "\n";
}
return $response;
}
}
}
protected function readBuffer ()
{
$read = @fread($this->_socket, 65535);
// AMI never returns EOF
if ($read === false ) {
$this->_errorException('Error reading');
}
// Do not return empty Messages
while ($read == "" ) {
$read = @fread($this->_socket, 65535);
}
// Add read to the rest of buffer from previous read
$this->_ProcessingMessage .= $read;
$this->getMessages();
}
protected function getMessages()
{
$msgs = array();
// Extract any complete messages and leave remainder for next read
while (($marker = strpos($this->_ProcessingMessage, aminterface\Message::EOM))) {
$msg = substr($this->_ProcessingMessage, 0, $marker);
$this->_ProcessingMessage = substr(
$this->_ProcessingMessage,
$marker + strlen(aminterface\Message::EOM)
);
$msgs[] = $msg;
}
$this->process($msgs);
}
public function process(array $msgs)
{
foreach ($msgs as $aMsg) {
// 2 types of message; Response or Event. Response only incudes data
// for JSON response and Command response. All other responses expect
// data in an event list - these events need to be attached to the response.
$resPos = strpos($aMsg, 'Response: '); // Have a Response message. This may not be 0.
$evePos = strpos($aMsg, 'Event: '); // Have an Event Message. This should always be 0.
// Add the incoming message to a string that can be checked
// against the completed message event when it is received.
$this->_incomingRawMessage[$this->_lastActionId] .= "\r\n\r\n" . $aMsg;
if (($resPos !== false) && (($resPos < $evePos) || $evePos === false)) {
$response = $this->_responseObjFromMsg($aMsg); // resp Ok
$this->eventListEndEvent = $response->getKey('eventlistendevent');
$this->_incomingMsgObjectList[$this->_lastActionId] = $response;
$this->eventListIsCompleted[$this->_lastActionId] = $response->isComplete();
} elseif ($evePos === 0) { // Event must be at the start of the msg.
$event = $this->_eventObjFromMsg($aMsg); // Event Ok
$this->eventListIsCompleted[$this->_lastActionId] = $event->isComplete();
$this->_incomingMsgObjectList[$this->_lastActionId]->addEvent($event);
} else {
// broken ami most probably through changes in chan_sccp_b.
// AMI is sending a message which is neither a response nor an event.
$this->_msgToDebug(1, 'resp broken ami');
$bMsg = 'Event: ResponseEvent' . "\r\n";
$bMsg .= 'ActionId: ' . $this->_lastActionId . "\r\n" . $aMsg;
$event = $this->_eventObjFromMsg($bMsg);
$this->_incomingMsgObjectList[$this->_lastActionId]->addEvent($event);
}
}
}
private function _msgToDebug($level, $msg)
{
if ($level > $this->debug_level) {
return;
}
print_r('<br> level: '.$level.' ');
print_r($msg);
print_r('<br>');
}
private function _responseObjFromMsg($message)
{
$_className = false;
$responseClass = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\Generic_Response';
if ($this->_lastRequestedResponseHandler != false) {
$_className = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\' . $this->_lastRequestedResponseHandler . '_Response';
}
if ($_className) {
if (class_exists($_className, true)) {
$responseClass = $_className;
} elseif ($responseHandler != false) {
$this->_errorException('Response Class ' . $_className . ' requested via responseHandler, could not be found');
}
}
$response = new $responseClass($message);
$actionId = $response->getActionID();
if ($actionId === null) {
$response->setActionId($this->_lastActionId);
}
return $response;
}
public function _eventObjFromMsg($message)
{
$eventType = explode(aminterface\Message::EOL,$message,2);
$name = trim(explode(':',$eventType[0],2)[1]);
$className = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\' . $name . '_Event';
if (class_exists($className, true) === false) {
$className = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\UnknownEvent';
}
return new $className($message);
}
protected function dispatch($message)
{
print_r("<br>------------dispatch----------<br>");
print_r($message);
return false;
die();
foreach ($this->_eventListeners as $data) {
$listener = $data[0];
$predicate = $data[1];
print_r($data);
if (is_callable($predicate) && !call_user_func($predicate, $message)) {
continue;
}
if ($listener instanceof \Closure) {
$listener($message);
} elseif (is_array($listener)) {
$listener[0]->$listener[1]($message);
} else {
$listener->handle($message);
}
}
print_r("<br>------------E dispatch----------<br>");
}
//-------------------Adaptive Function ------------------------------------------------------------
function core_list_hints()
{
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\ExtensionStateListAction();
$_response = $this->send($_action);
$_res = $_response->getResult();
foreach ($_res as $key => $value) {
foreach ($value as $key2 => $value2) {
$result[$key2] = '@' . $key2;
}
}
}
return $result;
}
function core_list_all_hints()
{
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\ExtensionStateListAction();
$_res = $this->send($_action)->getResult();
foreach ($_res as $key => $value) {
foreach ($value as $key2 => $value2) {
$result[$key.'@'.$key2] = $key.'@'.$key2;
}
}
}
return $result;
}
// --------------------- SCCP Comands
function sccp_list_keysets()
{
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowSoftkeySetsAction();
$_res = $this->send($_action)->getResult();
foreach ($_res as $key => $value) {
$result[$key] = $key;
}
}
return $result;
}
function sccp_get_active_device()
{
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDevicesAction();
$result = (array)$this->send($_action)->getResult();
}
return $result;
}
function sccp_getdevice_info($devicename)
{
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDeviceAction($devicename);
$result = $this->send($_action)->getResult();
$result['MAC_Address'] = $result['macaddress'];
}
return $result;
}
function sccpDeviceReset($devicename, $action = '')
{
if ($this->_connect_state) {
if ($action == 'tokenack') {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPTokenAckAction($devicename);
} else {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPDeviceRestartAction($devicename, $action);
}
$_response = $this->send($_action);
$result['data'] = 'Device: '.$devicename.' Result: '.$_response->getMessage();
$result['Response']=$_response->getKey('Response');
}
return $result;
}
//------------------- Core Comands ----
function core_sccp_reload()
{
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\ReloadAction('chan_sccp');
$result = ['Response' => $this->send($_action)->getMessage(), 'data' => ''];
}
return $result;
}
function getSCCPConfigMetaData($segment = '') {
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPConfigMetaDataAction($segment);
$metadata = $this->send($_action)->getResult();
}
return $metadata;
}
function getSCCPVersion()
{
//Initialise result array
$result = array( 'RevisionHash' => '', 'vCode' => 0, 'RevisionNum' => 0, 'buildInfo' => '', 'Version' => 0);
$metadata = $this->getSCCPConfigMetaData();
if (isset($metadata['Version'])) {
$result['Version'] = $metadata['Version'];
$version_parts = array_map('intval',explode('.', $metadata['Version']));
if ($version_parts[0] === 4) {
switch ($version_parts[1]) {
case 1:
$result['vCode'] = 410;
break;
case 2:
$result['vCode'] = 420;
break;
case 3:
$result['vCode'] = 430;
if($version_parts[2] >= 3){
$result['vCode'] = 433;
}
break;
default:
$result['vCode'] = 400;
break;
}
}
if (array_key_exists("RevisionHash", $metadata)) {
$result['RevisionHash'] = $metadata["RevisionHash"];
}
if (isset($metadata['RevisionNum'])) {
if ($metadata['RevisionNum'] >= 11063) { // new method, RevisionNum is incremental
$result['vCode'] = 433;
}
$result['RevisionNum'] = $metadata["RevisionNum"];
}
if (isset($metadata['ConfigureEnabled'])) {
$result['buildInfo'] = $metadata['ConfigureEnabled'];
}
}
return $result;
}
function getRealTimeStatus()
{
// Initialise array with default values to eliminate testing later
$result = array();
$cmd_res = array();
$cmd_res = ['sccp' => ['message' => 'legacy value', 'realm' => '', 'status' => 'ERROR']];
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\CommandAction('realtime mysql status');
$result = $this->send($_action)->getResult();
}
if (is_array($result['Output'])) {
foreach ($result['Output'] as $aline) {
if (strlen($aline) > 3) {
$temp_strings = explode(' ', $aline);
$cmd_res_key = $temp_strings[0];
foreach ($temp_strings as $test_string) {
if (strpos($test_string, '@')) {
$this_realm = $test_string;
break;
}
}
$cmd_res[$cmd_res_key] = array('message' => $aline, 'realm' => $this_realm, 'status' => strpos($aline, 'connected') ? 'OK' : 'ERROR');
}
}
}
return $cmd_res;
}
public function get_compatible_sccp($revNumComp=false) {
// only called with args from installer to get revision and compatibility
$res = $this->getSCCPVersion();
if ($res['RevisionNum'] < 11063) {
$this->useAmiInterface = false;
}
if ($revNumComp) {
return array($res['vCode'], true);
}
return $res['vCode'];
}
}

View file

@ -1,450 +0,0 @@
<?php
/**
*
* Core Comsnd Interface
*
*
*/
namespace FreePBX\modules\Sccp_manager;
class dbinterface
{
private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct($parent_class = null)
{
$this->paren_class = $parent_class;
$this->db = \FreePBX::Database();
}
public function info()
{
$Ver = '14.0.0.1'; // This should be updated
return array('Version' => $Ver,
'about' => 'Data access interface ver: ' . $Ver);
}
/*
* Core Access Function
*/
public function get_db_SccpTableByID($dataid, $data = array(), $indexField = '')
{
$result = array();
$raw = $this->getSccpDeviceTableData($dataid, $data);
if (empty($raw) || empty($indexField)) {
return $raw;
}
foreach ($raw as $value) {
$id = $value[$indexField];
$result[$id] = $value;
}
return $result;
}
public function getSccpDeviceTableData(string $dataid, $data = array())
{
// $stmt is a single row fetch, $stmts is a fetchAll while stmtU is fetchAll UNIQUE
$stmt = '';
$stmts = '';
$stmtU = '';
switch ($dataid) {
case 'extGrid':
// only called by getExtensionGrid from hardware.extension.php view
$stmts = $this->db->prepare("SELECT sccpline.name, sccpline.label, sccpbuttonconfig.ref AS mac, '-|-' AS line_status
FROM sccpline LEFT JOIN sccpbuttonconfig
ON sccpline.name = TRIM(TRAILING '!silent' FROM sccpbuttonconfig.name) ORDER BY sccpline.name");
break;
case 'SccpExtension':
if (empty($data['name'])) {
$stmtU = $this->db->prepare('SELECT name, sccpline.* FROM sccpline ORDER BY name');
} else {
$stmts = $this->db->prepare('SELECT * FROM sccpline WHERE name = :name');
$stmts->bindParam(':name', $data['name'],\PDO::PARAM_STR);
}
break;
case 'phoneGrid':
switch ($data['type']) {
case "cisco-sip":
$stmts = $this->db->prepare("SELECT name, type, button, addon, description, 'not connected' AS status, '- -' AS address, 'N' AS new_hw
FROM sccpdeviceconfig WHERE type LIKE '%-sip' ORDER BY name");
break;
case "sccp": // Fall through to default intentionally
default:
$stmts = $this->db->prepare("SELECT name, type, button, addon, description, 'not connected' AS status, '- -' AS address, 'N' AS new_hw
FROM sccpdeviceconfig WHERE type not LIKE '%-sip' ORDER BY name");
break;
}
break;
case 'SccpDevice':
if (empty($data['fields'])) {
$fld = 'name, name as mac, type, button, addon, description';
} else {
switch ($data['fields']) {
case "all":
$fld ='*';
break;
case "sip_ext":
$fld ='button as sip_lines, description as description, addon';
break;
default:
$fld = $data['fields'];
break;
}
}
if (!empty($data['name'])) { //either filter by name or by type
$stmt = $this->db->prepare('SELECT ' . $fld . ' FROM sccpdeviceconfig WHERE name = :name ORDER BY name');
$stmt->bindParam(':name', $data['name'],\PDO::PARAM_STR);
} elseif (!empty($data['type'])) {
switch ($data['type']) {
case "cisco-sip":
$stmts = $this->db->prepare("SELECT {$fld} FROM sccpdeviceconfig WHERE TYPE LIKE '%-sip' ORDER BY name");
break;
case "cisco": // Fall through to default intentionally
default:
$stmts = $this->db->prepare("SELECT {$fld} FROM sccpdeviceconfig WHERE TYPE not LIKE '%-sip' ORDER BY name");
break;
}
} else { //no filter and no name provided - return all
$stmts = $this->db->prepare("SELECT {$fld} FROM sccpdeviceconfig ORDER BY name");
}
break;
case 'get_columns_sccpdevice':
$stmtU = $this->db->prepare('DESCRIBE sccpdevice');
break;
case 'get_columns_sccpuser':
$stmts = $this->db->prepare('DESCRIBE sccpuser');
break;
case 'get_columns_sccpline':
$stmtU = $this->db->prepare('DESCRIBE sccpline');
break;
case 'get_sccpdevice_byid':
$stmt = $this->db->prepare('SELECT t1.*, types.dns, types.buttons, types.loadimage, types.nametemplate as nametemplate,
addon.buttons as addon_buttons FROM sccpdevice AS t1
LEFT JOIN sccpdevmodel as types ON t1.type=types.model
LEFT JOIN sccpdevmodel as addon ON t1.addon=addon.model WHERE name = :name');
$stmt->bindParam(':name', $data['id'],\PDO::PARAM_STR);
break;
case 'get_sccpuser':
$stmt = $this->db->prepare('SELECT * FROM sccpuser WHERE name = :name');
$stmt->bindParam(':name', $data['id'],\PDO::PARAM_STR);
break;
case 'getAssignedExtensions':
// all extensions that are designed as default lines
$stmtU = $this->db->prepare("SELECT DISTINCT name, name FROM sccpbuttonconfig WHERE buttontype = 'line' AND instance =1");
break;
case 'getDefaultLine':
$stmt = $this->db->prepare("SELECT name FROM sccpbuttonconfig WHERE ref = '{$data['id']}' and instance =1 and buttontype = 'line'");
break;
case 'get_sccpdevice_buttons':
$sql = '';
if (!empty($data['buttontype'])) {
$sql .= 'buttontype = :buttontype';
}
if (!empty($data['id'])) {
$sql .= (empty($sql)) ? 'ref = :ref' : ' and ref = :ref';
}
if (!empty($sql)) {
$stmts = $this->db->prepare("SELECT * FROM sccpbuttonconfig WHERE {$sql} ORDER BY instance");
// Now bind labels - only bind label if it exists or bind will create exception.
// can only bind once have prepared, so need to test again.
if (!empty($data['buttontype'])) {
$stmts->bindParam(':buttontype', $data['buttontype'],\PDO::PARAM_STR);
}
if (!empty($data['id'])) {
$stmts->bindParam(':ref', $data['id'],\PDO::PARAM_STR);
}
} else {
$raw_settings = array();
}
break;
// No default case so will give exception of $raw_settings undefined if the
// dataid is not in the switch.
}
if (!empty($stmt)) {
$stmt->execute();
$raw_settings = $stmt->fetch(\PDO::FETCH_ASSOC);
} elseif (!empty($stmts)) {
$stmts->execute();
$raw_settings = $stmts->fetchAll(\PDO::FETCH_ASSOC);
} elseif (!empty($stmtU)) {
//returns an assoc array indexed on first field
$stmtU->execute();
$raw_settings = $stmtU->fetchAll(\PDO::FETCH_ASSOC|\PDO::FETCH_UNIQUE);
}
return $raw_settings;
}
public function get_db_SccpSetting()
{
$stmt = $this->db->prepare('SELECT keyword, sccpsettings.* FROM sccpsettings ORDER BY type, seq');
$stmt->execute();
$settingsFromDb = $stmt->fetchAll(\PDO::FETCH_ASSOC|\PDO::FETCH_UNIQUE);
return $settingsFromDb;
}
public function get_db_sysvalues()
{
$stmt = $this->db->prepare('SHOW VARIABLES LIKE \'%group_concat%\'');
$stmt->execute();
return $stmt->fetch(\PDO::FETCH_ASSOC);
}
/*
* Get Sccp Device Model information
*/
function getDb_model_info($get = 'all', $format_list = 'all', $filter = array())
{
$sel_inf = '*, 0 as validate';
if ($format_list === 'model') {
$sel_inf = "model, vendor, dns, buttons, '-;-' as validate";
}
switch ($get) {
case 'byciscoid':
if (!empty($filter)) {
if (!empty($filter['model'])) {
if (!strpos($filter['model'], 'loadInformation')) {
$filter['model'] = 'loadInformation' . $filter['model'];
}
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (loadinformationid = :model ) ORDER BY model");
$stmt->bindParam(':model', $filter['model'], \PDO::PARAM_STR);
} else {
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
}
break;
}
break;
case 'byid':
if (!empty($filter)) {
if (!empty($filter['model'])) {
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE model = :model ORDER BY model");
$stmt->bindParam(':model', $filter['model'],\PDO::PARAM_STR);
} else {
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
}
break;
}
break;
case 'extension':
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns = 0) and (enabled = 1) ORDER BY model");
break;
case 'enabled':
//$stmt = $db->prepare('SELECT ' . {$sel_inf} . ' FROM sccpdevmodel WHERE enabled = 1 ORDER BY model'); //previously this fell through to phones.
//break; // above includes expansion modules but was not original behaviour so commented out. Falls through to phones.
case 'phones':
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns != 0) and (enabled = 1) ORDER BY model");
break;
case 'ciscophones':
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns > 0) and (enabled = 1) AND vendor NOT LIKE '%-sip' ORDER BY model");
break;
case 'sipphones':
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns > 0) and (enabled = 1) AND vendor LIKE '%-sip' ORDER BY model");
break;
case 'all': // Fall through to default
default:
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
break;
}
$stmt->execute();
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
}
function write($table_name = "", $save_value = array(), $mode = 'update', $key_fld = "", $hwid = "")
{
// mode clear - Empty table before update
// mode update - update / replace record
$result = false;
switch ($table_name) {
case 'sccpsettings':
if ($mode == 'replace') { // Change mode name to be more transparent
$this->db->prepare('TRUNCATE sccpsettings')->execute();
$stmt = $this->db->prepare('INSERT INTO sccpsettings (keyword, data, seq, type, systemdefault) VALUES (:keyword,:data,:seq,:type,:systemdefault)');
} else {
$stmt = $this->db->prepare('REPLACE INTO sccpsettings (keyword, seq, type, data, systemdefault) VALUES (:keyword,:seq,:type,:data,:systemdefault)');
}
foreach ($save_value as $key => $dataArr) {
if (empty($dataArr)) {
continue;
}
$stmt->bindParam(':keyword',$dataArr['keyword'],\PDO::PARAM_STR);
$stmt->bindParam(':data',$dataArr['data'],\PDO::PARAM_STR);
$stmt->bindParam(':seq',$dataArr['seq'],\PDO::PARAM_INT);
$stmt->bindParam(':type',$dataArr['type'],\PDO::PARAM_INT);
$stmt->bindParam(':systemdefault',$dataArr['systemdefault'],\PDO::PARAM_STR);
$result = $stmt->execute();
}
break;
case 'sccpdevmodel': // Fall through to next intentionally
case 'sccpdevice': // Fall through to next intentionally
case 'sccpuser':
$sql_key = "";
$sql_var = "";
foreach ($save_value as $key_v => $data) {
if (!empty($sql_var)) {
$sql_var .= ', ';
}
if ($data === $this->val_null) {
$sql_var .= $key_v . '= NULL';
} else {
$sql_var .= $key_v . ' = \'' . $data . '\''; //quote data as normally is string
}
if ($key_v === $key_fld) {
$sql_key = $key_v . ' = \'' . $data . '\''; //quote data as normally is string
}
}
if (!empty($sql_var)) {
switch ($mode) {
case 'delete':
$stmt = $this->db->prepare("DELETE FROM {$table_name} WHERE {$sql_key}");
break;
case 'update':
$stmt = $this->db->prepare("UPDATE {$table_name} SET {$sql_var} WHERE {$sql_key}");
break;
case 'replace':
$stmt = $this->db->prepare("REPLACE INTO {$table_name} SET {$sql_var}");
break;
// no default mode - must be explicit.
}
}
$result = $stmt->execute();
break;
case 'sccpbuttons':
switch ($mode) {
case 'delete':
$sql = 'DELETE FROM sccpbuttonconfig WHERE ref = :hwid';
$stmt = $this->db->prepare($sql);
$stmt->bindParam(':hwid', $hwid,\PDO::PARAM_STR);
$result = $stmt->execute();
break;
case 'replace':
foreach ($save_value as $button_array) {
$stmt = $this->db->prepare('UPDATE sccpbuttonconfig SET name =:name WHERE ref = :ref AND reftype =:reftype AND instance = :instance AND buttontype = :buttontype AND options = :options');
$stmt->bindParam(':ref', $button_array['ref'],\PDO::PARAM_STR);
$stmt->bindParam(':reftype', $button_array['reftype'],\PDO::PARAM_STR);
$stmt->bindParam(':instance', $button_array['instance'],\PDO::PARAM_INT);
$stmt->bindParam(':buttontype', $button_array['buttontype'],\PDO::PARAM_STR);
$stmt->bindParam(':name', $button_array['name'],\PDO::PARAM_STR);
$stmt->bindParam(':options', $button_array['options'],\PDO::PARAM_STR);
$result= $stmt->execute();
}
break;
case 'add':
foreach ($save_value as $button_array) {
$stmt = $this->db->prepare("INSERT INTO sccpbuttonconfig SET ref = :ref, reftype = :reftype, instance = :instance, buttontype = :buttontype, name = :name, options = :options");
$stmt->bindParam(':ref', $button_array['ref'],\PDO::PARAM_STR);
$stmt->bindParam(':reftype', $button_array['reftype'],\PDO::PARAM_STR);
$stmt->bindParam(':instance', $button_array['instance'],\PDO::PARAM_INT);
$stmt->bindParam(':buttontype', $button_array['buttontype'],\PDO::PARAM_STR);
$stmt->bindParam(':name', $button_array['name'],\PDO::PARAM_STR);
$stmt->bindParam(':options', $button_array['options'],\PDO::PARAM_STR);
$result = $stmt->execute();
}
break;
case 'clear';
// Clear is equivalent of delete + insert. Mode is used in order to activate trigger.
$this->write('sccpbuttons', '', $mode = 'delete','', $hwid);
$this->write('sccpbuttons', $save_value, $mode = 'add','', $hwid);
break;
// No default case - must be specific in request.
}
}
return $result;
}
//******** Get SIP settings *******
public function getSipTableData(string $dataid, $line='') {
global $db;
$tech = array();
switch ($dataid) {
case "DeviceById":
// TODO: This needs to be rewritten
$stmt = $this->db->prepare("SELECT keyword,data FROM sip WHERE id = '${line}'");
$stmt->execute();
$tech = $stmt->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP);
foreach ($tech as &$value) {
$value = $value[0];
}
return $tech;
case "extensionList";
$stmt = $this->db->prepare("SELECT id as name, data as label FROM sip WHERE keyword = 'callerid' order by name");
$stmt->execute();
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
/*
foreach ($result as $value) {
if (empty($tech[$value['id']]['id'])) {
$tech[$value['id']]['id']= $value['id'];
}
$tech[$value['id']][$value['keyword']]=$value['data'];
}
*/
return $result;
}
}
/*
* Maybe Replace by SccpTables ??!
*
*/
public function dump_sccp_tables($data_path, $database, $user, $pass)
{
$filename = $data_path.'/sccp_backup_'.date('G_a_m_d_y').'.sql';
$result = exec('mysqldump '.$database.' --password='.$pass.' --user='.$user.' --single-transaction >'.$filename, $output);
return $filename;
}
public function updateTableDefaults($table, $field, $value) {
$stmt = $this->db->prepare("ALTER TABLE {$table} ALTER COLUMN {$field} SET DEFAULT '{$value}'");
$stmt->execute();
}
/*
* Check Table structure
*/
public function validate()
{
$result = 0;
$check_fields = [
'431' => ['private'=> "enum('on','off')"],
'433' => ['directed_pickup'=>'']
];
$stmt = $this->db->prepare('DESCRIBE sccpdevice');
$stmt->execute();
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $value) {
$id_result[$value['Field']] = $value['Type'];
}
foreach ($check_fields as $key => $value) {
if (!empty(array_intersect_assoc($value, $id_result))) {
$result = $key;
} else {
// no match but maybe checking against an empty string so just need to check key does not exist
foreach ($value as $skey => $svalue) {
if (empty($svalue) && (!isset($id_result[$skey]))) {
$result = $key;
}
}
}
}
return $result;
}
public function getNamedGroup($callGroup) {
$sql = "SELECT {$callGroup} FROM sccpline GROUP BY {$callGroup}";
$sth = $this->db->prepare($sql);
$result = array();
$tech = array();
try {
$sth->execute();
$result = $sth->fetchAll();
foreach($result as $val) {
$tech[$callGroup][] = $val[0];
}
} catch(\Exception $e) {}
return $tech;
}
}

View file

@ -1,455 +0,0 @@
<?php
namespace FreePBX\modules\Sccp_manager;
class extconfigs
{
public function __construct($parent_class = null)
{
$this->paren_class = $parent_class;
}
public function info() {
$Ver = '13.2.0';
return array('Version' => $Ver,
'about' => 'Default Settings and Enums ver: ' . $Ver);
}
public function getExtConfig($id = '', $index = '') {
$result = array();
switch ($id) {
case 'keyset':
$result = $this->keysetdefault;
break;
case 'sccp_lang':
if (empty($index)) {
return $this->cisco_language; // return language array
} elseif (!empty($this->cisco_language[$index])) {
return $this->cisco_language[$index]; // return the matched value
}
break;
case 'sccpDefaults':
$result = $this->sccpDefaults;
break;
case 'sccp_timezone': // Sccp manager: 1303; server_info: 122
$result = array();
if (empty($index)) {
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
}
//See if DST is used in this TZ. Test if DST setting is different at
//various future intervals. If dst changes, this TZ uses dst
$usesDaylight = false;
$haveDstNow = date('I');
$futureDateArray = array(2,4,6,8);
foreach ($futureDateArray as $numMonths) {
$futureDate = (new \DateTime(null,new \DateTimeZone($index)))->modify("+{$numMonths} months");
if ($futureDate->format('I') != $haveDstNow) {
$usesDaylight = true;
break;
};
}
$thisTzOffset = (new \DateTime(null, new \DateTimeZone($index)))->getOffset();
// Now look for a match in cisco_tz_array based on offset and DST
// First correct offset if we have DST now as cisco offsets are
// based on non dst offsets
$tmpOffset = $thisTzOffset / 60;
if ($haveDstNow) {
$tmpOffset = $tmpOffset - 60;
}
foreach ($this->cisco_timezone as $key => $value) {
if (($value['offset'] == $tmpOffset) and ( $value['daylight'] == $usesDaylight )) {
// This code may not be the one typically used, but it has the correct values.
$cisco_code = $key . ' Standard' . (($usesDaylight) ? '/Daylight' : '') . ' Time';
$this->sccpvalues['tzoffset']['data'] = $tmpOffset;
return array('offset' => $tmpOffset, 'daylight' => ($usesDaylight) ? 'Daylight' : '', 'cisco_code' => $cisco_code);
break;
}
}
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
break;
default:
return array('noId');
break;
}
if (empty($index)) {
return $result;
} else {
if (isset($result[$index])) {
return $result[$index];
} else {
return array();
}
}
}
private function get_cisco_time_zone($tzc)
{
$tzdata = $this->cisco_timezone[$tzc];
$cisco_code = $tzc . ' Standard' . (($tzdata['daylight']) ? '/Daylight' : '') . ' Time';
return array('offset' => $tzdata['offset'], 'daylight' => $tzdata['daylight'], 'cisco_code' => $cisco_code);
}
private $sccpDefaults = array(
'servername' => 'VPBXSCCP',
'bindaddr' => '0.0.0.0', "port" => '2000', # chan_sccp also supports ipv6
'deny' => '0.0.0.0/0.0.0.0',
'permit' => '0.0.0.0/0.0.0.0', # !TODO!: please change this to 'internal' which would mean:
'dateformat' => 'D.M.Y',
'disallow' => 'all', "allow" => 'alaw;ulaw',
'hotline_enabled' => 'off',
'hotline_context' => 'default', # !TODO!: Should this not be from-internal on FreePBX ?
'hotline_extension' => '*60', # !TODO!: Is this a good default extension to dial for hotline ?
'hotline_label' => 'hotline',
'devicetable' => 'sccpdevice',
'linetable' => 'sccpline',
'displayconfig' => 'sccpgeneral',
'_dev_sshPassword' => 'cisco',
'_dev_sshUserId' => 'cisco',
'dev_deviceProtocol' => 'SCCP',
'dev_idleTimeout' => '60',
'ntp_config_enabled' => 'off',
'ntp_server' => 'pool.ntp.org',
'ntp_server_mode' => 'unicast',
'devlang' => 'English_United_States',
'dev_authenticationURL' => '',
'dev_informationURL' => '',
'dev_messagesURL' => '',
'dev_servicesURL' => '',
'dev_directoryURL' => '',
'dev_idleURL' => '',
'dev_secureauthenticationURL' => '',
'dev_secureinformationURL' => '',
'dev_securemessagesURL' => '',
'dev_secureservicesURL' => '',
'dev_securedirectoryURL' => '',
'dev_secureidleURL' => '',
'dev_proxyServerURL' => ''
);
private $keysetdefault = array('onhook' => 'redial,newcall,cfwdall,cfwdbusy,cfwdnoanswer,pickup,gpickup,dnd,private',
'connected' => 'hold,endcall,park,vidmode,select,cfwdall,cfwdbusy,idivert,monitor',
'onhold' => 'resume,newcall,endcall,transfer,conflist,select,dirtrfr,idivert,meetme',
'ringin' => 'answer,endcall,transvm,idivert',
'offhook' => 'redial,endcall,private,cfwdall,cfwdbusy,cfwdnoanswer,pickup,gpickup,meetme,barg',
'conntrans' => 'hold,endcall,transfer,conf,park,select,dirtrfr,monitor,vidmode,meetme,cfwdal',
'digitsfoll' => 'back,endcall,dial',
'connconf' => 'conflist,newcall,endcall,hold,vidmode,monitor',
'ringout' => 'empty,endcall,transfer',
'offhookfeat' => 'resume,newcall,endcall',
'onhint' => 'redial,newcall,pickup,gpickup',
'onstealable' => 'redial,newcall,barge,intrcpt,cfwdall,pickup,gpickup,dnd',
'holdconf' => 'resume,newcall,endcall,join',
'uriaction' => 'default');
// Cisco Language Code / Directory
//
private $cisco_language = array('ar_SA' => array('code' => 'ar', 'language' => 'Arabic', 'locale' => 'Arabic_Saudi_Arabia', 'codepage' => 'ISO8859-1'),
'bg_BG' => array('code' => 'bg', 'language' => 'Bulgarian', 'locale' => 'Bulgarian_Bulgaria', 'codepage' => 'ISO8859-1'),
'cz_CZ' => array('code' => 'cz', 'language' => 'Czech', 'locale' => 'Czech_Czech_Republic', 'codepage' => 'ISO8859-1'),
'da_DK' => array('code' => 'da', 'language' => 'Danish', 'locale' => 'Danish_Denmark', 'codepage' => 'ISO8859-1'),
'de_DE' => array('code' => 'de', 'language' => 'German', 'locale' => 'German_Germany', 'codepage' => 'ISO8859-1'),
'el_GR' => array('code' => 'el', 'language' => 'Greek', 'locale' => 'Greek_Greece', 'codepage' => 'ISO8859-1'),
'en_AU' => array('code' => 'en', 'language' => 'English', 'locale' => 'AU_English_United_States', 'codepage' => 'ISO8859-1'),
'en_GB' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_Kingdom', 'codepage' => 'ISO8859-1'),
'en_US' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_States', 'codepage' => 'ISO8859-1'),
'es_ES' => array('code' => 'es', 'language' => 'Spanish', 'locale' => 'Spanish_Spain', 'codepage' => 'ISO8859-1'),
'et_EE' => array('code' => 'et', 'language' => 'Estonian', 'locale' => 'Estonian_Estonia', 'codepage' => 'ISO8859-1'),
'fi_FI' => array('code' => 'fi', 'language' => 'Finnish', 'locale' => 'Finnish_Finland', 'codepage' => 'ISO8859-1'),
'fr_CA' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_Canada', 'codepage' => 'ISO8859-1'),
'fr_FR' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_France', 'codepage' => 'ISO8859-1'),
'he_IL' => array('code' => 'he', 'language' => 'Hebrew', 'locale' => 'Hebrew_Israel', 'codepage' => 'ISO8859-1'),
'hr_HR' => array('code' => 'hr', 'language' => 'Croatian', 'locale' => 'Croatian_Croatia', 'codepage' => 'ISO8859-1'),
'hu_HU' => array('code' => 'hu', 'language' => 'Hungarian', 'locale' => 'Hungarian_Hungary', 'codepage' => 'ISO8859-1'),
'it_IT' => array('code' => 'it', 'language' => 'Italian', 'locale' => 'Italian_Italy', 'codepage' => 'ISO8859-1'),
'ja_JP' => array('code' => 'ja', 'language' => 'Japanese', 'locale' => 'Japanese_Japan', 'codepage' => 'ISO8859-1'),
'ko_KO' => array('code' => 'ko', 'language' => 'Korean', 'locale' => 'Korean_Korea_Republic', 'codepage' => 'ISO8859-1'),
'lt_LT' => array('code' => 'lt', 'language' => 'Lithuanian', 'locale' => 'Lithuanian_Lithuania', 'codepage' => 'ISO8859-1'),
'lv_LV' => array('code' => 'lv', 'language' => 'Latvian', 'locale' => 'Latvian_Latvia', 'codepage' => 'ISO8859-1'),
'nl_NL' => array('code' => 'nl', 'language' => 'Dutch', 'locale' => 'Dutch_Netherlands', 'codepage' => 'ISO8859-1'),
'no_NO' => array('code' => 'no', 'language' => 'Norwegian', 'locale' => 'Norwegian_Norway', 'codepage' => 'ISO8859-1'),
'pl_PL' => array('code' => 'pl', 'language' => 'Polish', 'locale' => 'Polish_Poland', 'codepage' => 'ISO8859-1'),
'pt_BR' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Brazil', 'codepage' => 'ISO8859-1'),
'pt_PT' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Portugal', 'codepage' => 'ISO8859-1'),
'ro_RO' => array('code' => 'ro', 'language' => 'Romanian', 'locale' => 'Romanian_Romania', 'codepage' => 'ISO8859-1'),
'sk_SK' => array('code' => 'sk', 'language' => 'Slovakian', 'locale' => 'Slovak_Slovakia', 'codepage' => 'ISO8859-1'),
'sl_SL' => array('code' => 'sl', 'language' => 'Slovenian', 'locale' => 'Slovenian_Slovenia', 'codepage' => 'ISO8859-1'),
'sr_ME' => array('code' => 'sr', 'language' => 'Serbian', 'locale' => 'Serbian_Republic_of_Montenegro', 'codepage' => 'ISO8859-1'),
'sr_RS' => array('code' => 'rs', 'language' => 'Serbian', 'locale' => 'Serbian_Republic_of_Serbia', 'codepage' => 'ISO8859-1'),
'sv_SE' => array('code' => 'sv', 'language' => 'Swedish', 'locale' => 'Swedish_Sweden', 'codepage' => 'ISO8859-1'),
'th_TH' => array('code' => 'th', 'language' => 'Thailand', 'locale' => 'Thai_Thailand', 'codepage' => 'ISO8859-1'),
'tr_TR' => array('code' => 'tr', 'language' => 'Turkish', 'locale' => 'Turkish_Turkey', 'codepage' => 'ISO8859-1'),
'zh_CN' => array('code' => 'cn', 'language' => 'Chinese', 'locale' => 'Chinese_China', 'codepage' => 'ISO8859-1'),
'zh_TW' => array('code' => 'zh', 'language' => 'Chinese', 'locale' => 'Chinese_Taiwan', 'codepage' => 'ISO8859-1')
);
private $cisco_timezone = array(
'Dateline' => array('offset' => '-720', 'daylight' => false),
'Samoa' => array('offset' => '-660', 'daylight' => false),
'Hawaiian' => array('offset' => '-600', 'daylight' => false),
'Alaskan' => array('offset' => '-540', 'daylight' => true),
'Pacific' => array('offset' => '-480', 'daylight' => true),
'Mountain' => array('offset' => '-420', 'daylight' => true),
'US Mountain' => array('offset' => '-420', 'daylight' => false),
'Central' => array('offset' => '-360', 'daylight' => true),
'Mexico' => array('offset' => '-360', 'daylight' => true),
'Canada Central' => array('offset' => '-360', 'daylight' => false),
'SA Pacific' => array('offset' => '-300', 'daylight' => false),
'Eastern' => array('offset' => '-300', 'daylight' => true),
'US Eastern' => array('offset' => '-300', 'daylight' => false),
'Atlantic' => array('offset' => '-240', 'daylight' => true),
'SA Western' => array('offset' => '-240', 'daylight' => false),
'Pacific SA' => array('offset' => '-240', 'daylight' => false),
'Newfoundland' => array('offset' => '-210', 'daylight' => true),
'E. South America' => array('offset' => '-180', 'daylight' => true),
'SA Eastern' => array('offset' => '-180', 'daylight' => false),
'Pacific SA' => array('offset' => '-180', 'daylight' => true),
'Mid-Atlantic' => array('offset' => '-120', 'daylight' => true),
'Azores' => array('offset' => '-060', 'daylight' => true),
'GMT' => array('offset' => '00', 'daylight' => true),
'Greenwich' => array('offset' => '00', 'daylight' => false),
'W. Europe' => array('offset' => '60', 'daylight' => true),
'Central Europe' => array('offset' => '120', 'daylight' => true),
'South Africa' => array('offset' => '120', 'daylight' => false),
'Saudi Arabia' => array('offset' => '180', 'daylight' => false),
'Iran' => array('offset' => '210', 'daylight' => true),
'Caucasus' => array('offset' => '240', 'daylight' => true),
'Arabian' => array('offset' => '240', 'daylight' => false),
'Afghanistan' => array('offset' => '270', 'daylight' => false),
'West Asia' => array('offset' => '300', 'daylight' => false),
'India' => array('offset' => '330', 'daylight' => false),
'Central Asia' => array('offset' => '360', 'daylight' => false),
'SE Asia' => array('offset' => '420', 'daylight' => false),
'China' => array('offset' => '480', 'daylight' => false),
'Tokyo' => array('offset' => '540', 'daylight' => false),
'Cen. Australia' => array('offset' => '570', 'daylight' => true),
'AUS Central' => array('offset' => '570', 'daylight' => false),
'E. Australia' => array('offset' => '600', 'daylight' => false),
'AUS Eastern' => array('offset' => '600', 'daylight' => true),
'West Pacific' => array('offset' => '600', 'daylight' => false),
'Tasmania' => array('offset' => '600', 'daylight' => true),
'Central Pacific' => array('offset' => '660', 'daylight' => false),
'Fiji' => array('offset' => '720', 'daylight' => false),
'New Zealand' => array('offset' => '720', 'daylight' => true)
);
public function updateTftpStructure($settingsFromDb) {
global $amp_conf;
$adv_config = array('tftproot' => $settingsFromDb['tftp_path']['data'],
'firmware' => 'firmware',
'settings' => 'settings',
'locales' => 'locales',
'languages' => 'languages',
'templates' => 'templates',
'dialplan' => 'dialplan',
'softkey' => 'softkey',
'ringtones' => 'ringtones',
'wallpapers' => 'wallpapers',
'countries' => 'countries'
);
$adv_tree = array('pro' => array('templates' => 'tftproot',
'firmware' => 'tftproot',
'settings' => 'tftproot',
'locales' => 'tftproot',
'languages' => 'locales',
'templates' => 'tftproot',
'dialplan' => 'tftproot',
'softkey' => 'tftproot',
'ringtones' => 'tftproot',
'wallpapers' => 'tftproot',
'countries' => 'locales'
),
'def' => array('templates' => 'tftproot',
'firmware' => '',
'settings' => '',
'locales' => '',
'languages' => 'tftproot',
'dialplan' => '',
'softkey' => '',
'ringtones' => '',
'wallpapers' => '',
'countries' => ''
)
);
$base_tree = array('tftp_templates_path' => 'templates',
'tftp_firmware_path' => 'firmware',
'tftp_store_path' => 'settings',
'tftp_lang_path' => 'languages',
'tftp_dialplan_path' => 'dialplan',
'tftp_softkey_path' => 'softkey',
'tftp_ringtones_path' => 'ringtones',
'tftp_wallpapers_path' => 'wallpapers',
'tftp_countries_path' => 'countries'
);
$baseConfig = array();
if (empty($settingsFromDb['tftp_rewrite_path']['data'])) {
$settingsFromDb['tftp_rewrite_path']['data'] = $settingsFromDb['tftp_path']['data'];
} else {
// Have a setting in sccpsettings. It should start with $tftp_path
// If not we will replace it with $tftp_path. Avoids issues with legacy values
if (!strpos($settingsFromDb['tftp_rewrite_path']["data"],$settingsFromDb['tftp_path']['data'])) {
$settingsFromDb['tftp_rewrite_path']['data'] = $settingsFromDb['tftp_path']['data'];
}
}
$adv_ini = "{$settingsFromDb['tftp_rewrite_path']["data"]}/index.cnf";
$adv_tree_mode = 'def';
switch ($settingsFromDb['tftp_rewrite']['data']) {
case 'pro':
$adv_tree_mode = 'pro';
if (!empty($adv_ini) && file_exists($adv_ini)) {
$adv_ini_array = parse_ini_file($adv_ini);
$adv_config = array_merge($adv_config, $adv_ini_array);
}
// rewrite adv_ini to reflect the new $adv_config
if (file_exists($adv_ini)){
rename($adv_ini, "{$adv_ini}.old");
}
$indexFile = fopen($adv_ini,'w');
fwrite($indexFile, "[main]\n");
foreach ($adv_config as $advKey => $advVal) {
fwrite($indexFile, "{$advKey} = {$advVal}\n");
}
fclose($indexFile);
$settingsFromDb['tftp_rewrite']['data'] = 'pro';
break;
case 'on':
case 'internal':
case 'off':
default:
// not defined so set here to off
$settingsFromDb['tftp_rewrite']['data'] = 'off';
}
foreach ($adv_tree[$adv_tree_mode] as $key => $value) {
if (!empty($adv_config[$key])) {
if (!empty($value)) {
if (substr($adv_config[$key], 0, 1) != "/") {
$adv_config[$key] = $adv_config[$value] . '/' . $adv_config[$key];
}
} else {
$adv_config[$key] = $adv_config['tftproot'];
}
}
}
foreach ($base_tree as $key => $value) {
$baseConfig[$key] = $adv_config[$value];
if (!is_dir($baseConfig[$key])) {
if (!mkdir($baseConfig[$key], 0755, true)) {
die_freepbx(_("Error creating dir: $baseConfig[$key]"));
}
}
}
// Set up tftproot/settings so that can test if mapping is Enabled and configured.
if (!is_dir("{$settingsFromDb['tftp_path']['data']}/settings")) {
if (!mkdir("{$settingsFromDb['tftp_path']['data']}/settings", 0755, true)) {
die_freepbx(_("Error creating dir: {$settingsFromDb['tftp_path']['data']}/settings"));
}
}
// TODO: Need to add index.cnf, after setting defaults correctly
if (!file_exists("{$baseConfig['tftp_templates_path']}/XMLDefault.cnf.xml_template")) {
$src_path = $amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/conf/';
$dst_path = "{$baseConfig["tftp_templates_path"]}/";
foreach (glob("{$src_path}*.*_template") as $filename) {
copy($filename, $dst_path . basename($filename));
}
}
foreach ($baseConfig as $baseKey => $baseValue) {
$settingsFromDb[$baseKey] = array('keyword' => $baseKey, 'seq' => 20, 'type' => 0, 'data' => $baseValue, 'systemdefault' => '');
}
return $settingsFromDb;
}
public function validate_RealTime( $connector )
{
// This method only checks that asterisk is correctly configured for Realtime
// It is preventative and does not change anything for Sccp_manager
global $amp_conf;
$res = array();
/* if (empty($connector)) {
$connector = 'sccp';
}
$cnf_int = \FreePBX::Config();
$cnf_wr = \FreePBX::WriteConfig();
*/
$cnf_read = \FreePBX::LoadConfig();
// We are running inside FreePBX so must use the same database
$def_config = array('sccpdevice' => 'mysql,' . $amp_conf['AMPDBNAME'] . ',sccpdeviceconfig', 'sccpline' => 'mysql,' . $amp_conf['AMPDBNAME'] . ',sccplineconfig');
$backup_ext = array('_custom.conf', '.conf', '_additional.conf');
$def_bd_config = array('dbhost' => $amp_conf['AMPDBHOST'], 'dbname' => $amp_conf['AMPDBNAME'],
'dbuser' => $amp_conf['AMPDBUSER'], 'dbpass' => $amp_conf['AMPDBPASS'],
'dbport' => '3306', 'dbsock' => '/var/lib/mysql/mysql.sock'
);
$dir = $amp_conf['ASTETCDIR'];
$res_conf_sql = ini_get('pdo_mysql.default_socket');
$res_conf = '';
$ext_conf = '';
foreach ($backup_ext as $fext) {
if (file_exists($dir . '/extconfig' . $fext)) {
$ext_conf = $cnf_read->getConfig('extconfig' . $fext);
if (!empty($ext_conf['settings']['sccpdevice'])) {
if ($ext_conf['settings']['sccpdevice'] === $def_config['sccpdevice']) {
$res['sccpdevice'] = 'OK';
$res['extconfigfile'] = 'extconfig' . $fext;
} else {
$res['sccpdevice'] .= ' Error in line sccpdevice ';
}
}
if (!empty($ext_conf['settings']['sccpline'])) {
if ($ext_conf['settings']['sccpline'] === $def_config['sccpline']) {
$res['sccpline'] = 'OK';
} else {
$res['sccpline'] .= ' Error in line sccpline ';
}
}
}
}
$res['extconfig'] = 'OK';
if (empty($res['sccpdevice'])) {
$res['extconfig'] = ' Option "Sccpdevice" is not configured ';
}
if (empty($res['sccpline'])) {
$res['extconfig'] = ' Option "Sccpline" is not configured ';
}
if (empty($res['extconfigfile'])) {
$res['extconfig'] = 'File extconfig.conf does not exist';
}
if (!empty($res_conf_sql)) {
if (file_exists($res_conf_sql)) {
$def_bd_config['dbsock'] = $res_conf_sql;
}
}
// Check for mysql config files - should only be one depending on version
$mySqlConfigFiles = [ 'res_mysql.conf', 'res_config_mysql.conf' ];
foreach ($mySqlConfigFiles as $sqlConfigFile) {
if (file_exists( $dir . '/' . $sqlConfigFile )) {
$res_conf = $cnf_read->getConfig($sqlConfigFile);
if (empty($res_conf[$connector])) {
$res['mysqlconfig'] = 'Config not found in file: ' . $sqlConfigFile;
} else {
if ($res_conf[$connector]['dbsock'] != $def_bd_config['dbsock']) {
$res['mysqlconfig'] = 'Mysql Socket Error in file: ' . $sqlConfigFile;
}
}
if (empty($res['mysqlconfig'])) {
$res['mysqlconfig'] = 'OK';
}
}
}
if (empty($res['mysqlconfig'])) {
$res['mysqlconfig'] = 'Realtime Error: neither res_config_mysql.conf nor res_mysql.conf found in the path : ' . $dir;
}
return $res;
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,835 +0,0 @@
<?php
/**
*
* Core Comsnd Interface
*
*
*/
/* !TODO!: -TODO-: Would you like to use my XSD file to check if the provided template file is a correct cisco cnf.xml file ?
* !TODO!: -TODO-: I just don't understand how to use it here.. To check the incoming pattern ? To check the result of my script ?
* !TODO!: -TODO-: The most correct variant is to generate xml based on XSD template.
*/
namespace FreePBX\modules\Sccp_manager;
class xmlinterface
{
use \FreePBX\modules\Sccp_Manager\sccpManTraits\helperFunctions;
private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct($parent_class = null)
{
$this->paren_class = $parent_class;
$this->langCodeArray = array(
'Arabic_Saudi_Arabia' => 'ar',
'Bulgarian_Bulgaria' => 'bg',
'Czech_Czech_Republic' => 'cz',
'Danish_Denmark' => 'da',
'German_Germany' => 'de',
'Greek_Greece' => 'el',
'AU_English_United_States' => 'en',
'English_United_Kingdom' => 'en',
'English_United_States' => 'en',
'Spanish_Spain' => 'es',
'Estonian_Estonia' => 'et',
'Finnish_Finland' => 'fi',
'French_Canada' => 'fr',
'French_France' => 'fr',
'Hebrew_Israel' => 'he',
'Croatian_Croatia' => 'hr',
'Hungarian_Hungary' => 'hu',
'Italian_Italy' => 'it',
'Japanese_Japan' => 'ja',
'Korean_Korea_Republic' => 'ko',
'Lithuanian_Lithuania' => 'lt',
'Latvian_Latvia' => 'lv',
'Dutch_Netherlands' => 'nl',
'Norwegian_Norway' => 'no',
'Polish_Poland' => 'pl',
'Portuguese_Brazil' => 'pt',
'Portuguese_Portugal' => 'pt',
'Romanian_Romania' => 'ro',
'Russian_Russian_Federation' => 'ru',
'Slovak_Slovakia' => 'sk',
'Slovenian_Slovenia' => 'sl',
'Serbian_Republic_of_Montenegro' => 'sr',
'Serbian_Republic_of_Serbia' => 'rs',
'Swedish_Sweden' => 'sv',
'Thai_Thailand' => 'th',
'Turkish_Turkey' => 'tr',
'Chinese_China' => 'cn',
'Chinese_Taiwan' => 'zh'
);
}
public function info()
{
$Ver = '13.0.6';
return array('Version' => $Ver,
'about' => 'Create XML data interface ver: ' . $Ver);
}
function create_default_XML($store_path = '', $data_values = array(), $model_information = array(), $lang_info = array())
{
$data_path = $data_values['tftp_path'];
if (empty($store_path) || empty($data_path) || empty($data_values)) {
return;
}
$def_xml_fields = array('authenticationURL', 'informationURL', 'messagesURL', 'servicesURL', 'directoryURL',
'secureauthenticationURL', 'secureinformationURL', 'securemessagesURL', 'secureservicesURL', 'securedirectoryURL', 'secureidleURL',
'proxyServerURL', 'idleTimeout', 'idleURL');
$def_xml_locale = array('userLocale', 'networkLocaleInfo', 'networkLocale');
$xml_name = $store_path . '/XMLDefault.cnf.xml';
$xml_template = $data_values['tftp_path'] . '/templates/XMLDefault.cnf.xml_template';
if (file_exists($xml_template)) {
$xml_work = simplexml_load_file($xml_template);
$xnode = &$xml_work->callManagerGroup->members;
$bind_tmp = $this->get_server_sccp_bind($data_values);
//error_log("bind_tmp:".print_r($bind_tmp, true), 0);
$ifc = 0;
foreach ($bind_tmp as $bind_value) {
$xnode_obj = clone $xnode->member;
$xnode_obj['priority'] = $ifc;
$xnode_obj->callManager->name = $data_values['servername'];
$xnode_obj->callManager->ports->ethernetPhonePort = $bind_value['port'];
$xnode_obj->callManager->processNodeName = $bind_value['ip'];
if ($ifc === 0) {
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
} else {
$this->appendSimpleXmlNode($xnode->member, $xnode_obj);
}
$ifc++;
}
$this->replaceSimpleXmlNode($xml_work->callManagerGroup->members, $xnode);
foreach ($def_xml_fields as $value) {
if (!empty($data_values['dev_' . $value])) {
$xml_work->$value = trim($data_values['dev_' . $value]);
} else {
$node = $xml_work->$value;
if (!empty($node)) {
unset($node[0][0]);
}
}
}
foreach ($def_xml_locale as $key) {
if (!empty($xml_work->$key)) {
$xnode = &$xml_work->$key;
switch ($key) {
case 'userLocale':
case 'networkLocaleInfo':
if ($key == 'networkLocaleInfo') {
$lang = $data_values['netlang'];
} else {
$lang = $data_values['devlang'];
}
if (isset($lang_info[$lang])) {
$xnode->name = $lang_info[$lang]['locale'];
$xnode->langCode = $lang_info[$lang]['code'];
} else {
$xnode->name = '';
$xnode->langCode = '';
}
break;
case 'networkLocale':
$lang = $data_values['netlang'];
if (isset($lang_info[$lang])) {
$xnode = $lang_info[$lang]['language'];
} else {
$xnode = '';
}
break;
}
}
}
foreach ($model_information as $var) {
if (!empty($var['loadinformationid'])) {
$node = $xml_work->addChild($var['loadinformationid'], $var['loadimage']);
$node->addAttribute('model', $var['vendor'] . ' ' . $var['model']);
}
}
$this->saveXml($xml_work, $xml_name); // Save XMLDefault1.cnf.xml
}
}
function create_SEP_XML($store_path, $data_values, $dev_config, $dev_id, $lang_info = array())
{
// TODO: $data_values are system wide defaults, $dev_config are specific device values.
// Need to merge the two arrays so that device specific values override system values
$data_values = array_merge($data_values, $dev_config);
$var_xml_general_fields = array('authenticationurl' => 'dev_authenticationURL', 'informationurl' => 'dev_informationURL', 'messagesurl' => 'dev_messagesURL',
'servicesurl' => 'dev_servicesURL', 'directoryurl' => 'dev_directoryURL', 'idleurl' => 'dev_idleURL',
'secureauthenticationurl' => 'dev_secureauthenticationURL',
'secureinformationurl' => 'dev_secureinformationURL', 'securemessagesurl'=>'dev_securemessagesURL',
'secureservicesurl'=>'dev_secureservicesURL', 'securedirectoryurl'=>'dev_securedirectoryURL', 'secureidleurl' => 'dev_secureidleURL',
'proxyserverurl' => 'dev_proxyServerURL', 'idletimeout' => 'dev_idleTimeout',
'sshuserid' => 'dev_sshUserId', 'sshpassword' => 'dev_sshPassword', 'deviceprotocol' => 'dev_deviceProtocol',
'phonepersonalization' => 'phonepersonalization'
);
$var_xml_general_vars = array('capfAuthMode' => 'null', 'capfList' => 'null', 'mobility' => 'null',
'phoneServices' => 'null', 'certHash' => 'null',
'deviceSecurityMode' => '1');
$data_path = $dev_config['tftp_templates_path'];
if (empty($data_path)) {
die('Create_SEP_XML tftp_templates_path not defined');
}
$store_path = $dev_config['tftp_store_path'];
if (empty($store_path)) {
die('Create_SEP_XML tftp_store_path not defined');
}
if (!empty($dev_config['nametemplate'])) {
$xml_template = "{$data_path}/{$dev_config['nametemplate']}";
} else {
$xml_template = "{$data_path}/templates/SEP0000000000.cnf.xml_79df_template";
}
$xml_name = "{$store_path}/{$dev_id}.cnf.xml";
if (!file_exists($xml_template)) {
die('Error Hardware template :' . $xml_template . ' not found');
}
$xml_work = simplexml_load_file($xml_template);
foreach ($var_xml_general_vars as $key => $data) {
if (isset($xml_work->$key)) {
if ($data != 'null') {
$xml_work->$key = $data;
} else {
$node = $xml_work->$key;
unset($node[0][0]);
}
}
}
foreach ($xml_work as $key => $data) {
// Set System global Values
$key_l = strtolower($key);
if (!empty($var_xml_general_fields[$key_l])) {
$xml_work->$key = $data_values[$var_xml_general_fields[$key_l]];
}
// Set section Values
$xml_node = $xml_work->$key;
switch ($key_l) {
case 'devicepool':
$xml_node = $xml_work->$key;
foreach ($xml_work->$key->children() as $dkey => $ddata) {
switch (strtolower($dkey)) {
case 'datetimesetting':
$xnode = &$xml_node->$dkey;
$tz_id = $data_values['ntp_timezone'];
$TZdata = $data_values['ntp_timezone_id'];
if (empty($TZdata)) {
$TZdata = array('offset' => '0', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
}
$xnode->name = $tz_id;
$xnode->dateTemplate = $data_values['dateformat'];
$xnode->timeZone = $TZdata['cisco_code'];
// $xnode->timeZone = $tz_id.' Standard'.((empty($TZdata['daylight']))? '': '/'.$TZdata['daylight']).' Time';
if ($data_values['ntp_config_enabled'] == 'on') {
$xnode->ntps->ntp->name = $data_values['ntp_server'];
$xnode->ntps->ntp->ntpMode = $data_values['ntp_server_mode'];
} else {
$xnode->ntps = null;
}
// Ntp Config
break;
case 'srstinfo':
if ($data_values['srst_Option'] == 'user') {
break;
}
$xnode = &$xml_node->$dkey;
$xnode->name = $data_values['srst_Name'];
$xnode->srstOption = $data_values['srst_Option'];
$xnode->userModifiable = $data_values['srst_userModifiable'];
$xnode->isSecure = $data_values['srst_isSecure'];
// srst addresses are now stored as json;
$srst_addrs = $this->convertCsvToArray($data_values['srst_ip']);
//Now have an array of srst addresses - maybe empty
foreach ($srst_addrs as $netKey => $netValue) {
$nodeName = "ipAddr${netKey}";
$xnode->$nodeName = $netValue['ip'];
$nodeName = "port${netKey}";
$xnode->$nodeName = $netValue['port'];
}
break;
case 'connectionmonitorduration':
$xml_node->$dkey = strval(intval(intval($data_values['keepalive']) * 0.75));
break;
case 'callmanagergroup':
$xnode = &$xml_node->$dkey->members;
$bind_tmp = $this->get_server_sccp_bind($data_values);
$ifc = 0;
foreach ($bind_tmp as $bind_value) {
$xnode_obj = clone $xnode->member;
$xnode_obj['priority'] = $ifc;
$xnode_obj->callManager->name = $data_values['servername'];
if (!is_null($xnode_obj->callManager->description)) {
$xnode_obj->callManager->description = $data_values['servername'];
}
$xnode_obj->callManager->ports->ethernetPhonePort = $bind_value['port'];
$xnode_obj->callManager->processNodeName = $bind_value['ip'];
if (!empty($xnode_obj->callManager->ports->mgcpPorts)) {
unset($xnode_obj->callManager->ports->mgcpPorts);
}
if ($ifc === 0) {
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
} else {
$this->appendSimpleXmlNode($xnode->member, $xnode_obj);
}
$ifc++;
}
}
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'vendorconfig':
$xml_node = $xml_work->$key;
foreach ($xml_work->$key->children() as $dkey => $ddata) {
if (isset($data_values[strtolower($dkey)])) {
$vtmp_data = $data_values[strtolower($dkey)];
if (!empty($vtmp_data)) {
switch ($vtmp_data) {
case 'off':
$xml_node->$dkey = 1;
break;
case 'on':
$xml_node->$dkey = 0;
break;
default:
$xml_node->$dkey = $vtmp_data;
break;
}
}
}
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'versionstamp':
$xml_work->$key = time();
break;
case 'loadinformation':
if (isset($dev_config["tftp_firmware"])) {
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["tftp_firmware"] . $dev_config["loadimage"] : '';
} else {
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["loadimage"] : '';
}
if (!empty($dev_config['addon'])) {
$xnode = $xml_work->addChild('addOnModules');
$ti = 1;
$hw_addon = explode(';', $dev_config['addon']);
foreach ($hw_addon as $add_key) {
if (!empty($dev_config['addon_info'][$dev_config['addon']])) {
$add_val = $dev_config['addon_info'][$dev_config['addon']];
$xnode_obj = $xnode->addChild('addOnModule');
$xnode_obj->addAttribute('idx', $ti);
$xnode_obj->addChild('loadInformation', $add_val);
$ti++;
}
}
}
break;
case 'commonprofile':
$xml_node->phonePassword = $data_values['dev_sshPassword'];
$xml_node->backgroundImageAccess = (($data_values['backgroundImageAccess'] == 'on') || ($data_values['backgroundImageAccess'] == 'true') ) ? 'true' : 'false';
$xml_node->callLogBlfEnabled = $data_values['callLogBlfEnabled'];
break;
case 'userlocale':
// Device language
$lang = $data_values['devlang'];
if (!empty($dev_config['devlang'])) {
$lang = $dev_config['devlang'];
}
$xml_node->winCharSet = $dev_config['phonecodepage'];
$xml_node->name = $dev_config['devlang'];
$xml_node->langCode = 'en';
if (isset($this->langCodeArray[$dev_config['devlang']])) {
$xml_node->langCode = $this->langCodeArray[$dev_config['devlang']];
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'networklocale':
$lang = $data_values['netlang'];
if (!empty($dev_config['netlang'])) {
$lang = $dev_config['netlang'];
}
if (isset($lang)) {
$xml_work->$key = $lang;
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
} else {
$xml_work->$key = '';
}
break;
case 'networklocaleinfo':
$lang = $data_values['netlang'];
if (!empty($dev_config['netlang'])) {
$lang = $dev_config['netlang'];
}
if (isset($lang)) {
$xml_node->name = $lang;
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
} else {
$xml_work->$key = '';
}
break;
default:
break;
}
}
$this->saveXml($xml_work, $xml_name); // Save
return time();
}
private function get_server_sccp_bind($data_values = array())
{
$res = array();
if ($data_values['bindaddr'] !== '0.0.0.0') {
$rkey = $data_values['bindaddr'];
$res[$rkey] = array('ip' => $data_values['bindaddr'], 'port' => $data_values['port']);
return $res;
}
$ip_fill = true;
if (!empty($data_values['ccm_address'])) {
// ccm_address is json from sccpsettings
$ccm_address = $this->convertCsvToArray($data_values['ccm_address'], true);
// This is a sanitised list of ipaddresses and ports
foreach ($ccm_address as $netValue) {
$res[$netValue['ip']] = $netValue;
}
}
if ($ip_fill) {
foreach ($data_values['server_if_list'] as $value) {
if (!empty($value['ip'])) {
if (!in_array($value['ip'], array('0.0.0.0', '127.0.0.1'), true)) {
$rkey = $value['ip'];
$res[$rkey] = array('ip' => $rkey, 'port' => $data_values['port']);
}
}
}
}
if (!empty($data_values['externhost'])) {
$rkey = $data_values['externhost'];
if (!in_array($rkey, array('0.0.0.0', '127.0.0.1', 'localhost'), true)) {
$res[$rkey] = array('ip' => $rkey, 'port' => $data_values['port']);
}
} else {
if (!empty($data_values['externip'])) {
$rkey = $data_values['externip'];
if (!in_array($rkey, array('0.0.0.0', '127.0.0.1'), true)) {
$res[$rkey] = array('ip' => $rkey, 'port' => $data_values['port']);
}
}
}
return $res;
}
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',
'servicesURL' => 'dev_servicesURL', 'directoryURL' => 'dev_directoryURL', 'proxyServerURL' => 'dev_proxyServerURL', 'idleTimeout' => 'dev_idleTimeout',
'idleURL' => 'dev_idleURL', 'sshUserId' => 'dev_sshUserId', 'sshPassword' => 'dev_sshPassword',
'phonePersonalization' => 'phonepersonalization'
);
$var_xml_sipProfile = array('phoneLabel' => 'description',
'transferOnhookEnabled' => 'transferOnhookEnabled', 'enableVad' => 'enableVad', 'voipControlPort' => 'sipport'
);
$var_xml_sipline = array('name' => 'account', 'featureLabel' => 'account', 'displayName' => 'callerid', 'contact' => 'account',
'authName' => 'account', 'authPassword' => 'secret');
$var_xml_general_vars = array('capfAuthMode' => 'null', 'capfList' => 'null', 'mobility' => 'null',
'phoneServices' => 'null', 'certHash' => 'null', 'deviceProtocol' => 'SIP',
'deviceSecurityMode' => '1');
// $var_hw_config = $this->dbinterface->getSccpDeviceTableData("get_sccpdevice_byid", array('id' => $dev_id));
if (empty($dev_config)) {
return false;
}
$data_path = $dev_config['tftp_path'];
if (empty($store_path) || empty($data_path) || empty($data_values) || empty($dev_id)) {
return;
}
if (!empty($dev_config['nametemplate'])) {
$xml_template = $data_path . '/templates/' . $dev_config['nametemplate'];
if (!file_exists($xml_template)) {
$xml_template = $data_path . '/templates/SEP0000000000.cnf.xml_79df_sip_template';
}
} else {
$xml_template = $data_path . '/templates/SEP0000000000.cnf.xml_79df_sip_template';
}
$xml_name = $store_path . '/' . $dev_id . '.cnf.xml';
$sip_bind = $data_values['sbind'];
$bind_proto = 'tcp';
$bind_ip_def = '';
foreach ($sip_bind as $key => $value) {
if (empty($bind_ip_def)) {
$bind_ip_def = $key;
$bind_proto = (isset($value['tcp'])) ? 'tcp' : 'udp';
}
}
if (file_exists($xml_template)) {
$xml_work = simplexml_load_file($xml_template);
foreach ($var_xml_general_vars as $key => $data) {
if (isset($xml_work->$key)) {
if ($data != 'null') {
$xml_work->$key = $data;
} else {
$node = $xml_work->$key;
unset($node[0][0]);
}
}
}
foreach ($xml_work as $key => $data) {
// Set System global Values
if (!empty($var_xml_general_fields[$key])) {
$xml_work->$key = $data_values[$var_xml_general_fields[$key]];
}
// Set section Values
$xml_node = $xml_work->$key;
switch ($key) {
case 'devicePool':
$xml_node = $xml_work->$key;
foreach ($xml_work->$key->children() as $dkey => $ddata) {
switch ($dkey) {
case 'dateTimeSetting':
$xnode = &$xml_node->$dkey;
$tz_id = $data_values['ntp_timezone'];
$TZdata = $data_values['ntp_timezone_id'];
if (empty($TZdata)) {
$TZdata = array('offset' => '0', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
}
$xnode->dateTemplate = $data_values['dateformat'];
$xnode->timeZone = $TZdata['cisco_code'];
if ($data_values['ntp_config_enabled'] == 'on') {
$xnode->ntps->ntp->name = $data_values['ntp_server'];
$xnode->ntps->ntp->ntpMode = $data_values['ntp_server_mode'];
} else {
$xnode->ntps = null;
}
// Ntp Config
break;
case 'callManagerGroup':
$xnode = &$xml_node->$dkey->members;
$ifc = 0;
foreach ($sip_bind as $bind_ip => $bind_value) {
$xnode_obj = clone $xnode->member;
$xnode_obj['priority'] = $ifc;
$xnode_obj->callManager->name = $data_values['servername'];
$xnode_obj->callManager->ports->sipPort = $bind_value[$bind_proto];
// $xnode_obj->callManager->ports->securedSipPort = $bind_value['tlsport'];
$xnode_obj->callManager->processNodeName = $bind_ip;
if ($ifc === 0) {
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
} else {
$this->appendSimpleXmlNode($xnode->member, $xnode_obj);
}
$ifc++;
}
}
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'sipProfile':
$xml_node = $xml_work->$key;
foreach ($xml_work->$key->children() as $dkey => $ddata) {
if (!empty($var_xml_sipProfile[$dkey])) {
if (!empty($data_values[$var_xml_sipProfile[$dkey]])) {
$xml_node->$dkey = $data_values[$var_xml_sipProfile[$dkey]];
} else {
$xml_node->$dkey = null;
}
}
switch ($dkey) {
case 'sipProxies':
$xnode = &$xml_node->$dkey;
$xnode->backupProxy = $bind_ip_def;
$xnode->backupProxyPort = $sip_bind[$bind_ip_def][$bind_proto];
$xnode->emergencyProxy = $bind_proto;
$xnode->emergencyProxyPort = $sip_bind[$bind_ip_def][$bind_proto];
$xnode->outboundProxy = $bind_proto;
$xnode->outboundProxyPort = $sip_bind[$bind_ip_def][$bind_proto];
$xnode->registerWithProxy = "true";
break;
case 'sipLines':
$xnode = &$xml_node->$dkey;
$ifc = 0;
if (!empty($data_values['siplines'])) {
foreach ($data_values['siplines'] as $spkey => $spvalue) {
// if $spvalue[]
$xnode_obj = clone $xnode->line;
$xnode_obj['button'] = $ifc + 1;
$xnode_obj['lineIndex'] = $ifc + 1;
//$xnode_obj->proxy = $data_values['bindaddr'];
$xnode_obj->featureID = "9";
if ($xnode_obj->proxy != 'USECALLMANAGER') {
$xnode_obj->proxy = $bind_proto;
$xnode_obj->port = $sip_bind[$bind_ip_def][$bind_proto];
}
foreach ($var_xml_sipline as $line_key => $line_val) {
$xnode_obj->$line_key = $spvalue[$line_val];
}
if ($ifc === 0) {
$this->replaceSimpleXmlNode($xnode->line, $xnode_obj);
} else {
$this->appendSimpleXmlNode($xnode->line, $xnode_obj);
}
$ifc++;
}
}
if (!empty($data_values['speeddial'])) {
foreach ($data_values['speeddial'] as $spkey => $spvalue) {
$xmlstr = '<line button="' . ($ifc + 1) . '"> <featureID>22</featureID>'
. '<featureLabel>' . $spvalue["name"] . '</featureLabel>'
. '<speedDialNumber>' . $spvalue["dial"] . '</speedDialNumber>'
. '<contact>' . $spvalue["dial"] . '</contact> <retrievalPrefix /></line>';
$xnode_obj = simplexml_load_string($xmlstr);
$this->appendSimpleXmlNode($xnode->line, $xnode_obj);
$ifc++;
}
}
break;
case 'softKeyFile':
case 'dialTemplate': // Доработать !
$xml_ext_file = '';
$template_path = (($dkey == 'softKeyFile') ? $dev_config['tftp_softkey_path'] : $dev_config['tftp_dialplan_path']);
$tmp_key = ($dkey == 'softKeyFile') ? 'softkeyset' : '_dialrules';
if (!empty($dev_config[$tmp_key])) {
$xml_ext_file = (($dkey == 'softKeyFile') ? 'softkey' . $dev_config[$tmp_key] . '.xml' : $dev_config[$tmp_key] . '.xml');
}
if (empty($xml_ext_file) || !file_exists($template_path . '/' . $xml_ext_file)) {
$xml_ext_file = (($dkey == 'softKeyFile') ? 'softkeydefault.xml' : 'dialplan.xml');
}
if (file_exists($template_path . '/' . $xml_ext_file)) {
$xml_node->$dkey = $xml_ext_file;
} else {
$xml_node->$dkey = null;
}
break;
}
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'versionStamp':
$xml_work->$key = time();
break;
case 'loadInformation':
// Set Path Image ????
if (isset($dev_config["tftp_firmware"])) {
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["tftp_firmware"] . $dev_config["loadimage"] : '';
} else {
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["loadimage"] : '';
}
if (!empty($dev_config['addon'])) {
$xnode = $xml_work->addChild('addOnModules');
$ti = 1;
$hw_addon = explode(';', $dev_config['addon']);
foreach ($hw_addon as $add_key) {
if (!empty($dev_config['addon_info'][$dev_config['addon']])) {
$add_val = $dev_config['addon_info'][$dev_config['addon']];
$xnode_obj = $xnode->addChild('addOnModule');
$xnode_obj->addAttribute('idx', $ti);
$xnode_obj->addChild('loadInformation', $add_val);
$ti++;
}
}
}
break;
case 'commonProfile':
$xml_node->phonePassword = $data_values['dev_sshPassword'];
$xml_node->backgroundImageAccess = (($data_values['backgroundImageAccess'] == 'on') || ($data_values['backgroundImageAccess'] == 'true') ) ? 'true' : 'false';
$xml_node->callLogBlfEnabled = $data_values['callLogBlfEnabled'];
break;
case 'userlocale':
// Device language
$lang = $data_values['devlang'];
if (!empty($dev_config['devlang'])) {
$lang = $dev_config['devlang'];
}
$xml_node->winCharSet = $dev_config['phonecodepage'];
$xml_node->name = $dev_config['devlang'];
$xml_node->langCode = 'en';
if (isset($this->langCodeArray['devlang'])) {
$xml_node->langCode = $this->langCodeArray['devlang'];
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'networklocale':
$lang = $data_values['netlang'];
if (!empty($dev_config['netlang'])) {
$lang = $dev_config['netlang'];
}
if (isset($lang)) {
$xml_work->$key = $lang;
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
} else {
$xml_work->$key = '';
}
break;
case 'networklocaleinfo':
$lang = $data_values['netlang'];
if (!empty($dev_config['netlang'])) {
$lang = $dev_config['netlang'];
}
if (isset($lang)) {
$xml_node->name = $lang;
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
} else {
$xml_work->$key = '';
}
break;
default:
break;
}
}
$this->saveXml($xml_work, $xml_name); // Save
} else {
die('Error Hardware template :' . $xml_template . ' not found');
}
return time();
}
function saveDialPlan($confDir, $get_settings)
{
$xmlstr = "<DIALTEMPLATE>\n";
$xmlstr .= "<versionStamp>" . time() . "</versionStamp>\n";
$dialFelds = array('match', 'timeout', 'rewrite', 'tone'); //str -to lo !
$hdr_prefix = 'sccp_dial_';
$hdr_arprefix = 'sccp_dial-ar_';
$save_data = array();
$integer_msg = _("%s must be a non-negative integer");
$errors = array();
foreach ($get_settings[$hdr_arprefix . 'dialtemplate'] as $key => $value) {
$xmlstr .= '<TEMPLATE';
if (!empty($value['match'])) {
foreach ($dialFelds as $fld) {
if (isset($value[$fld])) {
if ($value[$fld] == 'empty' || $value[$fld] == '') {
} else {
$xmlstr .= ' ' . $fld . '="' . (string) $value[$fld] . '"';
}
}
}
} else {
$errors = array('Fields need to match !!');
}
$xmlstr .= "/>\n";
}
$xmlstr .= '</DIALTEMPLATE>';
if (!empty($get_settings['idtemplate'])) {
if ($get_settings['idtemplate'] == '*new*') {
if (!empty($get_settings[$hdr_prefix . 'dialtemplate_name'])) {
$put_file = (string) $get_settings[$hdr_prefix . 'dialtemplate_name'];
} else {
$errors = array('Fields Dial Plan Name is requered !!');
}
} else {
$put_file = (string) $get_settings['idtemplate'];
}
} else {
$errors = array('Fields Dial Plan Name is required !!');
}
if (empty($errors)) {
$put_file = str_replace(array("\n", "\r", "\t", "/", "\\", ".", ","), '', $put_file);
$file = $confDir . '/dial' . $put_file . '.xml';
file_put_contents($file, $xmlstr);
}
return $errors;
}
function create_xmlSoftkeyset($config, $confDir, $name)
{
if (empty($config[$name])) {
if ($name == 'default') {
$typeSoft = $confDir["tftp_templates_path"] . '/SIPDefaultSoftKey.xml_template';
if (file_exists($typeSoft)) {
$file = $confDir["tftp_softkey_path"] . '/softkey' . $name . '.xml';
if (!copy($typeSoft, $file)) {
return array('error' => 'Access error' . $name);
}
}
return array();
} else {
return array('error' => 'Invalid softkey Name' . $name);
}
}
$errors = array();
$xmlstr = "<softKeyCfg>\n";
$xmlstr .= "<versionStamp>" . time() . "</versionStamp>\n";
$typeSoft = $confDir["tftp_templates_path"] . '/SIPTypeSoftKey.xml_template';
$read_soft = "";
if (file_exists($typeSoft)) {
$f_read = fopen($typeSoft, 'r');
while (!feof($f_read)) {
$read_soft .= fread($f_read, 8192);
}
fclose($f_read);
}
$xmlstr .= $read_soft;
$xmlstr .= " <softKeySets>\n";
foreach ($config[$name] as $key => $value) {
$xmlstr .= ' <softKeySet id="' . $key . '">' . "\n";
foreach (explode(",", $value) as $keyvalue) {
$xmlstr .= ' <softKey keyID="' . $keyvalue . '" />' . "\n";
}
$xmlstr .= " </softKeySet>\n";
}
$xmlstr .= " </softKeySets>\n";
$xmlstr .= '</softKeyCfg>';
if (empty($errors)) {
$file = $confDir["tftp_softkey_path"] . '/softkey' . $name . '.xml';
file_put_contents($file, $xmlstr);
}
return $errors;
}
private function replaceSimpleXmlNode($xml, $element = SimpleXMLElement)
{
$dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode(
dom_import_simplexml($element),
true
);
$dom->parentNode->replaceChild($import, $dom);
}
private function appendSimpleXmlNode($xml, $element = SimpleXMLElement)
{
$dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode(
dom_import_simplexml($element),
true
);
$dom->parentNode->appendChild($import->cloneNode(true));
}
}

View file

@ -1,788 +0,0 @@
<?php
namespace FreePBX\modules\Sccp_manager\sccpManTraits;
trait ajaxHelper {
public function ajaxRequest($req, &$setting) {
// Called first by BMO. Must return true or request will be aborted.
// See https://wiki.freepbx.org/display/FOP/BMO+Ajax+Calls
switch ($req) {
case 'backupsettings':
case 'savesettings':
case 'save_device':
case 'save_sip_device':
case 'save_ruser':
case 'save_dialplan_template':
case 'delete_hardware':
case 'getPhoneGrid':
case 'getExtensionGrid':
case 'getDeviceModel':
case 'getUserGrid':
case 'getSoftKey':
case 'getDialTemplate':
case 'get_ext_files':
case 'create_hw_tftp':
case 'reset_dev':
case 'reset_token':
case 'model_enabled':
case 'model_disabled':
case 'model_update':
case 'model_add':
case 'model_delete':
case 'update_button_label':
case 'updateSoftKey':
case 'deleteSoftKey':
case 'delete_dialplan':
return true;
break;
case 'validateMac':
return true;
break;
default:
return false;
}
}
// ajaxHandler is called after ajaxRequest returns true
public function ajaxHandler() {
$request = $_REQUEST;
$msg = array();
$cmd_id = $request['command'];
switch ($cmd_id) {
case 'savesettings':
// Consolidate this into a separate method to improve legibility
$this->handleSubmit($request);
// TODO: Need to be more specific on reload and only reload if critical settings changed.
$res = $this->aminterface->core_sccp_reload();
return array('status' => true, 'message' => 'Data saved', 'reload' => true, 'toastFlag' => 'success', 'search' => '?display=sccpsettings', 'hash' => '');
break;
case 'save_sip_device':
case 'save_device':
return $this->saveSccpDevice($request);
break;
case 'save_ruser':
//$res = $request;
$res = $this->handleRoamingUsers($request);
return array('status' => true, 'search' => '?display=sccp_phone', 'hash' => 'general');
break;
case 'save_dialplan_template':
/* !TODO!: -TODO-: dialplan templates should be removed (only required for very old devices (like ATA) */
// ------------------------------- Old + Sip device support - In the development---
$res = $this->saveDialPlan($request);
//public
if (empty($res)) {
return array('status' => true, 'search' => '?display=sccp_adv', 'hash' => 'sccpdialplan');
} else {
return array('status' => false, 'message' => print_r($res));
}
break;
case 'delete_dialplan':
if (!empty($request['dialplan'])) {
$get_file = $request['dialplan'];
$res = $this->deleteDialPlan($get_file);
return array('status' => true, 'message' => 'Dial Template has been deleted ! ', 'table_reload' => true);
} else {
return array('status' => false, 'message' => print_r($res));
}
break;
// ------------------------------- Old device support - In the development---
case 'delete_hardware':
if (!empty($request['idn'])) {
foreach ($request['idn'] as $idv) {
if ($this->strpos_array($idv, array('SEP', 'ATA', 'VG')) !== false) {
$this->dbinterface->write('sccpdevice', array('name' => $idv), 'delete', "name");
$this->dbinterface->write('sccpbuttons', array(), 'delete', '', $idv);
$this->deleteSccpDeviceXML($idv); // Концы в вводу !!
$this->aminterface->sccpDeviceReset($idv, 'reset');
}
}
return array('status' => true, 'table_reload' => true, 'message' => 'Hardware device has been deleted! ');
}
break;
case 'create_hw_tftp':
$ver_id = ' Test !';
if (!empty($request['idn'])) {
$models = array();
foreach ($request['idn'] as $idv) {
$this->deleteSccpDeviceXML($idv);
$models [] = array('name' => $idv);
}
} else {
$this->deleteSccpDeviceXML('all');
$models = $this->dbinterface->getSccpDeviceTableData("SccpDevice");
}
$this->createDefaultSccpXml(); // Default XML
$ver_id = ' on found active model !';
foreach ($models as $data) {
$ver_id = $this->createSccpDeviceXML($data['name']);
if ($ver_id == -1) {
return array('status' => false, 'message' => 'Error Create Configuration Divice :' . $data['name']);
}
};
if ($this->sccpvalues['siptftp']['data'] == 'on') { // Check SIP Support Enabled
$this->createSccpXmlSoftkey(); // Create Softkey Sets for SIP
}
// !TODO!: -TODO-: Do these returned message strings work with i18n ?
return array('status' => true, 'message' => 'Create new config files (version:' . $ver_id . ')');
break;
case 'reset_token':
case 'reset_dev':
$msg = '';
$msgr = array();
$msgr[] = "Reset command sent to device(s) ";
if (!empty($request['name'])) {
foreach ($request['name'] as $idv) {
$msg = strpos($idv, 'SEP-');
if (!(strpos($idv, 'SEP') === false)) {
if ($cmd_id == 'reset_token') {
$res = $this->aminterface->sccpDeviceReset($idv, 'tokenack');
$msgr[] = $msg . ' ' . $res['Response'] . ' ' . $res['data'];
} else {
$res = $this->aminterface->sccpDeviceReset($idv, 'reset');
$msgr[] = $msg . ' ' . $res['Response'] . ' ' . $res['data'];
}
}
if ($idv == 'all') {
$dev_list = $this->aminterface->sccp_get_active_device();
foreach ($dev_list as $key => $data) {
if ($cmd_id == 'reset_token') {
if (($data['token'] == 'Rej') || ($data['status'] == 'Token ')) {
$res = $this->aminterface->sccpDeviceReset($idv, 'tokenack');
$msgr[] = 'Sent Token reset to :' . $key;
}
} else {
$res = $this->aminterface->sccpDeviceReset($idv, 'reset');
$msgr[] = $res['Response'] . ' ' . $res['data'];
}
}
}
}
}
return array('status' => (($res['Response'] == 'Error')? false : true ), 'message' => $msgr, 'reload' => false, 'table_reload' => true);
break;
case 'update_button_label':
$msg = '';
$hw_list = array();
if (!empty($request['name'])) {
foreach ($request['name'] as $idv) {
if (!(strpos($idv, 'SEP') === false)) {
$hw_list[] = array('name' => $idv);
}
if ($idv == 'all') {
}
}
}
$res = $this->updateSccpButtons($hw_list);
$msg .= $res['Response'] . (empty($res['data']) ? '' : ' raw data: ' . $res['data'] . ' ');
return array('status' => true, 'message' => 'Update Buttons Labels Complete: ' . $msg, 'reload' => false, 'table_reload' => true);
case 'model_add':
$save_settings = array();
$key_name = array('model', 'vendor', 'dns', 'buttons', 'loadimage', 'loadinformationid', 'nametemplate');
$upd_mode = 'replace';
case 'model_update':
if ($request['command'] == 'model_update') {
$key_name = array('model','vendor','dns', 'buttons', 'loadimage', 'loadinformationid', 'nametemplate');
$upd_mode = 'update';
}
if (!empty($request['model'])) {
foreach ($key_name as $key => $value) {
if (!empty($request[$value])) {
$save_settings[$value] = $request[$value];
} else {
$save_settings[$value] = $this->val_null; // null
}
}
$this->dbinterface->write('sccpdevmodel', $save_settings, $upd_mode, "model");
return array('status' => true, 'table_reload' => true);
}
return $save_settings;
break;
case 'model_enabled':
$model_set = '1'; // fall through intentionally
case 'model_disabled':
if ($request['command'] == 'model_disabled') {
$model_set = '0';
}
$msg = '';
$save_settings = array();
if (!empty($request['model'])) {
foreach ($request['model'] as $idv) {
$this->dbinterface->write('sccpdevmodel', array('model' => $idv, 'enabled' => $model_set), 'update', "model");
}
}
return array('status' => true, 'table_reload' => true);
break;
case 'model_delete':
if (!empty($request['model'])) {
$this->dbinterface->write('sccpdevmodel', array('model' => $request['model']), 'delete', "model");
return array('status' => true, 'table_reload' => true);
}
break;
case 'getDeviceModel':
switch ($request['type']) {
case 'all':
case 'extension':
case 'enabled':
$devices = $this->getSccpModelInformation($request['type'], $validate = true);
break;
}
if (empty($devices)) {
return array();
}
return $devices;
break;
case 'deleteSoftKey':
if (!empty($request['softkey'])) {
$id_name = $request['softkey'];
unset($this->sccp_conf_init[$id_name]);
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"], $this->sccp_conf_init);
$msg = print_r($this->aminterface->core_sccp_reload(), 1);
return array('status' => true, 'table_reload' => true);
}
break;
case 'updateSoftKey':
if (!empty($request['id'])) {
$id_name = preg_replace('/[^A-Za-z0-9]/', '', $request['id']);
$this->sccp_conf_init[$id_name]['type'] = "softkeyset";
foreach ($this->extconfigs->getExtConfig('keyset') as $keyl => $vall) {
if (!empty($request[$keyl])) {
$this->sccp_conf_init[$id_name][$keyl] = $request[$keyl];
}
}
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"], $this->sccp_conf_init);
// !TODO!: -TODO-: Check SIP Support Enabled
$this->createSccpXmlSoftkey();
$msg = print_r($this->aminterface->core_sccp_reload(), 1);
return array('status' => true, 'table_reload' => true);
}
break;
case 'getSoftKey':
$result = array();
$i = 0;
$keyl = 'default';
foreach ($this->aminterface->sccp_list_keysets() as $keyl => $vall) {
$result[$i]['softkeys'] = $keyl;
if ($keyl == 'default') {
foreach ($this->extconfigs->getExtConfig('keyset') as $key => $value) {
$result[$i][$key] = str_replace(',', '<br>', $value);
}
} else {
foreach ($this->getMyConfig('softkeyset', $keyl) as $key => $value) {
$result[$i][$key] = str_replace(',', '<br>', $value);
}
}
$i++;
}
return $result;
break;
case 'getExtensionGrid':
$lineList = $this->dbinterface->getSccpDeviceTableData($request['type']);
if (empty($lineList)) {
return array();
}
$activeDevices = $this->aminterface->sccp_get_active_device();
$uniqueLineList = array();
foreach ($lineList as $key => &$lineArr) {
if (array_key_exists($lineArr['mac'], $activeDevices)) {
$lineArr['line_status'] = "{$activeDevices[$lineArr['mac']]['status']} | {$activeDevices[$lineArr['mac']]['act']}";
}
if (array_key_exists($lineArr['name'], $uniqueLineList)) {
$lineList[$uniqueLineList[$lineArr['name']]]['mac'] .= '<br>' . $lineArr['mac'];
$lineList[$uniqueLineList[$lineArr['name']]]['line_status'] .= '<br>' . $lineArr['line_status'];
unset($lineList[$key]); // Drop this array as no longer used
continue;
}
$uniqueLineList[$lineArr['name']] = $key;
}
unset($lineArr, $uniqueLineList); // unset reference and temp vars.
return array_values($lineList); // Reindex array and return
break;
case 'getPhoneGrid':
$dbDevices = array();
// Find all devices defined in the database.
$dbDevices = $this->dbinterface->getSccpDeviceTableData('phoneGrid', array('type' => $request['type']));
// Return if only interested in SIP devices
if ($request['type'] == 'cisco-sip') {
return $dbDevices; //this may be empty
}
// Find all devices currently connected
$activeDevices = $this->aminterface->sccp_get_active_device();
foreach ($dbDevices as &$dev_id) {
if (!empty($activeDevices[$dev_id['name']])) {
// Device is in db and is connected
$dev_id['description'] = $activeDevices[$dev_id['name']]['descr'];
$dev_id['status'] = $activeDevices[$dev_id['name']]['status'];
$dev_id['address'] = $activeDevices[$dev_id['name']]['address'];
$dev_id['new_hw'] = 'N';
// No further action required on this active device
unset($activeDevices[$dev_id['name']]);
}
}
unset($dev_id); // unset reference.
if (!empty($activeDevices)) {
// Have a device that is connected but is not currently in the database
// This device must have connected via hotline or config in sccp.conf.
// Pass parameters to addDevice so that can be added to db.
foreach ($activeDevices as $dev_ids) {
$id_name = $dev_ids['name'];
$dev_data = $this->aminterface->sccp_getdevice_info($id_name);
if (!empty($dev_data['SCCP_Vendor']['model_id'])) {
$dev_addon = $dev_data['SCCP_Vendor']['model_addon'];
if (empty($dev_addon)) {
$dev_addon = null;
}
$dev_schema = $this->getSccpModelInformation('byciscoid', false, "all", array('model' => $dev_data['SCCP_Vendor']['model_id']));
if (empty($dev_schema)) {
$dev_schema[0]['model'] = "ERROR in Model Schema";
}
$dbDevices[] = array(
'name' => $id_name,
'mac' => $id_name,
'button' => '---',
'type' => $dev_schema[0]['model'],
'new_hw' => 'Y',
'description' => '*NEW* ' . $dev_ids['descr'],
'status' => '*NEW* ' . $dev_ids['status'],
'address' => $dev_ids['address'],
'addon' => $dev_addon
);
}
}
}
return $dbDevices;
break;
case 'getDialTemplate':
// ------------------------------- Old device support - In the development---
$result = $this->getDialPlanList();
if (empty($result)) {
$result = array();
}
return $result;
break;
case 'backupsettings':
// ------------------------------- Old device support - In the development---
$filename = $this->createSccpBackup();
$file_name = basename($filename);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=$file_name");
header("Content-Length: " . filesize($filename));
readfile($filename);
unlink($filename);
// return array('status' => false, 'message' => $result);
return $result;
break;
case 'validateMac':
break;
case 'get_ext_files':
return $this->getFilesFromProvisioner($request);
break;
}
}
function handleSubmit($request, $validateonly = false) {
$hdr_prefix = 'sccp_';
$hdr_arprefix = 'sccp-ar_';
$save_settings = array();
$save_codec = array();
$count_mods = 0;
$dbSaveArray = array();
$errors = array();
if (isset($request["{$hdr_prefix}createlangdir"]) && ($request["{$hdr_prefix}createlangdir"] == 'yes')) {
$this->initializeTFtpLanguagePath();
}
// if uncheck all codecs, audiocodecs key is missing so nothing changes in db.
// Unsetting all codecs will now return to chan-sccp defaults.
// all codecs are currently treated as audiocodecs. To treat videocodecs separately name in video codec section of
// server.codec needs to be changed from audiocodecs to videocodecs.
if (!isset($request['audiocodecs'])) {
$save_settings['allow'] = $this->sccpvalues['allow'];
$save_settings['allow']['data'] = $this->sccpvalues['allow']['systemdefault'];
} else {
foreach ($request['audiocodecs'] as $keycodeс => $dumVal) {
$save_codec[] = $keycodeс;
}
$save_settings['allow'] = $this->sccpvalues['allow'];
$save_settings['allow']['data'] = implode(";", $save_codec);
}
unset($request['audiocodecs']);
if (isset($request[$hdr_prefix . 'ntp_timezone'])) {
$TZdata = $this->extconfigs->getExtConfig('sccp_timezone', $request[$hdr_prefix . 'ntp_timezone']);
if (!empty($TZdata)) {
$save_settings['tzoffset'] = array(
'keyword' => 'tzoffset',
'data' => $TZdata['offset']/60,
'seq' => '98',
'type' => '2',
'systemdefault' => ''
);
}
unset($request[$hdr_prefix . 'ntp_timezone']);
}
// Now handle remaining data. First get table defaults
$sccpdevice_def = (array)$this->getTableDefaults('sccpdevice', false);
$sccpline_def = (array)$this->getTableDefaults('sccpline', false);
// before handling arrays, need to see if deny and permit are set in the request
// if they have been cleared by the users, will not be present
foreach (['deny','permit'] as $keyVal) {
if (!isset($request[$hdr_arprefix.$keyVal])) {
$tmpArr = $this->convertCsvToArray($this->sccpvalues[$keyVal]['systemdefault']);
if (isset($tmpArr[0]['internal'])) {
$request[$hdr_arprefix.$keyVal][0] = $tmpArr[0];
} else {
$request[$hdr_arprefix.$keyVal][1]['net'] = $tmpArr[0]['net'];
$request[$hdr_arprefix.$keyVal][1]['mask'] = $tmpArr[0]['mask'];
}
}
}
foreach ($request as $key => $value) {
// First handle any arrays as their prefix is part common with normal data
//$netvalue = array();
$key = (str_replace($hdr_arprefix, '', $key, $count_mods));
if ($count_mods) {
// Only arrays : network lists or ip lists.
$save_settings[$key]['keyword'] = $key;
$save_settings[$key]['type'] = $this->sccpvalues[$key]['type'];
$save_settings[$key]['seq'] = $this->sccpvalues[$key]['seq'];
$save_settings[$key]['data'] = $this->convertArrayToCsv($value);
$save_settings[$key]['systemdefault'] = $this->sccpvalues[$key]['systemdefault'];
continue;
}
// Now handle any normal data - arrays will not match as already handled.
if (strpos($key, $hdr_prefix) === 0) {
$key = (str_replace($hdr_prefix, '', $key, $count_mods));
if (($count_mods) && (!empty($this->sccpvalues[$key])) && ($this->sccpvalues[$key]['data'] != $value)) {
$save_settings[$key] = $this->sccpvalues[$key];
$save_settings[$key]['data'] = $value;
}
continue;
}
// Finally treat values to be saved to sccpdevice and sccpline defaults.
// TODO: Need to verify the tables defined in showGroup - some options maybe
// device options, but if set by freePbx extensions, be in sccpline.
foreach (array('sccpdevice', 'sccpline') as $tableName) {
$key = (str_replace("{$tableName}_", '', $key, $count_mods));
if ($count_mods) {
// Have default to be saved to db table default
$tableName_def = "{$tableName}_def";
if ((array_key_exists($key, ${$tableName_def})) && (${$tableName_def}[$key]['data'] == $value)) {
// Value unchanged so ignore
} else {
$dbSaveArray[$key] = array('table' => $tableName, 'field' => $key, 'Default' => $value);
}
// If have matched on device, cannot match on line
continue 2;
}
}
}
$extSettings = $this->extconfigs->updateTftpStructure(array_merge($this->sccpvalues, $save_settings));
$save_settings = array_merge($save_settings, $extSettings);
//dbug($save_settings);
if (!empty($save_settings)) {
$this->saveSccpSettings($save_settings);
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting();
}
// now add the site defaults from sccpsettings to sccpdevice for permit and deny, so that these will override
foreach (['deny', 'permit'] as $fieldId) {
$output = array();
foreach ($this->convertCsvToArray($this->sccpvalues[$fieldId]['data']) as $netValue) {
if (isset($netValue['internal'])) {
$output[] = 'internal';
continue;
}
$output[] = implode('/', $netValue);
}
$dbSaveArray[$fieldId] = array('table' => 'sccpdevice', 'field' => $fieldId, 'Default' => implode(';',$output));
}
foreach ($dbSaveArray as $key => $rowToSave) {
$this->dbinterface->updateTableDefaults($rowToSave['table'], $rowToSave['field'], $rowToSave['Default']);
}
// rewrite sccp.conf
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"], $this->sccp_conf_init);
$this->createDefaultSccpXml();
}
public function getMyConfig($var = null, $id = "noid") {
// TODO: this function has little purpose - need to integrate into AjaxHelper
switch ($var) {
case "softkeyset":
$final = array();
$i = 0;
if ($id == "noid") {
foreach ($this->sccp_conf_init as $key => $value) {
if ($this->sccp_conf_init[$key]['type'] == 'softkeyset') {
$final[$i] = $value;
$i++;
}
}
} else {
if (!empty($this->sccp_conf_init[$id])) {
if ($this->sccp_conf_init[$id]['type'] == 'softkeyset') {
$final = $this->sccp_conf_init[$id];
}
}
}
break;
}
return $final;
}
public function getFilesFromProvisioner($request) {
$filesToGet = array();
$totalFiles = 0;
$provisionerUrl = "https://github.com/dkgroot/provision_sccp/raw/master/";
// TODO: Maybe should always fetch to ensure have latest, backing up old version
if (!file_exists("{$this->sccppath['tftp_path']}/masterFilesStructure.xml")) {
if (!$this->getFileListFromProvisioner($this->sccppath['tftp_path'])) {
return array('status' => false,
'message' => "{$provisionerUrl}tools/tftpbootFiles.xml cannot be found. Check your internet connection, and that this path exists",
'reload' => false);
}
}
$tftpBootXml = simplexml_load_file("{$this->sccppath['tftp_path']}/masterFilesStructure.xml");
switch ($request['type']) {
case 'firmware':
$device = $request['device'];
$firmwareDir = $tftpBootXml->xpath("//Directory[@name='firmware']");
$result = $firmwareDir[0]->xpath("//Directory[@name='{$device}']");
$filesToGet['firmware'] = (array)$result[0]->FileName;
$totalFiles += count($filesToGet['firmware']);
$srcDir['firmware'] = $provisionerUrl . (string)$result[0]->DirectoryPath;
$dstDir['firmware'] = "{$this->sccppath['tftp_firmware_path']}/{$device}";
$msg = "Firmware for {$device} has been successfully downloaded";
break;
case 'locale':
$language = $request['locale'];
// Get locales
$localeDir = $tftpBootXml->xpath("//Directory[@name='languages']");
$result = $localeDir[0]->xpath("//Directory[@name='{$language}']");
$filesToGet['language'] = (array)$result[0]->FileName;
$totalFiles += count($filesToGet['language']);
$srcDir['language'] = $provisionerUrl . (string)$result[0]->DirectoryPath;
$dstDir['language'] = "{$this->sccppath['tftp_lang_path']}/{$language}";
// Get countries. Country is a substring of locale with exception of korea
$country = explode('_', $language);
array_shift($country);
$countryName = array_shift($country);
while (count($country)>=1) {
$countryName .= '_' . array_shift($country);
}
$msg = "{$language} Locale and Country tones have been successfully downloaded";
//fall through intentionally to also get country files
case 'country':
if ($totalFiles == 0) {
//Request is for countries; if >0, have fallen through from locale
$countryName = $request['country'];
$msg = "{$countryName} country tones have been successfully downloaded";
}
$result = $tftpBootXml->xpath("//Directory[@name='{$countryName}']");
$filesToGet['country'] = (array)$result[0]->FileName;
$totalFiles += count($filesToGet['country']);
$srcDir['country'] = $provisionerUrl . (string)$result[0]->DirectoryPath;
$dstDir['country'] = "{$this->sccppath['tftp_countries_path']}/{$countryName}";
break;
default:
return array('status' => false, 'message' => 'Invalid request', 'reload' => false);
break;
}
// Now get the files
$filesRetrieved = 0;
foreach (array('language','country', 'firmware') as $section){
if (!isset($dstDir[$section])) {
// No request for this section
continue;
}
$srcDir = $srcDir[$section];
$dstDir = $dstDir[$section];
if (!is_dir($dstDir)) {
mkdir($dstDir, 0755);
}
foreach ($filesToGet[$section] as $srcFile) {
try {
file_put_contents("{$dstDir}/{$srcFile}",
file_get_contents($srcDir. $srcFile));
} catch (\Exception $e) {
return array('status' => false,
'message' => "{$countriesSrcDir}{$srcFile} cannot be found. Check your internet connection, and that this path exists",
'reload' => false);
}
$filesRetrieved ++;
$percentComplete = $filesRetrieved *100 / $totalFiles;
$data = "{$percentComplete},";
echo $data;
ob_flush();
flush();
}
}
return array('status' => true, 'message' => $msg, 'reload' => true);
}
function saveSccpDevice($get_settings, $validateonly = false) {
$hdr_prefix = 'sccp_hw_';
$hdr_arprefix = 'sccp_hw-ar_';
$hdr_vendPrefix = 'vendorconfig_';
$save_buttons = array();
$save_settings = array();
$save_codec = array();
$name_dev = '';
$db_field = array_keys($this->dbinterface->getSccpDeviceTableData("get_columns_sccpdevice"));
$hw_id = (empty($get_settings['sccp_device_id'])) ? 'new' : $get_settings['sccp_device_id'];
$hw_type = (empty($get_settings['sccp_device_typeid'])) ? 'sccpdevice' : $get_settings['sccp_device_typeid'];
$update_hw = ($hw_id == 'new') ? 'add' : 'clear'; // Clear is delete + add. Only used for buttons
$hw_prefix = 'SEP';
if (!empty($get_settings[$hdr_prefix . 'type'])) {
$value = $get_settings[$hdr_prefix . 'type'];
if (strpos($value, 'ATA') !== false) {
$hw_prefix = 'ATA';
}
if (strpos($value, 'VG') !== false) {
$hw_prefix = 'VG';
}
}
foreach ($db_field as $key) {
$value = "";
switch ($key) {
case 'name':
if (!empty($get_settings[$hdr_prefix . 'mac'])) {
$value = $get_settings[$hdr_prefix . 'mac'];
$value = strtoupper(str_replace(array('.', '-', ':'), '', $value)); // Delete mac separators from string
$value = sprintf("%012s", $value);
if ($hw_prefix == 'VG') {
$value = $hw_prefix . $value . '0';
} else {
$value = $hw_prefix . $value;
}
$name_dev = $value;
}
break;
case 'phonecodepage':
// phonecodepage depends on 2 variables - language and phone type (uses java or not).
// Non java phones use ISO8859-1 or CP1251 (Cyrillic); java phones use UTF-8. See @dkgroot.
// Below list is not definitive or necessarily accurate - needs to be maintained.
$nonJavaPhones = array(
'6901', '6911', '6921', '6945', '7902', '7905', '7910', '7911', '7912', '7914', '7915', '7916', '7920', '7925', '7926', '7931', '7935', '7936', '7937', '7940', '7960'
);
// TODO: May be other exceptions so use switch. Historically this is the only one handled
if (!empty($get_settings["{$hdr_prefix}devlang"])) {
switch ($get_settings["{$hdr_prefix}devlang"]) {
case 'Russian_Russian_Federation':
$value = (in_array($get_settings['sccp_hw_type'], $nonJavaPhones, true)) ? 'CP1251' : 'utf-8';
break;
default:
$value = (in_array($get_settings['sccp_hw_type'], $nonJavaPhones, true)) ? 'ISO8859-1' : 'utf-8';
break;
}
}
break;
default:
// handle vendor prefix
if (!empty($get_settings["${hdr_vendPrefix}${key}"])) {
$value = $get_settings["${hdr_vendPrefix}${key}"];
}
// handle array prefix
if (!empty($get_settings["${hdr_arprefix}${key}"])) {
// Only 3 types of array returned permit,deny, setvar
$arr_data = '';
$arr_clear = false;
$output = array();
foreach ($get_settings["${hdr_arprefix}${key}"] as $netValue) {
switch ($key) {
case 'permit':
case 'deny';
// Now have an array of settings each with keys net and Mask
// TODO: This needs to be optimised
//foreach ($valueArr as $netValue) {
if (isset($netValue['inherit'])) {
$save_settings['deny'] = 'NONE';
continue 2;
}
if (isset($netValue['internal'])) {
$output[] = 'internal';
continue 2;
}
if (empty($netValue['net'])) {
// empty net so ignored
continue 2;
}
$netValue['mask'] = (empty($netValue['mask'])) ? "255.255.255.0" : $netValue['mask'];
$output[]= implode('/', $netValue);
//}
break;
case 'setvar':
$output[] = implode(';', $netValue);
break;
// No default case
}
}
$save_settings[$key] = implode(';', $output);
unset($output);
}
// Now only have normal prefix
if (!empty($get_settings["{$hdr_prefix}{$key}"])) {
$value = $get_settings["{$hdr_prefix}{$key}"];
}
}
if (!empty($value)) {
$save_settings[$key] = $value;
}
}
// Save this device.
$this->dbinterface->write('sccpdevice', $save_settings, 'replace');
// Retrieve the phone buttons from $_REQUEST ($get_settings) and write back to
// update sccpdeviceconfig via Trigger
$save_buttons = $this->getPhoneButtons($get_settings, $name_dev, $hw_type);
$this->dbinterface->write('sccpbuttons', $save_buttons, $update_hw, '', $name_dev);
// Create new XML for this device, and then reset or restart the device
// so that it loads the file from TFT.
$msg = "Device Saved";
$toastFlag = 'success';
if (!$this->createSccpDeviceXML($name_dev)){
// will only be false if creating SIP SEP with no line.
$msg = "Device Saved but SEP config file not created as no SIP line attached to this device";
$toastFlag = 'warning';
};
$hash = '#sipdevice';
if ($get_settings['sccp_device_typeid'] != 'sipdevice') {
$hash = '#sccpdevice';
// cannot restart SIP device via chan-sccp.
if ($hw_id == 'new') {
$this->aminterface->sccpDeviceReset($name_dev, 'reset');
} else {
$this->aminterface->sccpDeviceReset($name_dev, 'restart');
}
}
$search = '?display=sccp_phone';
return array('status' => true, 'message' => $msg, 'reload' => true, 'toastFlag' => $toastFlag, 'search' => $search, 'hash' => $hash);
}
}
?>

View file

@ -1,153 +0,0 @@
<?php
namespace FreePBX\modules\Sccp_manager\sccpManTraits;
trait bmoFunctions {
//Need to reload freePBX for modifications below to work
/*
//want to catch extensions
public static function myConfigPageInits() {
return array("extensions");
}
*/
public function doConfigPageInit($page) {
if ($page == "extensions") {
}
$this->doGeneralPost();
}
// Try to change extensions which is part of core
/*
public static function myGuiHooks() {
return array('core');
}
*/
/*
public function doGuiHook(&$cc) {
if ($_REQUEST['display'] == "extensions" ) {
if ($_REQUEST['tech_hardware'] == 'sccp_custom') {
this is the add extensions form
On submit returns to extensions page. Users prefer that it returns
To Sccp Phone.
Below adds redirect URL, but it is not followed
$cc->setRedirectURL("config.php?display=sccp_phone");
so force redirect at end of addDevice in SccpClass
}
}
}
*/
/* unused but FPBX API requires it */
public function install() {
}
/* unused but FPBX API requires it */
public function uninstall() {
}
/* unused but FPBX API requires it */
public function backup() {
}
/* unused but FPBX API requires it */
public function restore($backup) {
}
public function getActionBar($request) {
$buttons = array();
switch ($request['display']) {
case 'sccp_adv':
if (empty($request['tech_hardware'])) {
break;
}
$buttons = array(
'submit' => array(
'name' => 'ajaxsubmit',
'id' => 'ajaxsubmit',
'value' => _("Save")
),
'Save' => array(
'name' => 'ajaxsubmit2',
'id' => 'ajaxsubmit2',
'stayonpage' => 'yes',
'value' => _("Save + Continue")
),
'cancel' => array(
'name' => 'cancel',
'id' => 'ajaxcancel',
'data-search' => '?display=sccp_adv',
'data-hash' => 'sccpdialplan',
'value' => _("Cancel")
),
);
break;
case 'sccp_phone':
if (empty($request['tech_hardware'])) {
break;
}
$buttons = array(
'submit' => array(
'name' => 'ajaxsubmit',
'id' => 'ajaxsubmit',
'value' => _("Save")
),
'Save' => array(
'name' => 'ajaxsubmit2',
'id' => 'ajaxsubmit2',
'stayonpage' => 'yes',
'value' => _("Save + Continue")
),
'cancel' => array(
'name' => 'cancel',
'id' => 'ajaxcancel',
'data-search' => '?display=sccp_phone',
'data-hash' => 'sccpdevice',
'value' => _("Cancel")
),
);
break;
case 'sccpsettings':
// TODO: Need to change to have save and save and continue
$buttons = array(
'submit' => array(
'name' => 'ajaxsubmit',
'id' => 'ajaxsubmit',
'value' => _("Save")
),
'reset' => array(
'name' => 'reset',
'id' => 'ajaxcancel',
'data-reload' => 'reload',
'value' => _("Cancel")
),
);
break;
}
return $buttons;
}
public function getRightNav($request) {
global $amp_conf;
if (isset($request['tech_hardware']) && ($request['tech_hardware'] == 'cisco')) {
return load_view($amp_conf['AMPWEBROOT'] .'/admin/modules/sccp_manager/views/hardware.rnav.php', array('request' => $request));
}
}
public function doGeneralPost() {
if (!isset($_REQUEST['Submit'])) {
return;
}
}
}
?>

View file

@ -1,523 +0,0 @@
<?php
namespace FreePBX\modules\Sccp_manager\sccpManTraits;
trait helperfunctions {
private function convertCsvToArray($stringToConvert = "") {
// Take a csv string form of net/mask or ip/port and convert to an array
// sub arrays are separated by ";"
$outputArr = array();
if (empty($stringToConvert)) {
return $outputArr;
}
foreach (explode(";", $stringToConvert) as $value) {
//internal is always the first setting if present
if ($value == 'internal') {
$outputArr[] = array('internal' => 'on');
continue;
}
// Now handle rest of value types
$subArr = explode("/", $value);
if (count($subArr) === 2) {
// Have net/mask
$outputArr[] = array('net' => $subArr[0], 'mask' => $subArr[1]);
} else {
// have ip:port
$subArr = explode(":", $value);
$outputArr[] = array('ip' => $subArr[0], 'port' => $subArr[1]);
}
}
return $outputArr;
}
private function convertArrayToCsv(array $arrayToConvert) {
// About to save to db so need to convert to string
// Take an array form of net mask or ip port and convert to a csv
// sub arrays are separated by ";"
if (empty($arrayToConvert)) {
return '';
}
$output = array();
// Internal is always element 0, nets and ips start at element 1.
if ((isset($arrayToConvert[1]['net'])) || (isset($arrayToConvert[0]['internal']))) {
// Have net masks
foreach ($arrayToConvert as $netValue) {
if (isset($netValue['internal'])) {
$output[] = 'internal';
continue;
}
if (empty($netValue['net'])) {
// If network not set, user error, has added empty row so delete
continue;
}
// If the mask has not been set, set to this subnet
$netValue['mask'] = (empty($netValue['mask'])) ? "255.255.255.0" : $netValue['mask'];
$output[] = implode('/', $netValue);
}
} else {
// Have ip addresses
foreach ($arrayToConvert as $ipArr) {
if (isset($ipArr['internal'])) {
// should not be set for an ip address
continue;
}
if (empty($ipArr['ip'])) {
// If ip not set, user error, has added empty row so delete
continue;
}
$ipArr['port'] = (empty($ipArr['port'])) ? "2000" : $ipArr['port'];
$output[] = implode(':', $ipArr);
}
}
return implode(';', $output);
}
private function getIpInformation($type = '') {
$interfaces = array();
switch ($type) {
case 'ip4':
exec("/sbin/ip -4 -o addr", $result, $ret);
break;
case 'ip6':
exec("/sbin/ip -6 -o addr", $result, $ret);
break;
default:
exec("/sbin/ip -o addr", $result, $ret);
break;
}
foreach ($result as $line) {
$vals = preg_split("/\s+/", $line);
if ($vals[3] == "mtu") {
continue;
}
if ($vals[2] != "inet" && $vals[2] != "inet6") {
continue;
}
if (preg_match("/(.+?)(?:@.+)?:$/", $vals[1], $res)) {
continue;
}
$ret = preg_match("/(\d*+.\d*+.\d*+.\d*+)[\/(\d*+)]*/", $vals[3], $ip);
$interfaces[$vals[1] . ':' . $vals[2]] = array('name' => $vals[1], 'type' => $vals[2], 'ip' => ((empty($ip[1]) ? '' : $ip[1])));
}
return $interfaces;
}
private function before($thing, $inthat) {
return substr($inthat, 0, strpos($inthat, $thing));
}
private function array_key_exists_recursive($key, $arr) {
if (array_key_exists($key, $arr)) {
return true;
}
foreach ($arr as $currentKey => $value) {
if (is_array($value)) {
return $this->array_key_exists_recursive($key, $value);
}
}
return false;
}
private function strpos_array($haystack, $needles) {
if (is_array($needles)) {
foreach ($needles as $str) {
if (is_array($str)) {
$pos = $this->strpos_array($haystack, $str);
} else {
$pos = strpos($haystack, $str);
}
if ($pos !== FALSE) {
return $pos;
}
}
} else {
return strpos($haystack, $needles);
}
return FALSE;
}
private function getTableDefaults($table, $trim_underscore = true) {
$def_val = array();
// TODO: This is ugly and overkill - needs to be cleaned up in dbinterface
if ($table == 'sccpsettings') {
// sccpsettings has a different structure and already have values in $sccpvalues
return $this->sccpvalues;
}
$sccpTableDesc = $this->dbinterface->getSccpDeviceTableData("get_columns_{$table}");
foreach ($sccpTableDesc as $key => $data) {
// function has 2 roles: return actual table keys (trim_underscore = false)
// return sanitised keys to add defaults (trim_underscore = true)
if ($trim_underscore) {
// Remove any leading (or trailing but should be none) underscore
// These are only used to hide fields from chan-sccp for compatibility
$key = trim($key,'_');
}
$def_val[$key] = array("keyword" => $key, "data" => $data['Default'], "seq" => "99");
}
return $def_val;
}
private function getTableEnums($table, $trim_underscore = true) {
$enumFields = array();
$sccpTableDesc = $this->dbinterface->getSccpDeviceTableData("get_columns_{$table}");
foreach ($sccpTableDesc as $key => $data) {
// function has 2 roles: return actual table keys (trim_underscore = false)
// return sanitised keys to add defaults (trim_underscore = true)
if ($trim_underscore) {
// Remove any leading (or trailing but should be none) underscore
// These are only used to hide fields from chan-sccp for compatibility
$key = trim($key,'_');
}
$typeArray = explode('(', $data['Type']);
if ($typeArray[0] == 'enum') {
$enumOptions = explode(',', trim($typeArray[1],')'));
$enumFields[$key] = $enumOptions;
}
}
return $enumFields;
}
private function findAllFiles($searchDir, $file_mask = array(), $mode = 'full') {
$result = array();
if (!is_dir($searchDir)) {
return $result;
}
foreach (array_diff(scandir($searchDir),array('.', '..')) as $value) {
if (is_file("$searchDir/$value")) {
$extFound = '';
$foundFile = true;
if (!empty($file_mask)) {
$foundFile = false;
foreach ($file_mask as $k) {
if (strpos($value, $k) !== false) {
$foundFile = true;
$extFound = $k;
break;
}
}
}
if ($foundFile) {
switch ($mode) {
case 'fileonly':
$result[] = $value;
break;
case 'fileBaseName':
$result[] = basename("/$value", $extFound);
break;
case 'dirFileBaseName':
$result[] = $searchDir . "/" . basename("/$value", $extFound);
break;
default:
$result[] = "$searchDir/$value";
break;
}
}
continue;
}
// Now iterate over sub directories
$sub_find = $this->findAllFiles("$searchDir/$value", $file_mask, $mode);
if (!empty($sub_find)) {
foreach ($sub_find as $sub_value) {
$result[] = $sub_value;
}
}
}
return $result;
}
function is_assoc($array) {
foreach (array_keys($array) as $k => $v) {
if ($k !== $v)
return true;
}
return false;
}
function tftpReadTestFile($remoteFileName, $host = "127.0.0.1")
{
// https://datatracker.ietf.org/doc/html/rfc1350
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
// Set timeout so that do not hang if no data received.
socket_set_option($socket,SOL_SOCKET, SO_RCVTIMEO, array('sec'=>1, 'usec'=>0));
if ($socket) {
$port = 69; // Initial TFTP port. Changed in received packet.
// create the RRQ request packet
$packet = chr(0) . chr(1) . $remoteFileName . chr(0) . 'netascii' . chr(0);
// UDP is connectionless, so we just send it.
socket_sendto($socket, $packet, strlen($packet), MSG_EOR, $host, $port);
$buffer = null;
$port = "";
$ret = "";
// MSG_WAITALL is blocking but socket has timeout set to 1 sec.
$numbytes = socket_recvfrom($socket, $buffer, 84, MSG_WAITALL, $host, $port);
if ($numbytes < 2) {
// socket has timed out before data received.
return false;
}
// unpack the returned buffer and discard the first two bytes.
$pkt = unpack("nopcode/nblockno/a*data", $buffer);
// send ack and close socket.
$packet = chr(4) . chr($pkt["blockno"]);
socket_sendto($socket, $packet, strlen($packet), MSG_EOR, $host, $port);
socket_close($socket);
if ($pkt["opcode"] == 3 && $numbytes) {
return $pkt["data"];
}
}
return false;
}
public function initialiseConfInit(){
$read_config = \FreePBX::LoadConfig()->getConfig('sccp.conf');
$sccp_conf_init['general'] = $read_config['general'];
foreach ($read_config as $key => $value) {
if (isset($read_config[$key]['type'])) { // copy soft key
if ($read_config[$key]['type'] == 'softkeyset') {
$sccp_conf_init[$key] = $read_config[$key];
}
}
}
return $sccp_conf_init;
}
public function checkTftpMapping(){
exec('in.tftpd -V', $tftpInfo);
$info['TFTP Server'] = array('Version' => 'Not Found', 'about' => 'Mapping not available');
if (isset($tftpInfo[0])) {
$tftpInfo = explode(',',$tftpInfo[0]);
$info['TFTP Server'] = array('Version' => $tftpInfo[0], 'about' => 'Mapping not available');
$tftpInfo[1] = trim($tftpInfo[1]);
$this->sccpvalues['tftp_rewrite']['data'] = 'off';
if ($tftpInfo[1] == 'with remap') {
$info['TFTP Server'] = array('Version' => $tftpInfo[0], 'about' => $tftpInfo[1]);
$remoteFileName = ".sccp_manager_remap_probe_sentinel_temp".mt_rand(0, 9999999).".tlzz";
$remoteFileContent = "# This is a test file created by Sccp_Manager. It can be deleted without impact";
$testFtpDir = "{$this->sccpvalues['tftp_path']['data']}/settings";
// write a sentinel to a tftp subdirectory to see if mapping is working
if (is_dir($testFtpDir) && is_writable($testFtpDir)) {
$tempFile = "${testFtpDir}/{$remoteFileName}";
file_put_contents($tempFile, $remoteFileContent);
// try to pull the written file through tftp.
// this way we can determine if mapping is active and using sccp_manager maps
if ($remoteFileContent == $this->tftpReadTestFile($remoteFileName)) {
//found the file and contents are correct
$this->sccpvalues['tftp_rewrite']['data'] = 'pro';
} else {
// Did not find sentinel so mapping not available
$this->sccpvalues['tftp_rewrite']['data'] = 'off';
}
unlink($tempFile);
}
return true;
}
}
return false;
}
// helper function to save xml with proper indentation
public function saveXml($xml, $filename) {
$dom = new \DOMDocument("1.0");
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->loadXML($xml->asXML());
$dom->save($filename);
}
public function getFileListFromProvisioner(string $tftpRootPath) {
$provisionerUrl = "https://github.com/dkgroot/provision_sccp/raw/master/";
// Get master tftpboot directory structure
try {
file_put_contents("{$tftpRootPath}/masterFilesStructure.xml",file_get_contents("{$provisionerUrl}tools/tftpbootFiles.xml"));
} catch (\Exception $e) {
return false;
}
return true;
}
public function getChanSccpSettings() {
// This is a utility function for debug only, and is not used by core code
foreach (array('general','line', 'device') as $section) {
$sysConfig = $this->aminterface->getSCCPConfigMetaData($section);
dbug($sysConfig);
}
unset($sysConfig);
}
public function createDefaultSccpConfig(array $sccpvalues, string $asteriskPath, $conf_init) {
global $cnf_wr;
// Make sccp.conf data
// [general] section
// TODO: Need to review sccpsettings seq numbering, as will speed this up, and remove the need for $permittedSettings.
$cnf_wr = \FreePBX::WriteConfig();
//clear old general settings, and initiate with allow/disallow and permit/deny keys in correct order
$conf_init['general'] = array();
$conf_init['general']['disallow'] = 'all';
$conf_init['general']['allow'] = '';
$conf_init['general']['deny'] = '0.0.0.0/0.0.0.0';
$conf_init['general']['permit'] = '0.0.0.0/0.0.0.0';
// permitted chan-sccp settings array
$permittedSettings = array(
'debug', 'servername', 'keepalive', 'context', 'dateformat', 'bindaddr', 'port', 'secbindaddr', 'secport', 'disallow', 'allow', 'deny', 'permit',
'localnet', 'externip', 'externrefresh', 'firstdigittimeout', 'digittimeout', 'digittimeoutchar', 'recorddigittimeoutchar', 'simulate_enbloc',
'ringtype', 'autoanswer_ring_time', 'autoanswer_tone', 'remotehangup_tone', 'transfer', 'transfer_tone', 'transfer_on_hangup', 'dnd_tone',
'callwaiting_tone', 'callwaiting_interval', 'musicclass', 'language', 'callevents', 'accountcode', 'sccp_tos', 'sccp_cos', 'audio_tos',
'audio_cos', 'video_tos', 'video_cos', 'echocancel', 'silencesuppression', 'earlyrtp', 'dndFeature', 'private', 'mwilamp', 'mwioncall',
'cfwdall', 'cfwdbusy', 'cfwdnoanswer', 'cfwdnoanswer_timeout', 'nat', 'directrtp', 'allowoverlap', 'pickup_modeanswer',
'callhistory_answered_elsewhere', 'amaflags', 'callanswerorder', 'devicetable', 'linetable', 'meetmeopts', 'jbenable', 'jbforce',
'jblog', 'jbmaxsize', 'jbresyncthreshold', 'jbimpl', 'hotline_enabled', 'hotline_extension', 'hotline_context', 'hotline_label', 'fallback',
'backoff_time', 'server_priority');
foreach ($sccpvalues as $key => $value) {
if (!in_array($key, $permittedSettings, true)) {
continue;
}
if ($value['seq'] == 0) {
switch ($key) {
case "allow":
case "disallow":
case "deny":
case "localnet":
case "permit":
$conf_init['general'][$key] = explode(';', $value['data']);
break;
case "devlang":
/*
$lang_data = $this->extconfigs->getExtConfig('sccp_lang', $value['data']);
if (!empty($lang_data)) {
// TODO: will always get here, but lang_data['codepage'] will be empty as not a valid key
$this->sccp_conf_init['general']['phonecodepage'] = $lang_data['codepage'];
}
break;
*/
case "netlang": // Remove Key
case "tftp_path":
case "sccp_compatible": // This is equal to SccpDBmodel
break;
default:
if (!empty($value['data'])) {
$conf_init['general'][$key] = $value['data'];
}
}
}
}
//
// ----- It is a very bad idea to add an external configuration file "sccp_custom.conf" !!!!
// This will complicate solving problems caused by unexpected solutions from users.
//
if (file_exists($asteriskPath . "/sccp_custom.conf")) {
$conf_init['HEADER'] = array(
"; ;",
"; It is a very bad idea to add an external configuration file !!!! ;",
"; This will complicate solving problems caused by unexpected solutions ;",
"; from users. ;",
";--------------------------------------------------------------------------------;",
"#include sccp_custom.conf"
);
}
$cnf_wr->WriteConfig('sccp.conf', $conf_init);
}
public function initVarfromXml() {
if ((array) $this->xml_data) {
foreach ($this->xml_data->xpath('//page_group') as $item) {
foreach ($item->children() as $child) {
$seq = 0;
if (!empty($child['seq'])) {
$seq = (string) $child['seq'];
}
if ($seq < 99) {
if ($child['type'] == 'IE') {
foreach ($child->xpath('input') as $value) {
$tp = 0;
if (empty($value->value)) {
$datav = (string) $value->default;
} else {
$datav = (string) $value->value;
}
if (strtolower($value->type) == 'number') {
$tp = 1;
}
if (empty($this->sccpvalues[(string) $value->name])) {
$this->sccpvalues[(string) $value->name] = array('keyword' => (string) $value->name, 'data' => $datav, 'type' => $tp, 'seq' => $seq, 'systemdefault' => '');
}
}
}
if ($child['type'] == 'IS' || $child['type'] == 'IED') {
if (empty($child->value)) {
$datav = (string) $child->default;
} else {
$datav = (string) $child->value;
}
if (empty($this->sccpvalues[(string) $child->name])) {
$this->sccpvalues[(string) $child->name] = array('keyword' => (string) $child->name, 'data' => $datav, 'type' => '2', 'seq' => $seq, 'systemdefault' => '');
}
}
if (in_array($child['type'], array('SLD', 'SLS', 'SLT', 'SLNA', 'SLDA', 'SL', 'SLM', 'SLZ', 'SLTZN', 'SLA'))) {
if (empty($child->value)) {
$datav = (string) $child->default;
} else {
$datav = (string) $child->value;
}
if (empty($this->sccpvalues[(string) $child->name])) {
$this->sccpvalues[(string) $child->name] = array('keyword' => (string) $child->name, 'data' => $datav, 'type' => '2', 'seq' => $seq, 'systemdefault' => '');
}
}
}
}
}
}
}
public function getSipConfig() {
// Only called from sccp_manager class when saving SIP device
$result = array();
$tmp_binds = \FreePBX::Sipsettings()->getBinds();
$if_list = $this->getIpInformation('ip4');
if (!is_array($tmp_binds)) {
// FreePBX has no sip bindings.
die_freepbx(_("SIP server configuration error ! No SIP protocols enabled"));
}
foreach ($tmp_binds as $fpbx_protocol => $fpbx_bind) {
foreach ($fpbx_bind as $protocol_ip => $protocol_port_arr) {
if (empty($protocol_port_arr)) {
continue;
}
if (($protocol_ip == '0.0.0.0') || ($protocol_ip == '[::]')) {
foreach ($if_list as $if_type => $if_data) {
if ($if_data['ip'] == "127.0.0.1") {
continue;
}
if (empty($result[$fpbx_protocol][$if_data['ip']])) {
$result[$fpbx_protocol][$if_data['ip']]= $protocol_port_arr;
} else {
$result[$fpbx_protocol][$if_data['ip']]= array_merge($result[$fpbx_protocol][$if_data['ip']],$protocol_port_arr);
}
$result[$fpbx_protocol][$if_data['ip']]['ip']=$if_data['ip'];
}
} else {
$result[$fpbx_protocol][$protocol_ip]=$protocol_port_arr;
$result[$fpbx_protocol][$protocol_ip]['ip']=$protocol_ip;
}
}
}
if (empty($result)) {
die_freepbx(_("SIP server configuration error ! No SIP protocols enabled"));
}
return $result;
}
}
?>

View file

@ -1,21 +0,0 @@
{
"rawname": "sccp_manager",
"repo": "stable",
"name": "Sccp Manager",
"version": "14.5.0.4",
"publisher": "Steve Lad",
"license": "GPL",
"licenselink": "http://www.gnu.org/licenses/gpl.txt",
"changelog": "*14.5.0.4* Preserve softkeys across installs. Fix truncated values\n*14.5.0.3* Fix issue 32\n*14.4.0.5* Fix issue 59\n*14.4.0.1* Fix regression in SQL not compatible with MariaDb 5\n*14.4.0.1* Upgrade installer to prevent data loss when run\n*14.3.0.30* Fix issue returning after save\n*14.3.0.28* Fix issue with RNav\n*14.3.0.27* Improve handling of SIP devices\n*14.3.0.15* Install master files list via installer\n*14.2.0.3* Fix module database definition\n*14.2.0.3* Fix module database definition\n*14.2.0.2* First release of new version without old interface\n*13.0.0.1* Packaging of ver 1.0.0.1\n*12.0.0.1* Packaging of ver 1.0.0.1",
"category": "Sccp Connectivity",
"description": "The Sccp Manager module lets you manage the chan-sccp driver.",
"depends": {
"version": "16.0"
},
"supported": {
"version": "15.0"
},
"location": "https://github.com/chan-sccp/sccp_manager/archive/refs/tags/v14.5.0.4.tar.gz",
"md5sum": "80b454d5cfdd602bffeec350e6e76bac",
"packaged": "1643364518"
}

View file

@ -1,81 +1,42 @@
<?php <?php
/* $Id:$ */ /* $Id:$ */
if (!defined('FREEPBX_IS_AUTH')) { /* !TODO!: In an ideal world this should roll back everything the install.php script did, except for what existed before install.php was run */
die('No direct script access allowed'); /* !TODO!: This would require the install.php to make a note of all the actions that were skipped and/or performed */
} /* !TODO!: Might be a good idea to create a backup of the database before removing anything */
// !TODO!: -TODO-: I remove only that which is related to the Manager, it is in my opinion not a critical configuration information. This information is partially present in other files.
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');
global $sqlTables;
$sqlTables = array('sccpbuttonconfig','sccpdevice','sccpline','sccpuser','sccpsettings','sccpdevmodel');
createBackUpConfig();
function createBackUpConfig()
{
global $amp_conf;
global $sqlTables;
outn("<li>" . _("Creating Config BackUp") . "</li>");
$cnf_int = \FreePBX::Config();
$backup_files = array('extensions','extconfig','res_mysql', 'res_config_mysql','sccp','sccp_hardware','sccp_extensions');
$backup_ext = array('_custom.conf', '_additional.conf','.conf');
$dir = $cnf_int->get('ASTETCDIR');
$sqlTables = array('sccpbuttonconfig','sccpdevice','sccpline','sccpuser','sccpsettings','sccpdevmodel');
$sqlTablesString = implode(' ',$sqlTables);
$sqlBuFile = $dir.'/sccp_backup_'.date("Ymd").'.sql';
$result = exec("mysqldump {$amp_conf['AMPDBNAME']} {$sqlTablesString}
--password={$amp_conf['AMPDBPASS']}
--user={$amp_conf['AMPDBUSER']}
--single-transaction >{$sqlBuFile}");
try {
$zip = new \ZipArchive();
} catch (\Exception $e) {
outn("<br>");
outn("<font color='red'>PHPx.x-zip not installed where x.x is the installed PHP version. Install it before continuing !</font>");
die_freepbx();
}
$filename = $dir . "/sccp_uninstall_backup" . date("Ymd"). ".zip";
if ($zip->open($filename, \ZIPARCHIVE::CREATE)) {
foreach ($backup_files as $file) {
foreach ($backup_ext as $b_ext) {
if (file_exists($dir . '/'.$file . $b_ext)) {
$zip->addFile($dir . '/'.$file . $b_ext);
}
}
}
if (file_exists($sqlBuFile)) {
$zip->addFile($sqlBuFile);
}
$zip->close();
} else {
outn("<li>" . _("Error Creating BackUp: ") . $filename ."</li>");
outn("<br>");
outn("<font color='red'>PHPx.x-zip not installed where x.x is the installed PHP version. Install it before continuing !</font>");
die_freepbx();
}
unlink($sqlBuFile);
outn("<li>" . _("Config backup created: ") . $filename ."</li>");
}
echo "dropping table sccpdevmodel..";
sql("DROP TABLE IF EXISTS `sccpdevmodel`");
echo "dropping table sccpsettings..";
sql("DROP TABLE IF EXISTS `sccpsettings`");
if (!empty($version)) { if (!empty($version)) {
// Woo, we have a version
$check = $db->getRow("SELECT 1 FROM `kvstore` LIMIT 0", DB_FETCHMODE_ASSOC); $check = $db->getRow("SELECT 1 FROM `kvstore` LIMIT 0", DB_FETCHMODE_ASSOC);
if (!(DB::IsError($check))) { if (!(DB::IsError($check))) {
outn("<li>" . _("Deleting keys FROM kvstore..") . "</li>"); //print_r("none, creating table :". $value);
echo "Deleting key FROM kvstore..";
sql("DELETE FROM kvstore WHERE module = 'sccpsettings'"); sql("DELETE FROM kvstore WHERE module = 'sccpsettings'");
sql("DELETE FROM kvstore WHERE module = 'Sccp_manager'"); sql("DELETE FROM kvstore WHERE module = 'Sccp_manager'");
} }
}
// FreePbx removes all tables via module.xml, and uninstaller will error
// If the tables do not exist.
//outn("<li>" . _('Removing all Sccp_manager tables') . "</li>");
//foreach ($sqlTables as $table) {
//$sql = "DROP TABLE IF EXISTS {$table}";
//}
// Still need to handle views as FreePBX does not know about these.
outn("<li>" . _('Removing all Sccp_manager views') . "</li>");
$db->query("DROP VIEW IF EXISTS sccpdeviceconfig");
outn("<li>" . _("Uninstall Complete") . "</li>"); /* Comment: Maybe save in sccpsettings, if the chan_sccp tables already existed in the database or if they were created by install.php */
/* So that you know if it is save to drop/delete them */
/* DROP VIEW `sccpdeviceconfig`;
DROP TABLE `buttonconfig`;
DROP TABLE `sccpdevice`;
DROP TABLE `sccpdevmodel`;
DROP TABLE `sccpline`;
DROP TABLE `sccpsettings`;
*/
}
echo "done<br>\n";
?> ?>

View file

@ -12,12 +12,12 @@
<div class="display no-border"> <div class="display no-border">
<h1><?php echo _("Cisco Dial Template") ?></h1> <h1><?php echo _("Cisco Dial Template") ?></h1>
<div id="toolbar-sccp-dialtemplate"> <div id="toolbar-sccp-dialtemplate">
<a class="btn btn-default" href="config.php?display=sccp_adv&tech_hardware=dialplan&extdisplay=*new*"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Dialplan") ?></a> <a class="btn btn-default" href="config.php?display=sccp_adv&amp;tech_hardware=dialplan&amp;extdisplay=*new*"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Dialplan") ?></a>
<button id="remove-sccp-dialtemplate" class="btn btn-danger btn-remove" data-type="dialtemplate" data-section="sccp-dialtemplate" disabled> <button id="remove-sccp-dialtemplate" class="btn btn-danger btn-remove" data-type="dialtemplate" data-section="sccp-dialtemplate" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span> <i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button> </button>
</div> </div>
<table data-cookie="true" data-cookie-id-table="sccp-dialtemplate-table" data-url="ajax.php?module=sccp_manager&command=getDialTemplate" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-dialtemplate" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-dialtemplate" data-id="id"> <table data-cookie="true" data-cookie-id-table="sccp-dialtemplate-table" data-url="ajax.php?module=sccp_manager&amp;command=getDialTemplate" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-dialtemplate" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-dialtemplate" data-id="id">
<thead> <thead>
<tr> <tr>
<!-- <th data-checkbox="true"></th> --> <!-- <th data-checkbox="true"></th> -->
@ -34,9 +34,7 @@
function DispayDPActionsKeyFormatter(value, row, index) { function DispayDPActionsKeyFormatter(value, row, index) {
var exp_model = ''; var exp_model = '';
exp_model += '<a href="?display=sccp_adv&tech_hardware=dialplan&extdisplay=' + row['id'] + '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n'; exp_model += '<a href="?display=sccp_adv&tech_hardware=dialplan&extdisplay=' + row['id'] + '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
if (row['id'] !== 'dialplan') {
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="dialplan" data-id="' + row['id'] + '"><i class="fa fa-trash"></i></a>'; exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="dialplan" data-id="' + row['id'] + '"><i class="fa fa-trash"></i></a>';
}
return exp_model; return exp_model;
} }
</script> </script>

View file

@ -8,7 +8,7 @@
$keymultiselect = array('AllRight' =>'>>', 'Right' => '>', 'AllLeft' => '<<', 'Left' => '<'); $keymultiselect = array('AllRight' =>'>>', 'Right' => '>', 'AllLeft' => '<<', 'Left' => '<');
// ------------------------------------- Key Set Value --------------------------------------------------------- // ------------------------------------- Key Set Value ---------------------------------------------------------
$keysetarray = $this->extconfigs->getExtConfig('keyset'); $keysetarray = $this->extconfigs->getextConfig('keyset');
/*$keysetarray1 = array('onhook' => array('redial','newcall','cfwdall','dnd','pickup','gpickup','private'), /*$keysetarray1 = array('onhook' => array('redial','newcall','cfwdall','dnd','pickup','gpickup','private'),
'connected' => array('hold','endcall','park','vidmode','select','cfwdall','cfwdbusy','idivert'), 'connected' => array('hold','endcall','park','vidmode','select','cfwdall','cfwdbusy','idivert'),
@ -26,26 +26,27 @@ $keysetarray = $this->extconfigs->getExtConfig('keyset');
'uriaction' => array('default')); 'uriaction' => array('default'));
*/ */
// ------------------------------------- Key Set Display information --------------------------------------------------------- // ------------------------------------- Key Set Display information ---------------------------------------------------------
$keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Display Onhook', 'help' =>'help.'), $keynamearray = array('onhook' => array(sname => 'ONHOOK', name =>'Display Onhook',help =>'help.'),
'connected' => array('sname' => 'CONNECTED', 'name' =>'Display Connected', 'help' =>'help.'), 'connected' => array(sname => 'CONNECTED', name =>'Display Connected',help =>'help.'),
'onhold' => array('sname' => 'ONHOLD', 'name' =>'Display onhold', 'help' =>'help.'), 'onhold' => array(sname => 'ONHOLD', name =>'Display onhold',help =>'help.'),
'ringin' => array('sname' => 'RINGIN', 'name' =>'Display ringin', 'help' =>'help.'), 'ringin' => array(sname => 'RINGIN', name =>'Display ringin',help =>'help.'),
'offhook' => array('sname' => 'OFFHOOK', 'name' =>'Display offhook', 'help' =>'help.'), 'offhook' => array(sname => 'OFFHOOK', name =>'Display offhook',help =>'help.'),
'conntrans' => array('sname' => 'CONNTRANS', 'name' =>'Display conntrans', 'help' =>'help.'), 'conntrans' => array(sname => 'CONNTRANS', name =>'Display conntrans',help =>'help.'),
'digitsfoll' => array('sname' => 'DIGITSFOLL', 'name' =>'Display digitsfoll', 'help' =>'help.'), 'digitsfoll' => array(sname => 'DIGITSFOLL', name =>'Display digitsfoll',help =>'help.'),
'connconf' => array('sname' => 'CONNCONF', 'name' =>'Display connconf', 'help' =>'help.'), 'connconf' => array(sname => 'CONNCONF', name =>'Display connconf',help =>'help.'),
'ringout' => array('sname' => 'RINGOUT', 'name' =>'Display ringout', 'help' =>'help.'), 'ringout' => array(sname => 'RINGOUT', name =>'Display ringout',help =>'help.'),
'offhookfeat'=> array('sname' => 'OFFHOOKFEAT', 'name' =>'Display offhookfeat', 'help' =>'help.'), 'offhookfeat'=> array(sname => 'OFFHOOKFEAT', name =>'Display offhookfeat',help =>'help.'),
'onhint' => array('sname' => 'ONHINT', 'name' =>'Display onhint', 'help' =>'help.'), 'onhint' => array(sname => 'ONHINT', name =>'Display onhint',help =>'help.'),
'onstealable'=> array('sname' => 'onstealable', 'name' =>'Display onstealable', 'help' =>'help.'), 'onstealable'=> array(sname => 'onstealable', name =>'Display onstealable',help =>'help.'),
'holdconf' => array('sname' => 'HOLDCONF', 'name' =>'Display holdconf', 'help' =>'help.'), 'holdconf' => array(sname => 'HOLDCONF', name =>'Display holdconf',help =>'help.'),
'uriaction' => array('sname' => '', 'name' =>'Display uriaction', 'help' =>'help.') 'uriaction' => array(sname => '', name =>'Display uriaction',help =>'help.')
); );
?> ?>
<form autocomplete="off" name="frm_keyset" id="frm_keyset" class="fpbx-submit" action="" method="post"> <form autocomplete="off" name="frm_keyset" id="frm_keyset" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="keysetform"> <input type="hidden" name="category" value="keysetform">
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">
<div class="fpbx-container container-fluid"> <div class="fpbx-container container-fluid">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
@ -53,14 +54,15 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<div id="toolbar-all"> <div id="toolbar-all">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".edit_new_keyset"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".edit_new_keyset"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button>
</div> </div>
<table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-url="ajax.php?module=sccp_manager&command=getSoftKey&type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="softkey-all" data-unique-id="softkeys"> <table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-url="ajax.php?module=sccp_manager&amp;command=getSoftKey&amp;type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="softkey-all" data-unique-id="softkeys">
<thead> <thead>
<tr> <tr>
<!-- <th data-checkbox="true"></th> -->
<th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th> <th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th>
<?php <?php
$i = 0; $i = 0;
foreach ($keynamearray as $key => $value) { foreach ($keynamearray as $key => $value) {
if ($i < 12) { if ($i < 9 ){
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>'; echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
} }
$i ++; $i ++;
@ -88,27 +90,18 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<h4 class="modal-title" id="gridSystemModalLabel">Add New KeySet</h4> <h4 class="modal-title" id="gridSystemModalLabel">Add New KeySet</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<style type="text/css">
input:invalid {border: red solid 3px;} <div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
</style>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="new_keysetname">Name Keyset</label> <label class="control-label" for="new_keysetname">Name Keyset</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_devmodel"></i> <i class="fa fa-question-circle fpbx-help-icon" data-for="new_devmodel"></i>
</div> </div><div class="col-md-9">
<div class="col-md-9"> <input type="text" maxlength="15" class="form-control" id="new_keySetname" name="new_keySetname" value="SoftKeyset">
<input type="text" maxlength="15" pattern="[a-zA-Z0-9]{4,15}" class="form-control" id="new_keySetname" name="new_keySetname" value="SoftKeyset"> </div> </div></div>
</div> <div class="row"><div class="col-md-12">
</div> <span id="new_devmodel-help" class="help-block fpbx-help-block">Help. max len = 15</span>
</div> </div></div></div>
<div class="row">
<div class="col-md-12">
<span id="new_devmodel-help" class="help-block fpbx-help-block">Max length 15 letters or numbers without spaces</span>
</div>
</div>
</div>
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<?php <?php
@ -122,6 +115,7 @@ foreach ($keysetarray as $key => $value) {
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>
@ -164,6 +158,8 @@ foreach ($keysetarray as $key => $value) {
</div> </div>
</div> </div>
<script> <script>
function DispayActionsKeyFormatter(value, row, index) { function DispayActionsKeyFormatter(value, row, index) {
var exp_model = ''; var exp_model = '';

View file

@ -4,8 +4,7 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
$requestType = 'firmware';
global $amp_conf;
?> ?>
<div class="fpbx-container container-fluid"> <div class="fpbx-container container-fluid">
@ -14,13 +13,12 @@ global $amp_conf;
<div class="display no-border"> <div class="display no-border">
<div id="toolbar-model"> <div id="toolbar-model">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target=".add_new_model"><i class="fa fa-bolt"></i> <?php echo _("Add model"); ?> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target=".add_new_model"><i class="fa fa-bolt"></i> <?php echo _("Add model"); ?></button>
</button>
<button data-id="model_disabled" class="btn btn-danger sccp_update btn-tab-select" data-type="sccp_model" data-table="table-models" disabled data-section="all"> <button data-id="model_disabled" class="btn btn-danger sccp_update btn-tab-select" data-type="sccp_model" data-table="table-models" disabled data-section="all">
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Disable') ?></span> <i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Disabled') ?></span>
</button> </button>
<button data-id="model_enabled" class="btn btn-danger sccp_update btn-tab-select" data-table="table-models" data-type="sccp_model" disabled data-section="all"> <button data-id="model_enabled" class="btn btn-danger sccp_update btn-tab-select" data-table="table-models" data-type="sccp_model" disabled data-section="all">
<i class="glyphicon glyphicon-active"></i> <span><?php echo _('Enable') ?></span> <i class="glyphicon glyphicon-active"></i> <span><?php echo _('Enabled') ?></span>
</button> </button>
<div class="btn-group"> <div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
@ -33,10 +31,8 @@ global $amp_conf;
<li><a class="dropitem" data-id="all" tabindex="-1" href="#"><span><?php echo _('Show All') ?></span></a></li> <li><a class="dropitem" data-id="all" tabindex="-1" href="#"><span><?php echo _('Show All') ?></span></a></li>
</ul> </ul>
</div> </div>
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target=".get_ext_file_<?php echo $requestType; ?>"><i class="fa fa-bolt"></i> <?php echo _("Update Files from Provisioner"); ?>
</button>
</div> </div>
<table data-cookie="true" data-row-style="SetRowColor" data-cookie-id-table="sccp_model-all" data-url="ajax.php?module=sccp_manager&command=getDeviceModel&type=enabled" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-model" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-condensed" id="table-models" data-id="model" data-unique-id="model"> <table data-cookie="true" data-row-style="SetRowColor" data-cookie-id-table="sccp_model-all" data-url="ajax.php?module=sccp_manager&amp;command=getDeviceModel&amp;type=enabled" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-model" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-condensed" id="table-models" data-id="model" data-unique-id="model">
<thead> <thead>
<tr> <tr>
<th data-checkbox="true"></th> <th data-checkbox="true"></th>
@ -45,9 +41,9 @@ global $amp_conf;
<th data-sortable="true" data-field="vendor"><?php echo _('Vendor');?></th> <th data-sortable="true" data-field="vendor"><?php echo _('Vendor');?></th>
<th data-sortable="false" data-formatter="DisplayDnsFormatter" data-field="dns"><?php echo _('Expansion Module');?></th> <th data-sortable="false" data-formatter="DisplayDnsFormatter" data-field="dns"><?php echo _('Expansion Module');?></th>
<th data-sortable="false" data-field="buttons"><?php echo _('Buttons');?></th> <th data-sortable="false" data-field="buttons"><?php echo _('Buttons');?></th>
<th data-sortable="false" data-formatter="SetColFirmNf" data-field="loadimage"><?php echo _('Loadimage');?></th> <th data-sortable="false" data-formatter="SetColColorFirm" data-field="loadimage"><?php echo _('Loadimage');?></th>
<th data-sortable="false" data-field="loadinformationid"><?php echo _('Loadinformation ID');?></th> <th data-sortable="false" data-field="loadinformationid"><?php echo _('Loadinformation ID');?></th>
<th data-sortable="false" data-formatter="SetColTemplNf" data-field="nametemplate"><?php echo _('Model template');?></th> <th data-sortable="false" data-formatter="SetColColorTempl" data-field="nametemplate"><?php echo _('Model template');?></th>
<th data-field="actions" data-formatter="DispayActionsModelFormatter"><?php echo _('Actions');?></th> <th data-field="actions" data-formatter="DispayActionsModelFormatter"><?php echo _('Actions');?></th>
</tr> </tr>
</thead> </thead>
@ -64,7 +60,7 @@ global $amp_conf;
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="gridSystemModalLabel"><?php echo _('Add new model');?></h4> <h4 class="modal-title" id="gridSystemModalLabel"><?php echo _('Modal title');?></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3"> <div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
@ -84,7 +80,7 @@ global $amp_conf;
<input type="text" class="form-control" id="new_vendor" name="new_vendor" value="CISCO"> <input type="text" class="form-control" id="new_vendor" name="new_vendor" value="CISCO">
</div> </div></div> </div> </div></div>
<div class="row"><div class="col-md-12"> <div class="row"><div class="col-md-12">
<span id="new_vendor-help" class="help-block fpbx-help-block">Use "CISCO" for the Skinny Client Control Protocol and "CISCO-SIP" for the CISCO Sip Protocol</span> <span id="new_vendor-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div> </div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3"> <div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
@ -92,16 +88,17 @@ global $amp_conf;
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_dns"></i> <i class="fa fa-question-circle fpbx-help-icon" data-for="new_dns"></i>
</div><div class="col-md-9"> </div><div class="col-md-9">
<select name="new_dns" id="new_dns"> <select name="new_dns" id="new_dns">
<option value="1" selected='selected'>Phone - no sidecars.</option> <option value="1">Phone - no sidecars.</option>
<option value="2">Phone - one sidecar.</option> <option value="2">Phone - one sidecar.</option>
<option value="3">Phone - two sidecars.</option> <option value="3">Phone - two sidecars.</option>
<option value="0">Sidecar</option> <option value="0" selected='selected'>Sidecar</option>
</select> </select>
</div> </div></div> </div> </div></div>
<div class="row"><div class="col-md-12"> <div class="row"><div class="col-md-12">
<span id="new_dns-help" class="help-block fpbx-help-block">Help.</span> <span id="new_dns-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div> </div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3"> <div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_buttons"><?php echo _('Model Line Buttons');?></label> <label class="control-label" for="new_buttons"><?php echo _('Model Line Buttons');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_buttons"></i> <i class="fa fa-question-circle fpbx-help-icon" data-for="new_buttons"></i>
@ -112,6 +109,7 @@ global $amp_conf;
<span id="new_buttons-help" class="help-block fpbx-help-block">Help.</span> <span id="new_buttons-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div> </div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3"> <div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_loadimage"><?php echo _('Load Image');?></label> <label class="control-label" for="new_loadimage"><?php echo _('Load Image');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_loadimage"></i> <i class="fa fa-question-circle fpbx-help-icon" data-for="new_loadimage"></i>
@ -144,34 +142,14 @@ global $amp_conf;
</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 - Disabled');?></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>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php
$selectArray = array();
//below probably unnecessary as installer should ensure that a copy always exists
// TODO: Maybe should always check here to ensure that have latest
if (!file_exists("{$this->sccppath['tftp_path']}/masterFilesStructure.xml")) {
if (!$this->getFileListFromProvisioner($this->sccppath['tftp_path'])) {
// File does not exist and cannot get from internet.
return $result;
};
}
$tftpBootXml = simplexml_load_file("{$this->sccppath['tftp_path']}/masterFilesStructure.xml");
$firmwareDir = $tftpBootXml->xpath("//Directory[@name='firmware']");
foreach ($firmwareDir[0] as $child) {
if (!empty((string)$child['name'])) {
$selectArray[(string)$child['name']] = (string)$child['name'];
}
};
include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModal.html');
?>
<div class="modal fade" id="edit_model" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"> <div class="modal fade" id="edit_model" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg" role="document"> <div class="modal-dialog modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
@ -180,6 +158,7 @@ include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModa
<h4 class="modal-title" id="gridSystemModalLabel"><?php echo _('Modal title');?></h4> <h4 class="modal-title" id="gridSystemModalLabel"><?php echo _('Modal title');?></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3"> <div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_model"><?php echo _('Device Model');?></label> <label class="control-label" for="editd_model"><?php echo _('Device Model');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_model"></i> <i class="fa fa-question-circle fpbx-help-icon" data-for="editd_model"></i>
@ -190,44 +169,10 @@ include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModa
<span id="editd_model-help" class="help-block fpbx-help-block">Help.</span> <span id="editd_model-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div> </div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_vendor"><?php echo _('Vendor name');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_vendor"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="editd_vendor" name="editd_vendor" value="CISCO">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_vendor-help" class="help-block fpbx-help-block">Use "CISCO" for the Skinny Client Control Protocol and "CISCO-SIP" for the CISCO Sip Protocol</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_dns"><?php echo _('Expansion Module');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_dns"></i>
</div><div class="col-md-9">
<select name="editd_dns" id="editd_dns">
<option value="1" selected='selected'>Phone - no sidecars.</option>
<option value="2">Phone - one sidecar.</option>
<option value="3">Phone - two sidecars.</option>
<option value="0">Sidecar</option>
</select>
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_dns-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_buttons"><?php echo _('Model Line Buttons');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_buttons"></i>
</div><div class="col-md-9">
<input type="number" min="1" min="96" class="form-control" id="editd_buttons" name="editd_buttons" value="1">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_buttons-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3"> <div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_loadimage"><?php echo _('Load Image');?></label> <label class="control-label" for="editd_loadimage"><?php echo _('Load Image');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_loadimage"></i> <i class="fa fa-question-circle fpbx-help-icon" data-for="edit_devimage"></i>
</div><div class="col-md-9"> </div><div class="col-md-9">
<input type="text" class="form-control" id="editd_loadimage" name="editd_loadimage" value=""> <input type="text" class="form-control" id="editd_loadimage" name="editd_loadimage" value="">
</div> </div></div> </div> </div></div>
@ -235,16 +180,6 @@ include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModa
<span id="editd_loadimage-help" class="help-block fpbx-help-block">Help.</span> <span id="editd_loadimage-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div> </div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_loadinformationid"><?php echo _('Load Information ID');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_loadinformationid"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="editd_loadinformationid" name="editd_loadinformationid" value="">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_loadinformationid-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3"> <div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_nametemplate"><?php echo _('Model template XML');?></label> <label class="control-label" for="editd_nametemplate"><?php echo _('Model template XML');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_nametemplate"></i> <i class="fa fa-question-circle fpbx-help-icon" data-for="editd_nametemplate"></i>
@ -254,6 +189,8 @@ include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModa
<div class="row"><div class="col-md-12"> <div class="row"><div class="col-md-12">
<span id="editd_nametemplate-help" class="help-block fpbx-help-block">Help.</span> <span id="editd_nametemplate-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div> </div></div></div>
</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>
@ -286,17 +223,18 @@ include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModa
return exp_model; return exp_model;
} }
function SetColFirmNf(value, row, index) { function SetColColorFirm(value, row, index) {
if (row['validate'].split(';')[0] === 'no') { if (row['validate'].split(';')[0] === 'no') {
return "File not found<br />" + value; return 'No found '+ value;
} }
return value; return value;
} }
function SetColTemplNf(value, row, index) { function SetColColorTempl(value, row, index) {
if (row['validate'].split(';')[1] === 'no') { if (row['validate'].split(';')[1] === 'no') {
return "File not found<br /> " + value ; return 'No found ' + value ;
} }
return value; return value;
} }
function SetRowColor(row, index) { function SetRowColor(row, index) {
@ -321,10 +259,6 @@ include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModa
document.getElementById("editd_model").value = clr; document.getElementById("editd_model").value = clr;
document.getElementById("editd_loadimage").value = drow['loadimage']; document.getElementById("editd_loadimage").value = drow['loadimage'];
document.getElementById("editd_nametemplate").value = drow['nametemplate']; document.getElementById("editd_nametemplate").value = drow['nametemplate'];
document.getElementById("editd_loadinformationid").value = drow['loadinformationid'];
document.getElementById("editd_dns").value = drow['dns'];
document.getElementById("editd_vendor").value = drow['vendor'];
document.getElementById("editd_buttons").value = drow['buttons'];
} }
} }
</script> </script>

View file

@ -4,147 +4,77 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
$def_val = array(); $def_val = null;
$dev_id = null; $dev_id = null;
$device_warning= null; $dev_new = null;
// Default value from Server setings // Default value from Server setings
//Get default values. Will use these for a new device, and modify for an existing.
$def_val = $this->getTableDefaults('sccpdevice');
$def_val['netlang'] = array("keyword" => 'netlang', "data" => $this->sccpvalues['netlang']['data'], "seq" => "99"); $def_val['netlang'] = array("keyword" => 'netlang', "data" => $this->sccpvalues['netlang']['data'], "seq" => "99");
$def_val['devlang'] = array("keyword" => 'devlang', "data" => $this->sccpvalues['devlang']['data'], "seq" => "99"); $def_val['devlang'] = array("keyword" => 'devlang', "data" => $this->sccpvalues['devlang']['data'], "seq" => "99");
$def_val['directed_pickup_context'] = array("keyword" => 'directed_pickup_context', "data" => $this->sccpvalues['directed_pickup_context']['data'], "seq" => "99"); $def_val['directed_pickup_context'] = array("keyword" => 'directed_pickup_context', "data" => $this->sccpvalues['directed_pickup_context']['data'], "seq" => "99");
if (!empty($_REQUEST['new_id'])) { if (!empty($_REQUEST['new_id'])) {
// Adding device that is connected but not in database
$dev_id = $_REQUEST['new_id']; $dev_id = $_REQUEST['new_id'];
// Overwrite some specific defaults based on $_REQUEST $val = str_replace(array('SEP','ATA','VG'), '', $dev_id);
$def_val['type'] = array("keyword" => 'type', "data" => $_REQUEST['type'], "seq" => "99"); $val = implode('.',sscanf($val, '%4s%4s%4s')); // Convert to Cisco display Format
$def_val['mac'] = array("keyword" => 'mac', "data" => $val, "seq" => "99");
$val = $_REQUEST['type'];
$def_val['type'] = array("keyword" => 'type', "data" => $val, "seq" => "99");
if (!empty($_REQUEST['addon'])) { if (!empty($_REQUEST['addon'])) {
$def_val['addon'] = array("keyword" => 'type', "data" => $_REQUEST['addon'], "seq" => "99"); $def_val['addon'] = array("keyword" => 'type', "data" => $_REQUEST['addon'], "seq" => "99");
} }
} }
if (!empty($_REQUEST['id'])) { if (!empty($_REQUEST['id'])) {
// Editing an existing Device. Overwrite any defaults that are already set for this device.
$dev_id = $_REQUEST['id']; $dev_id = $_REQUEST['id'];
$dev_new = $dev_id;
$db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id)); $db_res = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
foreach ($db_res as $key => $val) { foreach ($db_res as $key => $val) {
if (!empty($val)) { if (!empty($val)) {
switch ($key) { switch ($key) {
case 'phonepersonalization': case 'name':
$def_val['phonepersonalization'] = array("keyword" => 'phonepersonalization', "data" => $val, "seq" => "99"); $key = 'mac';
$val = str_replace(array('SEP','ATA','VG'), '', $val);
$val = implode('.',sscanf($val, '%4s%4s%4s')); // Convert to Cisco display Format
break; break;
default: case '_hwlang':
// Overwrite existing defaults after checking that data is still valid after schema updates $tmpar = explode(":",$val);
// Do not strip underscores as these fields are new in the schema and so should be valid. $def_val['netlang'] = array("keyword" => 'netlang', "data" => $tmpar[0], "seq" => "99");
$enumFields = $this->getTableEnums('sccpdevice', false); $def_val['devlang'] = array("keyword" => 'devlang', "data" => $tmpar[1], "seq" => "99");
if (array_key_exists($key, $enumFields)){
// This field is (now) an enum. Check the current value is acceptable.
// Quote value as enum values are quoted.
if (in_array("'{$val}'", $enumFields[$key])) {
// The value is valid so will keep
$def_val[$key] = array('keyword' => $key, 'data' => $val, 'seq' => 99);
}
// Do not store value and let defaults apply
break; break;
// case 'permit':
// case 'deny':
// $def_val[$key . '_net'] = array("keyword" => $key, "data" => before('/', $val), "seq" => "99");
// $key = $key . '_mask';
// $val = after('/', $val);
// break;
} }
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99"); $def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
// Need to assign defaultLine as not set in the db.
$def_val['defaultLine'] = $this->dbinterface->getSccpDeviceTableData('getDefaultLine', array('id' => $dev_id))['name'];
break;
} }
} }
} }
}
if (!empty($def_val['type'])) {
$tmp_raw = $this->getSccpModelInformation('byid', true, 'all', array('model'=>$def_val['type']));
if (!empty($tmp_raw[0])) {
$tmp_raw = $tmp_raw[0];
}
if (!empty($tmp_raw['validate'])) {
$tmpar = explode(";", $tmp_raw['validate']);
if ($tmpar[0] != 'yes') {
$device_warning['Image'] = array('Device firmware not found : '.$tmp_raw['loadimage']);
}
if ($tmpar[1] != 'yes') {
$device_warning['Template'] = array('Missing device configuration template : '. $tmp_raw['nametemplate']);
}
if (!empty($device_warning)) {
?>
<div class="fpbx-container container-fluid">
<div class="row">
<div class="container">
<h2 style="border:2px solid Tomato;color:Tomato;" >Warning in the SCCP Device</h2>
<div class="table-responsive">
<pre>
<?php
foreach ($device_warning as $key => $value) {
echo '<h3>'.$key.'</h3>';
if (is_array($value)) {
echo '<li>'._(implode('</li><li>', $value)).'</li>';
} else {
echo '<li>'. _($value).'</li>';
}
}
?> ?>
</pre>
</div>
</div>
</div>
</div>
<br>
<?php }
}
} ?>
<form autocomplete="off" name="frm_adddevice" id="frm_adddevice" class="fpbx-submit" action="" method="post" data-id="hw_edit"> <form autocomplete="off" name="frm_adddevice" id="frm_adddevice" class="fpbx-submit" action="" method="post" data-id="hw_edit">
<input type="hidden" name="category" value="adddevice_form"> <input type="hidden" name="category" value="adddevice_form">
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">
<?php <?php
if (empty($dev_id)) {
echo '<input type="hidden" name="sccp_deviceid" value="new">';
} else {
$val = str_replace(array('SEP','ATA','VG'), '', $dev_id);
$val = implode(':', sscanf($val, '%2s%2s%2s%2s%2s%2s')); // Convert to Cisco display Format
$def_val['mac'] = array("keyword" => 'mac', "data" => $val, "seq" => "99");
echo '<input type="hidden" name="sccp_device_id" value="'.$dev_id.'">';
}
if ($_REQUEST['tech_hardware'] == 'cisco') {
echo '<input type="hidden" name="sccp_device_typeid" value="sccpdevice">';
if (empty($dev_id)) {
echo $this->showGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val);
} else {
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_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_pickup', 1, 'sccp_hw', $def_val); This are line properties and does not exist!
echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'vendorconfig', $def_val);
echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
} else if ($_REQUEST['tech_hardware'] == 'cisco-sip') {
echo '<input type="hidden" name="sccp_device_typeid" value="sipdevice">';
/*
if (empty($dev_new)){ if (empty($dev_new)){
echo '<input type="hidden" name="sccp_deviceid" value="new">'; echo '<input type="hidden" name="sccp_deviceid" value="new">';
} else { } else {
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_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_sip_dev2', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_sip_conf', 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_softkey', 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_network', 1, 'sccp_hw', $def_val);
?> ?>
</form> </form>

View file

@ -1,34 +0,0 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$def_val = null;
$dev_id = null;
$dev_new = null;
if (!empty($_REQUEST['ru_id'])) {
$dev_id = $_REQUEST['ru_id'];
$def_val['id'] = array("keyword" => 'id', "data" => $dev_id, "seq" => "99");
$db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpuser', array("id" => $dev_id));
if (!empty($db_res)) {
foreach ($db_res as $key => $val) {
if (!empty($val)) {
$def_val[$key] = array("keyword" => $key, "data" => $val, "seq" => "99");
}
}
}
}
?>
<form autocomplete="off" name="frm_addruser" id="frm_addruser" class="fpbx-submit" action="" method="post" data-id="ruser_edit">
<input type="hidden" name="category" value="addruser_form">
<input type="hidden" name="Submit" value="Submit">
<?php
echo $this->showGroup('sccp_ruser', 1, 'sccp_ru', $def_val);
echo $this->showGroup('sccp_ruser_time', 1, 'sccp_ru', $def_val);
?>
</form>

View file

@ -6,51 +6,54 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
$forminfo =array( $forminfo =array(
array('name'=>'dev_buttons', 'label'=>'Buttons Configuration'), array("name"=>"dev_buttons",label=>"Buttons Configuration"),
array('name'=>'button', 'label'=>'Buttons', 'help'=>'help') array("name"=>"button",label=>"Buttons ",help=>"help.")
); );
//$buttons_type= array("empty","line","service","feature","speeddial"); //$buttons_type= array("empty","line","service","feature","speeddial");
// "feature","service" -- Add leter ! // "feature","service" -- Add leter !
$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line"); $buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line");
$feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status"); $feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status");
if ($_REQUEST['tech_hardware'] === 'cisco') { $lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
$lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension'); //$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
} else { $data_sort = Array();
$lines_list = $this->dbinterface->getSipTableData('extensionList'); $hint_list1 = $this->get_hint_info();
foreach ($hint_list1 as $key => $value) {
$data_sort[$value['name']] = $key;
} }
ksort($data_sort);
$hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ; //print_r(count($data_sort));
//print_r(count($hint_list1));
foreach ($data_sort as $key => $value) {
$hint_list[$value] = $hint_list1[$value];
}
//print_r($hint_list);
//ksort($hint_list);
//natsort($hint_list);
$line_id =0; $line_id =0;
$max_buttons =56; //Don't know hardware type so set a maximum. On save, this is set to actual max buttons $max_buttons =56;
$show_buttons =1; $show_buttons =1;
//print_r($hint_list);
if (!empty($_REQUEST['id'])) { if (!empty($_REQUEST['id'])) {
$dev_id = $_REQUEST['id']; $dev_id = $_REQUEST['id'];
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array("id" => $dev_id)); $db_buttons = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_buttons', array("id" => $dev_id));
$db_device = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id)); $db_device = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
$show_buttons = $db_device['buttons']; $max_buttons = $db_device['buttons'];
if (!empty($db_device['addon_buttons'])){ if (!empty($db_device['addon_buttons'])){
$show_buttons += $db_device['addon_buttons']; $max_buttons += $db_device['addon_buttons'];
} }
//$show_buttons = $max_buttons; $show_buttons = $max_buttons;
} }
if (!empty($_REQUEST['new_id'])) { if (!empty($_REQUEST['new_id'])) {
$val = $_REQUEST['type']; $val = $_REQUEST['type'];
$dev_schema = $this-> getSccpModelInformation('byid', false, "all", array('model' =>$val)); $dev_schema = $this-> getSccp_model_information('byid', false, "all", array('model' =>$val));
// $db_device = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $val)); // $db_device = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $val));
$show_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-> getSccpModelInformation('byid', false, "all", array('model' =>$val)); $dev_schema = $this-> getSccp_model_information('byid', false, "all", array('model' =>$val));
$show_buttons += $dev_schema[0]['buttons']; $max_buttons += $dev_schema[0]['buttons'];
} }
//$show_buttons = $max_buttons;
}
if (!empty($_REQUEST['ru_id'])) {
$dev_id = $_REQUEST['ru_id'];
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array("id" => $dev_id));
$show_buttons = $max_buttons; $show_buttons = $max_buttons;
} }
@ -59,9 +62,7 @@ if (!empty($_REQUEST['ru_id'])) {
<form autocomplete="off" name="frm_editbuttons" id="frm_editbuttons" class="fpbx-submit" action="" method="post" data-id="hw_edit"> <form autocomplete="off" name="frm_editbuttons" id="frm_editbuttons" class="fpbx-submit" action="" method="post" data-id="hw_edit">
<input type="hidden" name="category" value="frm_editbuttons"> <input type="hidden" name="category" value="frm_editbuttons">
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">
<input type="hidden" name="buttonscount" id="buttonscount" value="<?php echo $show_buttons;?>"> <input type="hidden" name="buttonscount" value="<?php echo $max_buttons?>">
<input type="hidden" name="devButtonCnt" id="devButtonCnt" value="<?php echo (!empty($db_device['buttons']))?$db_device['buttons']:0;?>">
<input type="hidden" name="addonCnt" id="addonCnt" value="<?php echo (!empty($db_device['dns']))?$db_device['dns']:0;?>">
<div class="section-title" data-for="<?php echo $forminfo[0]['name'];?>"> <div class="section-title" data-for="<?php echo $forminfo[0]['name'];?>">
<h3><i class="fa fa-minus"></i><?php echo _($forminfo[0]['label']) ?></h3> <h3><i class="fa fa-minus"></i><?php echo _($forminfo[0]['label']) ?></h3>
</div> </div>
@ -90,19 +91,18 @@ if (!empty($_REQUEST['ru_id'])) {
</div></div> </div></div>
<?php <?php
for ($line_id = 0; $line_id <$max_buttons; $line_id ++) { for ($line_id = 0; $line_id <=$max_buttons; $line_id ++){
// print_r($db_buttons[$line_id]);
$show_form_mode = ''; $show_form_mode = '';
$defaul_tv = (empty($db_buttons[$line_id])) ? "empty": $db_buttons[$line_id]['buttontype']; $defaul_tv = (empty($db_buttons[$line_id])) ? "empty": $db_buttons[$line_id]['type'];
$defaul_btn = (empty($db_buttons[$line_id])) ? "": $db_buttons[$line_id]['name']; $defaul_btn = (empty($db_buttons[$line_id])) ? "": $db_buttons[$line_id]['name'];
$defaul_opt = (empty($db_buttons[$line_id])) ? array(''): explode(',',$db_buttons[$line_id]['options']); $defaul_opt = (empty($db_buttons[$line_id])) ? array(''): explode(',',$db_buttons[$line_id]['options']);
$show_form_mode = $defaul_tv; $show_form_mode = $defaul_tv;
$def_hint = ''; // Hint check Box $def_hint = ''; // Hint check Box
$def_hint_btn = ''; // Hint Combo Box $def_hint_btn = ''; // Hint Combo Box
$def_park = ''; // Hint check Box
$def_silent = ''; $def_silent = '';
$defaul_advline = ''; $defaul_advline = '';
$defaul_ftr = '';
if (strpos($defaul_btn,'@') >0) { if (strpos($defaul_btn,'@') >0) {
$defaul_tv = 'adv.line'; $defaul_tv = 'adv.line';
$show_form_mode = 'adv.line'; $show_form_mode = 'adv.line';
@ -120,10 +120,8 @@ if (!empty($_REQUEST['ru_id'])) {
if ($defaul_tv == "feature") { if ($defaul_tv == "feature") {
$defaul_ftr = $defaul_opt[0]; $defaul_ftr = $defaul_opt[0];
$defaul_fcod = (empty($defaul_opt[1])) ? '': $defaul_opt[1]; $defaul_fcod = (empty($defaul_opt[1])) ? '': $defaul_opt[1];
$def_park = (empty($defaul_opt[2])) ? '': 'checked'; // print_r($defaul_fcod);
// print_r($defaul_opt);
} }
foreach ($defaul_opt as $data_i) { foreach ($defaul_opt as $data_i) {
if (strpos($data_i,'@')>0) { if (strpos($data_i,'@')>0) {
$test_btn = strtok($data_i,'@'); $test_btn = strtok($data_i,'@');
@ -142,9 +140,13 @@ if (!empty($_REQUEST['ru_id'])) {
} }
} }
} }
// print_r($defaul_btn);
// print_r($defaul_opt);
echo '<!-- Begin button :'.$line_id.' -->'; echo '<!-- Begin button :'.$line_id.' -->';
echo '<div class="line_button element-container" '.(($line_id < $show_buttons)?"":"hidden ").'data-id="'.$line_id.'">'; echo '<div class="line_button element-container" '.(($line_id < $show_buttons)?"":"hidden ").'data-id="'.$line_id.'">';
// echo 'Mode : '.$show_form_mode. ' opt: ';
// print_r( $defaul_opt);
?> ?>
<div class="row"> <div class="form-group"> <div class="row"> <div class="form-group">
@ -154,7 +156,7 @@ if (!empty($_REQUEST['ru_id'])) {
<div class="col-sm-5"> <div class="col-sm-5">
<div class="col-xs-3"> <div class="col-xs-3">
<!-- Line Type Select --> <!-- Line Type Select -->
<select class="form-control buttontype" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_type';?>"> <select class="form-control lineselect" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_type';?>" >
<?php <?php
if ($line_id == 0) { if ($line_id == 0) {
echo '<option value="line" selected >DEF LINE</option>'; echo '<option value="line" selected >DEF LINE</option>';
@ -169,7 +171,7 @@ if (!empty($_REQUEST['ru_id'])) {
</div> </div>
<!-- if Line Type = feature Show Futures --> <!-- if Line Type = feature Show Futures -->
<div class="col-xs-7"> <div class="col-xs-7">
<select data-type="feature" class ="futuretype form-control lineid_<?php echo $line_id.(($show_form_mode=='feature')?'':' hidden');?>" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_feature';?>" > <select class ="form-control linefeature_<?php echo $line_id.(($show_form_mode=='feature')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_feature';?>" >
<?php <?php
foreach ($feature_list as $fkey => $fval) { foreach ($feature_list as $fkey => $fval) {
$select = (($fkey == $defaul_ftr)?"selected":""); $select = (($fkey == $defaul_ftr)?"selected":"");
@ -178,16 +180,16 @@ if (!empty($_REQUEST['ru_id'])) {
?> ?>
</select> </select>
<!-- if Line Type = line Show SCCP Num --> <!-- if Line Type = line Show SCCP Num -->
<select data-type='line' class ="form-control lineid_<?php echo $line_id.(($show_form_mode=='line' || $show_form_mode=='adv.line')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_line';?>" id="<?php echo $forminfo[1]['name'].$line_id.'_line';?>"> <select class ="form-control lineselect_<?php echo $line_id.(($show_form_mode=='line' || $show_form_mode=='adv.line')?'':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_line';?>" >
<?php <?php
foreach ($lines_list as $data){ foreach ($lines_list as $data){
$select = (($data['name']==$defaul_btn)?'selected="selected"':""); $select = (($data['name']==$defaul_btn)?"selected":"");
echo '<option value="'.$data['name'].'" '.$select.' >'.$data['name'].' / '.$data['label'].'</option>'; echo '<option value="'.$data['name'].'" '.$select.' >'.$data['name'].' / '.$data['label'].'</option>';
} }
?> ?>
</select> </select>
<!-- if Line Type = Othe Show Input --> <!-- if Line Type = Othe Show Input -->
<div data-type='speeddial' class="lineid_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" > <div class="linevalue_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" >
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_input" name="'.$forminfo[1]['name'].$line_id.'_input" placeholder="Name" value="'.$db_buttons[$line_id]['name'].'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_input" name="'.$forminfo[1]['name'].$line_id.'_input" placeholder="Name" value="'.$db_buttons[$line_id]['name'].'" >';
?> ?>
@ -197,7 +199,7 @@ if (!empty($_REQUEST['ru_id'])) {
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<!-- if Line Type = speeddial Show Hint line --> <!-- if Line Type = speeddial Show Hint line -->
<div data-type='hintline' class="lineid_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>"> <div class="linespeed_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<?php <?php
echo '<div class="col-xs-5">'; echo '<div class="col-xs-5">';
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_phone" name="'.$forminfo[1]['name'].$line_id.'_phone" placeholder="Phone" value="'.$defaul_opt[0].'">'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_phone" name="'.$forminfo[1]['name'].$line_id.'_phone" placeholder="Phone" value="'.$defaul_opt[0].'">';
@ -209,21 +211,20 @@ if (!empty($_REQUEST['ru_id'])) {
echo '<select class="form-control" name="'.$forminfo[1]['name'].$line_id.'_hline" >'; echo '<select class="form-control" name="'.$forminfo[1]['name'].$line_id.'_hline" >';
foreach ($hint_list as $data){ foreach ($hint_list as $data){
$select = (($data['key']==$def_hint_btn)?"selected":""); $select = (($data['hint']==$def_hint_btn)?"selected":"");
echo '<option value="'.$data['key'].'" '.$select.' >'.$data['exten'].' / '.$data['label'].'</option>'; echo '<option value="'.$data['hint'].'" '.$select.' >'.$data['name'].' / '.$data['label'].'</option>';
} }
echo '</select>'; echo '</select>';
echo '</div>'; echo '</div>';
?> ?>
</div> </div>
<!-- if Line Type = feature Show Futures Park --> <div class="linefeature_<?php echo $line_id.(($show_form_mode=='feature')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<div data-type='feature' class="lineid_<?php echo $line_id.(($show_form_mode=='feature')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>"> <div class="col-xs-5">
<div class="col-xs-4">
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_flabel" name="'.$forminfo[1]['name'].$line_id.'_flabel" placeholder="Display Label" value="'.$db_buttons[$line_id]['name'].'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_flabel" name="'.$forminfo[1]['name'].$line_id.'_flabel" placeholder="Display Label" value="'.$db_buttons[$line_id]['name'].'" >';
?> ?>
</div> </div>
<div class="col-xs-4"> <div class="col-xs-5">
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_fvalue" name="'.$forminfo[1]['name'].$line_id.'_fvalue" placeholder="code" value="'.$defaul_fcod.'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_fvalue" name="'.$forminfo[1]['name'].$line_id.'_fvalue" placeholder="code" value="'.$defaul_fcod.'" >';
?> ?>
@ -231,7 +232,7 @@ if (!empty($_REQUEST['ru_id'])) {
</div> </div>
<!-- if Line Type = Advanced Show Hint line --> <!-- if Line Type = Advanced Show Hint line -->
<div data-type='adv_line' class="lineid_<?php echo $line_id.(($show_form_mode=='adv.line')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>"> <div class="lineadv_<?php echo $line_id.(($show_form_mode=='adv.line')? '':' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_hint';?>">
<div class="col-xs-5"> <div class="col-xs-5">
<?php <?php
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advline" name="'.$forminfo[1]['name'].$line_id.'_advline" placeholder="[+=][01]:[cidname]" value="'.$defaul_advline.'" >'; echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advline" name="'.$forminfo[1]['name'].$line_id.'_advline" placeholder="[+=][01]:[cidname]" value="'.$defaul_advline.'" >';
@ -243,17 +244,6 @@ if (!empty($_REQUEST['ru_id'])) {
?> ?>
</div> </div>
</div> </div>
<!-- if Line Type = feature Show Futures Park -->
<div data-type='featurep' class="lineid_<?php echo $line_id.(($show_form_mode=='feature')? (($defaul_ftr=='parkinglot')? ' ':' hidden'):' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_park';?>">
<div class="col-xs-4">
<div class="radioset" data-toggle="buttons">
<?php
echo '<input class="form-control" type="checkbox" name="'.$forminfo[1]['name'].$line_id.'_retrieve" id="'.$forminfo[1]['name'].$line_id.'_retrieve" '.$def_park.' value="retrieve">';
echo '<label for="'.$forminfo[1]['name'].$line_id.'_retrieve">RetrieveSingle</label>';
?>
</div>
</div>
</div>
</div> </div>
@ -269,6 +259,3 @@ if (!empty($_REQUEST['ru_id'])) {
</div> </div>
</form> </form>
<div class="section-butom" data-for="<?php echo $forminfo[0]['name'];?>">
<h3></h3>
</div>

View file

@ -1,16 +0,0 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
?>
<form autocomplete="off" name="frm_advanced" id="frm_adddevice" class="fpbx-submit" action="" method="post" data-id="hw_edit">
<input type="hidden" name="category" value="deviceadvanced_form">
<input type="hidden" name="Submit" value="Submit">
<?php
echo $this->showGroup('sccp_hw_addv_device', 1, 'sccp_hw', $def_val);
?>
</form>

View file

@ -6,7 +6,7 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
//$list_data = $this->getDialPlan('dialplan'); //$list_data = $this->get_DialPlan('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->getDialPlan($dev_id); $list_data= $this->get_DialPlan($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) {
@ -37,11 +37,11 @@ if ($dev_id != '*new*') {
<form autocomplete="off" name="frm_editdialtemplate" id="frm_editbuttons" class="fpbx-submit" action="" method="post" data-id="dial_template"> <form autocomplete="off" name="frm_editdialtemplate" id="frm_editbuttons" class="fpbx-submit" action="" method="post" data-id="dial_template">
<input type="hidden" name="idtemplate" value="<?php echo str_replace('dial', '', $dev_id);?>"> <input type="hidden" name="idtemplate" value="<?php echo $dev_id;?>">
<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>

861
views/formShow.php Normal file
View file

@ -0,0 +1,861 @@
<?php
/*
* IE - Text Input
* IED - Text Input Dynamic
* ITED- Input Dynamic Table
* IS - Radio box
* SL - Select element
* SLA - Select element (from - data )
* Input element Select SLD - Date format
* SLZ - Time Zone
* SLZN - Time Zone List
* SLT - TFTP Lang
* SLM - Music on hold
* SLK - System KeySet
* * Input element Select SLS - System Language
* Input element Select SDM - Model List
* SDE - Extension List
* Help elemen HLP - Help Element
*/
$npref = $form_prefix.'_';
$napref = $form_prefix.'-ar_';
if (empty($form_prefix)){
$npref = "sccp_";
$napref ="sccp-ar_";
}
$day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-M-Y", "D-M-YA", "Y-M-D", "YA-M-D", "M/D/Y", "M/D/YA",
"D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
$mysql_table = array("sccpdevice","sccpdeviceconfig");
//$time_zone_name = timezone_identifiers_list();
$time_zone = array('-12' => 'GTM -12', '-11' => 'GTM -11', '-10' => 'GTM -10', '-09' => 'GTM -9',
'-08' => 'GTM -8', '-07' => 'GTM -7', '-06' => 'GTM -6', '-05' => 'GTM -5',
'-04' => 'GTM -4', '-03' => 'GTM -3', '-02' => 'GTM -2', '-01' => 'GTM -1',
'00' => 'GTM time', '01' => 'GTM +1', '02' => 'GTM +2', '03' => 'GTM +3',
'04' => 'GTM +4', '05' => 'GTM +5', '06' => 'GTM +6', '07' => 'GTM +7',
'08' => 'GTM +8', '09' => 'GTM +9', '10' => 'GTM +10', '11'=> 'GTM +11', '12' => 'GTM +12');
$time_zone_name = \FreePBX::Sccp_manager()-> extconfigs-> getextConfig('cisco_timezone');
//$time_zone = \FreePBX::Sccp_manager()-> extconfigs-> getextConfig('cisco_time');
//$system_time_zone = \FreePBX::Sccp_manager()->getSysnemTimeZone();
//print_r($metainfo);
if (\FreePBX::Modules()->checkStatus("soundlang")) {
$syslangs = \FreePBX::Soundlang()->getLanguages();
if (!is_array($syslangs)) {
$syslangs = array();
}
}
if (function_exists('music_list')){
$moh_list = music_list();
// $cur = (isset($mohsilence) && $mohsilence != "" ? $mohsilence : 'default');
}
if (!is_array($moh_list)){
$moh_list = array('default');
}
$sofkey_list = \FreePBX::Sccp_manager()-> srvinterface -> sccp_list_keysets();
$model_list = \FreePBX::Sccp_manager()->dbinterface->get_db_SccpTableData("HWDevice");
$extension_list = \FreePBX::Sccp_manager()->dbinterface->get_db_SccpTableData("HWextension");
$extension_list[]=array(model=>'NONE', vendor=>'CISCO', dns=>'0');
$items = $itm -> children();
if ($h_show==1) {
$sec_class ='';
if (!empty($items ->class)){
$sec_class = (string)$items ->class;
}
?>
<div class="section-title" data-for="<?php echo $npref.$itm['name'];?>">
<h3><i class="fa fa-minus"></i><?php echo _($items ->label) ?></h3>
</div>
<div class="section <?php echo $sec_class;?>" data-id="<?php echo $npref.$itm['name'];?>">
<?php
}
foreach ($items as $child) {
if (empty($child->help)) {
$child->help = 'Help is not available.';
$child->meta_help = '1';
}
// $child->meta_help = '1'; // Remove comments to see original help !
if ($child['type'] == 'IE') {
$res_input = '';
$res_name = '';
$res_oid = (string)$child->input[0]->name;
$res_id = $npref.$res_oid;
if (!empty($metainfo[$res_oid])){
if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metainfo[$res_oid]['Description'];
}
}
// --- Add Hiden option
$res_sec_class ='';
if (!empty($child ->class)){
$res_sec_class = (string)$child ->class;
}
if (empty($child->nameseparator)) {
$child->nameseparator = ' / ';
}
$i = 0;
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"> <div class="form-group <?php echo $res_sec_class; ?>">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9">
<?php
foreach ($child->xpath('input') as $value) {
$res_n = (string)$value->name;
$res_name = $npref . $res_n;
if (empty($res_id)) {
$res_id = $res_name;
}
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$value->value = $fvalues[$res_n]['data'];
}
}
if (empty($value->value)) {
$value->value = $value->default;
}
if (empty($value->type)) {
$value->type = 'text';
}
if (empty($value->class)) {
$value->class = 'form-control';
}
if ($i > 0) echo $child->nameseparator;
//
echo '<input type="' . $value->type . '" class="' . $value->class . '" id="' . $res_id . '" name="' . $res_name . '" value="' . $value->value.'"';
if (isset($value->options)){
foreach ($value->options ->attributes() as $optkey =>$optval){
echo ' '.$optkey.'="'.$optval.'"';
}
}
if (!empty($value->min)) echo ' min="'.$value->min.'"';
if (!empty($value->max)) echo ' max="'.$value->max.'"';
echo '>';
$i ++;
}
?>
</div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
if ($child['type'] == 'IED') {
$res_input = '';
$res_name = '';
$res_value = '';
$opt_at = array();
$res_n = (string)$child->name;
if (!empty($metainfo[$res_n])){
if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metainfo[$res_n]['Description'];
}
}
// $res_value
$lnhtm = '';
$res_id = $napref.$child->name;
$i = 0;
$max_row = 255;
if (!empty($child->max_row)) {
$max_row = $child->max_row;
}
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$res_value = explode(';', $fvalues[$res_n]['data']);
}
}
if (empty($res_value)) {
$res_value = array((string) $child->default);
// $res_value = explode('/', (string) $child->default);
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9">
<?php
if (!empty($child->cbutton)) {
echo '<div class="form-group form-inline">';
foreach ($child->xpath('cbutton') as $value) {
$res_n = $res_id.'[0]['.$value['field'].']';
$res_vf = '';
if ($value['value']=='NONE' && empty($res_value)){
$res_vf = 'active';
}
$ch_key = array_search($value['value'],$res_value);
if ($ch_key !== false) {
unset($res_value[$ch_key]);
$res_vf = 'active';
$res_value = explode(';', implode(';', $res_value));
}
$opt_hide ='';
$opt_class="button-checkbox";
if (!empty($value->option_hide)) {
$opt_class .= " sccp_button_hide";
$opt_hide = ' data-vhide="'.$value->option_hide.'" data-btn="checkbox" data-clhide="'.$value->option_hide['class'].'" ';
}
if (!empty($child->option_show)) {
if (empty($opt_hide)) {
$opt_hide =' class="sccp_button_hide" ';
}
$opt_hide .= ' data-vshow="'.$child->option_show.'" data-clshow="'.$child->option_show['class'].'" ';
}
if (!empty($value->option_disabled)) {
$opt_class .= " sccp_button_disabled";
$opt_hide = ' data-vhide="'.$value->option_disabled.'" data-btn="checkbox" data-clhide="'.$value->option_disabled['class'].'" ';
}
if (!empty($value->class)) {
$opt_class .= " ".(string)$value->class;
}
echo '<span class="'.$opt_class.'"'.$opt_hide.'><button type="button" class="btn '.$res_vf.'" data-color="primary">';
echo '<i class="state-icon '. (($res_vf == 'active')?'glyphicon glyphicon-check"':'glyphicon glyphicon-uncheck'). '"></i> ';
echo $value.'</button><input type="checkbox" name="'. $res_n.'" class="hidden" '. (($res_vf == 'active')?'checked="checked"':'') .'/></span>';
}
echo '</div>';
}
$opt_class = "col-sm-7 ".$res_id."-gr";
if (!empty($child->class)) {
$opt_class .= " ".(string)$child->class;
}
echo '<div class = "'.$opt_class.'">';
foreach ($res_value as $dat_v) {
?>
<div class = "<?php echo $res_id;?> form-group form-inline" data-nextid=<?php echo $i+1;?> >
<?php
$res_vf = explode('/', $dat_v);
$i2 = 0;
foreach ($child->xpath('input') as $value) {
$res_n = $res_id.'['.$i.']['.$value['field'].']';
$fields_id = (string)$value['field'];
$opt_at[$fields_id]['nameseparator']=(string)$value['nameseparator'];
if (!empty($value->class)) {
$opt_at[$fields_id]['class']='form-control ' .(string)$value->class;
}
$opt_at[$fields_id]['nameseparator']=(string)$value['nameseparator'];
echo '<input type="text" name="'. $res_n.'" class="'.$opt_at[$fields_id]['class'].'" value="'.$res_vf[$i2].'"';
if (isset($value->options)){
foreach ($value->options ->attributes() as $optkey =>$optval){
$opt_at[$fields_id]['options'][$optkey]=(string)$optval;
echo ' '.$optkey.'="'.$optval.'"';
}
}
echo '> '.(string)$value['nameseparator'].' ';
$i2 ++;
}
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 '</div>';
$i++;
}
?>
</div>
<?php
if (!empty($child->addbutton)) {
echo '<div class = "col-sm-5 '.$res_id.'-gr">';
echo '<input type="button" id="'.$res_id.'-btn" data-id="'.$res_id.'" data-for="'.$res_id.'" data-max="'.$max_row.'"data-json="'.bin2hex(json_encode($opt_at)).'" class="input-js-add" value="'._($child->addbutton).'" />';
echo '</div>';
}
?>
</div>
</div>
</div>
</div>
</div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
if ($child['type'] == 'IS') {
$res_n = (string)$child->name;
$res_id = $npref.$child->name;
if (!empty($metainfo[$res_n])){
if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metainfo[$res_n]['Description'];
}
}
// --- Add Hiden option
$res_sec_class ='';
if (!empty($child ->class)){
$res_sec_class = (string)$child ->class;
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"><div class="form-group <?php echo $res_sec_class;?>">
<div class="col-md-3 radioset">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9 radioset " data-hide="on">
<?php
$i = 0;
// $res_v = 'no';
$opt_hide = '';
if (empty($child->default)) {
$res_v = 'no';
} else {
$res_v = (string)$child->default;
}
if (!empty($child->value)) {
$res_v = (string)$child->value;
}
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$res_v = (string)$fvalues[$res_n]['data'];
}
}
if (!empty($child->option_hide)) {
$opt_hide = ' class="sccp_button_hide" data-vhide="'.$child->option_hide.'" data-clhide="'.$child->option_hide['class'].'" ';
}
if (!empty($child->option_show)) {
if (empty($opt_hide)) {
$opt_hide =' class="sccp_button_hide" ';
}
$opt_hide .= ' data-vshow="'.$child->option_show.'" data-clshow="'.$child->option_show['class'].'" ';
}
foreach ($child->xpath('button') as $value) {
$val_check = (string)$value[@value];
if ($val_check == '' || $val_check == 'NONE' || $val_check == 'none' ) {
$val_check = (((string)$value[@value] == $res_v) ? " checked" : "");
} else {
$val_check = (strtolower((string)$value[@value]) == strtolower($res_v) ? " checked" : "");
}
echo '<input type="radio" name="' . $res_id . '" id="' . $res_id. '_' . $i .'" value="' . $value[@value] . '"' . $val_check . $opt_hide.'>';
echo '<label for="' . $res_id. '_' . $i . '">' . _($value) . '</label>';
$i++;
}
?>
</div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
/*
* Input element Select SLD - Date format
* SLZ - Time Zone
*
* SLM - Music on hold
* SLK - System KeySet
*/
if ($child['type'] == 'SLD' || $child['type'] == 'SLM'|| $child['type'] == 'SLK' ) {
// $value = $child -> select;
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
if (!empty($metainfo[$res_n])){
if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metainfo[$res_n]['Description'];
}
}
if (empty($child->class)) {
$child->class = 'form-control';
}
if ($child['type'] == 'SLD') {
$select_opt= $day_format;
}
if ($child['type'] == 'SLM') {
$select_opt= $moh_list;
}
if ($child['type'] == 'SLK') {
$select_opt= $sofkey_list;
}
// if ($child['type'] == 'SLZ') {
// $select_opt= $time_zone;
// }
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"><div class = "lnet form-group form-inline" data-nextid=1> <?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$child->value = $fvalues[$res_n]['data'];
}
}
foreach ($select_opt as $key) {
echo '<option value="' . $key . '"';
if ($key == $child->value) {
echo ' selected="selected"';
}
echo '>' . $key . '</option>';
}
?> </select>
</div></div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
/*
* Input element Select SLS - System Language
*/
if ($child['type'] == 'SLS' || $child['type'] == 'SLT' || $child['type'] == 'SLA' || $child['type'] == 'SLZ' || $child['type'] == 'SLZN') {
// $value = $child -> select;
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
$child->value ='';
if (!empty($metainfo[$res_n])){
if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metainfo[$res_n]['Description'];
}
}
if ($child['type'] == 'SLS') {
$select_opt= $syslangs;
}
if ($child['type'] == 'SLT') {
$select_opt= $tftp_lang;
}
if ($child['type'] == 'SLZN') {
$select_opt= $time_zone_name;
}
if ($child['type'] == 'SLZ') {
$select_opt= $time_zone;
// $child->value = ($system_time_zone[offset]/60);
}
if ($child['type'] == 'SLA') {
$select_opt ='';
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$res_value = explode(';', $fvalues[$res_n]['data']);
}
if (empty($res_value)) {
$res_value = array((string) $child->default);
}
foreach ($res_value as $key) {
$select_opt[$key]= $key;
}
}
}
if (empty($child->class)) {
$child->class = 'form-control';
}
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$child->value = $fvalues[$res_n]['data'];
}
}
if (empty($child->value)){
if (!empty($child->default)){
$child->value = $child->default;
}
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"> <!-- <div class = "lnet form-group form-inline" data-nextid=1> --> <?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
foreach ($select_opt as $key => $val) {
if (is_array($val)) {
$opt_key = (isset($val['id'])) ? $val['id'] : $key;
$opt_val = (isset($val['val'])) ? $val['val'] : $val;
} else {
$opt_key = $key;
$opt_val = $val;
}
echo '<option value="' . $opt_key . '"';
if ($opt_key == $child->value) {
echo ' selected="selected"';
}
echo '>' . $opt_val. '</option>';
}
?> </select>
<!-- </div> --> </div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<!--END System Language-->
<?php
echo '<!-- END '.$child->label.' -->';
}
/*
* Input element Select
*/
if ($child['type'] == 'SL') {
$res_n = (string)$child->name;
$res_id = $npref.$child->name;
if (!empty($metainfo[$res_n])){
if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metainfo[$res_n]['Description'];
}
}
if (empty($child ->class)) {
$child->class = 'form-control';
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"> <div class = "lnet form-group form-inline" data-nextid=1> <?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '">';
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$child->value = $fvalues[$res_n]['data'];
}
}
foreach ($child->xpath('select') as $value) {
if (!empty($value[@value])) {
$key = $value[@value];
} else {
$key = (string)$value;
}
echo '<option value="' . $key . '"';
if (strtolower((string)$key) == strtolower((string)$child->value)) {
echo ' selected="selected"';
}
echo '>' . (string)$value. '</option>';
}
?> </select>
</div> </div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
/*
* Input element Select SDM - Model List
* SDE - Extension List
*/
if ($child['type'] == 'SDM' || $child['type'] == 'SDE' ) {
// $value = $child -> select;
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
if (!empty($metainfo[$res_n])){
if ($child->meta_help == '1' || $child->help == 'Help!') {
$child->help = $metainfo[$res_n]['Description'];
}
}
if (empty($child->class)) {
$child->class = 'form-control';
}
if ($child['type'] == 'SDM') {
$select_opt= $model_list;
}
if ($child['type'] == 'SDE') {
$select_opt= $extension_list;
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="element-container">
<div class="row"> <div class="form-group">
<div class="col-md-3">
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
</div>
<div class="col-md-9"><div class = "lnet form-group form-inline" data-nextid=1> <?php
echo '<select name="'.$res_id.'" class="'. $child->class . '" id="' . $res_id . '"';
if (isset($child->options)){
foreach ($child->options->attributes() as $optkey =>$optval){
echo ' '.$optkey.'="'.$optval.'"';
}
}
echo '>';
$fld = (string)$child->select['name'];
$flv = (string)$child->select;
$flk = (string)$child->select['dataid'];
$flkv= (string)$child->select['dataval'];
$key = (string)$child->default;
if (!empty($fvalues[$res_n])) {
if (!empty($fvalues[$res_n]['data'])) {
$child->value = $fvalues[$res_n]['data'];
$key = $fvalues[$res_n]['data'];
}
}
foreach ($select_opt as $data) {
echo '<option value="' . $data[$fld] . '"';
if ($key == $data[$fld]) {
echo ' selected="selected"';
}
if (!empty($flk)){
echo ' data-id="'.$data[$flk].'"';
}
if (!empty($flkv)){
echo ' data-val="'.$data[$flkv].'"';
}
echo '>' . $data[$flv] . '</option>';
}
?> </select>
</div></div>
</div></div>
<div class="row"><div class="col-md-12">
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
</div></div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
if ($child['type'] == 'ITED') {
$res_input = '';
$res_name = '';
$res_na = (string)$child->name;
// $res_value
$lnhtm = '';
$res_id = $napref.$child->name;
$i = 0;
if (!empty($fvalues[$res_na])) {
if (!empty($fvalues[$res_na]['data'])) {
$res_value = explode(';', $fvalues[$res_na]['data']);
}
}
if (empty($res_value)) {
$res_value = array((string) $child->default);
// $res_value = explode('/', (string) $child->default);
}
echo '<!-- Begin '.$res_id.' -->';
?>
<table class="table table-striped" id="dp-table-<?php echo $res_id;?>">
<?php
foreach ($res_value as $dat_v) {
echo '<tr data-nextid="'.($i+1).'" class="'.$res_id.'" id="'.$res_id.'-row-'.($i).'"> ';
if (!empty($child->label)) {
echo '<td class=""> <div class="input-group">'.$child->label.'</div></td>';
}
$res_vf = explode('/', $dat_v);
$i2 = 0;
foreach ($child->xpath('element') as $value) {
$fields_id = (string)strtolower($value['field']);
$res_n = $res_id.'['.$i.']['.$fields_id.']';
$res_ni = $res_id.'_'.$i.'_'.$fields_id;
$opt_at[$fields_id]['display_prefix']=(string)$value['display_prefix'];
$opt_at[$fields_id]['display_sufix']=(string)$value['display_sufix'];
if (empty($value->options->class)) {
$opt_at[$fields_id]['options']['class']='form-control';
}
$opt_at[$fields_id]['type']=(string)$value['type'];
$res_opt['addon'] ='';
if (isset($value->options)){
foreach ($value->options ->attributes() as $optkey =>$optval){
$opt_at[$fields_id]['options'][$optkey]=(string)$optval;
$res_opt['addon'] .=' '.$optkey.'="'.$optval.'"';
}
}
echo '<td class="">';
$res_opt['inp_st'] = '<div class="input-group"> <span class="input-group-addon" id="basep_'.$res_n.'">'.$opt_at[$fields_id]['display_prefix'].'</span>';
$res_opt['inp_end'] = '<span class="input-group-addon" id="bases_'.$res_n.'">'.$opt_at[$fields_id]['display_sufix'].'</span></div>';
switch ($value['type']){
case 'date':
echo $res_opt['inp_st'].'<input type="date" name="'. $res_n.'" value="'.$res_vf[$i2].'"'.$res_opt['addon']. '>'.$res_opt['inp_end'];
break;
case 'number':
echo $res_opt['inp_st'].'<input type="number" name="'. $res_n.'" value="'.$res_vf[$i2].'"'.$res_opt['addon']. '>'.$res_opt['inp_end'];
break;
case 'input':
echo $res_opt['inp_st'].'<input type="text" name="'. $res_n.'" value="'.$res_vf[$i2].'"'.$res_opt['addon']. '>'.$res_opt['inp_end'];
break;
case 'title':
if ($i > 0 ) {
break;
}
case 'label':
$opt_at[$fields_id]['data'] = (string)$value;
echo '<label '.$res_opt['addon'].' >'.(string)$value.'</label>';
break;
case 'select':
echo $res_opt['inp_st'].'<select name="'.$res_n.'" id="' . $res_n . '"'. $res_opt['addon'].'>';
$opt_at[$fields_id]['data']='';
foreach ($value->xpath('data') as $optselect ){
$opt_at[$fields_id]['data'].= (string)$optselect.';';
echo '<option value="' . $optselect. '"';
if (strtolower((string)$optselect) == strtolower((string)$res_vf[$i2])) {
echo ' selected="selected"';
}
echo '>' . (string)$optselect. '</option>';
}
echo '</select>'.$res_opt['inp_end'];
break;
}
echo '</td>';
$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="+" />';
if ($i > 0 ) {
echo '<input type="button" id="'.$res_id.'-btndel" data-id="'.($i).'" data-for="'.$res_id.'" class="table-js-del" value="-" />';
}
echo '</td></tr>';
$i++;
}
echo '</table>';
echo '<!-- END '.$res_id.' -->';
}
if ($child['type'] == 'HLP' ) {
$res_n = (string)$child ->name;
$res_id = $npref.$res_n;
if (empty($child->class)) {
$child->class = 'form-control';
}
echo '<!-- Begin '.$child->label.' -->';
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-info-circle"></i> <nbsp> <?php echo _($child->label);?>
<a data-toggle="collapse" href="<?php echo '#'.$res_id;?>"><i class="fa fa-plus pull-right"></i></a></h3>
</div>
<div class="panel-body collapse" id="<?php echo $res_id;?>">
<?php
foreach ($child->xpath('element') as $value) {
switch ($value['type']){
case 'p':
case 'h1':
case 'h2':
case 'h3':
case 'h4':
echo '<'.$value['type'].'>'._((string)$value).'</'.$value['type'].'>';
break;
case 'table':
echo '<'.$value['type'].' class="table" >';
foreach ($value->xpath('row') as $trow) {
echo '<tr>';
foreach ($trow->xpath('col') as $tcol) {
echo '<td>'._((string)$tcol).'</td>';
}
echo '</tr>';
}
echo '</'.$value['type'].'>';
break;
}
}
?>
</div>
</div>
<?php
echo '<!-- END '.$child->label.' -->';
}
}
?>
<?php
if ($h_show==1) {
echo '</div>';
}
?>

View file

@ -1,4 +1,5 @@
<div class="element-container"> <div class="row"> <div class="form-group"> <div class="element-container"> <div class="row"> <div class="form-group">
<div class="col-md-3"> <label class="control-label" for="ERROR">Error loadinging form configuration </label> <div class="col-md-3"> <label class="control-label" for="ERROR">Error Load form config </label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="ERROR"></i> <i class="fa fa-question-circle fpbx-help-icon" data-for="ERROR"></i>
</div></div></div></div> </div></div></div></div>

View file

@ -1,113 +0,0 @@
<?php
/*
* IE - Text Input
* IED - Text Input Dynamic
* ITED- Input Dynamic Table
* IS - Radio box
* SL - Select element
* SLA - Select element (from - data )
* Input element Select SLD - Date format
* SLZ - Time Zone
* SLTZN - Time Zone List
* SLT - TFTP Lang
* SLM - Music on hold
* SLK - System KeySet
* * Input element Select SLS - System Language
* Input element Select SDM - Model List
* SDE - Extension List
* Help elemen HLP - Help Element
*/
// This will not work if the field already has the underscore
$npref = $form_prefix.'_';
$napref = $form_prefix.'-ar_';
if (empty($form_prefix)) {
$npref = "sccp_";
$napref ="sccp-ar_";
//} elseif ($form_prefix == 'vendorconfig') {
// $npref = 'vendorconfig';
// $napref = 'vendorconfig-ar';
}
if (empty($fvalues)) {
$fvalues = $sccp_defaults;
}
$items = $itm -> children();
if ($h_show==1) {
$sec_class ='';
if (!empty($items ->class)) {
$sec_class = (string)$items ->class;
}
?>
<div class="section-title" data-for="<?php echo $npref.$itm['name'];?>">
<h3><i class="fa fa-minus"></i><?php echo _($items ->label) ?></h3>
</div>
<div class="section <?php echo $sec_class;?>" data-id="<?php echo $npref.$itm['name'];?>">
<?php
}
foreach ($items as $child) {
$disabledButtons = array();
if (empty($child->help)) {
$child->help = 'Help is not available.';
$child->meta_help = '1';
}
echo "<!-- Begin {$child->label} -->";
switch ($child['type']) {
case 'IE':
\FreePbx::sccp_manager()->formcreate->addElementIE($child, $fvalues, $sccp_defaults,$npref);
break;
case 'IED':
\FreePbx::sccp_manager()->formcreate->addElementIED($child, $fvalues, $sccp_defaults,$npref, $napref);
break;
case 'ISC':
// This is a special case for Provision mode. Set some parameters here and fall through to IS.
$disabledButtons = array('pro' => 'Provision');
if ($sccp_defaults['tftp_rewrite']['data'] == 'pro') {
$disabledButtons = array('off' => 'Off');
}
case 'IS':
\FreePbx::sccp_manager()->formcreate->addElementIS($child, $fvalues, $sccp_defaults,$npref, $disabledButtons);
break;
case 'SLD':
case 'SLM':
case 'SLK':
case 'SLP':
case 'SLS':
case 'SLTD':
case 'SLTN':
case 'SLA':
case 'SLZ':
case 'SL':
\FreePbx::sccp_manager()->formcreate->addElementSL($child, $fvalues, $sccp_defaults,$npref, $installedLangs);
break;
case 'SLDA':
case 'SLNA':
\FreePbx::sccp_manager()->formcreate->addElementSLNA($child, $fvalues, $sccp_defaults,$npref, $installedLangs);
break;
case 'SDM':
case 'SDMS':
case 'SDML':
case 'SDMF':
case 'SDE':
case 'SDD':
\FreePbx::sccp_manager()->formcreate->addElementSD($child, $fvalues, $sccp_defaults,$npref);
break;
case 'ITED':
\FreePbx::sccp_manager()->formcreate->addElementITED($child, $fvalues, $sccp_defaults, $npref, $napref);
break;
case 'HLP':
\FreePbx::sccp_manager()->formcreate->addElementHLP($child, $fvalues, $sccp_defaults,$npref);
break;
case 'SLTZN':
\FreePbx::sccp_manager()->formcreate->addElementSLTZN($child, $fvalues, $sccp_defaults,$npref);
break;
}
echo "<!-- END {$child->label} -->";
}
if ($h_show==1) {
echo '</div>';
}
?>

View file

@ -1,85 +0,0 @@
<!--Begin modal include-->
<div class="modal fade get_ext_file_<?php echo $requestType;?>" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="gridSystemModalLabel"><?php echo _('Get Files From Provisioner');?></h4>
</div>
<div class="modal-body">
<div class="element-container">
<div class="row">
<div class="col-md-12">
<?php echo "Sccp_Manager will try to download {$requestType} files from Provision_Sccp on GitHub.<br>
This site, dkgroot/provision_sccp, is unrelated to Sccp_Manager, and the files found cannot be warrantied<br>
If you accept this, please select the {$requestType} that you want to try to get files for and then Get Files From Provisioner<br><br>
Please be patient - this may take some time depending on your internet link<br><br>" ?>
</div>
</div>
</div>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="get_model_files"><?php echo _('Fetch Files for');?></label>
<i class="fa fa-question-circle fpbx-help-icon" ></i>
</div>
<div class="col-md-3">
<div class = "lnet form-group form-inline" data-nextid=1>
<?php
switch ($requestType) {
case 'firmware':
echo "<select class='form-control' id='ext_device'>";
break;
case 'locale':
echo "<select class='form-control' id='ext_locale'>";
break;
case 'country':
echo "<select class='form-control' id='ext_country'>";
break;
}
foreach ($selectArray as $key => $val) {
echo "<option value= '{$val}'";
if (($val == 'English_United_Kingdom') || ($val == 'United_Kingdom')) {
echo ' selected="selected"';
}
echo ">{$val}</option>";
}
?>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="new_model-help" class="help-block fpbx-help-block">Help.</span>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo _('Cancel');?></button>
<button type="button" class="btn btn-primary sccp_get_ext" data-id="get_ext_files" data-type=<?php echo '"'.$requestType.'"';?> onclick="showProgress();" id="get_model_files" data-dismiss="modal"><?php echo _('Get Files from Provisioner');?></button>
</div>
</div>
</div>
</div>
<!--End modal include-->
<!--Start progress modal include-->
<div id="pleaseWaitDialog" class="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1>Getting files .....please wait</h1>
</div>
<div class="modal-body">
<div class="progress">
<div id="progress-bar" class="progress-bar progress-bar-striped progress-bar-animated active" role="progressbar" style="width:0%">
</div>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!--End progress modal include-->

View file

@ -5,12 +5,7 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
// vim: set ai ts=4 sw=4 ft=phtml: // vim: set ai ts=4 sw=4 ft=phtml:
$roming_enable = '';
if (!empty($this->sccpvalues['system_rouminguser'])) {
if ($this->sccpvalues['system_rouminguser']['data'] == 'yes') {
$roming_enable = 'yes';
}
}
?> ?>
<div class="fpbx-container container-fluid"> <div class="fpbx-container container-fluid">
<div class="row"> <div class="row">
@ -18,15 +13,17 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
<div class="display no-border"> <div class="display no-border">
<h1><?php echo _("Extensions (Line)") ?></h1> <h1><?php echo _("Extensions (Line)") ?></h1>
<div id="toolbar-sccp-extension"> <div id="toolbar-sccp-extension">
<a class="btn btn-default" href="config.php?display=extensions&tech_hardware=sccp_custom"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Extension") ?></a> <a class="btn btn-default" href="config.php?display=extensions&amp;tech_hardware=sccp_custom"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Extension") ?></a>
<button id="remove-sccp-extension" class="btn btn-danger btn-remove" data-type="extensions" data-section="sccp-extension" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button>
</div> </div>
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&command=getExtensionGrid&type=extGrid" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name"> <table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&amp;command=getExtensionGrid&amp;type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name">
<thead> <thead>
<tr> <tr>
<!-- <th data-checkbox="true"></th> -->
<th data-sortable="true" data-field="name"><?php echo _('Extension') ?></th> <th data-sortable="true" data-field="name"><?php echo _('Extension') ?></th>
<th data-sortable="true" data-field="label"><?php echo _('Display Name') ?></th> <th data-sortable="true" data-field="label"><?php echo _('Display Name') ?></th>
<th data-sortable="true" data-field="mac"><?php echo _('Device') ?></th>
<th data-sortable="true" data-field="line_status" class="text-center"><?php echo _('Status | Active') ?></th>
<th data-field="actions" data-formatter="DispayPhoneActionsKeyFormatter"><?php echo _('Actions') ?></th> <th data-field="actions" data-formatter="DispayPhoneActionsKeyFormatter"><?php echo _('Actions') ?></th>
</tr> </tr>
</thead> </thead>
@ -37,14 +34,6 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
</div> </div>
<script> <script>
function DispayPhoneActionsKeyFormatter(value, row, index) { function DispayPhoneActionsKeyFormatter(value, row, index) {
var exp_dev = '';
var rmn_dev = '<?php echo $roming_enable ?>';
exp_dev += '<a href="config.php?display=extensions&amp;extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;';
exp_dev += '<a class="clickable delete" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
if (rmn_dev == 'yes') {
exp_dev += '<a href="config.php?display=sccp_phone&amp;tech_hardware=r_user&amp;ru_id=' + row['name'] + '"><i class="fa fa-bicycle"></i></a> &nbsp;';
}
return exp_dev;
return '<a href="config.php?display=extensions&amp;extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;<a class="clickable delete" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>'; return '<a href="config.php?display=extensions&amp;extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;<a class="clickable delete" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
} }
</script> </script>

View file

@ -12,18 +12,15 @@
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="display no-border"> <div class="display no-border">
<h1><?php echo _("Device SCCP Phone") ?></h1> <h1><?php echo _("Device Phone") ?></h1>
<div id="toolbar-sccp-phone"> <div id="toolbar-sccp-phone">
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a> <a class="btn btn-default" href="config.php?display=sccp_phone&amp;tech_hardware=cisco"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<button id="remove-sccp-phone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled> <button id="remove-sccp-phone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span> <i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button> </button>
<button name="cr_sccp_phone_xml" class="btn sccp_update btn-default" data-id="create-cnf"> <button name="cr_sccp_phone_xml" class="btn sccp_update btn-default" data-id="create-cnf">
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Create CNF') ?></span> <i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Create CNF') ?></span>
</button> </button>
<button name="update_button_label" class="btn sccp_update btn-default" data-id="update_button_label">
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Update Button label') ?></span>
</button>
<button name="reset_sccp_phone" class="btn sccp_update btn-default" data-id="reset_dev"> <button name="reset_sccp_phone" class="btn sccp_update btn-default" data-id="reset_dev">
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Device') ?></span> <i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Device') ?></span>
</button> </button>
@ -31,19 +28,16 @@
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Token Device') ?></span> <i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Token Device') ?></span>
</button> </button>
</div> </div>
<table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp" <table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="table-sip" data-id="mac">
data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sccp" data-maintain-selected="true"
data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true"
data-search="true" class="table table-striped ext-list" id="table-sccp" data-id="name">
<thead> <thead>
<tr> <tr>
<th data-checkbox="true"></th> <th data-checkbox="true"></th>
<th data-sortable="true" data-field="name"><?php echo _('Device ID') ?></th> <th data-sortable="true" data-field="mac"><?php echo _('Device SEP ID') ?></th>
<th data-sortable="true" data-field="description"><?php echo _('Device Description') ?></th> <th data-sortable="true" data-field="description"><?php echo _('Device Descriptions') ?></th>
<th data-sortable="true" data-formatter="DispayTypeFormatter" data-field="type"><?php echo _('Device type') ?></th> <th data-sortable="true" data-formatter="DispayTypeFormatter" data-field="type"><?php echo _('Device type') ?></th>
<th data-sortable="true" data-field="button" data-formatter="LineFormatter"><?php echo _('Line') ?></th> <th data-sortable="false" data-field="button" data-formatter="LineFormatter"><?php echo _('Line') ?></th>
<th data-sortable="true" data-field="status"><?php echo _('Status') ?></th> <th data-sortable="false" data-field="status"><?php echo _('Status') ?></th>
<th data-sortable="true" data-field="address"><?php echo _('Address') ?></th> <th data-sortable="false" data-field="address"><?php echo _('Address') ?></th>
<th data-field="actions" data-formatter="DispayDeviceActionsKeyFormatter"><?php echo _('Actions') ?></th> <th data-field="actions" data-formatter="DispayDeviceActionsKeyFormatter"><?php echo _('Actions') ?></th>
</tr> </tr>
</thead> </thead>
@ -57,13 +51,8 @@
function DispayTypeFormatter(value, row, index) { function DispayTypeFormatter(value, row, index) {
var exp_model = value; var exp_model = value;
if (row['addon'] !== null ) { if (row['addon'] !== null ) {
var posd = row['addon'].indexOf(';');
if (posd >0) {
exp_model += ' + 2x ' + row['addon'].substring(0, posd);
} else {
exp_model += ' + ' + row['addon']; exp_model += ' + ' + row['addon'];
} }
}
return exp_model; return exp_model;
} }
@ -82,10 +71,8 @@
} }
return exp_model; return exp_model;
} }
function LineFormatter(value, row, index) { function LineFormatter(value, row, index) {
if (value === null) {
return '-- EMPTY --';
}
var data = value.split(";"); var data = value.split(";");
result = ''; result = '';
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {

View file

@ -1,33 +1,23 @@
<div id="toolbar-sccp-rnav"> <div id="toolbar-sccpbnav">
<a class="btn btn-default" href="config.php?display=sccp_phone#sccpdevice"> <a href="config.php?display=sccp_phone#sccpdevice" class = "btn btn-default"><i class="fa fa-list"></i>&nbsp;<?php echo _("List Device")?></a>
<i class="fa fa-list"></i>&nbsp; <a href="config.php?display=sccp_phone&amp;tech_hardware=cisco" class = "btn btn-default"><i class="fa fa-plus"></i>&nbsp;<?php echo _("Add Device")?></a>
<?php echo _("List Device")?>
</a>
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco">
<i class="fa fa-plus">&nbsp;</i>
<?php echo _("Add Device")?>
</a>
</div> </div>
<table id="sccpnavgrid" <table id="sccpnavgrid"
data-search="true" data-search="true"
data-toolbar="#toolbar-sccp-rnav" data-toolbar="#toolbar-sccpnav"
data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp" data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=sccp"
data-cache="false" data-cache="false"
data-toggle="table" data-toggle="table"
class="table"> class="table">
<thead> <thead>
<tr> <tr>
<th data-sortable="true" data-field="name"><?php echo _('SEP ID')?></th> <th data-sortable="true" data-field="mac"><?php echo _('SEP ID') ?></th>
<th data-sortable="true" data-field="description"><?php echo _('Descriptions') ?></th> <th data-sortable="true" data-field="description"><?php echo _('Descriptions') ?></th>
</tr> </tr>
</thead> </thead>
</table> </table>
<script type="text/javascript"> <script type="text/javascript">
$("#sccpnavgrid").on('click-row.bs.table',function(e,row,elem){ $("#sccpnavgrid").on('click-row.bs.table',function(e,row,elem){
if (row['new_hw'] == 'Y' ) { window.location = '?display=sccp_phone&tech_hardware=cisco&id='+row['mac'];
window.location = '?display=sccp_phone&tech_hardware=cisco&new_id=' +row['name'] +'&' +row['type'];
} else {
window.location = '?display=sccp_phone&tech_hardware=cisco&id='+row['name'];
};
}) })
</script> </script>

View file

@ -1,92 +0,0 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
// vim: set ai ts=4 sw=4 ft=phtml:
?>
<div class="fpbx-container container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="display no-border">
<h1><?php echo _("Device SIP Phone") ?></h1>
<div id="toolbar-sccp-sphone">
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco-sip"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<button id="remove-sccp-sphone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button>
<button name="cr_sip_phone_xml" class="btn sccp_update btn-default" data-id="create-cnf">
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Create CNF') ?></span>
</button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-sphone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=cisco-sip"
data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true"
data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true"
data-search="true" class="table table-striped ext-list" id="table-sip" data-id="name">
<thead>
<tr>
<th data-checkbox="true"></th>
<th data-sortable="true" data-field="name"><?php echo _('Device ID') ?></th>
<th data-sortable="true" data-field="description"><?php echo _('Device Description') ?></th>
<th data-sortable="true" data-formatter="DispayTypeFormatter" data-field="type"><?php echo _('Device type') ?></th>
<th data-sortable="true" data-field="button" data-formatter="LineFormatter"><?php echo _('Line') ?></th>
<th data-sortable="true" data-field="status"><?php echo _('Status') ?></th>
<th data-sortable="true" data-field="address"><?php echo _('Address') ?></th>
<th data-field="actions" data-formatter="DispayDeviceActionsKeyFormatterS"><?php echo _('Actions') ?></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<script>
function DispayTypeFormatter(value, row, index) {
var exp_model = value;
if (row['addon'] !== null ) {
var posd = row['addon'].indexOf(';');
if (posd >0) {
exp_model += ' + 2x ' + row['addon'].substring(0, posd);
} else {
exp_model += ' + ' + row['addon'];
}
}
return exp_model;
}
function DispayDeviceActionsKeyFormatterS(value, row, index) {
var exp_model = '';
if (row['new_hw'] == "Y") {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco-sip&new_id=' + row['name'] + '&type='+ row['type'];
if (row['addon'] !== null ) {
exp_model += '&addon='+ row['addon'];
}
exp_model += '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
} else {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco-sip&id=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="hardware" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
}
return exp_model;
}
function LineFormatter(value, row, index) {
if (value === null) {
return '-- EMPTY --';
}
var data = value.split(";");
result = '';
for (var i = 0; i < data.length; i++) {
var val = data[i].split(',');
if (val[0] === 'line') {
result = result + val[1] + '<br>';
}
}
return result;
}
</script>

View file

@ -12,12 +12,8 @@
<?php <?php
// originally, this was populated by sccpgeneral.xml but that should be static echo $this->ShowGroup('sccp_srst',1);
// now will populate from the db defaults. // echo $this->ShowGroup('sccp_dev_time',1);
$defaultVals = $this->getTableDefaults('sccpdevice', true);
echo $this->showGroup('sccp_srst', 1);
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'sccpdevice', $defaultVals);
?> ?>
</form> </form>

View file

@ -6,57 +6,46 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
$def_val = null; $def_val = null;
$dev_id = null; $dev_id = null;
$audio_codecs = $this->getCodecs('audio'); $sccp_codec = $this->getCodecs('audio', true);
$video_codecs = $this->getCodecs('video'); $sccp_disalow_def = $this->extconfigs->getextConfig('sccpDefaults','disallow');
$sccp_disallow_def = $this->sccpvalues['disallow']['data']; $sccp_disalow = $sccp_disalow_def;
$sys_disallow_def = $this->sccpvalues['disallow']['systemdefault'];
if (empty($sccp_disallow_def)) { if (!empty($_REQUEST['id'])) {
$sccp_disallow_def = $sys_disallow_def; $dev_id = $_REQUEST['id'];
$db_res = $this->dbinterface->get_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
if (!empty($db_res['allow'])) {
$i = 1;
foreach(explode(';', $db_res['allow']) as $c){
$codec_list[$c] = $i;
$i ++;
} }
foreach ($sccp_codec as $c => $v) {
if (!isset($codec_list[$c])) {
$codec_list[$c] = false;
}
}
}
if (!empty($db_res['disallow'])) {
$sccp_disalow = $db_res['disallow'];
}
} else {
$codec_list = $sccp_codec;
}
?> ?>
<!-- Codec selection is at the line level - this page sets site defaults based on chan-sccp defaults -->
<form autocomplete="off" name="frm_codec" id="frm_codec" class="fpbx-submit" action="" method="post"> <form autocomplete="off" name="frm_codec" id="frm_codec" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="codecform"> <input type="hidden" name="category" value="codecform">
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">
<div class="section" data-id="sccp_dcodecs">
<!--Codec disallow-->
<div class="element-container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="sccp_disallow"><?php echo _("Disallow") ?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="sccp_disallow"></i>
</div>
<div class="col-md-9 radioset">
<input id="sccp_disallow" type="text" name="sccp_disallow" value="<?php echo $sccp_disallow_def ?>">
<label for="sccp_disallow"><?php echo _("Recomended default: all") ?></label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="sccp_disallow-help" class="help-block fpbx-help-block"><?php echo _("Default : all. If you wish to change (Not Recommended) please enter a semicolon separated list for example: alaw;ulaw;...") ?></span>
</div>
</div>
</div>
<!--END Codec disallow-->
</div>
<!--SCCP Audio Codecs--> <!--SCCP Audio Codecs-->
<div class="section-title" data-for="sccp_acodecs"> <div class="section-title" data-for="sccp_acodecs">
<h3><i class="fa fa-minus"></i><?php echo _("SCCP Audio Codecs ") ?></h3> <h3><i class="fa fa-minus"></i><?php echo _("SCCP Codecs") ?></h3>
</div> </div>
<div class="section" data-id="sccp_acodecs"> <div class="section" data-id="sccp_acodecs">
<!--Codecs--> <!--Codecs-->
<div class="element-container"> <div class="element-container">
@ -65,29 +54,24 @@ if (empty($sccp_disallow_def)) {
<div class="row"> <div class="row">
<div class="form-group"> <div class="form-group">
<div class="col-md-3"> <div class="col-md-3">
<label class="control-label" for="codecw"><?php echo _("Allow") ?></label> <label class="control-label" for="codecw"><?php echo _("SCCP Audio Codecs (allow)") ?></label>
</div> </div>
<div class="col-md-9"> <div class="col-md-9">
<div> <div>
<?php echo show_help(_("These are the default audio codec settings for this site. Unchecked codecs cannot be assigned to extensions. <?php echo show_help(_("This is the default Codec setting for SCCP Device.")) ?>
<br>Order can be changed by dragging and dropping to indicate priority. This priority applies for all extensions
<br>Higher priority enabled codecs are at the top
<br>Precedence for ulaw and alaw, if used, should be set according to your region
<br>If your region uses alaw, it is important that alaw has the highest priority
<br>To return to chan-sccp defaults, uncheck ALL codecs (both Audio and Video)."),"Helpful information",true) ?>
</div> </div>
<?php <?php
$seq = 1; $seq = 1;
echo '<ul class="sortable">'; echo '<ul class="sortable">';
foreach ($audio_codecs as $codec => $codec_state) { foreach ($codec_list as $codec => $codec_state) {
$codec_trans = _($codec); $codec_trans = _($codec);
$codec_checked = $codec_state ? 'checked' : ''; $codec_checked = $codec_state ? 'checked' : '';
echo '<li><a href="#">' echo '<li><a href="#">'
. '<img src="assets/sipsettings/images/arrow_up_down.png" height="16" width="16" border="0" alt="move" style="float:none; margin-left:-6px; margin-bottom:-3px;cursor:move" /> ' . '<img src="assets/sipsettings/images/arrow_up_down.png" height="16" width="16" border="0" alt="move" style="float:none; margin-left:-6px; margin-bottom:-3px;cursor:move" /> '
. '<input type="checkbox" ' . '<input type="checkbox" '
. ($codec_checked ? 'value="' . $seq++ . '" ' : '') . ($codec_checked ? 'value="' . $seq++ . '" ' : '')
. 'name="audiocodecs[' . $codec . ']" ' . 'name="voicecodecs[' . $codec . ']" '
. 'id="' . $codec . '" ' . 'id="' . $codec . '" '
. 'class="audio-codecs" ' . 'class="audio-codecs" '
. $codec_checked . $codec_checked
@ -106,57 +90,36 @@ if (empty($sccp_disallow_def)) {
</div> </div>
<!--END Codecs--> <!--END Codecs-->
</div>
<!--END SCCP Audio Codecs-->
<!--SCCP Video Codecs--> <!--Codec disallow-->
<div class="section-title" data-for="sccp_vcodecs">
<h3><i class="fa fa-minus"></i><?php echo _("SCCP Video Codecs ") ?></h3>
</div>
<div class="section" data-id="sccp_vcodecs">
<!--Codecs-->
<div class="element-container"> <div class="element-container">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="row"> <div class="row">
<div class="form-group"> <div class="form-group">
<div class="col-md-3"> <div class="col-md-3">
<label class="control-label" for="codecw"><?php echo _("Allow") ?></label> <label class="control-label" for="sccp_disallow"><?php echo _("Codec Disallow") ?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="sccp_disallow"></i>
</div> </div>
<div class="col-md-9"> <div class="col-md-9 radioset">
<div> <input id="sccp_disallow" type="text" name="sccp_disallow" value="<?php echo $sccp_disalow ?>">
<?php echo show_help(_("These are the default video codec settings for this site.")) ?> <label for="sccp_disallow"><?php echo _("default : " . $sccp_disalow_def) ?></label>
</div> </div>
<?php </div>
$seq = 1; </div>
</div>
</div>
<div class="row">
<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>
</div>
</div>
</div>
<!--END Codec disallow-->
echo '<ul class="sortable">'; <!--END SCCP Audio Codecs-->
// Although classed as video codecs, all stored under allow so name is audiocodecs.
foreach ($video_codecs as $codec => $codec_state) {
$codec_trans = _($codec);
$codec_checked = $codec_state ? 'checked' : '';
echo '<li><a href="#">'
. '<img src="assets/sipsettings/images/arrow_up_down.png" height="16" width="16" border="0" alt="move" style="float:none; margin-left:-6px; margin-bottom:-3px;cursor:move" /> '
. '<input type="checkbox" '
. ($codec_checked ? 'value="' . $seq++ . '" ' : '')
. 'name="audiocodecs[' . $codec . ']" '
. 'id="' . $codec . '" '
. 'class="video-codecs" '
. $codec_checked
. ' />'
. '&nbsp;&nbsp;<label for="' . $codec . '"> '
. '<small>' . $codec_trans . '</small>'
. " </label></a></li>\n";
}
echo '</ul>';
?>
</div>
</div>
</div>
</div>
</div>
<!--END Codecs-->
</div>
<!--END SCCP Video Codecs-->
</div> </div>
</form> </form>

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

@ -5,29 +5,28 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
/*
$data = 'none;';
foreach ($this->get_DialPlanList() as $value) {
$data .= $value['id'].';';
}
if (strlen($data) >0 ){
$data = substr ($data,0,-1);
}
$this->sccpvalues['dial_template'] = array('keyword' => 'dial_template', 'data' => $data, 'type' => '10', 'seq' => '90');
*
*/
?> ?>
<form autocomplete="off" name="frm_device" id="frm_device" class="fpbx-submit" action="" method="post"> <form autocomplete="off" name="frm_device" id="frm_device" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="deviceform"> <input type="hidden" name="category" value="deviceform">
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">
<div class="fpbx-container container-fluid">
<div class="row">
<div class="container">
<h2 style="border:2px solid Tomato;color:Tomato;" ><?php echo _("Warning : Any changes to the device configuration can cause all phones to restart.<br>It is important to read the information on hotline below before using this capability"); ?></h2>
</div>
</div>
</div>
<?php <?php
$def_val_line = $this->getTableDefaults('sccpline'); echo $this->ShowGroup('sccp_dev_config',1);
$def_val_device = $this->getTableDefaults('sccpdevice'); echo $this->ShowGroup('sccp_dev_group_config',1);
echo $this->ShowGroup('sccp_dev_advconfig',1);
//echo $this->showGroup('sccp_dev_config', 1, 'sccpdevice', $def_val_device); echo $this->ShowGroup('sccp_dev_softkey',1);
echo $this->showGroup('sccp_dev_config', 1); echo $this->ShowGroup('sccp_dev_url',1);
echo $this->showGroup('sccp_dev_group_config', 1); echo $this->ShowGroup('sccp_hotline_config',1);
echo $this->showGroup('sccp_dev_advconfig', 1);
echo $this->showGroup('sccp_dev_softkey', 1);
echo $this->showGroup('sccp_hotline_config', 1);
echo $this->showGroup('sccp_qos_config', 1, 'sccpdevice', $def_val_device);
?> ?>
</form> </form>

View file

@ -4,98 +4,59 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
// vim: set ai ts=4 sw=4 ft=phtml:
$test_ami = 0; // print_r($this->sccp_conf_init);
$test_any = 0; // print_r($this->sccpvalues);
global $amp_conf; //print_r('<br><br>');
$driver = $this->FreePBX->Core->getAllDriversInfo(); $driver = $this->FreePBX->Core->getAllDriversInfo();
$core = $this->aminterface->getSCCPVersion(); $core = $this->srvinterface->getSCCPVersion();
$ast_realtime = $this->aminterface->getRealTimeStatus(); $ast_realtime = $this->srvinterface->sccp_realtime_status();
//$ast_realm = (empty($ast_realtime['sccp']) ? '' : 'sccp'); $ast_realm = (empty($ast_realtime['sccp']) ? '':'sccp');
// if there are multiple connections, this will only return the first.
foreach ($ast_realtime as $key => $value) { foreach ($ast_realtime as $key => $value) {
if (empty($ast_realm)) { if (empty($ast_realm)) {
if ($value['status'] === 'OK') { if ($value['status'] == 'OK') {
$ast_realm = $key; $ast_realm = $key;
} }
} }
} }
$conf_realtime = $this->extconfigs->validate_RealTime($ast_realm); $conf_realtime = $this->extconfigs->validate_RealTime($ast_realm);
$db_Schema = $this->dbinterface->validate();
$mysql_info = $this->dbinterface->get_db_sysvalues();
$compatible = $this->aminterface->get_compatible_sccp();
$info = array(); $info = array();
$info['srvinterface'] = $this->srvinterface->info();
//$info['srvinterface'] = $this->srvinterface->info();
$moduleXml = simplexml_load_file("{$amp_conf['AMPWEBROOT']}/admin/modules/sccp_manager/module.xml");
$info['extconfigs'] = $this->extconfigs->info(); $info['extconfigs'] = $this->extconfigs->info();
$info['dbinterface'] = $this->dbinterface->info(); $info['dbinterface'] = $this->dbinterface->info();
$info['aminterface'] = $this->aminterface->info(); $db_Schema = $this->dbinterface->validate();
$info['XML'] = $this->xmlinterface->info(); $info['XML'] = $this->xmlinterface->info();
$info['sccp_class'] = $driver['sccp']; $info['sccp_class'] = $driver['sccp'];
$info['Core_sccp'] = array('Version' => $core['Version'], $info['Core_sccp'] = array('Version' => $core['Version'], 'about'=> 'Sccp ver.'. $core['Version'].' r'.$core['vCode']. ' Revision :'. $core['RevisionNum']. ' Hash :'. $core['RevisionHash']);
'about' => "Sccp ver: {$core['Version']} r{$core['vCode']} Revision: {$core['RevisionNum']} Hash: {$core['RevisionHash']}");
$capabilityArray = array( "park", "pickup", "realtime", "video", "conference", "dirtrfr", "feature_monitor", "functions", "manager_events",
"devicestate", "devstate_feature", "dynamic_speeddial", "dynamic_speeddial_cid", "experimental", "debug");
$info['chan-sccp build info'] = array('Version' => $core['Version'], 'about' => 'Following options NOT built: ' . implode('; ',array_diff($capabilityArray, $core['buildInfo'])));
$info['Asterisk'] = array('Version' => FreePBX::Config()->get('ASTVERSION'), 'about'=> 'Asterisk.'); $info['Asterisk'] = array('Version' => FreePBX::Config()->get('ASTVERSION'), 'about'=> 'Asterisk.');
if (!empty($this->sccpvalues['SccpDBmodel'])) { if (!empty($this->sccpvalues['SccpDBmodel'])) {
$info['DB Model'] = array('Version' => $this->sccpvalues['SccpDBmodel']['data'], 'about'=> 'SCCP DB Configure'); $info['DB Model'] = array('Version' => $this->sccpvalues['SccpDBmodel']['data'], 'about'=> 'SCCP DB Configure');
} }
if (!empty($this->sccpvalues['tftp_rewrite'])) {
exec('in.tftpd -V', $tftpInfo); if ($this->sccpvalues['tftp_rewrite']['data'] == 'pro') {
$info['TFTP Server'] = array('Version' => 'Not Found', 'about' => 'Mapping not available');
if (isset($tftpInfo[0])) {
$tftpInfo = explode(',',$tftpInfo[0]);
$info['TFTP Server'] = array('Version' => $tftpInfo[0], 'about' => 'Mapping not available');
$tftpInfo[1] = trim($tftpInfo[1]);
if ($tftpInfo[1] == 'with remap') {
$info['TFTP Server'] = array('Version' => $tftpInfo[0], 'about' => $tftpInfo[1]);
}
}
if (!empty($this->sccpvalues['tftp_rewrite']['data'])) {
switch ($this->sccpvalues['tftp_rewrite']['data']) {
case 'custom':
case 'pro':
$info['Provision_SCCP'] = array('Version' => 'base', 'about'=> 'Provision Sccp enabled'); $info['Provision_SCCP'] = array('Version' => 'base', 'about'=> 'Provision Sccp enabled');
break;
default:
if ($tftpInfo[1] == 'with remap') {
$info['TFTP_Mapping'] = array('Version' => 'off', 'about' => "TFTP mapping is available but the mapping file is not included in tftpd-hpa default settings.<br>
To enable Provision mode, add option <br>
-m /etc/asterisk/sccpManagerRewrite.rules <br>
to the tftpd defaults, (location dependant on the system), and restart the tftpd server");
} else { } else {
$info['TFTP_Mapping'] = array('Version' => 'off', 'about' => "Mapping capability is not built into the TFTP server. To enable Provision, upgrade the TFTP server."); $info['TFTP_Rewrite'] = array('Version' => 'base', 'about'=> 'Rewrite Supported');
}
break;
} }
} }
$info['Сompatible'] = array('Version' => $this->srvinterface->get_compatible_sccp(), 'about'=> 'Ok');
// Finished testing tftp server options
$info['Сompatible'] = array('Version' => $compatible, 'about' => 'Ok');
if (!empty($this->sccpvalues['SccpDBmodel'])) { if (!empty($this->sccpvalues['SccpDBmodel'])) {
if ($compatible > $this->sccpvalues['SccpDBmodel']['data']) { if ($this->srvinterface->get_compatible_sccp()> $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' => (($compatible == $db_Schema ) ? 'Ok' : 'Incompatible Version')); $info['DB_Schema'] = array('Version' => $db_Schema, 'about'=> (($this->srvinterface->get_compatible_sccp() == $db_Schema ) ? 'Ok' : 'Incompatable Version'));
} }
if (empty($ast_realtime)) { if (empty($ast_realtime)) {
$info['RealTime'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> No RealTime connections found</div>'); $info['RealTime'] = array('Version' => 'Error', 'about'=> '<div class="alert signature alert-danger"> No found Real Time connections</div>');
} else { } else {
$rt_info = ''; $rt_info = '';
$rt_sccp = 'Failed'; $rt_sccp = 'Failed';
@ -103,26 +64,20 @@ if (empty($ast_realtime)) {
if ($key == $ast_realm) { if ($key == $ast_realm) {
if ($value['status'] == 'OK') { if ($value['status'] == 'OK') {
$rt_sccp = 'TEST OK'; $rt_sccp = 'TEST OK';
$rt_info .= '<div> Using SCCP connection found to database: '.$value['realm'] . ' with connector: ['. $key .']</div>'; $rt_info .= 'SCCP conettions found';
} else { } else {
$rt_sccp = 'SCCP ERROR'; $rt_sccp = 'SCCP ERROR';
$rt_info .= '<div class="alert signature alert-danger"> Error : '. $value['message']. '</div>'; $rt_info .= '<div class="alert signature alert-danger"> Error : '. $value['message']. '</div>';
} }
} else if ($value['status'] == 'ERROR') { } else if ($value['status'] == 'ERROR') {
$rt_info .= '<div> No connector found for [' . $key . '] : ' . $value['message'] . '</div>'; $rt_info .= '<div> Found error in realtime sectoin ['.$key.'] : '. $value['message']. '</div>';
} elseif ($value['status'] == 'OK') {
$rt_info .= '<div> Alternative connector found to database '.$value['realm'] . ' with connector: ['. $key . '] </div>';
} }
} }
$info['RealTime'] = array('Version' => $rt_sccp, 'about'=> $rt_info); $info['RealTime'] = array('Version' => $rt_sccp, 'about'=> $rt_info);
} }
// There are potential issues with string Type Declarations in PHP 5.
$info['PHP'] = array('Version' => phpversion(), 'about' => version_compare(phpversion(), '7.0.0', '>' ) ? 'OK' : 'PHP 7 Preferred - Please upgrade if possible');
$mariaDbInfo = exec('mysql -V');
$info['MariaDb'] = array('Version' => explode(" ",$mariaDbInfo)[3], 'about' => $mariaDbInfo);
if (empty($conf_realtime)) { if (empty($conf_realtime)) {
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> Realtime configuration was not found</div>'); $info['ConfigsRealTime'] = array('Version' => 'Error', 'about'=> '<div class="alert signature alert-danger"> No found Real Time Configs</div>');
} else { } else {
$rt_info = ''; $rt_info = '';
foreach ($conf_realtime as $key => $value) { foreach ($conf_realtime as $key => $value) {
@ -134,68 +89,42 @@ if (empty($conf_realtime)) {
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about'=> $rt_info); $info['ConfigsRealTime'] = array('Version' => 'Error', 'about'=> $rt_info);
} }
} }
// $mysql_info //global $amp_conf;
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', print_r("<br> Request:<br><pre>");
'Step 2: And add the following line below [mysqld] as shown below <br> [mysqld] <br>group_concat_max_len = 4096 or more', $json = '';
'Step 3: Save and restart <br> systemctl restart mariadb.service<br> Or <br> service mysqld restart'); print_r("<br>");
} // print_r($conf_realtime);
print_r("<br>");
print_r("<br>");
print_r($this->dbinterface->validate());
// print_r("DIRECT START");
// print_r($this->sccpvalues['ccm_address']);
print_r("<br>");
// print_r($this->getIP_information2());
// print_r($this->srvinterface->getеtestChanSCCP_GlablsInfo());
// print_r($this->sccp_metainfo);
print("</pre>");
// $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK');
// print_r('<br>');
// print_r(timezone_identifiers_list());
// print_r('<br>');
// Check Time Zone compatibility //print_r($this->dbinterface->info());
$conf_tz = $this->sccpvalues['ntp_timezone']['data']; */
$cisco_tz = $this->extconfigs->getExtConfig('sccp_timezone', $conf_tz);
if ($cisco_tz['offset'] == 0) {
if (!empty($conf_tz)) {
$tmp_dt = new DateTime(null, new DateTimeZone($conf_tz));
$tmp_ofset = $tmp_dt->getOffset();
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');
}
}
}
if (!empty($this->info_warning)) {
?>
<div class="fpbx-container container-fluid">
<div class="row">
<div class="container">
<h2 style="border:2px solid Tomato;color:Tomato;" >Sccp Manager Warning</h2>
<div class="table-responsive">
<br> There are Warning in the SCCP Module:<br><pre>
<?php
foreach ($this->info_warning as $key => $value) {
echo '<h3>' . $key . '</h3>';
if (is_array($value)) {
echo '<li>' . _(implode('</li><li>', $value)) . '</li>';
} else {
echo '<li>' . _($value) . '</li>';
}
echo '<br>';
}
?>
</pre>
<br><h4 style="border:2px solid Tomato;color:Green;" > Check these problems before continuing to work.</h4> <br>
</div>
</div>
</div>
</div>
<br>
<?php
}
if (!empty($this->class_error)) { if (!empty($this->class_error)) {
?> ?>
<div class="fpbx-container container-fluid"> <div class="fpbx-container container-fluid">
<div class="row"> <div class="row">
<div class="container"> <div class="container">
<h2 style="border:2px solid Tomato;color:Tomato;" >Diagnostic information about SCCP Manager errors</h2> <h2 style="border:2px solid Tomato;color:Tomato;" >Sccp Manager Error</h2>
<div class="table-responsive"> <div class="table-responsive">
<br> There is an error in the :<br><pre> <br> There are Error in the SCCP Module:<br><pre>
<?php print_r($this->class_error); ?> <?php print_r($this->class_error); ?>
</pre> </pre>
<br> Correct these problems before continuing to work. <br> <br> Correct these problems before continuing to work. <br>
<br><h3 style="border:2px solid Tomato;color:Green;" > Open 'SCCP Connectivity' -> Server Config' to change global settings</h3> <br> <br><h3 style="border:2px solid Tomato;color:Green;" > Open 'SCCP Conectivity -> Server Config' to change global settings</h3> <br>
</div> </div>
</div> </div>
</div> </div>
@ -205,7 +134,7 @@ if (!empty($this->class_error)) {
<div class="fpbx-container container-fluid"> <div class="fpbx-container container-fluid">
<div class="row"> <div class="row">
<div class="container"> <div class="container">
<h2>Sccp Manager v<?php print_r((string) $moduleXml->version); ?> Info </h2> <h2>Sccp Manager V.<?php print_r($this->sccp_manager_ver); ?> Info </h2>
<div class="table-responsive"> <div class="table-responsive">
<table class="table"> <table class="table">
<thead> <thead>
@ -229,4 +158,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

@ -14,20 +14,13 @@
<!-- div id="toolbar-all"> <!-- div id="toolbar-all">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".new_network"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".new_network"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button>
</div --> </div -->
<div class="fpbx-container container-fluid">
<div class="row">
<div class="container">
<h2 style="border:2px solid Tomato;color:Tomato;" ><?php echo _("Warning : Any changes to the server configuration can cause all phones to restart"); ?></h2>
</div>
</div>
</div>
<?php <?php
$def_val_device = $this->getTableDefaults('sccpdevice'); echo $this->ShowGroup('sccp_general',1);
echo $this->ShowGroup('sccp_dev_time_s',1);
echo $this->showGroup('sccp_general', 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_extpath_config', 1); echo $this->ShowGroup('sccp_extpath_config',1);
?> ?>
@ -39,12 +32,12 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="gridSystemModalLabel_Net">Device</h4> <h4 class="modal-title" id="gridSystemModalLabel_Net">Add New Network</h4>
</div> </div>
<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>
@ -56,3 +49,4 @@
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,14 +0,0 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
?>
<form autocomplete="off" name="frm_url" id="frm_url" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value=" deviceurlform">
<input type="hidden" name="Submit" value="Submit">
<?php
echo $this->showGroup('sccp_dev_url', 1,);
?>
</form>