Compare commits
421 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5752d9f393 | ||
|
|
b28ec36e20 | ||
|
|
9519f0243a | ||
|
|
f5e51a52b7 | ||
|
|
4cf414e995 | ||
|
|
fb66f0e239 | ||
|
|
60e973b4a6 | ||
|
|
2ea478c117 | ||
|
|
fbbbefb25e | ||
|
|
e7bc2492ef | ||
|
|
f7e13505e9 | ||
|
|
b752640f81 | ||
|
|
da62493384 | ||
|
|
722285bc3d | ||
|
|
09acfd097d | ||
|
|
bd84870c6b | ||
|
|
60777bf3e3 | ||
|
|
1c5fa400ae | ||
|
|
a8e3dbdd30 | ||
|
|
381fe184bd | ||
|
|
e08ad858f5 | ||
|
|
ddd10f3ca9 | ||
|
|
d7ad8397da | ||
|
|
4e17791fa1 | ||
|
|
5796297bae | ||
|
|
546de5add1 | ||
|
|
b1769e6378 | ||
|
|
360ceea6cd | ||
|
|
0dec44161f | ||
|
|
6808154c3a | ||
|
|
e25fab14ff | ||
|
|
e088deee12 | ||
|
|
8051c30987 | ||
|
|
5c4848442a | ||
|
|
24cc8be3a7 | ||
|
|
4f468517e7 | ||
|
|
c3089d6d7f | ||
|
|
12cb1307ba | ||
|
|
3ce99c94d8 | ||
|
|
70b318019e | ||
|
|
82bd9cbaef | ||
|
|
34d6e976f2 | ||
|
|
6681a07c96 | ||
|
|
8013474e75 | ||
|
|
88f4fba2c0 | ||
|
|
a8dfaac9bb | ||
|
|
745ef87fea | ||
|
|
048077fce8 | ||
|
|
fa9f28aac3 | ||
|
|
1f73ade196 | ||
|
|
8c725874d7 | ||
|
|
b39983c690 | ||
|
|
8f91e2c6e6 | ||
|
|
463ab79add | ||
|
|
198b3fffa8 | ||
|
|
21f9123ece | ||
|
|
3381ad189b | ||
|
|
b9ca187d30 | ||
|
|
2d9a272589 | ||
|
|
a68ac219d3 | ||
|
|
4833638c8e | ||
|
|
ad698eb5c0 | ||
|
|
6cf10cc13b | ||
|
|
378d3b2ff7 | ||
|
|
354e3a2f47 | ||
|
|
ce365acdf2 | ||
|
|
84b65309a3 | ||
|
|
89b1a1cd3f | ||
|
|
8953484e1f | ||
|
|
8268bbf81a | ||
|
|
10a0ddb123 | ||
|
|
8d412ce4ae | ||
|
|
61beae544e | ||
|
|
c473c62ada | ||
|
|
fe780283a8 | ||
|
|
7d4c7c5e50 | ||
|
|
f4aa2eda1c | ||
|
|
03206f8384 | ||
|
|
c0e7a3bc0a | ||
|
|
9a6bff2d27 | ||
|
|
0bc2eed76b | ||
|
|
1489968b9e | ||
|
|
3737462fa7 | ||
|
|
380a9a52f2 | ||
|
|
eb73d61684 | ||
|
|
bca54bddff | ||
|
|
01a703f5cf | ||
|
|
90ebbd20f8 | ||
|
|
5586a896cb | ||
|
|
f8f447b89c | ||
|
|
64ab034443 | ||
|
|
88409eb6c8 | ||
|
|
9470072e7c | ||
|
|
00a83d65ca | ||
|
|
00781216d9 | ||
|
|
a395120fac | ||
|
|
c2fb5f4492 | ||
|
|
ef944e37c3 | ||
|
|
2830dfeeb1 | ||
|
|
a2217e6e37 | ||
|
|
1b979222fa | ||
|
|
04738f0657 | ||
|
|
ec9d1cc720 | ||
|
|
2b90440df7 | ||
|
|
aca38997c7 | ||
|
|
2e990783bb | ||
|
|
e69db63dd2 | ||
|
|
c674fdea96 | ||
|
|
0d2bfdbecd | ||
|
|
48ace0574a | ||
|
|
5bd1455e91 | ||
|
|
67f2a8b2a3 | ||
|
|
2dc613f063 | ||
|
|
6e97ce5fde | ||
|
|
2d39f838b6 | ||
|
|
3a9d422252 | ||
|
|
a0d7c81738 | ||
|
|
1a09d4df1e | ||
|
|
63679cd49c | ||
|
|
8f6c7be74e | ||
|
|
570171bce0 | ||
|
|
1bea598588 | ||
|
|
43677651df | ||
|
|
c209932eb5 | ||
|
|
3a1a89fdb8 | ||
|
|
fbb61be0f1 | ||
|
|
b7d5851643 | ||
|
|
90729f74aa | ||
|
|
031ef0087e | ||
|
|
91d6ad2f48 | ||
|
|
662e2a4aa3 | ||
|
|
a40c110efe | ||
|
|
0b03d58c09 | ||
|
|
481c8929a9 | ||
|
|
8dc1175b37 | ||
|
|
b30340eab5 | ||
|
|
31e8a48e12 | ||
|
|
0f352eeb59 | ||
|
|
14215b64ca | ||
|
|
6567923ff1 | ||
|
|
b3fc62caa7 | ||
|
|
f1cc0f1bf6 | ||
|
|
b133b2bc3a | ||
|
|
2c8842d21a | ||
|
|
6775b6686b | ||
|
|
4ffcfaf6b7 | ||
|
|
74ddfcd413 | ||
|
|
7ab6eba556 | ||
|
|
28bb5a63da | ||
|
|
ab7b295b87 | ||
|
|
d8d2f946ce | ||
|
|
43a656cebc | ||
|
|
e313b9da3f | ||
|
|
3ea36f5459 | ||
|
|
b7a64e854f | ||
|
|
e8cabfbd1a | ||
|
|
1338336dd9 | ||
|
|
49fd6a5c91 | ||
|
|
d8287157bd | ||
|
|
85e77ab34c | ||
|
|
40cace04e4 | ||
|
|
97c1f6d5d4 | ||
|
|
60f7d74cf4 | ||
|
|
a267f075c8 | ||
|
|
d432ff7a05 | ||
|
|
472d73489e | ||
|
|
fb25407611 | ||
|
|
f2d15ebd5e | ||
|
|
1f910c7e97 | ||
|
|
d43570b471 | ||
|
|
b753482898 | ||
|
|
646a975a5f | ||
|
|
48a2793886 | ||
|
|
b659f55170 | ||
|
|
4e9dcb09f3 | ||
|
|
a1e52d01a4 | ||
|
|
26f750296a | ||
|
|
80cf629c0f | ||
|
|
75858d7cc1 | ||
|
|
97cfa12fea | ||
|
|
312229d4cf | ||
|
|
83d54c0fad | ||
|
|
4a6caf1eac | ||
|
|
4151b4fdae | ||
|
|
215cacae41 | ||
|
|
3a53e9ac8b | ||
|
|
3475efc2c6 | ||
|
|
a4aa4eb03b | ||
|
|
97c1395eb1 | ||
|
|
65f3a6cd37 | ||
|
|
4b40811d60 | ||
|
|
be5890e61f | ||
|
|
477eb69146 | ||
|
|
2898f5e3c9 | ||
|
|
b3b3858965 | ||
|
|
d9fa0ad8bf | ||
|
|
3d69090767 | ||
|
|
5c4bbaabba | ||
|
|
913cbd14c4 | ||
|
|
d7fd77dfe8 | ||
|
|
1b32e0977e | ||
|
|
a4f8fa4600 | ||
|
|
ef77bce159 | ||
|
|
2ffe4028e6 | ||
|
|
6e26428b1d | ||
|
|
2b709c9037 | ||
|
|
651f3adb44 | ||
|
|
5a184ededb | ||
|
|
248abe6cb7 | ||
|
|
bf7556ed81 | ||
|
|
ffaab80ee2 | ||
|
|
30cbe1ba95 | ||
|
|
2a98d8cfdb | ||
|
|
71fef35ebd | ||
|
|
ce115dab8b | ||
|
|
d966bfa303 | ||
|
|
ba4dfb2f0d | ||
|
|
acb0141d99 | ||
|
|
6429b6add9 | ||
|
|
11da8356a5 | ||
|
|
945e77f9bc | ||
|
|
f929267910 | ||
|
|
2e5028f438 | ||
|
|
acdf777bcc | ||
|
|
8b06495938 | ||
|
|
fea6d88aa5 | ||
|
|
5af3c7d2eb | ||
|
|
47522b4a25 | ||
|
|
4ad33852fd | ||
|
|
6fa4c8626e | ||
|
|
c1aab666b3 | ||
|
|
44e0846761 | ||
|
|
a6a9850a3c | ||
|
|
b15729a340 | ||
|
|
a493165153 | ||
|
|
2809b0796e | ||
|
|
503f227b98 | ||
|
|
b6dfb51993 | ||
|
|
6ecc981a02 | ||
|
|
dd9888e55e | ||
|
|
7dc4438ad8 | ||
|
|
93fe6d45e1 | ||
|
|
927186151e | ||
|
|
dcd9c75886 | ||
|
|
02f0b401d0 | ||
|
|
e50c32a1ac | ||
|
|
3b91ad2188 | ||
|
|
01b5e9e868 | ||
|
|
64624fa597 | ||
|
|
3ec730b71b | ||
|
|
ace4945eb0 | ||
|
|
b7766fcf64 | ||
|
|
063556f898 | ||
|
|
d1e72714af | ||
|
|
22d845ced3 | ||
|
|
f882a66eb4 | ||
|
|
ee419ae193 | ||
|
|
f74978c1b3 | ||
|
|
7721e7a8a0 | ||
|
|
b1a7fe3510 | ||
|
|
4fcf16b317 | ||
|
|
d8cc6f3ba1 | ||
|
|
bab83c7e3e | ||
|
|
d83c3ab93f | ||
|
|
4da4f391d6 | ||
|
|
838ff633aa | ||
|
|
a6a7b517d1 | ||
|
|
3a03815daf | ||
|
|
fb9ea64134 | ||
|
|
97c4c93fb6 | ||
|
|
852156878d | ||
|
|
0e36336033 | ||
|
|
9be50bab5c | ||
|
|
e841c7cb40 | ||
|
|
ff1c451fe1 | ||
|
|
4d7463f341 | ||
|
|
9daf307081 | ||
|
|
cdac0f0276 | ||
|
|
d7e196cf21 | ||
|
|
ec79925661 | ||
|
|
d422776ad6 | ||
|
|
4e15376181 | ||
|
|
cb890aa264 | ||
|
|
95cd7b4d9b | ||
|
|
c271dbf3c2 | ||
|
|
0692b3cd6a | ||
|
|
def22582e3 | ||
|
|
649b717ce7 | ||
|
|
34a7f6a163 | ||
|
|
be8aa5cd92 | ||
|
|
55285cf625 | ||
|
|
2dad547e3d | ||
|
|
aad6fa31c6 | ||
|
|
fd21a94821 | ||
|
|
310256dc5d | ||
|
|
d6cfa86978 | ||
|
|
510b4259ac | ||
|
|
de3c58178b | ||
|
|
57bc13f782 | ||
|
|
f36c224f87 | ||
|
|
efdf2d0469 | ||
|
|
afe3382aed | ||
|
|
82772eed71 | ||
|
|
5df918a04b | ||
|
|
416cedc425 | ||
|
|
a146cd2354 | ||
|
|
b420f35ad2 | ||
|
|
815b7dbd2a | ||
|
|
790b5f7949 | ||
|
|
b2ee6ad853 | ||
|
|
922ae3eaf7 | ||
|
|
218e1c66ee | ||
|
|
4c40809071 | ||
|
|
5e5cf3ffda | ||
|
|
5e7bdbe40b | ||
|
|
8c4b0ce240 | ||
|
|
92ef25bc62 | ||
|
|
2b49bbc373 | ||
|
|
fb8f4ec00e | ||
|
|
61818026ff | ||
|
|
d2e9ac3184 | ||
|
|
5ea2c83115 | ||
|
|
707371cb92 | ||
|
|
d7bc3e500b | ||
|
|
79f59de92e | ||
|
|
1751e9dd9c | ||
|
|
9ac0d59c66 | ||
|
|
09db30fe9f | ||
|
|
808e676972 | ||
|
|
e6c5dd63a0 | ||
|
|
89fe90d2ca | ||
|
|
be2b21f8cf | ||
|
|
f159ab72f6 | ||
|
|
0e82da2492 | ||
|
|
7107dbe86b | ||
|
|
6260f79b86 | ||
|
|
3d1b8015c5 | ||
|
|
007330159e | ||
|
|
3fee812cc6 | ||
|
|
bbd811e578 | ||
|
|
3b5fb64589 | ||
|
|
f20146b7ef | ||
|
|
67c43fea6c | ||
|
|
7aaee83d4a | ||
|
|
30933c6bfb | ||
|
|
8303ec28a4 | ||
|
|
878dd7c29a | ||
|
|
1182d65971 | ||
|
|
f51f839e9c | ||
|
|
84925a334e | ||
|
|
50d2f25326 | ||
|
|
5b67c8d6f9 | ||
|
|
7adaaeea09 | ||
|
|
5b3111e047 | ||
|
|
78feebc894 | ||
|
|
9547cfe927 | ||
|
|
d0873cdd16 | ||
|
|
5c656e409b | ||
|
|
1a96c523b7 | ||
|
|
7427fcabb8 | ||
|
|
cf546961fe | ||
|
|
214509e2c7 | ||
|
|
7f96c121fa | ||
|
|
dface29681 | ||
|
|
03057edd6c | ||
|
|
5ad6f5bae0 | ||
|
|
0fa539bd6a | ||
|
|
4ec741e1fa | ||
|
|
0c2df2d529 | ||
|
|
792cf34522 | ||
|
|
668bc3355c | ||
|
|
9e360240d9 | ||
|
|
e97dc89a49 | ||
|
|
d7ebf7d0ec | ||
|
|
6250f1b186 | ||
|
|
17293287fa | ||
|
|
e8dae84512 | ||
|
|
98a0f4e8b7 | ||
|
|
f7d88e68bb | ||
|
|
fc9c060b26 | ||
|
|
355b0b0ca3 | ||
|
|
8244ce5366 | ||
|
|
883f8ae674 | ||
|
|
ec54af5b9d | ||
|
|
337da918d4 | ||
|
|
868ebbecc8 | ||
|
|
d683f686e5 | ||
|
|
c8ccef50c9 | ||
|
|
3f7d59ee34 | ||
|
|
a8d12501de | ||
|
|
d72a19f9e8 | ||
|
|
f4927793ee | ||
|
|
1c78d23df8 | ||
|
|
495ede0df2 | ||
|
|
8341cba1ca | ||
|
|
c1f35ace41 | ||
|
|
cd0da5b6a3 | ||
|
|
8c7c7d6fef | ||
|
|
41033edc44 | ||
|
|
13778ce657 | ||
|
|
7d641e3b2d | ||
|
|
4620df53c4 | ||
|
|
6df032c137 | ||
|
|
2f487d1a32 | ||
|
|
4ee26a9871 | ||
|
|
f6bdd27335 | ||
|
|
91986cb674 | ||
|
|
c9e52cc0c5 | ||
|
|
bd80580933 | ||
|
|
975dd84853 | ||
|
|
32e465d635 | ||
|
|
538e4eeb0c | ||
|
|
42b41d8bd0 | ||
|
|
80cc601da4 | ||
|
|
9ef59f0df4 | ||
|
|
09a5daa593 | ||
|
|
67c02aabf1 | ||
|
|
d0fd1f2cdb | ||
|
|
2eab67a117 | ||
|
|
97c02f125f | ||
|
|
ee0fda775e |
71
README.md
71
README.md
|
|
@ -14,7 +14,7 @@
|
|||
[](https://github.com/chan-sccp/chan-sccp/releases/latest)
|
||||
[](https://github.com/chan-sccp/chan-sccp/wiki)
|
||||
|
||||
This module has been developed to help IT Staff with their Asterisk-Cisco infrastructure deployment,
|
||||
This FreePBX 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.
|
||||
The idea of creating a module is borrowed from (https://github.com/Cynjut/SCCP_Manager), and was further developed and managed
|
||||
by PhantomVl (https://github.com/PhantomVl/sccp_manager) who has been unavailable for some time. sccp_manager relies heavily
|
||||
|
|
@ -35,13 +35,16 @@ Make sure you have the following installed on your system:
|
|||
- gui:
|
||||
- freepbx >= 13.0.192
|
||||
- a working version of [chan-sccp](https://github.com/chan-sccp/chan-sccp)
|
||||
- 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
|
||||
- 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.4 (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:
|
||||
```./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate --enable-video```
|
||||
- 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)
|
||||
- You will need the phone settings templates. You can use the templates taken from the distribution "chan-sccp"
|
||||
|
|
@ -59,30 +62,56 @@ Make sure you have the following installed on your system:
|
|||
|
||||
## Installation
|
||||
|
||||
1. Download module into your local system. (/var/www/html/admin/modules/)
|
||||
2. Goto FreePBX Admin -> Module Admin.
|
||||
How to install sccp_manager
|
||||
-----
|
||||
|
||||
1. Log in to FreePBX
|
||||
2. Go to Admin -> Module Admin
|
||||
3. Click Upload Modules.
|
||||
4. Browse to the location of the module on your computer and select Upload.
|
||||
5. Click Manage Local Modules.
|
||||
6. Find and click SCCP Manager. Check Install. Click Process button.
|
||||
7. Confirm installation.
|
||||
8. Close Status window.
|
||||
9. Apply Config to FreePBX.
|
||||
4. Enter one of the following urls:
|
||||
|
||||
Stable - Version 14.3.
|
||||
|
||||
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.
|
||||
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
|
||||
```
|
||||
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
|
||||
|
||||
If you installed sccp_manager using git clone instead of installing a zip
|
||||
file / tarball then you can do easily keep up with the latest develop by
|
||||
doing this:
|
||||
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
|
||||
```
|
||||
fwconsole ma upgrade sccp_manager
|
||||
```
|
||||
|
||||
1. Goto to module into your local system. (/var/www/html/admin/modules/sccp_manager/)
|
||||
|
||||
> cd /var/www/html/admin/modules/sccp_manager/
|
||||
> git pull
|
||||
> git checkout develop
|
||||
|
||||
### IMPORTANT NOTES:
|
||||
- !!! If something stops working, use the develop branch [develop](https://github.com/chan-sccp/sccp_manager/tree/develop)
|
||||
- If something stops working, use the Stable branch as described in [Installation](https://github.com/chan-sccp/sccp_manager#installation)
|
||||
- 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)).
|
||||
- For the cisco phones to work correctly, they should be provisioned with the latest firmware (v8.1 or higher)
|
||||
|
|
|
|||
127
README.ru.md
127
README.ru.md
|
|
@ -1,99 +1,118 @@
|
|||
## Welcome to Develop Chan_SCCP GUI Manager for FreePBX
|
||||
| [English :gb:/:us:](README.md) | [Russian :ru:](README.ru.md) | [OLD Stable Release](https://github.com/PhantomVl/sccp_manager/tree/master)
|
||||
## Добро пожаловать странник на SCCP страницу веб интерфейса для FreePBX (SCCP Manager)
|
||||
| [English :gb:/:us:](README.md) | [Russian :ru:](README.ru.md) | [Старая страница проекта](https://github.com/PhantomVl/sccp_manager/tree/master)
|
||||
|
||||

|
||||

|
||||
|
||||
* [Installation](https://github.com/PhantomVl/sccp_manager#installation)
|
||||
* [Prerequisites](https://github.com/PhantomVl/sccp_manager#prerequisites)
|
||||
* [Links](https://github.com/PhantomVl/sccp_manager#link)
|
||||
* [Wiki](https://github.com/PhantomVl/sccp_manager/wiki)
|
||||
* [Installation](https://github.com/chan-sccp/sccp_manager#installation)
|
||||
* [Prerequisites](https://github.com/chan-sccp/sccp_manager#prerequisites)
|
||||
* [Links](https://github.com/chan-sccp/sccp_manager#link)
|
||||
* [Wiki](https://github.com/chan-sccp/sccp_manager/wiki)
|
||||
|
||||
## Link
|
||||
|
||||
[](https://github.com/PhantomVl/sccp_manager/archive/master.zip)и традиционно добалены новые баги
|
||||
[](https://github.com/chan-sccp/sccp_manager/archive/tarball/develop)
|
||||
[](https://github.com/chan-sccp/chan-sccp/releases/latest)
|
||||
[](https://github.com/chan-sccp/chan-sccp/wiki)
|
||||
|
||||
### История
|
||||
Корни идея создания этого проекта лежат в несовершенстве уже существующего и заброшенного проекта.
|
||||
Для желающих попробовать себя на просторах программирования ссылка на проект (https://github.com/Cynjut/SCCP_Manager).
|
||||
.... давнем давно в далеком прошлом ....
|
||||
Группа программистов пыталось быстро бороться с несовершенством продуктов CISCO, но повседневные дела угробили проект.
|
||||
Но на помощь им пришел молодой программист и возродил идею уже заброшенного проекта.
|
||||
Для желающих попробовать себя в этой борьбе на просторах программирования ссылка на проект (https://github.com/Cynjut/SCCP_Manager).
|
||||
|
||||
### Кому это надо...
|
||||
Ну в первую очередь для себя, а заодно и для тех у кого есть куча телефонного хлама от компании Cisco.
|
||||
Ну в первую очередь для Себя любимого ну и для тех, у кого есть куча телефонного хлама от компании Cisco.
|
||||
Если вы планируете использовать Aserisk + FreePBX, то я надеюсь, что данный модуль существенно упростит управление и настройки телефонами от Cisco.
|
||||
В интернете, существует замечательный проект (IMHO) который интегрирует проприетарный протокол Cisco в Asterisk, конечно он пока далек от идеала,
|
||||
В интернете существует замечательный проект (IMHO), который интегрирует проприетарный протокол Cisco в Asterisk, конечно, он пока далек от идеала,
|
||||
но все же это замечательная замена серверам CCME, СCM, СUСM !
|
||||
Ну я совершенно не представляю себе, сколько времени данный проект будет поддерживаться.
|
||||
|
||||
### Если ты еще с нами ...
|
||||
### Ну если ты еще с нами ...
|
||||
|
||||
Как я говорил выше, это дополнение к (Aserisk + FreePBX), но нам еще потребуется :
|
||||
Как я говорил выше, это дополнение к (Aserisk + FreePBX), но нам еще потребуется:
|
||||
1. У меня не получилось поставить добиться работы с дисками Aserisk и FreePBX - собираем из исходников
|
||||
1.1. Замечательная копания freepbx. Теперь с SNG7-PBX-64bit-1805 все работает !
|
||||
1.1. Замечательная копания freepbx. Теперь с SNG7-PBX-64bit-... все работает!
|
||||
2. Mysql (Maria)
|
||||
3. Драйвер протокола SCCP страница (https://github.com/chan-sccp/chan-sccp/)
|
||||
4. Ну и этот модуль.
|
||||
4. Этот модуль.
|
||||
5. Руки
|
||||
6. Возможно еще несколько проектов
|
||||
|
||||
### Вжно! В этой ветке лежат самые последне нововведения и обновления, и самые последние БАГИ !
|
||||
Пользуйся и наслождайся. Так же не забывай писать нам об ошибках, которые ты нашел !
|
||||
Это очень нам поможет, Я с радостью исправлю то что ты нашел и добалю новых.
|
||||
### Вжно! В этой ветке лежат самые последне нововведения и обновления, и самые последние БАГИ!
|
||||
Пользуйся и наслождайся. Так же не забывай писать нам об ошибках, которые ты нашел!
|
||||
Это очень нам поможет, Я с радостью исправлю то, что ты нашел и добалю новых.
|
||||
|
||||
### Wiki - Основные Инструкции по настройке
|
||||
Вся документация лежит на Вики [](https://github.com/PhantomVl/sccp_manager/wiki)
|
||||
Вся документация по проекту пока лежит на старой Вики [](https://github.com/PhantomVl/sccp_manager/wiki)
|
||||
Вся документация по драйверу Chan-SCCP [](https://github.com/chan-sccp/wiki)
|
||||
|
||||
Ну и как водится у на SCCP Manager это бесплатное дополнение. И помни "(C)" означает "Копия верна". Please see the file COPYING for details.
|
||||
|
||||
|
||||
### Prerequisites - как говориться все, что хуже этого возможно работать тоже будет .... но только вопрос как ?
|
||||
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
|
||||
- PHPx.x-zip has to be installed (where x.x is the installed version of PHP).
|
||||
For example, on Debian, using PHP7.3
|
||||
|
||||
- pbx:
|
||||
- asterisk >= 1.8 (absolute minimum & not recommended)
|
||||
- asterisk >= 13.7 or asterisk >= 14.0 or asterisk >= 15.0 (Тестировалось на стендах)
|
||||
- gui:
|
||||
- freepbx >= 13.0.192 (http://wiki.freepbx.org/display/FOP/Install+FreePBX)
|
||||
- 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 Очень короткая инструкция
|
||||
###### [Полная версия инструкции](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
|
||||
- открой полную инструкцию [Полная версия инструкции] (https://github.com/PhantomVl/sccp_manager/wiki/step-by-step-instlation)
|
||||
|
||||
- Важно ! **_Собираем с флагами и создаем БД для работы:_**
|
||||
> ./configure ./configure --enable-conference --enable-advanced-functions --enable-distributed-devicestate --enable-video
|
||||
> mysql -u root asterisk < mysql-v5_enum.sql
|
||||
### Installation Другие инструкции по установке :-)
|
||||
- [Setting up a FreePBX system](http://wiki.freepbx.org/display/FOP/Install+FreePBX)
|
||||
- [Setting up Chan-Sccp](https://github.com/chan-sccp/chan-sccp/wiki/How-to-setup-the-chan_sccp-Module)
|
||||
- [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.
|
||||
-----
|
||||
|
||||
- Обновление модуля
|
||||
> cd /var/www/html/admin/modules/sccp_manager/
|
||||
> git fetch
|
||||
> git pull
|
||||
> git checkout extension_mobility
|
||||
> or
|
||||
> git checkout develop
|
||||
1. Log in to FreePBX
|
||||
2. Go to Admin -> Module Admin
|
||||
3. Click Upload Modules.
|
||||
4. Enter one of the following urls:
|
||||
|
||||
Мы решили, что это стабильная версия:
|
||||
|
||||
```
|
||||
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/tree/master)
|
||||
- !!! Если это это проект не заработал на твоей системе - переключись на ветку мастер [master](https://github.com/PhantomVl/sccp_manager)
|
||||
!!! Но есть ограничение - ветка master не поддерживает изменения в chan-sccp сделаные после октября 2018 г.
|
||||
- И чуть не забыл настраиваем Realtime-Configuration ([See](https://github.com/chan-sccp/chan-sccp/wiki/Realtime-Configuration)).
|
||||
- Желательно иметь Firmware телефонов Cisco, языковые пакеты ну всякое разное.
|
||||
- Возможно, ты найдешь, то что ищешь, в проекте (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 FreePbx](https://wiki.freepbx.org/display/FOP/Install+FreePBX)
|
||||
- Возможно, ты найдешь, то, что ищешь, в проекте (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),
|
||||
|
||||
### Chat
|
||||
[](https://gitter.im/sccp_manager/community)
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,525 +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;
|
||||
|
||||
class oldinterface
|
||||
{
|
||||
|
||||
var $error;
|
||||
|
||||
public function __construct($parent_class = null)
|
||||
{
|
||||
$this->paren_class = $parent_class;
|
||||
$this->error = "";
|
||||
}
|
||||
|
||||
public function info()
|
||||
{
|
||||
$Ver = '13.0.4';
|
||||
return array('Version' => $Ver,
|
||||
'about' => 'Old 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'), // Жесткая перезагрузка
|
||||
'restart_phone' => array('cmd' => "sccp restart ", 'param' => 'name'),
|
||||
'reload_phone' => array('cmd' => "sccp reload device ", 'param' => 'name'),
|
||||
'reload_line' => array('cmd' => "sccp reload line ", '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();
|
||||
// Below added for compatibility with AMI result and modified server.info
|
||||
$ast_res = ['sccp' => ['message' => 'default value', 'realm' => '', 'status' => 'ERROR']];
|
||||
$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 0:
|
||||
return 0;
|
||||
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;
|
||||
}
|
||||
|
||||
function getCoreSCCPVersion()
|
||||
{
|
||||
$result = array();
|
||||
$ast_out = $this->sccp_version();
|
||||
$result["Version"] = $ast_out[0];
|
||||
if ($ast_out[0] == '-1') {
|
||||
$result["vCode"] = 0;
|
||||
return $result;
|
||||
}
|
||||
$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 (($ast_out['Response'] == 'Error') || (strpos($ast_out['data'], 'No such command') != false)) {
|
||||
return array('-1');
|
||||
}
|
||||
if (preg_match("/Release.*\(/", $ast_out['data'], $matches)) {
|
||||
$ast_out = substr($matches[0], 9, -1);
|
||||
return explode(' ', $ast_out);
|
||||
} else {
|
||||
return array('unknown');
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
} elseif ($version_parts[1] == "2") {
|
||||
$result["vCode"] = 420;
|
||||
} elseif ($version_parts[1] >= "3") {
|
||||
if ($version_parts[2] == "3"){
|
||||
$result["vCode"] = 433;
|
||||
} else {
|
||||
$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, $address, $devname, $status, $token, $junk) = explode(";|", implode(";|", $line_arr));
|
||||
|
||||
// list ($descr, $address, $devname, $status, $junk) = $line_arr;
|
||||
// if (strlen($ast_key[$devname]) < 1) {
|
||||
if (strlen($devname) > 1) {
|
||||
$ast_key[$devname] = array('name' => $devname, 'status' => $status, 'address' => $address, 'descr' => $descr, 'token' => $token);
|
||||
}
|
||||
/*
|
||||
if (isset($ast_key[$devname])) {
|
||||
if (strlen($ast_key[$devname]) < 1) {
|
||||
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $address, 'descr' => $descr, 'token' => $descr);
|
||||
}
|
||||
} else {
|
||||
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $address, '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 = $this->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 getGlobalsFromMetaData($Segment = '')
|
||||
{
|
||||
global $astman;
|
||||
$params = array();
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,506 +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.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_offset': // Sccp manafer: 1400 (+ Id) :2007 (+ Id)
|
||||
if (empty($index)) {
|
||||
return 0;
|
||||
}
|
||||
if (array_key_exists($index, $this->cisco_timezone)) {
|
||||
$tmp_time = $this->get_cisco_time_zone($index);
|
||||
return $tmp_time['offset'];
|
||||
}
|
||||
|
||||
$tmp_dt = new \DateTime(null, new \DateTimeZone($index));
|
||||
$tmp_ofset = $tmp_dt->getOffset();
|
||||
return $tmp_ofset / 60;
|
||||
|
||||
break;
|
||||
case 'sccp_timezone': // Sccp manafer: 1400 (+ Id) :2007 (+ Id)
|
||||
$result = array();
|
||||
|
||||
if (empty($index)) {
|
||||
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
||||
}
|
||||
if (array_key_exists($index, $this->cisco_timezone)) {
|
||||
return $this->get_cisco_time_zone($index);
|
||||
} else {
|
||||
$timezone_abbreviations = \DateTimeZone::listAbbreviations();
|
||||
|
||||
$tz_tmp = array();
|
||||
foreach ($timezone_abbreviations as $subArray) {
|
||||
$tf_idt = array_search($index, array_column($subArray, 'timezone_id'));
|
||||
if (!empty($tf_idt)) {
|
||||
$tz_tmp[] = $subArray[$tf_idt];
|
||||
}
|
||||
}
|
||||
if (empty($tz_tmp)) {
|
||||
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
||||
}
|
||||
|
||||
if (count($tz_tmp)==1) {
|
||||
$time_set = $tz_tmp[0];
|
||||
} else {
|
||||
$tmp_dt = new \DateTime(null, new \DateTimeZone($index));
|
||||
$tmp_ofset = $tmp_dt->getOffset();
|
||||
foreach ($tz_tmp as $subArray) {
|
||||
if ($subArray['offset'] == $tmp_ofset) {
|
||||
$time_set = $subArray;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$tmp_ofset = $time_set['offset'] / 60;
|
||||
$tmp_dli = (empty($time_set['dst']) ? '' : 'Daylight' );
|
||||
foreach ($this->cisco_timezone as $key => $value) {
|
||||
if (($value['offset'] == $tmp_ofset) and ( $value['daylight'] == $tmp_dli )) {
|
||||
return $this->get_cisco_time_zone($key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
||||
if ((empty($tzc)) or (!array_key_exists($tzc, $this->cisco_timezone))) {
|
||||
// return array('offset' => '00', 'daylight' => '', 'cisco_code' => 'Greenwich');
|
||||
return array();
|
||||
}
|
||||
$tzdata = $this->cisco_timezone[$tzc];
|
||||
$cisco_code = $tzc . ' Standard' . ((empty($tzdata['daylight'])) ? '' : '/' . $tzdata['daylight']) . ' Time';
|
||||
if (isset($tzdata['cisco_code'])) {
|
||||
$cisco_code = (empty($tzdata['cisco_code'])) ? $cisco_code : $tzdata['cisco_code'];
|
||||
}
|
||||
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
|
||||
# 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,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'),
|
||||
'ru_RU' => array('code' => 'ru', 'language' => 'Russian', 'locale' => 'Russian_Russian_Federation', 'codepage' => 'CP1251'),
|
||||
'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' => ''),
|
||||
'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' => ''),
|
||||
/* Russian 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 - Russian 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', 'dialplan' => 'dialplan', 'softkey' => 'softkey');
|
||||
// 'pro' /tftpboot - root dir
|
||||
// /tftpboot/locales/locales/%Languge_name%
|
||||
// /tftpboot/settings/XMLdefault.cnf.xml
|
||||
// /tftpboot/settings/SEP[MAC].cnf.xml
|
||||
// /tftpboot/firmware/79xx/SCCPxxxx.loads
|
||||
$adv_tree['pro'] = array('templates' => 'tftproot', 'settings' => 'tftproot', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'locales', 'dialplan' => 'tftproot', 'softkey' => 'tftproot');
|
||||
|
||||
// 'def' /tftpboot - root dir
|
||||
// /tftpboot/languages/%Languge_name%
|
||||
// /tftpboot/XMLdefault.cnf.xml
|
||||
// /tftpboot/SEP[MAC].cnf.xml
|
||||
// /tftpboot/SCCPxxxx.loads
|
||||
$adv_tree['def'] = array('templates' => 'tftproot', 'settings' => '', 'locales' => '', 'firmware' => '', 'languages' => 'tftproot', 'dialplan' => '', 'softkey' => '');
|
||||
// $adv_tree['def'] = Array('templates' => 'tftproot', 'settings' => '', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => '');
|
||||
// $adv_tree['def'] = Array('templates' => 'tftproot', 'settings' => '', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'tftproot');
|
||||
//* **************------ ****
|
||||
$base_tree = array('tftp_templates' => 'templates', 'tftp_path_store' => 'settings', 'tftp_lang_path' => 'languages', 'tftp_firmware_path' => 'firmware', 'tftp_dialplan' => 'dialplan', 'tftp_softkey' => 'softkey');
|
||||
|
||||
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 exist or 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 permission on tftp DIR';
|
||||
}
|
||||
return array('error' => 'No write permission 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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
print_r($base_config, 1);
|
||||
// die(print_r($base_config,1));
|
||||
// $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;
|
||||
}
|
||||
// Type declaration in below function is incompatible with PHP 5
|
||||
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'] . ',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'
|
||||
);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace FreePBX\modules\Sccp_manager;
|
||||
|
||||
class sipconfigs
|
||||
{
|
||||
// protected $database;
|
||||
// protected $freepbx;
|
||||
|
||||
public function __construct($parent_class = null)
|
||||
{
|
||||
$this->paren_class = $parent_class;
|
||||
// $freepbx
|
||||
// $this->database = $freepbx->Database;
|
||||
}
|
||||
|
||||
public function info()
|
||||
{
|
||||
$Ver = '13.0.4';
|
||||
return array('Version' => $Ver,
|
||||
'about' => 'Sip Setings ver: ' . $Ver);
|
||||
}
|
||||
|
||||
public function get_db_sip_TableData($dataid, $data = array())
|
||||
{
|
||||
global $db;
|
||||
if ($dataid == '') {
|
||||
return false;
|
||||
}
|
||||
switch ($dataid) {
|
||||
case "Device":
|
||||
$sql = "SELECT * FROM sip ORDER BY `id`";
|
||||
$tech = array();
|
||||
try {
|
||||
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
|
||||
foreach ($raw_settings as $value) {
|
||||
if (empty($tech[$value['id']]['id'])) {
|
||||
$tech[$value['id']]['id']= $value['id'];
|
||||
}
|
||||
$tech[$value['id']][$value['keyword']]=$value['data'];
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
return $tech;
|
||||
case "DeviceById":
|
||||
$sql = "SELECT keyword,data FROM sip WHERE id = ?";
|
||||
$sth = $db->prepare($sql);
|
||||
$tech = array();
|
||||
try {
|
||||
$id = $data['id'];
|
||||
$sth->execute(array($id));
|
||||
$tech = $sth->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_GROUP);
|
||||
foreach ($tech as &$value) {
|
||||
$value = $value[0];
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
return $tech;
|
||||
}
|
||||
}
|
||||
|
||||
public function getSipConfig()
|
||||
{
|
||||
$result = array();
|
||||
// $def_sip_proto = 'sip';
|
||||
// $def_proto = 'tcp';
|
||||
// $supp_proto = '';
|
||||
|
||||
// $result['sipport'] = \FreePBX::Sipsettings()->getConfig('bindport');
|
||||
// $result['tlsport'] = \FreePBX::Sipsettings()->getConfig('tlsbindport');
|
||||
// $tmp_sipsetigs = \FreePBX::Sipsettings()->getChanSipSettings();
|
||||
$tmp_binds = \FreePBX::Sipsettings()->getBinds();
|
||||
$if_list = $this->paren_class ->getIpInformation('ip4');
|
||||
|
||||
/*
|
||||
$tmp_bind_ip = !empty($tmp_sipsetigs['externhost_val']) ? $tmp_sipsetigs['externhost_val'] : '';
|
||||
$tmp_bind_ip = !empty($tmp_sipsetigs['externip_val']) ? $tmp_sipsetigs['externip_val'] : $tmp_bind_ip;
|
||||
$tmp_bind_ip = !empty($tmp_sipsetigs['bindaddr']) ? $tmp_sipsetigs['bindaddr'] : $tmp_bind_ip;
|
||||
*/
|
||||
$tmp_binds = is_array($tmp_binds) ? $tmp_binds: array();
|
||||
$result = array();
|
||||
foreach ($tmp_binds as $f_protocol => $f_bind) {
|
||||
foreach ($f_bind as $f_ip => $f_port) {
|
||||
if (($f_ip == '0.0.0.0') || ($f_ip == '[::]')) {
|
||||
foreach ($if_list as $f_if => $f_data) {
|
||||
if ($f_data['ip'] == "127.0.0.1") {
|
||||
continue;
|
||||
}
|
||||
if (empty($result[$f_protocol][$f_data['ip']])) {
|
||||
$result[$f_protocol][$f_data['ip']]= $f_port;
|
||||
} else {
|
||||
$result[$f_protocol][$f_data['ip']]= array_merge($result[$f_protocol][$f_data['ip']],$f_port);
|
||||
}
|
||||
$result[$f_protocol][$f_data['ip']]['ip']=$f_data['ip'];
|
||||
}
|
||||
} else {
|
||||
$result[$f_protocol][$f_ip]=$f_port;
|
||||
$result[$f_protocol][$f_ip]['ip']=$f_ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
/*
|
||||
// $result['sipbind'] = $tmp_bind_ip;
|
||||
if (empty($tmp_sip_binds[$def_sip_proto])){
|
||||
$def_proto = 'pjsip';
|
||||
}
|
||||
return $result;
|
||||
|
||||
foreach ($tmp_sip_binds[$def_sip_proto] as $key => $value) {
|
||||
if (empty($value[$def_proto])) {
|
||||
$def_proto = 'udp';
|
||||
$supp_proto = 'udp';
|
||||
} else {
|
||||
$supp_proto = !empty($value['udp']) ? 'tcp;udp' : 'tcp';
|
||||
}
|
||||
if (empty($def_key)) {
|
||||
$def_key = $key;
|
||||
}
|
||||
if ($key != '0.0.0.0') {
|
||||
$tmp_bind_ip = $key;
|
||||
}
|
||||
$result['sipbindport'] = $value[$def_proto];
|
||||
}
|
||||
$result['sipbind'] = $tmp_bind_ip;
|
||||
$result['sipsuportproto'] = $supp_proto;
|
||||
|
||||
$binds= array();
|
||||
$driver = \FreePBX::Config()->get_conf_setting('ASTSIPDRIVER');
|
||||
if ($driver == "both" || $driver == "chan_pjsip") {
|
||||
$b = \FreePBX::Sipsettings()->getConfig("binds");
|
||||
$b = is_array($b) ? $b : array();
|
||||
foreach($b as $protocol => $bind) {
|
||||
foreach($bind as $ip => $state) {
|
||||
if($state != "on") {
|
||||
continue;
|
||||
}
|
||||
$p = \FreePBX::Sipsettings()->getConfig($protocol."port-".$ip);
|
||||
$result['nb3'.$protocol] = $p;
|
||||
if ($flatten) {
|
||||
$binds['pjsip']['[::]'][$protocol] = $p;
|
||||
} else {
|
||||
$binds['pjsip'][$ip][$protocol] = $p;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$binds['pjsip'] = array("0.0.0.0" => array());
|
||||
}
|
||||
|
||||
$result['nd'] = $driver;
|
||||
|
||||
$result['nb'] = $binds;
|
||||
$result['nb2'] = $b;
|
||||
return $result;
|
||||
*
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
@ -1,350 +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;
|
||||
|
||||
class srvinterface {
|
||||
|
||||
var $error;
|
||||
var $_info;
|
||||
var $ami_mode = false;
|
||||
var $useAmiInterface = true;
|
||||
|
||||
public function __construct($parent_class = null) {
|
||||
$this->paren_class = $parent_class;
|
||||
if ($this->paren_class == null) {
|
||||
$this->paren_class = $this;
|
||||
}
|
||||
$this->error = "";
|
||||
$driverNamespace = "\\FreePBX\\Modules\\Sccp_manager";
|
||||
$drivers = array('aminterface' => 'aminterface.class.php', 'oldinterface' => 'oldinterface.class.php');
|
||||
$ami_mode = false;
|
||||
foreach ($drivers as $key => $value) {
|
||||
$class = $driverNamespace . "\\" . $key;
|
||||
$driver = __DIR__ . "/aminterface/" . $value;
|
||||
if (!class_exists($class, false)) {
|
||||
if (file_exists($driver)) {
|
||||
include($driver);
|
||||
} else {
|
||||
throw new \Exception("Class required but file not found " . $driver);
|
||||
}
|
||||
if (class_exists($class, false)) {
|
||||
$this->$key = new $class($this->paren_class);
|
||||
$parent_class->$key = $this->$key;
|
||||
$this->_info [] = $this->$key->info();
|
||||
} else {
|
||||
throw new \Exception("Invalid Class inside in the include folder" . $freepbx);
|
||||
}
|
||||
} else {
|
||||
if (is_null($this->$key)) {
|
||||
if (class_exists($class, false)) {
|
||||
$this->$key = new $class($this->paren_class);
|
||||
$this->_info [] = $this->$key->info();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->aminterface->status()) {
|
||||
// Ami is not hard disabled in Amiinterface __construct line 54.
|
||||
if ($this->aminterface->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->aminterface->close();
|
||||
} else {
|
||||
// is compatible so enable AMI mode
|
||||
$this->ami_mode = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function info() {
|
||||
$Ver = '14.0.1';
|
||||
$info = '';
|
||||
foreach ($this->_info as $key => $value) {
|
||||
$info .= $value['about'] . "\n ";
|
||||
}
|
||||
return array('Version' => $Ver,
|
||||
'about' => 'Server interface data ver: ' . $Ver . "\n " . $info);
|
||||
}
|
||||
|
||||
public function sccpDeviceReset($id = '') {
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->sccpDeviceReset($id, 'reset');
|
||||
} else {
|
||||
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $id));
|
||||
}
|
||||
}
|
||||
|
||||
public function sccpDeviceRestart($id = '') {
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->sccpDeviceReset($id, 'restart');
|
||||
} else {
|
||||
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $id));
|
||||
}
|
||||
}
|
||||
|
||||
public function sccp_device_reload($id = '') {
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->sccpDeviceReset($id, 'full');
|
||||
} else {
|
||||
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reload_phone', 'name' => $id));
|
||||
}
|
||||
}
|
||||
|
||||
public function sccp_reset_token($id = '') {
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->sccpDeviceReset($id, 'tokenack');
|
||||
} else {
|
||||
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reset_token', 'name' => $id));
|
||||
}
|
||||
}
|
||||
|
||||
public function sccp_reload() {
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->core_sccp_reload();
|
||||
// return $this->oldinterface->sccp_core_commands(array('cmd' => 'sccp_reload')); // !!!!!!!!!!!!!!!!!!!!!!!!!--------------------------- Remove
|
||||
} else {
|
||||
return $this->oldinterface->sccp_core_commands(array('cmd' => 'sccp_reload'));
|
||||
}
|
||||
}
|
||||
|
||||
public function sccp_line_reload($id = '') {
|
||||
if ($this->ami_mode) {
|
||||
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reload_line', 'name' => $id));
|
||||
} else {
|
||||
return $this->oldinterface->sccp_core_commands(array('cmd' => 'reload_line', 'name' => $id));
|
||||
}
|
||||
}
|
||||
|
||||
private function sccp_core_commands($params = array()) {
|
||||
|
||||
if (!$this->ami_mode) {
|
||||
return $this->oldinterface->sccp_core_commands($params);
|
||||
}
|
||||
|
||||
if (!empty($params['cmd'])) {
|
||||
switch ($params['cmd']) {
|
||||
case 'reset_phone':
|
||||
return $this->aminterface->sccpDeviceReset($params['name'], 'reset');
|
||||
break;
|
||||
case 'restart_phone':
|
||||
return $this->aminterface->sccpDeviceReset($params['name'], 'restart');
|
||||
break;
|
||||
case 'reload_phone':
|
||||
return $this->aminterface->sccpDeviceReset($params['name'], 'full');
|
||||
break;
|
||||
case 'reset_token':
|
||||
return $this->aminterface->sccpDeviceReset($params['name'], 'tokenack');
|
||||
break;
|
||||
case 'reload_line':
|
||||
// return $this->aminterface->sccpDeviceReset($params['name'], 'full');
|
||||
break;
|
||||
// case 'get_version':
|
||||
// case 'sccp_reload':
|
||||
// break;
|
||||
// case 'get_realtime_status':
|
||||
// break;
|
||||
// case 'phone_call':
|
||||
// case 'phone_message':
|
||||
|
||||
case 'get_softkey':
|
||||
case 'get_device':
|
||||
case 'get_hints':
|
||||
case 'get_dev_info':
|
||||
print_r($params);
|
||||
throw new \Exception("Invalid Class inside in the include folder" . $params['cmd']);
|
||||
die();
|
||||
break;
|
||||
default:
|
||||
return $this->oldinterface->sccp_core_commands($params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function sccp_getdevice_info($dev_id) {
|
||||
if (empty($dev_id)) {
|
||||
return array();
|
||||
}
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->sccp_getdevice_info($dev_id);
|
||||
} else {
|
||||
return $this->oldinterface->sccp_getdevice_info($dev_id);
|
||||
}
|
||||
}
|
||||
|
||||
public function sccp_list_hints() {
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->core_list_hints();
|
||||
} else {
|
||||
return $this->oldinterface->sccp_list_hints();
|
||||
}
|
||||
}
|
||||
|
||||
public function sccp_list_all_hints() {
|
||||
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->core_list_all_hints();
|
||||
} else {
|
||||
return $this->oldinterface->sccp_list_all_hints();
|
||||
}
|
||||
}
|
||||
|
||||
public function sccp_realtime_status() {
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->getRealTimeStatus();
|
||||
} else {
|
||||
return $this->oldinterface->sccp_realtime_status();
|
||||
}
|
||||
}
|
||||
|
||||
public function get_compatible_sccp($revNumComp=false) {
|
||||
// only called with args from installer to get revision and compatibility
|
||||
$res = $this->getSCCPVersion();
|
||||
if (empty($res)) {
|
||||
return 0;
|
||||
}
|
||||
switch ($res["vCode"]) {
|
||||
case 0:
|
||||
$retval = 0;
|
||||
break;
|
||||
case 433:
|
||||
$retval = 433;
|
||||
break;
|
||||
case 432:
|
||||
$retval = 430;
|
||||
break;
|
||||
case 431:
|
||||
$retval = 431;
|
||||
break;
|
||||
default:
|
||||
$retval = 430;
|
||||
}
|
||||
if ($res['RevisionNum'] < 11063) {
|
||||
$this->useAmiInterface = false;
|
||||
}
|
||||
if ($revNumComp) {
|
||||
return array($retval, $this->useAmiInterface);
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
public function getSCCPVersion() {
|
||||
$res = $this->getChanSCCPVersion();
|
||||
if (empty($res)) {
|
||||
$res = $this->oldinterface->getCoreSCCPVersion();
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function sccp_list_keysets() {
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->sccp_list_keysets();
|
||||
} else {
|
||||
return $this->oldinterface->sccp_list_keysets();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function sccp_get_active_device() {
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->sccp_get_active_device();
|
||||
} else {
|
||||
return $this->oldinterface->sccp_get_active_device();
|
||||
}
|
||||
}
|
||||
|
||||
function getChanSCCPVersion() {
|
||||
if ($this->ami_mode) {
|
||||
return $this->aminterface->getSCCPVersion();
|
||||
} else {
|
||||
return $this->oldinterface->getChanSCCPVersion();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------- Debug Data -------------------------------------------
|
||||
function t_get_ami_data() {
|
||||
global $amp_conf;
|
||||
$fp = fsockopen("127.0.0.1", "5038", $errno, $errstr, 10);
|
||||
if (!$fp) {
|
||||
echo "$errstr ($errno)<br />\n";
|
||||
} else {
|
||||
$time_connect = microtime_float();
|
||||
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: SCCPShowDevice\r\n");
|
||||
// fputs($fp,"Segment: general\r\n");
|
||||
// fputs($fp,"DeviceName: SEP00070E36555C\r\n");
|
||||
// fputs ($fp,"Action: DeviceStateList\r\n");
|
||||
fputs($fp, "Action: SCCPShowDevices\r\n");
|
||||
fputs($fp, "Segment: general\r\n");
|
||||
|
||||
// fputs ($fp,"Action: SCCPShowDevice\r\n");
|
||||
// fputs ($fp,"DeviceName: SEP00070E36555C\r\n");
|
||||
//
|
||||
// fputs($fp, "Action: ExtensionStateList\r\n");
|
||||
// fputs($fp, "Action: ExtensionStateList\r\n");
|
||||
// fputs($fp, "Command: sccp show version\r\n");
|
||||
// fputs($fp, "Command: core show hints\r\n");
|
||||
// fputs ($fp,"Segment: general\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");
|
||||
$time_send = microtime_float();
|
||||
/*
|
||||
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");
|
||||
$time_logoff = microtime_float();
|
||||
|
||||
// print_r(fgets($fp));
|
||||
$resp = '';
|
||||
while (!feof($fp)) {
|
||||
$resp .= fgets($fp);
|
||||
}
|
||||
$time_resp = microtime_float();
|
||||
$resp .= "\r\n\r\n Connect :" . ($time_send - $time_connect) . " Logoff :" . ($time_logoff - $time_send) . " Response :" . ($time_resp - $time_logoff) . "\r\n\r\n ";
|
||||
// print_r(fgets($fp));
|
||||
// print_r('<br>');
|
||||
// echo fgets($fp, 128);
|
||||
}
|
||||
fclose($fp);
|
||||
return $resp;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cata/186_188/2_15_ms/english/administration/guide/sccp/sccp/sccpaape.html
|
||||
|
||||
Äëÿ ðàáîòû Cisco ATA-186, 188
|
||||
îáíîâëåíèå ïðîøèâêè
|
||||
--- linux
|
||||
/sata186us.linux -any -d3 ATA030204SCCP090202A.zup
|
||||
|
||||
Äëÿ ðàáîòû Cisco ATA-186, 188 ìîæåò ïîòðåáîâàòüñÿ ôàéë atadefault.cfg
|
||||
---------- Config
|
||||
cfgfmt.linux atadefault.txt atadefault.cfg
|
||||
|
||||
|
||||
----------------------begin atadefault.txt ---------------------
|
||||
#txt
|
||||
UIPassword:0
|
||||
UseTftp:1
|
||||
TftpURL:0
|
||||
cfgInterval:3600
|
||||
EncryptKey:0
|
||||
ToConfig:0
|
||||
upgradecode:0,0x301,0x0400,0x0200,0.0.0.0,69,0,none
|
||||
upgradelang:0,0x301,0x0400,0x0200,0.0.0.0,69,0,none
|
||||
Dhcp:1
|
||||
StaticIp:0
|
||||
StaticRoute:0
|
||||
StaticNetMask:0
|
||||
CA0orCM0:172.30.122.41:2000
|
||||
CA1orCM1:0
|
||||
CA0UID:0
|
||||
CA1UID:0
|
||||
EPID0orSID0:.
|
||||
EPID1orSID1:.
|
||||
PrfCodec:1
|
||||
LBRCodec:3
|
||||
AudioMode:0x00350035
|
||||
NumTxFrames:2
|
||||
CallerIdMethod:0x00019e60
|
||||
ConnectMode:0x90000400
|
||||
DNS1IP:0.0.0.0
|
||||
DNS2IP:0.0.0.0
|
||||
UDPTOS:0xA0
|
||||
RingCadence:2,4,25
|
||||
DialTone:2,31538,30831,1380,1740,1,0,0,0
|
||||
BusyTone:2,30467,28959,1191,1513,0,4000,4000,0
|
||||
ReorderTone:2,30467,28959,1191,1513,0,2000,2000,0
|
||||
RingBackTone:2,30831,30467,1943,2111,0,16000,32000,0
|
||||
CallWaitTone:1,30831,0,5493,0,0,2400,2400,4800
|
||||
ConfirmTone:1,30467,0,5970,0,0,480,480,1920
|
||||
MediaPort:16384
|
||||
UseMGCP:0
|
||||
MGCPPort:2427
|
||||
RetxIntvl:500
|
||||
RetxLim:7
|
||||
MGCPVer:MGCP1.0
|
||||
NPrintf:0
|
||||
TraceFlags:0x00000000
|
||||
SigTimer:0x00000064
|
||||
CodecName:PCMU,PCMA,G723,G729
|
||||
OpFlags:0x2
|
||||
VLANSetting:0x0000002b
|
||||
-----------------------end atadefault.txt ------------------
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
Conference - NOT CONFERENCE BRIDGE !!!!! ( Sccp Conference)
|
||||
|
||||
Conference Introduction
|
||||
|
||||
The integrated conference solution build in chan-sccp-b is based on asterisk's ConfBridge functionality. In stead of having to memorize the confbridge voice menu and having to press DTMF keys to control your conference we have opted to include a visual Cisco-XML menu, which give you (the Moderator) the ability to Kick, Mute and Promote another user to become an additional Moderator.
|
||||
|
||||
Note: You need to './configure --enable-conference ...' when you built the chan_sccp.so module. Note: A conference always requires at least one moderator.
|
||||
Conference Settings
|
||||
|
||||
The standard conference settings are setup per device and contain:
|
||||
param default description
|
||||
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_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_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
|
||||
Creating a New Conference (Conf Softkey)
|
||||
|
||||
Using the Conference Button makes it possible to set up a Simple Conference between 3 or more participant. (The actual minimum to start a conference is 2, but that doesn't make a lot of sense now does it.)
|
||||
|
||||
You already have 2 or more lines connected (One is active and the other(s) is/are on Hold), which you would like to put in a Conference; Simply Press the Conf Softkey Button.
|
||||
|
||||
If you do not already have these lines connected, that call some people first and then start the conference. It does not make sense to be conferencing on your own.
|
||||
Conference List (ConfList Softkey)
|
||||
|
||||
When conf_show_conflist=yes or you press the ConfList Softkey, you will be presented with a Cisco-XML Menu, showing you all currently connected Participant. Something like this:
|
||||
|
||||
7970_Conference.png
|
||||
|
||||
You can use the Softkeys underneath the menu, for example:
|
||||
Softkey Description
|
||||
EndConf Hangup all participants and end the current conference
|
||||
Kick Through a specific participant out of the conference (Call is hungup)
|
||||
Mute Do not allow a specific participant to speak (The hear a voiceprompt stating that they have been muted (if conf_play_part_announce = yes), and the mute status is displayed on their display (if they have an sccp device))
|
||||
Unmute Allow a specific participant to speak (The hear a voiceprompt stating that they have been unmuted (if conf_play_part_announce = yes), and the mute status is displayed on their display (if they have an sccp device)).
|
||||
Promote Make a specific participant a moderator as well (giving them control over the conference as well). You can leave the conference by hanging up, without the conference being terminated.
|
||||
Exit Leave the ConfList Menu, but remain connected to the conference. This makes it possible to put the conference onhold and invite someone new for examples. You need to press the ConfList Softkey to get back into the ConfList Menu.
|
||||
Adding another Participant after the conference has already started (Join Softkey)
|
||||
|
||||
If you do need to add a person after having started the conference, then you need to exit the conflist menu, put the conference on hold and dial the new "future" participant, once that person has picked up, you press the join button on that new call and this new participant will be added to the conference and you will automatically resume the conference you where in before.
|
||||
|
||||
Once the conference is started you will be presented with the conflist menu which will allow you to control the conference directly from your phone (kick / mute participant and even promote one of the participant to become a secondary moderator, so that they can take over control of the conference and you are free to leave).
|
||||
Q & A:
|
||||
The Conference Softkey just created a two person conference
|
||||
|
||||
Question: Creating a conference call on my 7961 does not seem to work. Once I hit the Conference softbutton, it will create a conference but put me and the other person directly into the conference without giving me any way to call a third party.
|
||||
|
||||
Solution: Just put the first person on hold, dial the second person (and a third, fourth etc) and then press the conference button. All of the calls connected to your phone will automatically be put into the conference.
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
|
||||
You can specifying 'useRedialMenu = yes' in the sccp.conf device section and the redial softkey will cause the "placed calls" list instead of immediately calling the last dialed number.
|
||||
CallListStateUpdate (java phones)
|
||||
|
||||
If you add/enable the 'callLogBlfEnabled' xml entry in SEPXXX.cnf.xml under commonProfile, like so:
|
||||
|
||||
<commonProfile>
|
||||
<callLogBlfEnabled>3</callLogBlfEnabled>
|
||||
</commonProfile>
|
||||
|
||||
and you have added hints for your local extension in your dialplan, like:
|
||||
|
||||
exten => _XX.,hint,SCCP/${EXTEN}
|
||||
|
||||
Then the placed calls list will include the status of the remote extension, like this:
|
||||
|
||||
PlacedCalls
|
||||
|
||||
Which does show numbers you can redial, but also include their current device state, so you know when they are currently busy. Note that the other phonebook entries will now also monitor the remove device state and show the current device state.
|
||||
|
||||
Note: the hints for the extension need to be in the same context as the device/global context, for callLogBlfEnabled to work
|
||||
|
||||
# This does not apply to phones 7940. Be careful with these keys the phone may not boot !!!
|
||||
|
|
@ -1,554 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<device>
|
||||
<fullConfig>true</fullConfig>
|
||||
<deviceProtocol>SCCP</deviceProtocol>
|
||||
<sshUserId>cisco</sshUserId>
|
||||
<sshPassword>cisco</sshPassword>
|
||||
<!--
|
||||
After using the above login, you will be prompted again for a username/password.
|
||||
Use debug/debug for this second login, and type 'help' for commands.
|
||||
(also see note about sshAccess below)
|
||||
-->
|
||||
<devicePool>
|
||||
<revertPriority>0</revertPriority>
|
||||
<name>Default</name>
|
||||
<dateTimeSetting>
|
||||
<name>Netherlands</name>
|
||||
<dateTemplate>D/M/YA</dateTemplate>
|
||||
<timeZone>W. Europe Standard/Daylight Time</timeZone>
|
||||
<ntps>
|
||||
<ntp>
|
||||
<name>pool.ntp.org</name>
|
||||
<ntpMode>Unicast</ntpMode>
|
||||
</ntp>
|
||||
</ntps>
|
||||
</dateTimeSetting>
|
||||
<callManagerGroup>
|
||||
<name>Default</name>
|
||||
<tftpDefault>true</tftpDefault>
|
||||
<members>
|
||||
<member priority="0">
|
||||
<callManager>
|
||||
<name>Asterisk</name>
|
||||
<description>Primary Asterisk Server</description>
|
||||
<ports>
|
||||
<ethernetPhonePort>2000</ethernetPhonePort>
|
||||
<!--
|
||||
<sipPort>5060</sipPort>
|
||||
<securedSipPort>5061</securedSipPort>
|
||||
<mgcpPorts>
|
||||
<listen>2427</listen>
|
||||
<keepAlive>2428</keepAlive>
|
||||
</mgcpPorts>
|
||||
-->
|
||||
</ports>
|
||||
<processNodeName>x.x.x.x</processNodeName>
|
||||
</callManager>
|
||||
</member>
|
||||
<member priority="1">
|
||||
<callManager>
|
||||
<name>Asterisk 1</name>
|
||||
<description>Secundary Asterisk Server</description>
|
||||
<ports>
|
||||
<ethernetPhonePort>2000</ethernetPhonePort>
|
||||
<!--
|
||||
<sipPort>5060</sipPort>
|
||||
<securedSipPort>5061</securedSipPort>
|
||||
<mgcpPorts>
|
||||
<listen>2427</listen>
|
||||
<keepAlive>2428</keepAlive>
|
||||
</mgcpPorts>
|
||||
-->
|
||||
</ports>
|
||||
<processNodeName>x.x.x.x</processNodeName>
|
||||
<!--
|
||||
'processNodeName' is the ip address of your asterisk server.
|
||||
-->
|
||||
</callManager>
|
||||
</member>
|
||||
</members>
|
||||
</callManagerGroup>
|
||||
<srstInfo>
|
||||
<name>Enable</name>
|
||||
<srstOption>Enable</srstOption>
|
||||
<userModifiable>true</userModifiable>
|
||||
<ipAddr1>x.x.x.x</ipAddr1>
|
||||
<port1>2000</port1>
|
||||
<ipAddr2></ipAddr2>
|
||||
<port2>2000</port2>
|
||||
<ipAddr3></ipAddr3>
|
||||
<port3>2000</port3>
|
||||
<sipIpAddr1>192.168.5.101</sipIpAddr1>
|
||||
<sipPort1>5060</sipPort1>
|
||||
<sipIpAddr2></sipIpAddr2>
|
||||
<sipPort2>5060</sipPort2>
|
||||
<sipIpAddr3></sipIpAddr3>
|
||||
<sipPort3>5060</sipPort3>
|
||||
<isSecure>false</isSecure>
|
||||
</srstInfo>
|
||||
<mlppDomainId>-1</mlppDomainId>
|
||||
<mlppIndicationStatus>Default</mlppIndicationStatus>
|
||||
<preemption>Default</preemption>
|
||||
<connectionMonitorDuration>120</connectionMonitorDuration>
|
||||
</devicePool>
|
||||
<commonProfile>
|
||||
<phonePassword></phonePassword>
|
||||
<backgroundImageAccess>true</backgroundImageAccess>
|
||||
<callLogBlfEnabled>2</callLogBlfEnabled>
|
||||
</commonProfile>
|
||||
<vendorConfig>
|
||||
<ehookEnable>1</ehookEnable>
|
||||
<!--
|
||||
Headset Hookswitch Control
|
||||
This allows the headset to take the phone off-hook (with appropriate
|
||||
cables/connections etc)
|
||||
-->
|
||||
|
||||
<disableSpeaker>false</disableSpeaker>
|
||||
<!--
|
||||
Disable only the speakerphone functionality.
|
||||
Disabling speakerphone functionality will not affect the handset.
|
||||
true = Disabled.
|
||||
false = Enabled (default).
|
||||
-->
|
||||
|
||||
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
|
||||
<!--
|
||||
Enables and disables the speakerphone and headset.
|
||||
true = Disabled.
|
||||
false = Enabled (default).
|
||||
-->
|
||||
|
||||
<pcPort>0</pcPort>
|
||||
<!--
|
||||
Enables and disables the Ethernet switch port on the phone so the IP phone can
|
||||
have access to an Ethernet connection for a PC connection through the phone.
|
||||
0 = Enabled (default).
|
||||
1 = Disabled.
|
||||
-->
|
||||
|
||||
<settingsAccess>1</settingsAccess>
|
||||
<!--
|
||||
Enables and disables the Settings button on an IP phone.
|
||||
Indicates whether the Settings button on the phone is functional. When Settings Access is enabled, you can change the phone network configuration, ring type, and volume on the phone. When Settings Access is disabled, the Settings button is completely disabled; no options appear when you press the button. Also, you cannot adjust the ringer volume or save any volume settings. By default, Settings Access is enabled.
|
||||
0 = Disabled.
|
||||
1 = Enabled (default). The phone user can modify features by using the Settings menu.
|
||||
2 = Restricted. The phone user is allowed to access User Preferences and volume settings only.
|
||||
-->
|
||||
|
||||
<garp>0</garp>
|
||||
<!--
|
||||
Enables and disables IP phone response to gratuitous Address Resolution
|
||||
Protocol (ARP) messages from the IP phone's Ethernet interface.
|
||||
Indicates whether the phone will learn MAC addresses from Gratuitous ARP responses. Disabling the phones ability to accept Gratuitous ARP will prevent applications which use this mechanism for monitoring and recording of voice streams from working. If monitoring capability is not desired, change this setting to Disabled.
|
||||
0 = Disabled.
|
||||
1 = Enabled (default).
|
||||
-->
|
||||
|
||||
<voiceVlanAccess>0</voiceVlanAccess>
|
||||
<!--
|
||||
Enables and disables spanning, which is the IP phone's access to the voice
|
||||
VLAN of the PC to which the IP phone's Ethernet port is connected.
|
||||
0 = Enabled (default).
|
||||
1 = Disabled.
|
||||
-->
|
||||
|
||||
<videoCapability>1</videoCapability>
|
||||
<!--
|
||||
a 7975G doesn't have any "real" video capability, it requires software
|
||||
called video advantage to stream webcam/video from a pc connected to
|
||||
the pc-port on the back of the phone. Enabled here just as a
|
||||
curiosity for now.
|
||||
|
||||
Make sure this is only set when video is available. Seems to cause sporadic issues if not.
|
||||
-->
|
||||
|
||||
<autoSelectLineEnable>0</autoSelectLineEnable>
|
||||
<!--
|
||||
Enables and disables auto line selection.
|
||||
0 = Disabled.
|
||||
1 = Enabled (default).
|
||||
-->
|
||||
|
||||
<webAccess>0</webAccess>
|
||||
<!--
|
||||
Enables and disables web access that allows phone users to configure settings and features on User Option web pages.
|
||||
This parameter indicates whether the phone will accept connections from a web browser or other HTTP client.
|
||||
Disabling the web server functionality of the phone will block access to the phones internal web pages.
|
||||
These pages provide statistics and configuration information.
|
||||
Features, such as QRT ( Quality Report Tool ), will not function properly without access to the phones web pages.
|
||||
This setting will also affect any serviceability application such as CiscoWorks 2000 that relies on web access.
|
||||
The following options are available.
|
||||
Disabled: Phone does not accept any HTTP connection. HTTP server is disabled on the phone.
|
||||
Read Only: Phone displays web pages but does not allow any configuration.
|
||||
Full: Phone displays web pages and allows configuration.
|
||||
0 = Enabled (default).
|
||||
1 = Disabled.
|
||||
2 = Read Only.
|
||||
-->
|
||||
|
||||
<daysDisplayNotActive>1,7</daysDisplayNotActive> <!-- sunday = 1, sat = 7 -->
|
||||
<displayOnTime>08:00</displayOnTime>
|
||||
<displayOnDuration>12:00</displayOnDuration>
|
||||
<displayIdleTimeout>00:10</displayIdleTimeout>
|
||||
<displayOnWhenIncomingCall>1</displayOnWhenIncomingCall>
|
||||
|
||||
<forwardingDelay>1</forwardingDelay>
|
||||
|
||||
<loggingDisplay>1</loggingDisplay>
|
||||
|
||||
<!-- <headsetWidebandUIControl>1</headsetWidebandUIControl> -->
|
||||
<!--
|
||||
Enables or disables wideband headset option on supported IP phones.
|
||||
If the headsetWidebandUIControl parameter is set to Enable (0), the option set
|
||||
in the phone UI, by the phone user, has priority over the value set for this
|
||||
parameter.
|
||||
0 = Enabled (default). Enables wideband headset on phone.
|
||||
1 = Disabled. Disables wideband headset on phone.
|
||||
-->
|
||||
|
||||
<!-- <handsetWidebandUIControl>1</handsetWidebandUIControl> -->
|
||||
<!--
|
||||
Enables or disables control of handset options by phone user.
|
||||
0 = Enabled (default). Allows phone user to select either narrowband or wideband handset in the phone UI.
|
||||
1 = Disabled.
|
||||
-->
|
||||
|
||||
<!-- <headsetWidebandEnable>1</headsetWidebandEnable> -->
|
||||
<!--
|
||||
Enables or disables control of headset option by phone user.
|
||||
0 = Enabled (default). Allows phone user to select either narrowband or wideband headset
|
||||
1 = Disabled.
|
||||
-->
|
||||
|
||||
<!-- <handsetWidebandEnable>1</handsetWidebandEnable> -->
|
||||
<!--
|
||||
Enables or disables wideband handset option on supported IP phones.
|
||||
If the handsetWidebandUIControl parameter is set to Enable (1), the option
|
||||
set in the phone UI, by the phone user, has priority over the value set for
|
||||
this parameter.
|
||||
0 = Phone default (default), equal to disabled or enabled and set by manufacturer.
|
||||
1 = Enabled. Enables wideband handset on phone.
|
||||
2 = Disabled. Disables wideband headset on phone.
|
||||
-->
|
||||
|
||||
<spanToPCPort>1</spanToPCPort>
|
||||
<!--
|
||||
Enables and disables the path between the Ethernet switch port of an IP phone
|
||||
and a connection to a PC.
|
||||
0 = Enabled (default).
|
||||
1 = Disabled.
|
||||
-->
|
||||
|
||||
<g722CodecSupport>2</g722CodecSupport>
|
||||
<!--
|
||||
Enables and disables the registration of the G.722 codec on the IP phone.
|
||||
0 = Phone default (default), equal to disabled or enabled and set by manufacturer.
|
||||
1 = Disabled. Disables G.722-64K2 codec on phone.
|
||||
2 = Enabled. Enables G.722-64K codec on phone.
|
||||
See also advertiseG722Codec
|
||||
-->
|
||||
|
||||
<peerFirmwareSharing>1</peerFirmwareSharing>
|
||||
<enableCdpSwPort>1</enableCdpSwPort>
|
||||
<enableCdpPcPort>1</enableCdpPcPort>
|
||||
<enableLldpSwPort>1</enableLldpSwPort>
|
||||
<enableLldpPcPort>1</enableLldpPcPort>
|
||||
<lldpAssetId></lldpAssetId>
|
||||
<powerPriority>1</powerPriority>
|
||||
<!--
|
||||
I have the above turned on just for curiosity.
|
||||
-->
|
||||
|
||||
<sshAccess>0</sshAccess> <!-- 0 = enabled -->
|
||||
<sshPort>22</sshPort>
|
||||
<!--
|
||||
The above 2 lines are *required* to enable ssh on this phone, it is off
|
||||
by default.
|
||||
-->
|
||||
|
||||
<adminPassword></adminPassword>
|
||||
<!--
|
||||
Password to access the web interface on the phone
|
||||
string
|
||||
length = 32
|
||||
-->
|
||||
<loadServer></loadServer>
|
||||
<!--
|
||||
Indicates that the phone will use an alternative server to obtain firmware loads and upgrades, rather than the defined TFTP server.
|
||||
This option enables you to indicate a local server to be used for firmware upgrades, which can assist in reducing install times, particularly for upgrades over a WAN. Enter the hostname or the IP address (using standard IP addressing format) of the server. The indicated server must be running TFTP services and have the load file in the TFTP path. If the load file is not found, the load will not install. The phone will not be redirected to the TFTP server.
|
||||
If this field is left blank, the phone will use the designated TFTP server to obtain its load files and upgrades
|
||||
string
|
||||
length = 256
|
||||
-->
|
||||
|
||||
<WlanProfile1>0</WlanProfile1>
|
||||
<!--
|
||||
Only on 7921/7925/7926
|
||||
|
||||
Indicates whether WLAN Profile 1 can be modified by the user.
|
||||
If the profile is locked, the user can not modify it.
|
||||
To allow the user to edit only the username and password in the profile, set it to restricted.
|
||||
0 = Unlocked
|
||||
1 = Locked
|
||||
2 = Restricted
|
||||
|
||||
-->
|
||||
<WlanProfile2>0</WlanProfile1>
|
||||
<WlanProfile3>0</WlanProfile1>
|
||||
<WlanProfile4>0</WlanProfile1>
|
||||
<specialNumbers></specialNumbers>
|
||||
<!--
|
||||
Only on 7921/7925/7926
|
||||
|
||||
Special numbers are telephone numbers that do not require unlocking the phone to call.
|
||||
For example, in the United States, the 911 emergency number is a good special number candidate so that it can be dialed without unlocking the phone.
|
||||
You may enter one or more special numbers in this field.
|
||||
To enter more than one special number, use a comma as separator.
|
||||
For example, if you want to enter 411, 511, and 911 as special numbers, enter 411,511,911 in the field without spaces.
|
||||
string
|
||||
length = 16
|
||||
comma separated
|
||||
-->
|
||||
<PushToTalkURL></PushToTalkURL>
|
||||
<!--
|
||||
Only on 7921/7925/7926
|
||||
|
||||
This parameter specifies the URL which the phone contacts for application services.
|
||||
-->
|
||||
<sendKeyAction></sendKeyAction>
|
||||
<!--
|
||||
This field controls the behavior of the "Send" (green) key when it is pressed. If the "Onhook Dialing" option is selected, the phone displays a list of the last numbers dialed. If the "Offhook Dialing" option is selected, the phone sends a SCCP "offhook" message to the Cisco Unified CallManager.
|
||||
-->
|
||||
<phoneBookWebAccess></phoneBookWebAccess>
|
||||
<!--
|
||||
This field controls the accessibility of the local phone book via the web and works in conjunction with the 'Web Access' parameter. When 'Web Access' is 'Disabled', the local phone book is not accessible via the web regardless of this parameter setting. When 'Web Access' is 'Read-Only' or 'Full', access to the local phone book is as follows: 'Deny All' will not allow web access for reading or writing of the local phone book; 'Allow Admin' will allow only the phone administrator to read from and write to the local phone book.
|
||||
-->
|
||||
<unlockSettingsSequence></unlockSettingsSequence>
|
||||
<!--
|
||||
Only on 7921/7925/7926
|
||||
This parameter determines if a "**#" (star-star-pound) key sequence is required for write-access to the phone's settings menu. A value of 'Enabled' requires the user to enter **# first before making changes to the settings menu. If the value is 'Disabled', the user is allowed to make modifications to the settings menu without having to enter the unlock key sequence.
|
||||
-->
|
||||
<appButtonTimer></appButtonTimer>
|
||||
<!--
|
||||
Amount of time you must hold down the Application Button to activate the application. The timer values are in seconds. A value of 0 indicates that a simple push of the Application Button will active the application. For non-zero values, the application is activated after the specified timer value expires.
|
||||
-->
|
||||
<appButtonPriority></appButtonPriority>
|
||||
<!--
|
||||
This parameter indicates the priority of the Application Button relative to all other tasks on the phone. The priorities are defined as follows.
|
||||
Low: The Application Button only works when the phone is idle and on the main screen.
|
||||
Medium: The Application Button takes precedence over all tasks on the phone except when the keypad is locked.
|
||||
High: The Application Button takes precedence over all tasks on the phone.
|
||||
-->
|
||||
<outOfRangeAlert></outOfRangeAlert>
|
||||
<!--
|
||||
Only on 7921/7925/7926
|
||||
This parameter controls the frequency of audible alerts when the phone is out of range of an access point. The phone does not play audible alerts when the parameter value is "disabled." The phone can beep once or regularly at a selected interval (10, 30, or 60 seconds) when it is out of range of an access point. Once the phone is within range of an access point, audible alerts stop.
|
||||
-->
|
||||
<scanningMode></scanningMode>
|
||||
<!--
|
||||
Only on 7921/7925/7926
|
||||
This parameter controls when the phone performs scanning. The parameter values are as follow.
|
||||
Auto: Phone scans when it is in a call or when the received strength signal indicator (RSSI) is low.
|
||||
Single AP: Phone never scans except when the basic service set (BSS) is lost.
|
||||
Continuous: Phone scans continuously even when it is not in a call.
|
||||
-->
|
||||
<restrictDataRates></restrictDataRates>
|
||||
<!--
|
||||
This parameter enables or disables the restriction of the upstream and downstream PHY rates according to CCX V4 Traffic Stream Rate Set IE (S54.2.6).
|
||||
-->
|
||||
<powerOffWhenCharging></powerOffWhenCharging>
|
||||
<!--
|
||||
Only on 7921/7925/7926
|
||||
This parameter indicates whether the phone powers off when it is connected to a charger or placed in a charging station.
|
||||
-->
|
||||
<cdpEnable></cdpEnable>
|
||||
<!--
|
||||
This parameter enables or disables the Cisco Discovery Protocol (CDP) on the phone.
|
||||
-->
|
||||
<g722CodecSupport></g722CodecSupport>
|
||||
<!--
|
||||
This parameter indicates whether the phone will advertise the G.722 codec to the Cisco Unified CallManager. Codec negotiation involves two steps: first, the phone must advertise the supported codec(s) to the Cisco Unified CallManager (not all endpoints support the same set of codecs). Second, when the Cisco Unified CallManager gets the list of supported codecs from all phones involved in the call attempt, it chooses a commonly-supported codec based on various factors, including the region pair setting. Valid values specify Use System Default (this phone will defer to the setting specified in the enterprise parameter, Advertise G.722 Codec), Disabled (this phone will not advertise G.722 to the Cisco Unified CallManager) or Enabled (this phone will advertise G.722 to the Cisco Unified CallManager).
|
||||
-->
|
||||
<homeScreen></homeScreen>
|
||||
<!--
|
||||
This parameter sets the phone's default home screen.
|
||||
-->
|
||||
<fipsMode></fipsMode>
|
||||
<!--
|
||||
This parameter sets the Federal Information Processing Standards (FIPS) mode for the phone. The Cisco 7926 is a FIPS 140-2 level 1 compliant device when this option is enabled.
|
||||
-->
|
||||
<autoSelectLineEnable></autoSelectLineEnable>
|
||||
<!--
|
||||
When enabled, indicates that the phone will shift the call focus to incoming calls on all lines. When disabled, the phone will only shift the focus to incoming calls on the currently used line.
|
||||
-->
|
||||
<bluetooth></bluetooth>
|
||||
<!--
|
||||
Indicates whether the Bluetooth device on the phone is enabled or disabled.
|
||||
-->
|
||||
<fileSystemVerificationEnable></fileSystemVerificationEnable>
|
||||
<!--
|
||||
This parameter indicates whether the phone will perform a file system integrity check as part of the firmware upgrade process. Enable this option to troubleshoot file system issues. This feature may impact phone performance if it is enabled.
|
||||
-->
|
||||
<barCodeSymbologyGroup></barCodeSymbologyGroup>
|
||||
<!--
|
||||
Only on 7921/7925/7926
|
||||
-->
|
||||
<scannerCommands></scannerCommands>
|
||||
<!--
|
||||
Only on 7921/7925/7926
|
||||
-->
|
||||
<minimumRingVolume></minimumRingVolume>
|
||||
<!--
|
||||
-->
|
||||
<java></java>
|
||||
<!--
|
||||
-->
|
||||
<headsetHandsetMonitor>0</handsetHeadsetMonitor>
|
||||
<!--
|
||||
0: will not enable the handset monitoring and only the headset will be active
|
||||
1: will enable activate both the headset as well as the handset during a call
|
||||
-->
|
||||
<detectCMConnectionFailure>0</detectCMConnectionFailure>
|
||||
<!--
|
||||
Switch from measured keepalive packet delivery time falure detection to delayed failure detection
|
||||
See: https://github.com/chan-sccp/chan-sccp/wiki/Unregister%2C-ReRegistering%2C-Keepalive-issues
|
||||
See: http://www.cisco.com/c/en/us/support/docs/collaboration-endpoints/unified-ip-phone-7900-series/200410-Troubleshoot-IP-Phone-Unregistration-A.html
|
||||
0: Normal Failure Detection
|
||||
1: Delayed Failure Detection
|
||||
-->
|
||||
</vendorConfig>
|
||||
<versionStamp>{Jan 01 2003 00:00:00}</versionStamp>
|
||||
<loadInformation>P00308010100</loadInformation>
|
||||
<!--
|
||||
The firmware version that the phone looks for at boot.
|
||||
Can be either the actual firmware version like P00308010100 or SCCP70.8-5-4S or a reference to the termXX.default file.
|
||||
The later is actually much easier to maintain, just unpack the new firmware, which replaces the termXX.default.loads file.
|
||||
You don't have to update all your SEP... files because it just refers them to the loads file, from which they get the
|
||||
new firmware version number.
|
||||
|
||||
-->
|
||||
<userLocale>
|
||||
<name>Dutch_Netherlands</name>
|
||||
<langCode>nl</langCode>
|
||||
<winCharSet>iso-8859-1</winCharSet>
|
||||
</userLocale>
|
||||
|
||||
<networkLocale>Netherlands</networkLocale>
|
||||
<networkLocaleInfo>
|
||||
<name>Dutch_Netherlands</name>
|
||||
<langCode>nl</langCode>
|
||||
<uid>64</uid>
|
||||
<version>4.0(1)</version>
|
||||
</networkLocaleInfo>
|
||||
<!--
|
||||
This is something to do with dialtones. The above config gives Dutch dialtones.
|
||||
-->
|
||||
|
||||
<authenticationURL>http://x.x.x.x/cisco_menu/authentication.php</authenticationURL>
|
||||
<!--
|
||||
The above is simply a dummy authentication page. It literally contains
|
||||
one word: AUTHORIZED
|
||||
(it receives UserId, Password, and devicename in the url - if you truly wish
|
||||
to implement special auth)
|
||||
-->
|
||||
<informationURL>http://x.x.x.x/cisco_menu/help/help.php</informationURL>
|
||||
<messagesURL></messagesURL>
|
||||
<proxyServerURL></proxyServerURL>
|
||||
<servicesURL>http://x.x.x.x/cisco_menu/menu.php</servicesURL>
|
||||
<directoryURL>http://x.x.x.x/cisco_menu/directory/menu.php</directoryURL>
|
||||
<!--
|
||||
This is the URL for a CiscoIPPhoneMenu which gets appended to the end of the
|
||||
Missed/Received/Placed calls. I don't use it (I find it makes more sense to
|
||||
put my phone book under services)
|
||||
-->
|
||||
<idleURL>http://x.x.x.x/cisco_menu/idle.php</idleURL>
|
||||
<!--
|
||||
URL of CiscoIPPhoneImage.
|
||||
Requires a non-zero setting in idleTimeout.
|
||||
-->
|
||||
<idleTimeout>3600</idleTimeout>
|
||||
|
||||
<deviceSecurityMode>1</deviceSecurityMode>
|
||||
<phonePersonalization>1</phonePersonalization>
|
||||
<singleButtonBarge>1</singleButtonBarge>
|
||||
<joinAcrossLines>1</joinAcrossLines>
|
||||
<autoCallPickupEnable>false</autoCallPickupEnable>
|
||||
<blfAudibleAlertSettingOfIdleStation>1</blfAudibleAlertSettingOfIdleStation>
|
||||
<blfAudibleAlertSettingOfBusyStation>1</blfAudibleAlertSettingOfBusyStation>
|
||||
<advertiseG722Codec>1</advertiseG722Codec>
|
||||
|
||||
<mobility>
|
||||
<handoffdn></handoffdn>
|
||||
<dtmfdn></dtmfdn>
|
||||
<ivrdn></ivrdn>
|
||||
<dtmfHoldCode>*81</dtmfHoldCode>
|
||||
<dtmfExclusiveHoldCode>*82</dtmfExclusiveHoldCode>
|
||||
<dtmfResumeCode>*83</dtmfResumeCode>
|
||||
<dtmfTxfCode>*84</dtmfTxfCode>
|
||||
<dtmfCnfCode>*85</dtmfCnfCode>
|
||||
</mobility>
|
||||
|
||||
<dscpForSCCPPhoneConfig>104</dscpForSCCPPhoneConfig>
|
||||
<dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices>
|
||||
<dscpForCm2Dvce>184</dscpForCm2Dvce>
|
||||
<transportLayerProtocol>4</transportLayerProtocol>
|
||||
<capfAuthMode>0</capfAuthMode>
|
||||
<capfList>
|
||||
<capf>
|
||||
<phonePort>3804</phonePort>
|
||||
</capf>
|
||||
</capfList>
|
||||
<certHash></certHash>
|
||||
<encrConfig>false</encrConfig>
|
||||
<phoneServices>
|
||||
<provisioning>0</provisioning>
|
||||
<!-- provisioning:
|
||||
0 = Use PhoneServices
|
||||
1 = Use ServicerURL / DirectoryURL and MessagesURL (Above)
|
||||
2 = Use Both (Merge Both)
|
||||
-->
|
||||
|
||||
<!-- Below
|
||||
type = 0 -> applicaton menu
|
||||
type = 1 -> contacts menu
|
||||
type = 2 -> messages menu
|
||||
-->
|
||||
<phoneService type="0" category="0">
|
||||
<name>Corporate Directory</name>
|
||||
<url>Application:Cisco/CorporateDirectory</url>
|
||||
<vendor></vendor>
|
||||
<version></version>
|
||||
</phoneService>
|
||||
<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="1" category="0">
|
||||
<name>Personal Directory</name>
|
||||
<url>Application:Cisco/PersonalDirectory</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>
|
||||
</device>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
http://usecallmanager.nz/sepmac-cnf-xml.html
|
||||
http://usecallmanager.nz/line-keys-xml.html
|
||||
http://usecallmanager.nz/user-locale.html
|
||||
https://www.voip-info.org/wiki/view/Asterisk+phone+cisco+79x1+xml+configuration+files+for+SIP
|
||||
https://www.voip-info.org/wiki/view/Asterisk+phone+cisco+7970+SIP
|
||||
https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cuipph/all_models/xsi/8_5_1/xsi_dev_guide/xmlobjects.html
|
||||
https://habrahabr.ru/post/176019/
|
||||
https://learningnetwork.cisco.com/thread/14585
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
https://github.com/chan-sccp/chan-sccp/wiki/Adding-custom-background-images
|
||||
http://www.voicecerts.com/2011/08/changing-cisco-ip-phone-background.html
|
||||
https://silver-golem.livejournal.com/432591.html
|
||||
|
||||
> Real Time !
|
||||
http://silver-golem.livejournal.com/431942.html
|
||||
|
||||
General Information
|
||||
|
||||
Cisco IP Phones support either colored or monochrom background images in various resolutions (depending on model). The background can either be set up in sccp.conf server side or the user can be enabled to select a background image from a defined list of backgrounds. The image has to be a graphic file with .PNG extension. Other requirements apply, depending on phone model (see below).
|
||||
Set background image server side
|
||||
|
||||
Background images can be set up server side in sccp.conf for most modern Cisco IP Phones by using a parameter in the device section. This image is pushed to the phone upon every restart.
|
||||
|
||||
[SEPXXXXXXXXX]
|
||||
...
|
||||
backgroundImage=http://PATH-TO-BACKGROUND-IMAGE/filename.png
|
||||
|
||||
!!!> Phone personalization needs to be set to allow the server to push background or ringtones to the phone in the SEPXXXXXXXXXX.cnf.xml of each phone:
|
||||
|
||||
------------------------------------
|
||||
<phonePersonalization>1</phonePersonalization>
|
||||
------------------------------------
|
||||
Enable user to pick a custom background image
|
||||
|
||||
When a user is allowed to pick his own background image in the user settings (true in device section of the SEPXXXX.xml config file), the phone searches for the List.xml (case-sensitive) file in the following directories. Depending on the phone model, the required file properties are as follows:
|
||||
Phone Model Image Size Thumbnail Size Directory
|
||||
7906 / 7911 95x34 23x8 /Desktops/95x34x1
|
||||
7941 / 7961 320x196 80x49 /Desktops/320x196x4
|
||||
7942 / 7962 320x196 80x49 /Desktops/320x196x4
|
||||
7945 / 7965 320x212 80x53 /Desktops/320x212x16
|
||||
7970 / 7971 320x212 80x53 /Desktops/320x212x12
|
||||
7975 320x216 80x53 /Desktops/320x216x16
|
||||
7985 800x600 not supported /Desktops/800x600x16
|
||||
8941 / 8945 640x480 123x111 /Desktops/640x480x24
|
||||
|
||||
The Image file is used for the background of the phone display. An additional thumbnail is used as a preview image on the phone settings menu (on 7985 only the filename). The List.xml has to be in the above model-depending directory. The file has a Cisco IPPhoneImage syntax, example:
|
||||
|
||||
<CiscoIPPhoneImageList>
|
||||
<ImageItem Image="TFTP:Desktops/640x480x24/sccp-tn.png"
|
||||
URL="TFTP:Desktops/640x480x24/sccp.png"/>
|
||||
<ImageItem Image="TFTP:Desktops/640x480x24/sccp_2-tn.png"
|
||||
URL="TFTP:Desktops/640x480x24/sccp_2.png"/>
|
||||
</CiscoIPPhoneImageList>
|
||||
|
||||
While the resolution is fix, the phones are able to reduce the color depth if the original image uses too many colors.
|
||||
|
||||
Note: This can also be done using the SEP....cnf.xml file
|
||||
<device>
|
||||
...
|
||||
<commonProfile>
|
||||
<defaultBackground>TFTP/HTTP/HTTPS URL</defaultBackground>
|
||||
<backgroundImageAccess>true/false</backgroundImageAccess> <!-- allowing users to change the background -->
|
||||
</commonProfile>
|
||||
<phonePersonalization>1</phonePersonalization> <!-- allowing users to change the background -->
|
||||
...
|
||||
</device>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
Убрать коменты
|
||||
в sccpgeneral.xml
|
||||
- <item type="SLA-disabled" id="6"><label>Default Dial Plan</label>
|
||||
+ <item type="SLA" id="6"><label>Default Dial Plan</label>
|
||||
|
||||
|
||||
в Sccp_manager.class.php
|
||||
// "sccpdialplan" => array(
|
||||
// "name" => _("SCCP Dial Plan information"),
|
||||
// "page" => 'views/server.dialtemplate.php'
|
||||
// )
|
||||
|
|
@ -1 +0,0 @@
|
|||
https://github.com/chan-sccp/chan-sccp/wiki/Monitor-and-Pickup-Incoming-Calls-via-Speeddial-Using-Custom-Devstate
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
diff --git a/src/sccp_config.c b/src/sccp_config.c
|
||||
index e15d19db..c78bcbf2 100644
|
||||
--- a/src/sccp_config.c
|
||||
+++ b/src/sccp_config.c
|
||||
@@ -3062,6 +3062,7 @@ int sccp_manager_config_metadata(struct mansession *s, const struct message *m)
|
||||
uint i;
|
||||
const char *id = astman_get_header(m, "ActionID");
|
||||
const char *req_segment = astman_get_header(m, "Segment");
|
||||
+ const char *req_listresult = astman_get_header(m, "ListResult");
|
||||
uint comma = 0;
|
||||
|
||||
if (sccp_strlen_zero(req_segment)) { // return all segments
|
||||
@@ -3180,11 +3181,22 @@ int sccp_manager_config_metadata(struct mansession *s, const struct message *m)
|
||||
sccpConfigSegment = &sccpConfigSegments[i];
|
||||
const SCCPConfigOption *config = sccpConfigSegment->config;
|
||||
|
||||
- astman_append(s, "Response: Success\r\n");
|
||||
- if (!ast_strlen_zero(id)) {
|
||||
- astman_append(s, "ActionID: %s\r\n", id);
|
||||
+ if (sccp_strcaseequals(req_listresult, "yes")) {
|
||||
+ //astman_append(s, "Response: Follows\r\n\r\n");
|
||||
+ //astman_append(s, "EventList: Start\r\n");
|
||||
+ astman_send_listack(s, m, "SCCPConfigMetaData Follows", "Start");
|
||||
+ astman_append(s, "Event: SCCPConfigMetaData\r\n");
|
||||
+ if (!ast_strlen_zero(id)) {
|
||||
+ astman_append(s, "ActionID: %s\r\n", id);
|
||||
+ }
|
||||
+ } else if (sccp_strcaseequals(req_listresult, "freepbx")) {
|
||||
+ astman_append(s, "Response: Follows\r\n");
|
||||
+ } else {
|
||||
+ astman_append(s, "Response: Success\r\n");
|
||||
+ if (!ast_strlen_zero(id)) {
|
||||
+ astman_append(s, "ActionID: %s\r\n", id);
|
||||
+ }
|
||||
}
|
||||
-
|
||||
astman_append(s, "JSON: {");
|
||||
astman_append(s, "\"Segment\":\"%s\",", sccpConfigSegment->name);
|
||||
astman_append(s, "\"Options\":[");
|
||||
@@ -3296,8 +3308,17 @@ int sccp_manager_config_metadata(struct mansession *s, const struct message *m)
|
||||
comma = 1;
|
||||
}
|
||||
}
|
||||
- astman_append(s, "]}\r\n\r\n");
|
||||
+ astman_append(s, "]}\r\n");
|
||||
total++;
|
||||
+ if (sccp_strcaseequals(req_listresult, "yes")) {
|
||||
+ astman_append(s,
|
||||
+ "\r\nEvent: SCCPConfigMetaDataComplete\r\n"
|
||||
+ "EventList: Complete\r\n"
|
||||
+ "ListItems: %d\r\n\r\n", total);
|
||||
+ } else if (sccp_strcaseequals(req_listresult, "freepbx")) {
|
||||
+ astman_append(s, "--END COMMAND--\r\n");
|
||||
+ }
|
||||
+ astman_append(s, "\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
git clone https://github.com/chan-sccp/chan-sccp chan-sccp_develop
|
||||
|
||||
./configure --enable-indications --enable-conference --enable-advanced-functions --enable-distributed-devicestate
|
||||
make
|
||||
make install
|
||||
|
||||
load = chan_sccp.so
|
||||
noload = chan_skinny.so
|
||||
|
||||
preload = func_db.so
|
||||
preload = res_odbc.so
|
||||
preload = res_config_odbc.so
|
||||
preload = cdr_adaptive_odbc.so
|
||||
preload = app_voicemail.so
|
||||
|
||||
|
|
@ -1,280 +0,0 @@
|
|||
;!
|
||||
;! Automatically generated configuration file
|
||||
;! Filename: sccp.conf.annotated (/usr/local/asterisk-13-branch/etc/asterisk/sccp.conf.annotated)
|
||||
;! Generator: sccp config generate
|
||||
;! Creation Date: Sun Nov 1 01:27:41 2015
|
||||
;!
|
||||
|
||||
|
||||
;
|
||||
; general section
|
||||
;
|
||||
[general]
|
||||
;servername = Asterisk ; (REQUIRED) show this name on the device registration
|
||||
;keepalive = 60 ; (REQUIRED) Phone keep alive message every 60 secs. Used to check the voicemail and keep an open connection between server and phone (nat).
|
||||
; Don't set any lower than 60 seconds.
|
||||
;debug = core ; (MULTI-ENTRY) console debug level or categories
|
||||
; examples: debug = 11 | debug = mwi,event,core | debug = all | debug = none or 0
|
||||
; possible categories:
|
||||
; core, sccp, hint, rtp, device, line, action, channel, cli, config, feature, feature_button, softkey, indicate, pbx
|
||||
; socket, mwi, event, adv_feature, conference, buttontemplate, speeddial, codec, realtime, lock, newcode, high, all, none
|
||||
;context = default ; (REQUIRED) pbx dialplan context
|
||||
;dateformat = M/D/Y ; (SIZE: 7) M-D-Y in any order. Use M/D/YA (for 12h format)
|
||||
;bindaddr = 0.0.0.0 ; (REQUIRED) replace with the ip address of the asterisk server (RTP important param)
|
||||
;port = 2000 ; listen on port 2000 (Skinny, default)
|
||||
deny = 0.0.0.0/0.0.0.0
|
||||
permit = internal ; (REQUIRED) (MULTI-ENTRY) Deny every address except for the only one allowed. example: '0.0.0.0/0.0.0.0'
|
||||
; Accept class C 192.168.1.0 example '192.168.1.0/255.255.255.0'
|
||||
; You may have multiple rules for masking traffic.
|
||||
; Rules are processed from the first to the last.
|
||||
; 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
|
||||
;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.
|
||||
;firstdigittimeout = 16 ; Dialing timeout for the 1st digit
|
||||
;digittimeout = 8 ; More digits
|
||||
;digittimeoutchar = # ; You can force the channel to dial with this char in the dialing state
|
||||
;recorddigittimeoutchar = no ; You can force the channel to dial with this char in the dialing state
|
||||
;simulate_enbloc = yes ; Use simulated enbloc dialing to speedup connection when dialing while onhook (older phones)
|
||||
;ringtype = outside ; Ringtype for incoming calls (default='outside')
|
||||
;autoanswer_ring_time = 1 ; Ringing time in seconds for the autoanswer.
|
||||
;autoanswer_tone = 0x32 ; Autoanswer confirmation tone. For a complete list of tones: grep SKINNY_TONE sccp_protocol.h
|
||||
; not all the tones can be played in a connected state, so you have to try.
|
||||
;remotehangup_tone = 0x32 ; Passive hangup notification. 0 for none
|
||||
;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.
|
||||
; 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.
|
||||
;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_interval = 0 ; Callwaiting ring interval in seconds. Set to 0 to disable the callwaiting ringing interval.
|
||||
;musicclass = default ; Sets the default music on hold class
|
||||
;language = en ; Default language setting
|
||||
;callevents = yes ; Generate manager events when phone
|
||||
; Performs events (e.g. hold)
|
||||
;accountcode = skinny ; Accountcode to ease billing
|
||||
;sccp_tos = 0x68 ; Sets the default sccp signaling packets Type of Service (TOS) (defaults to 0x68 = 01101000 = 104 = DSCP:011010 = AF31)
|
||||
; Others possible values : [CS?, AF??, EF], [0x??], [lowdelay, throughput, reliability, mincost(solaris)], none
|
||||
;sccp_cos = 4 ; sets the default sccp signaling packets Class of Service (COS).
|
||||
;audio_tos = 0xB8 ; sets the default audio/rtp packets Type of Service (TOS) (defaults to 0xb8 = 10111000 = 184 = DSCP:101110 = EF)
|
||||
;audio_cos = 6 ; sets the default audio/rtp packets Class of Service (COS).
|
||||
;video_tos = 0x88 ; sets the default video/rtp packets Type of Service (TOS) (defaults to 0x88 = 10001000 = 136 = DSCP:100010 = AF41)
|
||||
;video_cos = 5 ; sets the default video/rtp packets Class of Service (COS).
|
||||
;echocancel = yes ; sets the phone echocancel for all devices
|
||||
;silencesuppression = no ; sets the silence suppression for all devices
|
||||
; we don't have to trust the phone ip address, but the ip address of the connection
|
||||
;earlyrtp = progress ; valid options: none, offhook, immediate, dial, ringout and progress.
|
||||
; The audio stream will be open in the progress and connected state by default. Immediate forces overlap dialing.
|
||||
; (POSSIBLE VALUES: ["Immediate","OffHook","Dialing","Ringout","Progress","None"])
|
||||
;dndFeature = on ; Turn on the dnd softkey for all devices. Valid values are 'off', 'on'.
|
||||
;private = yes ; permit the private function softkey
|
||||
;mwilamp = on ; Set the MWI lamp style when MWI active to on, off, wink, flash or blink
|
||||
; (POSSIBLE VALUES: ["Off","On","Wink","Flash","Blink"])
|
||||
;mwioncall = no ; Set the MWI on call.
|
||||
;blindtransferindication = ring ; moh or ring. the blind transfer should ring the caller or just play music on hold
|
||||
; (POSSIBLE VALUES: ["RING","MOH"])
|
||||
;cfwdall = yes ; activate the callforward ALL stuff and softkeys
|
||||
;cfwdbusy = yes ; activate the callforward BUSY stuff and softkeys
|
||||
;cfwdnoanswer = yes ; activate the callforward NOANSWER stuff and softkeys
|
||||
;nat = auto ; Global NAT support.
|
||||
; (POSSIBLE VALUES: ["Auto","Off","(Auto)Off","On","(Auto)On"])
|
||||
;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.
|
||||
; 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
|
||||
pickupgroup = "" ; We can do call pick-p for call group 1,3,4,5. Valid for all lines
|
||||
;directed_pickup_modeanswer = yes ; Automatically Answer when using Directed Pickup.
|
||||
;amaflags = default ; Sets the default AMA flag code stored in the CDR record
|
||||
;callanswerorder = oldestfirst ; oldestfirst or lastestfirst
|
||||
; (POSSIBLE VALUES: ["OldestFirst","LastFirst"])
|
||||
regcontext = "" ; SCCP Lines will we added to this context in asterisk for Dundi lookup purposes.
|
||||
; Do not set to an already created/used context. The context will be autocreated. You can share the sip/iax regcontext if you like.
|
||||
;devicetable = sccpdevice ; datebasetable for devices
|
||||
;linetable = sccpline ; datebasetable for lines
|
||||
;meetme = yes ; enable/disable conferencing via meetme (on/off), make sure you have one of the meetme apps mentioned below activated in module.conf
|
||||
; when switching meetme=on it will search for the first of these three possible meetme applications and set these defaults
|
||||
; - {'MeetMe', 'qd'},
|
||||
; - {'ConfBridge', 'Mac'},
|
||||
; - {'Konference', 'MTV'}
|
||||
;meetmeopts = qxd ; options to send the meetme application, defaults are dependent on meetme app see the list above
|
||||
; Other options (app_meetme: A,a,b,c,C,d,D,E,e,F,i,I,l,L,m,M,o,p,P,q,r,s,S,t,T,w,x,X,1) see meetme specific documentation
|
||||
;jbenable = no ; Enables the use of a jitterbuffer on the receiving side of a sccp channel.
|
||||
; An enabled jitterbuffer will be used only if the sending side can create and the receiving side can not accept jitter.
|
||||
; The sccp channel can accept jitter, thus a jitterbuffer on the receive sccp side will beused only if it is forced and enabled.
|
||||
;jbforce = no ; Forces the use of a jitterbuffer on the receive side of a sccp channel.
|
||||
;jblog = no ; Enables jitterbuffer frame logging.
|
||||
;jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
|
||||
;jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is
|
||||
; resynchronized. Useful to improve the quality of the voice, with
|
||||
; big jumps in/broken timestamps, usually sent from exotic devices
|
||||
; and programs.
|
||||
;jbimpl = fixed ; (SIZE: 11) Jitterbuffer implementation, used on the receiving side of a
|
||||
; sccp channel. Two implementations are currently available
|
||||
; - 'fixed' (with size always equals to jbmaxsize)
|
||||
; - 'adaptive' (with variable size, actually the new jb of IAX2).
|
||||
;hotline_enabled = yes ; Setting the hotline Feature on a device, will make it connect to a predefined extension as soon as the Receiver
|
||||
; is picked up or the 'New Call' Button is pressed. No number has to be given. This works even on devices which
|
||||
; have no entry in the config file or realtime database.
|
||||
; The hotline function can be used in different circumstances, for example at a door, where you want people to be
|
||||
; able to only call one number, or for unprovisioned phones to only be able to call the helpdesk to get their phone
|
||||
; set up. If hotline_enabled = yes, any device which is not included in the configuration explicitly will be allowed
|
||||
; to registered as a guest device. All such devices will register on a single shared line called 'hotline'.
|
||||
;hotline_context = sccp ;
|
||||
;hotline_extension = 111 ;
|
||||
;hotline_label = hotline ;
|
||||
;fallback = no ; Immediately fallback to primairy/master server when it becomes available (master/slave asterisk cluster) (TokenRequest)
|
||||
; Possible values are: true/false/odd/even/script.
|
||||
; active/passive cluster: true on active/false on passive
|
||||
; active/active cluster: even on active1/off on active2
|
||||
; more complex cluster: use script. It will be called with three arguments, namely mac-address, ip-address, devicetype.
|
||||
; and it should return 'ACK' (without the quotes) to acknowledge the token, or a value for the number of seconds to backoff and try again.
|
||||
; Value can be changed online via CLI/AMI command 'sccp set fallback true/false/odd/even/script'
|
||||
;backoff_time = 60 ; Time to wait before re-asking to fallback to primairy server (Token Reject Backoff Time)
|
||||
;server_priority = 1 ; Server Priority for fallback: 1=Primairy, 2=Secundary, 3=Tertiary etc
|
||||
; For active-active (fallback=odd/even) use 1 for both
|
||||
|
||||
;
|
||||
; device section
|
||||
;
|
||||
[default_device](!)
|
||||
device = "" ; (SIZE: 15) device type
|
||||
devicetype = "" ; (SIZE: 15) device type
|
||||
description = "" ; device description
|
||||
keepalive = "" ; set keepalive to 60
|
||||
;tzoffset = 0 ; time zone offset
|
||||
;disallow = all
|
||||
;allow = ulaw ; (MULTI-ENTRY) Same as entry in [general] section
|
||||
;allow = alaw
|
||||
;transfer = yes ; enable or disable the transfer capability. It does remove the transfer softkey
|
||||
;park = yes ; take a look to the compile how-to. Park stuff is not compiled by default.
|
||||
;cfwdall = no ; activate the call forward stuff and soft keys
|
||||
;cfwdbusy = no ; allow call forward when line is busy
|
||||
;cfwdnoanswer = no ; allow call forward when line if not being answered
|
||||
;dndFeature = yes ; allow usage do not disturb button
|
||||
dnd = "" ; allow setting dnd action for this device. Valid values are 'off', 'reject' (busy signal), 'silent' (ringer = silent) or 'user' (not used at the moment). . The value 'on' has been made obsolete in favor of 'reject'
|
||||
; (POSSIBLE VALUES: ["Off","Reject","Silent","UserDefined"])
|
||||
;force_dtmfmode = auto ; auto, skinny or rfc2833. Some phone models with bad firmware do send dtmf in a messed up order and need to be forced to skinny mode.
|
||||
; (POSSIBLE VALUES: ["AUTO","RFC2833","SKINNY"])
|
||||
deny = ""
|
||||
permit = "" ; (MULTI-ENTRY) Same as entry in [general] section
|
||||
; This device can register only using this ip address
|
||||
audio_tos = "" ; sets the audio/rtp packets Type of Service (TOS) (defaults to 0xb8 = 10111000 = 184 = DSCP:101110 = EF).
|
||||
; Others possible values : 0x??, lowdelay, throughput, reliability, mincost(solaris), none.
|
||||
audio_cos = "" ; sets the audio/rtp packets Class of Service (COS)
|
||||
video_tos = "" ; sets the video/rtp packets Type of Service (TOS) (defaults to 0x88 = 10001000 = 136 = DSCP:100010 = AF41).
|
||||
video_cos = "" ; sets the video/rtp packets Class of Service (COS).
|
||||
nat = "" ; Device NAT support. Currently nat is automatically detected in most cases.
|
||||
; (POSSIBLE VALUES: ["Auto","Off","(Auto)Off","On","(Auto)On"])
|
||||
directrtp = "" ; This option allow devices to do direct RTP sessions.
|
||||
earlyrtp = "" ; valid options: none, offhook, immediate, dial, ringout and progress.
|
||||
; The audio stream will be open in the progress and connected state by default. Immediate forces overlap dialing.
|
||||
; (POSSIBLE VALUES: ["Immediate","OffHook","Dialing","Ringout","Progress","None"])
|
||||
private = "" ; permit the private function softkey for this device
|
||||
privacy = "" ; permit the private function softkey for this device
|
||||
mwilamp = "" ; Set the MWI lamp style when MWI active to on, off, wink, flash or blink
|
||||
; (POSSIBLE VALUES: ["Off","On","Wink","Flash","Blink"])
|
||||
mwioncall = "" ; Set the MWI on call.
|
||||
meetme = "" ; enable/disable conferencing via app_meetme (on/off)
|
||||
meetmeopts = "" ; options to send the app_meetme application (default 'qd' = quiet,dynamic pin)
|
||||
; Other options (A,a,b,c,C,d,D,E,e,F,i,I,l,L,m,M,o,p,P,q,r,s,S,t,T,w,x,X,1) see app_meetme documentation
|
||||
;softkeyset = default ; use specified softkeyset with name 'default'
|
||||
;useRedialMenu = no ; show redial phone book list instead of dialing the last number (adv_feature). Requires a Phone Service block in SEP....cnf.xml to work correct on Java phones (See conf/tftp/SEP example files)
|
||||
;directed_pickup = yes ; enable/disable Pickup button to do directed pickup from a specific extension.
|
||||
directed_pickup_context = "" ; context where direct pickup search for extensions. if not set current contect will be use.
|
||||
;directed_pickup_modeanswer = yes ; on = asterisk way, the call has been answered when picked up.
|
||||
monitor = "" ;
|
||||
allowoverlap = "" ; Allow for Overlap dialing (Continue dialing after the first part of the number has already been send to the pstn)
|
||||
setvar = "" ; (MULTI-ENTRY) extra variables to be set on line initialization multiple entries possible (for example the sip number to use when dialing outside)
|
||||
; format setvar=param=value, for example setvar=sipno=12345678
|
||||
permithost = "" ; (MULTI-ENTRY) permit/deny but by resolved hostname
|
||||
addon = "" ; One of 7914, 7915, 7916
|
||||
button = "" ; (MULTI-ENTRY) Buttons come in the following flavours (empty, line, speeddial, service, feature).
|
||||
; Examples (read the documentation for more examples/combinations):
|
||||
; - button = line,1234
|
||||
; - button = line,1234,default
|
||||
; - button = empty
|
||||
; - button = line,98099@11:Phone1
|
||||
; - button = line,98099@12:Phone2#ButtonLabel!silent ; append cidnum:'12' and cidname:'Phone2' to line-ci with label 'ButtonLabel', don't ring when dialed directly
|
||||
; - button = line,98099@+12:Phone2@ButtonLabel!silent ; same as the previous line
|
||||
; - button = line,98099@=12:Phone2!silent ; overwrite line-cid instead of appending
|
||||
; - button = speeddial,Phone 2 Line 1, 98021, 98021@hints
|
||||
; - button = feature,cfwdall,1234
|
||||
; - button = feature,PDefault,ParkingLot,default ; feature, name, feature_type, parkinglotContext [,RetrieveSingle]
|
||||
; - button = feature,PDefault,ParkingLot,default,RetrieveSingle ; feature, name, feature_type, parkinglotContext [,RetrieveSingle]
|
||||
;allowRinginNotification = no ; allow ringin notification for hinted extensions. experimental configuration param that may be removed in further version
|
||||
;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_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
|
||||
;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
|
||||
backgroundImage = "" ; Set the Background Image after device registered. Image must be set as URI to a http served file.
|
||||
ringtone = "" ; Set the Ring Tone after device registered. Ring Tone must be set as URI to a http served file.
|
||||
imageversion = "" ; (SIZE: 31) ImageVersion to be loaded on the device.
|
||||
|
||||
;
|
||||
; line section
|
||||
;
|
||||
[default_line](!)
|
||||
id = "" ; (SIZE: 7) id
|
||||
pin = "" ; (SIZE: 7) pin
|
||||
description = "" ; description
|
||||
context = "" ; pbx dialing context
|
||||
defaultSubscriptionId_name = "" ; (SIZE: 79) Name used on a shared line when no name is specified on the line button for the device
|
||||
defaultSubscriptionId_number = "" ; (SIZE: 79) Number used on a shared line when no name is specified on the line button for the device
|
||||
mailbox = "" ; Mailbox to store messages in. Format 'mailbox@context' or 'mailbox' when you use 'default' context
|
||||
vmnum = "" ; Number to dial to get to the users Mailbox
|
||||
adhocNumber = "" ; Adhoc Number or Private-line automatic ring down (PLAR):
|
||||
; Adhoc/PLAR circuits have statically configured endpoints and do not require the user dialing to connect calls.
|
||||
; - The adhocNumber is dialed as soon as the Phone is taken off-hook or when the new-call button is pressed.
|
||||
; - The number will not be dialed when choosing a line; so when you choose a line you can enter a number manually.
|
||||
meetme = "" ; enable/disable conferencing via meetme, make sure you have one of the meetme apps mentioned below activated in module.conf.
|
||||
; When switching meetme=on it will search for the first of these three possible meetme applications and set these defaults.
|
||||
; Meetme=>'qd', ConfBridge=>'Mac', Konference=>'MTV'
|
||||
meetmenum = "" ; This extension will receive meetme requests, SCCP_MEETME_ROOM channel variable will
|
||||
; contain the room number dialed into simpleswitch (this parameter is going to be removed).
|
||||
meetmeopts = "" ; options to send the meetme application, defaults are dependent on meetme app see the list above.
|
||||
; Other options (app_meetme: A,a,b,c,C,d,D,E,e,F,i,I,l,L,m,M,o,p,P,q,r,s,S,t,T,w,x,X,1) see conferencing app for specific documentation
|
||||
transfer = "" ; per line transfer capability
|
||||
;incominglimit = 6 ; allow x number of incoming calls (call waiting)
|
||||
echocancel = "" ; sets the phone echocancel for this line
|
||||
silencesuppression = "" ; sets the silence suppression for this line
|
||||
language = "" ; sets the language setting per line
|
||||
musicclass = "" ; sets the music on hold class per line
|
||||
accountcode = "" ; accountcode for this line to make billing per call possible
|
||||
amaflags = "" ; sets the AMA flags stored in the CDR record for this line
|
||||
callgroup = "" ; sets the caller groups this line is a member of
|
||||
pickupgroup = "" ; sets the pickup groups this line is a member of (this phone can pickup calls from remote phones which are in this caller group
|
||||
namedcallgroup = "" ; sets the named caller groups this line is a member of (ast111)
|
||||
namedpickupgroup = "" ; 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)
|
||||
parkinglot = "" ; parkinglot assigned to this line
|
||||
trnsfvm = "" ; extension to redirect the caller to for voice mail
|
||||
secondary_dialtone_digits = "" ; digits to indicate an external line to user (secondary dialtone) (max 9 digits)
|
||||
;secondary_dialtone_tone = 0x22 ; outside dialtone frequency
|
||||
setvar = "" ; (MULTI-ENTRY) extra variables to be set on line initialization multiple entries possible (for example the sip number to use when dialing outside)
|
||||
; format setvar=param=value, for example setvar=sipno=12345678
|
||||
dnd = "" ; allow setting dnd action for this line. Valid values are 'off', 'reject' (busy signal), 'silent' (ringer = silent) or 'user' (not used at the moment). . The value 'on' has been made obsolete in favor of 'reject'
|
||||
; (POSSIBLE VALUES: ["Off","Reject","Silent","UserDefined"])
|
||||
regexten = "" ; SCCP Lines will we added to the regcontext with this number for Dundi look up purpose
|
||||
; If regexten is not filled in the line name (categoryname between []) will be used
|
||||
|
||||
;
|
||||
; softkey section
|
||||
;
|
||||
;[mysoftkeyset]
|
||||
;type = softkeyset ; (SIZE: -1) This should be set to softkeyset
|
||||
;onhook = redial,newcall,cfwdall,dnd,pickup,gpickup,private ; (SIZE: 15) displayed when we are on hook
|
||||
;connected = hold,endcall,park,vidmode,select,cfwdall,cfwdbusy,idivert ; (SIZE: 15) displayed when we have a connected call
|
||||
;onhold = resume,newcall,endcall,transfer,conflist,select,dirtrfr,idivert,meetme ; (SIZE: 15) displayed when we have a call on hold
|
||||
;ringin = answer,endcall,transvm,idivert ; (SIZE: 15) displayed when we have an incoming call
|
||||
;offhook = redial,endcall,private,cfwdall,cfwdbusy,pickup,gpickup,meetme,barge ; (SIZE: 15) displayed when the phone is taken off hook
|
||||
;conntrans = hold,endcall,transfer,conf,park,select,dirtrfr,vidmode,meetme,cfwdall,cfwdbusy ; (SIZE: 15) displayed when we are connected and could transfer a call
|
||||
;digitsfoll = back,endcall,dial ; (SIZE: 15) displayed when one or more digits have been entered, more are expected
|
||||
;connconf = conflist,newcall,endcall,hold,vidmode ; (SIZE: 15) displayed when we are in a conference
|
||||
;ringout = empty,endcall,transfer,cfwdall,idivert ; (SIZE: 15) displayed when We are calling someone
|
||||
;offhookfeat = redial,endcall ; (SIZE: 15) displayed wenn we went offhook using a feature
|
||||
;onhint = redial,newcall,pickup,gpickup,barge ; (SIZE: 15) displayed when a hint is activated
|
||||
;onstealable = redial,newcall,cfwdall,pickup,gpickup,dnd,intrcpt ; (SIZE: 15) displayed when there is a call we could steal on one of the neighboring phones
|
||||
;holdconf = resume,newcall,endcall,join ; (SIZE: 15) displayed when we are a conference moderator, have the conference on hold and have another active call
|
||||
uriaction = "" ; (MULTI-ENTRY) (SIZE: 7) softkey uri action to replace default handling. Format: uriaction = softkeyname, uri[,uri...]
|
||||
; . URI can be an embedded cisco action (like Key:Service, Play:1041.raw) or a URLIf uri is a url the following parameters will be added to it: devicename, linename, channelname, callid, linkedid, uniqueid, appid, transactionid
|
||||
|
|
@ -471,6 +471,12 @@
|
|||
|
||||
<deviceSecurityMode>1</deviceSecurityMode>
|
||||
<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>
|
||||
<joinAcrossLines>1</joinAcrossLines>
|
||||
<autoCallPickupEnable>false</autoCallPickupEnable>
|
||||
|
|
|
|||
91
Technical.notes/asterisk-chan-sccp-config-handling.txt
Normal file
91
Technical.notes/asterisk-chan-sccp-config-handling.txt
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
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.
|
||||
|
|
@ -16,4 +16,3 @@ and open the template in the editor.
|
|||
min-height: 10px;
|
||||
padding: 1px 1px;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ $(document).ready(function () {
|
|||
},
|
||||
});
|
||||
$('#ajaxcancel').on('click', function (e) {
|
||||
// console.log('Calncel');
|
||||
console.log('Cancel');
|
||||
if ($(this).data('hash') != null) {
|
||||
location.hash = $(this).data('hash');
|
||||
}
|
||||
|
|
@ -24,38 +24,7 @@ $(document).ready(function () {
|
|||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
$('#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 is "Save and continue" - saves form data and stays on form
|
||||
$('#ajaxsubmit2').on('click', function (e) {
|
||||
var vdata = '';
|
||||
var snd_command = 'savesettings';
|
||||
|
|
@ -64,10 +33,10 @@ $(document).ready(function () {
|
|||
vdata = vdata + $(this).serialize() + '&';
|
||||
});
|
||||
if ($('.fpbx-submit').data('id') == "hw_edit") {
|
||||
snd_command = 'save_hardware';
|
||||
snd_command = 'save_device';
|
||||
}
|
||||
if ($('.fpbx-submit').data('id') == "hw_sedit") {
|
||||
snd_command = 'save_sip_hardware';
|
||||
snd_command = 'save_sip_device';
|
||||
}
|
||||
if ($('.fpbx-submit').data('id') == "ruser_edit") {
|
||||
snd_command = 'save_ruser';
|
||||
|
|
@ -85,7 +54,7 @@ $(document).ready(function () {
|
|||
if (data.message) {
|
||||
bs_alert(data.message,data.status);
|
||||
} else {
|
||||
bs_alert('Data Save',data.status);
|
||||
fpbxToast(_('Data saved'),'', 'success');
|
||||
}
|
||||
} else {
|
||||
bs_alert(data.message,data.status);
|
||||
|
|
@ -93,7 +62,7 @@ $(document).ready(function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ajaxsubmit is save and close form
|
||||
$('#ajaxsubmit').on('click', function (e) {
|
||||
var vdata = '';
|
||||
var snd_command = 'savesettings';
|
||||
|
|
@ -101,10 +70,10 @@ $(document).ready(function () {
|
|||
vdata = vdata + $(this).serialize() + '&';
|
||||
});
|
||||
if ($('.fpbx-submit').data('id') == "hw_edit") {
|
||||
snd_command = 'save_hardware';
|
||||
snd_command = 'save_device';
|
||||
}
|
||||
if ($('.fpbx-submit').data('id') == "hw_sedit") {
|
||||
snd_command = 'save_sip_hardware';
|
||||
snd_command = 'save_sip_device';
|
||||
}
|
||||
if ($('.fpbx-submit').data('id') == "ruser_edit") {
|
||||
snd_command = 'save_ruser';
|
||||
|
|
@ -118,28 +87,28 @@ $(document).ready(function () {
|
|||
data: vdata,
|
||||
success: function (data) {
|
||||
if (data.status === true) {
|
||||
if (data.message) {
|
||||
var old_style = bs_alert(data.message, data.status, data.reload);
|
||||
}
|
||||
if (data.table_reload === true) {
|
||||
$('table').bootstrapTable('refresh');
|
||||
}
|
||||
if (data.hash != null) {
|
||||
location.hash = data.hash;
|
||||
}
|
||||
if (data.href != null) {
|
||||
location.href = data.href;
|
||||
}
|
||||
if (data.path != null) {
|
||||
location.path = data.path;
|
||||
}
|
||||
if (data.search != null) {
|
||||
location.search = data.search;
|
||||
}
|
||||
// if (data.reload === true ) {
|
||||
if (data.reload === true && old_style ===true ) {
|
||||
var newLocation = location.href;
|
||||
newLocation = ('path' in data && data.path !== '') ? data.path : location.pathname;
|
||||
newLocation += ('search' in data && data.search !== '') ? `${data.search}` : `${location.search}`;
|
||||
// location.hash is set by (".change-tab") at line 198 for settings
|
||||
newLocation += ('hash' in data && data.hash !== '' ) ? data.hash : location.hash;
|
||||
if (data.message) {
|
||||
fpbxToast(_(data.message),'', data.toastFlag);
|
||||
// If posting warning, allow time to read
|
||||
var toastDelay = (data.toastFlag == 'success') ? 500 : 1500;
|
||||
if (data.reload === true) {
|
||||
setTimeout(function(){
|
||||
location.replace(newLocation);
|
||||
if (data.search == `?display=sccpsettings`) {
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
toastDelay);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bs_alert(data.message,data.status);
|
||||
}
|
||||
|
|
@ -147,10 +116,6 @@ $(document).ready(function () {
|
|||
});
|
||||
});
|
||||
|
||||
$(".input-js-add").click(function () {
|
||||
add_dynamic_input($(this), $(this).data('for'), "", "");
|
||||
});
|
||||
|
||||
$(".table").on('click', '.table-js-add', function (e) {
|
||||
add_dynamic_table($(this), $(this).data('for'), "", "");
|
||||
});
|
||||
|
|
@ -159,7 +124,6 @@ $(document).ready(function () {
|
|||
del_dynamic_table($(this), $(this).data('for'));
|
||||
});
|
||||
|
||||
|
||||
$(".table").on('click', '.btn-item-delete', function (e) {
|
||||
var dev_cmd = '';
|
||||
var dev_id = $(this).data('id');
|
||||
|
|
@ -183,23 +147,23 @@ $(document).ready(function () {
|
|||
}
|
||||
// console.log("delete : " + data);
|
||||
if (dev_cmd != '') {
|
||||
if (confirm(_('Are you sure you wish to delete "' + dev_id.toString().toUpperCase() + '" inormation ?'))) {
|
||||
if (confirm(_('Are you sure you wish to delete "' + dev_id.toString().toUpperCase() + '" information?'))) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
|
||||
command: dev_cmd,
|
||||
data: ext_data,
|
||||
success: function (data) {
|
||||
// console.log(data);
|
||||
if (data.status === true) {
|
||||
if (data.message) {
|
||||
var old_style = bs_alert(data.message, data.status, data.reload);
|
||||
}
|
||||
if (data.table_reload === true) {
|
||||
$('table').bootstrapTable('refresh');
|
||||
}
|
||||
if (data.reload === true && old_style === true ) {
|
||||
location.reload();
|
||||
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 {
|
||||
bs_alert(data.message,data.status);
|
||||
|
|
@ -225,6 +189,11 @@ $(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) {
|
||||
var kid = $(this).data('id');
|
||||
if ($(this).data('key') === 'Right') {
|
||||
|
|
@ -241,6 +210,22 @@ $(document).ready(function () {
|
|||
}
|
||||
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
|
||||
$('.futuretype').change(function (e) {
|
||||
|
|
@ -299,31 +284,67 @@ $(document).ready(function () {
|
|||
});
|
||||
});
|
||||
// Form.adddevice
|
||||
$('.hw_select').change(function (e) {
|
||||
// console.log('HwSelect');
|
||||
$('.hw_select').mouseover(function (e) {
|
||||
var type_id = $('#sccp_hw_type').find(':selected').data('id');
|
||||
var btn_dev = $('#sccp_hw_type').find(':selected').data('val');
|
||||
// var btn_add=$('#sccp_hw_addon').find(':selected').data('val');
|
||||
|
||||
if (type_id === 1) {
|
||||
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').removeAttr('disabled');
|
||||
}
|
||||
|
||||
var btn_add = $('#sccp_hw_addon').find(':selected').data('val');
|
||||
$('.line_button').each(function () {
|
||||
if ($(this).data('id') < btn_dev + btn_add) {
|
||||
$(this).removeClass('hidden');
|
||||
$(this).removeAttr('hidden')
|
||||
} else {
|
||||
$(this).addClass('hidden');
|
||||
$('#sccp_hw_addon').prop('disabled',false);
|
||||
}
|
||||
});
|
||||
|
||||
$('.hw_select').change(function (e) {
|
||||
// data-val contains the number of buttons for this type
|
||||
// data-id contains the max number of addons (1 = 0, 3 = 2)
|
||||
var type_id = $('#sccp_hw_type').find(':selected').data('id');
|
||||
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
|
||||
if (btn_dev == null) {
|
||||
var btn_dev = $('#devButtonCnt').val();
|
||||
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);
|
||||
}
|
||||
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 () {
|
||||
if ($(this).data('id') < totButtons) {
|
||||
$(this).removeClass('hidden');
|
||||
$(this).removeAttr('hidden');
|
||||
} else {
|
||||
$(this).addClass('hidden');
|
||||
$(this).attr('hidden', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.lineSelect').change(function (e) {
|
||||
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 () {
|
||||
|
|
@ -503,6 +524,8 @@ $(document).ready(function () {
|
|||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$('.sccp_update').on('click', function (e) {
|
||||
// console.log($(this).data('id'));
|
||||
|
||||
|
|
@ -534,7 +557,6 @@ $(document).ready(function () {
|
|||
}
|
||||
|
||||
// ----------------------- Server.model form ----------------
|
||||
|
||||
if ($(this).data('id') === 'model_add') {
|
||||
var dev_cmd = 'model_add';
|
||||
// var dev_fld = ["model","vendor","dns","buttons","loadimage","loadinformationid","validate","enabled"];
|
||||
|
|
@ -610,13 +632,13 @@ $(document).ready(function () {
|
|||
var i = 0;
|
||||
var conf_msg = '??????';
|
||||
if ($(this).data('id') === 'reset_dev') {
|
||||
conf_msg = 'Reset All device ?';
|
||||
conf_msg = 'Reset ALL devices ?';
|
||||
}
|
||||
if ($(this).data('id') === 'reset_token') {
|
||||
conf_msg = 'Reset Token on All device ?';
|
||||
conf_msg = 'Reset Token on ALL devices ?';
|
||||
}
|
||||
if ($(this).data('id') === 'update_button_label') {
|
||||
conf_msg = 'Update Butons Labels on All device ?';
|
||||
conf_msg = 'Update Button Labels on ALL devices ?';
|
||||
}
|
||||
$('#table-sccp').bootstrapTable('getSelections').forEach(function (entry) {
|
||||
datas = datas + 'name[' + i + ']=' + entry['name'] + '&';
|
||||
|
|
@ -643,26 +665,26 @@ $(document).ready(function () {
|
|||
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
|
||||
data: datas,
|
||||
success: function (data) {
|
||||
// console.log(data);
|
||||
|
||||
if (data.status === true) {
|
||||
if (data.message) {
|
||||
var old_style = bs_alert(data.message, data.status,data.reload);
|
||||
}
|
||||
if (data.table_reload === true) {
|
||||
$('table').bootstrapTable('refresh');
|
||||
}
|
||||
if (data.reload === true && old_style === true) {
|
||||
location.reload();
|
||||
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) {
|
||||
bs_alert(entry,data.status);
|
||||
//fpbxToast(entry, 'error', 'error');
|
||||
fpbxToast(data.message[1],_('Error Result'), 'warning');
|
||||
});
|
||||
} else {
|
||||
if (data.message) {
|
||||
bs_alert(data.message,data.status);
|
||||
fpbxToast(data.message,_('Error Result'), 'warning');
|
||||
} else {
|
||||
if (data) {
|
||||
bs_alert(data,data.status);
|
||||
|
|
@ -676,6 +698,83 @@ $(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) {
|
||||
// console.log("asasdasdasdasd");
|
||||
// console.log($('#update-sccp-phone').find(':selected').data('val'));
|
||||
|
|
@ -817,32 +916,51 @@ 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();
|
||||
});
|
||||
|
||||
function add_dynamic_input(pe, pclass, vdefault)
|
||||
{
|
||||
// We'd like a new one, please.
|
||||
pcls = pe.data('for');
|
||||
pname = pe.data('id');
|
||||
pmax = pe.data('max');
|
||||
jdata = JSON.parse(hex2bin(pe.data('json')));
|
||||
$(document).on('click', ".input-js-add" , function () {
|
||||
// Add new row to networks or ip array
|
||||
var pcls = $(this).data('for'),
|
||||
pname = $(this).data('id'),
|
||||
pmax = $(this).data('max'),
|
||||
prow = $(this).data('row'),
|
||||
pcount = $("." + pcls).length;
|
||||
if (pcount == pmax){
|
||||
//already reached max elements
|
||||
return;
|
||||
}
|
||||
|
||||
var last = $("." + pcls + ":last"),
|
||||
jdata = JSON.parse(hex2bin($(this).data('json')));
|
||||
|
||||
var last = $("." + pcls).last(),
|
||||
ourid = last.data('nextid'),
|
||||
nextid = ourid + 1;
|
||||
var html = "<div class = '" + pcls + " form-group form-inline' data-nextid=" + nextid + ">";
|
||||
nextid = ourid + 1,
|
||||
html = "<div class = '" + pcls + "' id ='" + pname + nextid + "' form-group form-inline' data-nextid=" + nextid + ">";
|
||||
for (var key in jdata) {
|
||||
html_opt = '';
|
||||
html_calss = jdata[key]['class'];
|
||||
for (var skey in jdata[key]['options']) {
|
||||
html_opt += ' ' + skey + '="' + jdata[key]['options'][skey] + '"';
|
||||
}
|
||||
html += "<input type='text' name='" + pname + "[" + ourid + "][" + key + "]' class='" + html_calss + "' " + html_opt + " value='" + vdefault + "'> " + jdata[key]['nameseparator'] + " ";
|
||||
html += "<input type='text' name='" + pname + "[" + nextid + "][" + key + "]' class " + html_opt + "> " + 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";
|
||||
if (pmax >= nextid) {
|
||||
|
||||
last.after(html);
|
||||
}
|
||||
}
|
||||
|
||||
$('#' + pname + prow + '-btn-add').remove();
|
||||
});
|
||||
|
||||
function del_dynamic_table(pe, pclass, vdefault)
|
||||
{
|
||||
|
|
@ -1067,6 +1185,14 @@ function hex2bin(hex)
|
|||
return String.fromCharCode.apply(String, bytes);
|
||||
}
|
||||
|
||||
function showProgress() {
|
||||
$('#pleaseWaitDialog').modal();
|
||||
}
|
||||
|
||||
function closeProgress() {
|
||||
$('#pleaseWaitDialog').modal('hide');
|
||||
}
|
||||
|
||||
function sleep(milliseconds)
|
||||
{
|
||||
var start = new Date().getTime();
|
||||
|
|
@ -1076,3 +1202,101 @@ function sleep(milliseconds)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
803
conf/CiscoIPPhone.xsd
Normal file
803
conf/CiscoIPPhone.xsd
Normal file
|
|
@ -0,0 +1,803 @@
|
|||
<?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>
|
||||
|
|
@ -1,319 +0,0 @@
|
|||
<?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.4",
|
||||
"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 supported");
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,421 +0,0 @@
|
|||
<?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 = _("Named PickupGroup : ");
|
||||
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 supported");
|
||||
$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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,351 +0,0 @@
|
|||
<?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" => 'cid_name', "mailbox" => 'mailbox',
|
||||
"musicclass" => 'musicclass',"allow" => 'allow',"disallow" => 'disallow',
|
||||
"videomode" => 'videomode',
|
||||
"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.4",
|
||||
"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'] = '';
|
||||
$settings['cid_name']['value'] = $label;
|
||||
$settings['mailbox']['value']= '';
|
||||
|
||||
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 (strpos($key,'codec_') !== false ) {
|
||||
$allow_codec[] =substr($key,6);
|
||||
}
|
||||
}
|
||||
$settings['allow']['value'] = implode(",", $allow_codec);
|
||||
|
||||
// parse outboundcid content into cid_num and cid_name sccpline fields
|
||||
if (empty($settings['cid_num']['value'])) {
|
||||
$settings['cid_num']['value'] = $id;
|
||||
} else {
|
||||
$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 (!empty($_REQUEST['vm']) && ($_REQUEST['vm'] =='enabled')){ // mailbox
|
||||
if (empty($settings['mailbox']['value'])) {
|
||||
$settings['mailbox']['value']= $id;
|
||||
}
|
||||
}
|
||||
|
||||
// die(print_r($settings));
|
||||
$tech = Array();
|
||||
$sql = "DESCRIBE sccpline";
|
||||
foreach ($this->database->query($sql) as $row) {
|
||||
$tech[$row["Field"]]=$row["Field"];
|
||||
}
|
||||
$sqlCol = 'name';
|
||||
$sqlVal = "\'{$id}\'";
|
||||
foreach($this->data_fld as $key => $val) {
|
||||
if (isset($settings[$val]['value'])){
|
||||
$sqlCol .= ", {$key}";
|
||||
$sqlVal .= ", \' {$settings[$val]['value']} \'";
|
||||
}
|
||||
}
|
||||
$sql = "REPLACE INTO sccpline ( {$sqlCol} ) VALUES ( {$sqlVal} );";
|
||||
|
||||
$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 supported");
|
||||
$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;
|
||||
}
|
||||
}
|
||||
9
conf/mappingRulesHeader
Normal file
9
conf/mappingRulesHeader
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# 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
|
||||
#
|
||||
|
|
@ -41,10 +41,3 @@ hotline_context=default
|
|||
hotline_extension=111
|
||||
devicetable=sccpdevice
|
||||
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
1018
conf/sccpgeneral.xml
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,12 +0,0 @@
|
|||
[main]
|
||||
debug = on ; The output in the browser window for more information
|
||||
tftproot = /tftpboot
|
||||
;default_language = English_United_States
|
||||
|
||||
firmware = firmware
|
||||
settings = /tftpboot
|
||||
wallpapers = /tftpboot/Desktops
|
||||
ringtones = ringtones
|
||||
locales = locales
|
||||
countries = countries
|
||||
languages = /tftpboot/languages
|
||||
2882
contrib/masterFilesStructure.xml
Normal file
2882
contrib/masterFilesStructure.xml
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -58,13 +58,13 @@ ri ^(P00405000700.sbn)$ firmware/7910/\1
|
|||
ri ^(CP7912080004SCCP080108A.sbin)$ firmware/7912/\1
|
||||
|
||||
# 7915 firmware (ancient)
|
||||
ri ^(B015-1-0-)(+\.SBN)$ firmware/7915/\1
|
||||
ri ^(B015-1-0-)(.+\.SBN)$ firmware/7915/\1\2
|
||||
|
||||
# 7916 firmware (ancient)
|
||||
ri ^(B016-1-0-)(+\.SBN)$ firmware/7916/\1
|
||||
ri ^(B016-1-0-)(.+\.SBN)$ firmware/7916/\1\2
|
||||
|
||||
# 7920 firmware (ancient)
|
||||
ri ^(cmterm_7920)(+\.bin)$ firmware/7920/\1
|
||||
ri ^(cmterm_7920)(.+\.bin)$ firmware/7920/\1\2
|
||||
|
||||
# 7921_7925 firmware (ancient)
|
||||
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
|
||||
|
||||
# 7940_7960 firmware (ancient)
|
||||
ri ^(P0030801SR)(.+\.bin)$ firmware/7940/\1
|
||||
ri ^(P0030801SR)(.+\.loads)$ firmware/7940/\1
|
||||
ri ^(P0030801SR)(.+\.sb2)$ firmware/7940/\1
|
||||
ri ^(P0030801SR)(.+\.sbn)$ firmware/7940/\1
|
||||
ri ^(P0030801SR)(.+\.bin)$ firmware/7940/\1\2
|
||||
ri ^(P0030801SR)(.+\.loads)$ firmware/7940/\1\2
|
||||
ri ^(P0030801SR)(.+\.sb2)$ firmware/7940/\1\2
|
||||
ri ^(P0030801SR)(.+\.sbn)$ firmware/7940/\1\2
|
||||
|
||||
# 7941_7961 firmware (java-based)
|
||||
ri ^(apps41)(.+\.sbn)$ firmware/7941/\1\2
|
||||
|
|
@ -174,26 +174,28 @@ ri ^(ATA030204SCCP090202A.zup)$ firmware/ata186/\1
|
|||
# Sub-Directory Handling
|
||||
|
||||
# settings
|
||||
#ri ^(.+\.tlv)?$ settings/\1
|
||||
#ri ^\/(.+\.tlv)?$ settings/\1
|
||||
#ri ^((.+\.cnf.xml)(\.enc)?(\.sgn)?)$ settings/\1
|
||||
#ri ^\/((.+\-cnf.xml)(\.enc)?(\.sgn)?)$ settings/\1
|
||||
#ri ^\/((SPA504G-cfg.xml)(\.enc)?(\.sgn)?)$ settings/\1
|
||||
ri ^(.+\.tlv)?$ settings/\1
|
||||
ri ^\/(.+\.tlv)?$ settings/\1
|
||||
ri ^((.+\.cnf.xml)(\.enc)?(\.sgn)?)$ settings/\1
|
||||
ri ^\/((.+\-cnf.xml)(\.enc)?(\.sgn)?)$ settings/\1
|
||||
ri ^\/((SPA504G-cfg.xml)(\.enc)?(\.sgn)?)$ settings/\1
|
||||
|
||||
# Keep firmware in a separate directory (optional)
|
||||
#ri ^(.+\.loads)$ firmware/\1
|
||||
#ri ^(.+\.sbn)$ firmware/\1
|
||||
|
||||
# Keep locales in a separate directory (optional)
|
||||
ri ^(.+)\/(.+-sccp.jar)$ languages/\1/\2
|
||||
ri ^(.+)\/(.+-sip.jar)$ languages/\1/\2
|
||||
ri ^(.+)\/(.+-dictionary.xml)$ languages/\1/\2
|
||||
ri ^(.+)\/(.+-dictionary-ext.xml)$ languages/\1/\2
|
||||
ri ^(.+)\/(.+-tones.xml)$ languages/\1/\2
|
||||
ri ^(.+)\/(.+-font.xml)$ languages/\1/\2
|
||||
ri ^(.+)\/(.+-kate.xml)$ languages/\1/\2
|
||||
|
||||
#ri ^(.+)\/(.+-tones.xml)$ locales/countries/\1/\2
|
||||
ri ^(.+)\/(.+-sccp.jar)$ locales/languages/\1/\2
|
||||
ri ^(.+)\/(.+-sip.jar)$ locales/languages/\1/\2
|
||||
ri ^(.+)\/(.+-dictionary.xml)$ locales/languages/\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)
|
||||
ri ^([R|r]ing[L|l]ist)(\.xml|-wb\.xml)(\.sgn)?$ ringtones/ringlist.xml
|
||||
|
|
@ -204,6 +206,9 @@ ri ^(.+)(\.raw|\.rwb|\.pcm)(\.sgn)?$ ringtones/\1\2\3
|
|||
#ri ^Desktops/(.+)/(List\.xml)(\.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
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ service tftp
|
|||
wait = yes
|
||||
user = root
|
||||
server = /usr/sbin/in.tftpd
|
||||
server_args = -c -s -v /tftpboot -m /tftpboot/rewrite.rules
|
||||
server_args = -c -s -v /tftpboot -m -m /etc/asterisk/sccpManagerRewrite.rules
|
||||
disable = no
|
||||
per_source = 11
|
||||
cps = 100 2
|
||||
|
|
|
|||
|
|
@ -1,88 +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.
|
||||
*/
|
||||
/*
|
||||
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($thing, $inthat)
|
||||
{
|
||||
if (!is_bool(strpos($inthat, $thing))) {
|
||||
return substr($inthat, strpos($inthat, $thing) + strlen($thing));
|
||||
}
|
||||
}
|
||||
|
||||
function after_last($thing, $inthat)
|
||||
{
|
||||
if (!is_bool(strrevpos($inthat, $thing))) {
|
||||
return substr($inthat, strrevpos($inthat, $thing) + strlen($thing));
|
||||
}
|
||||
}
|
||||
function before($thing, $inthat)
|
||||
{
|
||||
return substr($inthat, 0, strpos($inthat, $thing));
|
||||
}
|
||||
|
||||
function before_last($thing, $inthat)
|
||||
{
|
||||
return substr($inthat, 0, strrevpos($inthat, $thing));
|
||||
}
|
||||
|
||||
function between($thing, $that, $inthat)
|
||||
{
|
||||
return before($that, after($thing, $inthat));
|
||||
}
|
||||
|
||||
function between_last($thing, $that, $inthat)
|
||||
{
|
||||
return after_last($thing, 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;
|
||||
}
|
||||
*
|
||||
*
|
||||
*/
|
||||
Binary file not shown.
|
|
@ -910,8 +910,8 @@ msgid "General Device configuration"
|
|||
msgstr "Абонентского устройство"
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
msgid "Device SEP ID.[XXXXXXXXXXXX]=MAC"
|
||||
msgstr "Устройство SEP ID : [XXXXXXXXXXXX]=MAC"
|
||||
msgid "Device ID.[XXXXXXXXXXXX]=MAC"
|
||||
msgstr "Устройство ID : [XXXXXXXXXXXX]=MAC"
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
msgid ""
|
||||
|
|
@ -955,8 +955,8 @@ msgid "Device Label"
|
|||
msgstr "Название Устройства"
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
msgid "Device SEP ID"
|
||||
msgstr "Идентификатор устройства SEP ID"
|
||||
msgid "Device ID"
|
||||
msgstr "Идентификатор устройства ID"
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
msgid "The information in the upper right corner of the device screen"
|
||||
|
|
@ -1005,7 +1005,7 @@ msgid "Buttons Configuration"
|
|||
msgstr "Настройка Кнопок"
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
msgid "Device MAC SEP."
|
||||
msgid "Device MAC."
|
||||
msgstr "Прямое подключение."
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ msgid "General Device configuration"
|
|||
msgstr ""
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
msgid "Device SEP ID.[XXXXXXXXXXXX]=MAC"
|
||||
msgid "Device ID.[XXXXXXXXXXXX]=MAC"
|
||||
msgstr ""
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
|
|
@ -707,7 +707,7 @@ msgid "Device Label"
|
|||
msgstr ""
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
msgid "Device SEP ID"
|
||||
msgid "Device ID"
|
||||
msgstr ""
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
|
|
@ -743,7 +743,7 @@ msgid "Buttons Configuration"
|
|||
msgstr ""
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
msgid "Device MAC SEP."
|
||||
msgid "Device MAC."
|
||||
msgstr ""
|
||||
|
||||
#: views/sccpgeneral.xml:
|
||||
|
|
|
|||
1793
install.php
1793
install.php
File diff suppressed because it is too large
Load diff
258
module.xml
258
module.xml
|
|
@ -1,11 +1,10 @@
|
|||
<module>
|
||||
<rawname>sccp_manager</rawname>
|
||||
<name>SCCP Manager</name>
|
||||
<version>14.1.0.1</version>
|
||||
<version>14.5.0.4</version>
|
||||
<type>setup</type>
|
||||
<category>SCCP Connectivity</category>
|
||||
<publisher>Steve Lad</publisher>
|
||||
<publisher>Alex GP</publisher>
|
||||
<publisher>Steve Lad, Alex GP</publisher>
|
||||
<repo>extended</repo>
|
||||
<description>SCCP Phone and Extension Manager</description>
|
||||
<menuitems>
|
||||
|
|
@ -18,12 +17,263 @@
|
|||
* 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>
|
||||
<location></location>
|
||||
<location>https://github.com/chan-sccp/sccp_manager</location>
|
||||
<depends>
|
||||
<version>15</version>
|
||||
<phpversion>7.0</phpversion>
|
||||
<phpcomponent>zip</phpcomponent>
|
||||
</depends>
|
||||
<supported>
|
||||
<version>13.0.0.2M</version>
|
||||
</supported>
|
||||
<info>https://github.com/chan-sccp/sccp_manager</info>
|
||||
<updateurl>https://raw.githubusercontent.com/chan-sccp/sccp_manager/develop/sccpManagerUpdater.json</updateurl>
|
||||
<license>GPL</license>
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if (!defined('FREEPBX_IS_AUTH')) {
|
|||
|
||||
//
|
||||
// Initialise page before to avoid double calls and improve performance
|
||||
$display_page = FreePBX::create()->Sccp_manager->myShowPage();
|
||||
$display_page = FreePBX::create()->Sccp_manager->settingsShowPage();
|
||||
$display_info = _("SCCP Server Settings");
|
||||
// standardise code to reduce base
|
||||
include('page.html.php');
|
||||
|
|
|
|||
482
sccpManClasses/Sccp.class.php.v433
Normal file
482
sccpManClasses/Sccp.class.php.v433
Normal file
|
|
@ -0,0 +1,482 @@
|
|||
<?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")),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -100,8 +100,9 @@ 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));
|
||||
$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));
|
||||
|
|
@ -111,8 +112,9 @@ class SCCPShowDevice_Event extends Event
|
|||
|
||||
public function getCodecsPreference()
|
||||
{
|
||||
// TODO unused method - to be deleted?
|
||||
$ret = array();
|
||||
$codecs = explode(", ", substr($this->getKey('CodecsPreference'), 1, -1));
|
||||
$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));
|
||||
|
|
@ -392,7 +392,7 @@ class SCCPTokenAckAction extends ActionMessage
|
|||
{
|
||||
parent::__construct('SCCPTokenAck');
|
||||
$this->setKey('DeviceId', $DeviceName);
|
||||
$this->setResponseHandler("SCCPGeneric");
|
||||
$this->setResponseHandler("Generic");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -30,13 +30,16 @@ class aminterface
|
|||
{
|
||||
$driverNamespace = "\\FreePBX\\Modules\\Sccp_manager\\aminterface";
|
||||
|
||||
$drivers = array('Message' => 'Message.class.php', 'Response' => 'Response.class.php', 'Event' => 'Event.class.php');
|
||||
$drivers = array('Message' => 'Message.class.php',
|
||||
'Response' => 'Response.class.php',
|
||||
'Event' => 'Event.class.php'
|
||||
);
|
||||
foreach ($drivers as $key => $value) {
|
||||
$class = $driverNamespace . "\\" . $key;
|
||||
$driver = __DIR__ . "/" . $value;
|
||||
$driver = __DIR__ . "/amInterfaceClasses/" . $value;
|
||||
if (!class_exists($class, false)) {
|
||||
if (file_exists($driver)) {
|
||||
include(__DIR__ . "/" . $value);
|
||||
include(__DIR__ . "/amInterfaceClasses/" . $value);
|
||||
} else {
|
||||
throw new \Exception("Class required but file not found " . $driver);
|
||||
}
|
||||
|
|
@ -51,7 +54,14 @@ class aminterface
|
|||
$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->_config = array('host' => 'localhost',
|
||||
'user' => '',
|
||||
'pass' => '',
|
||||
'port' => '5038',
|
||||
'tsoket' => 'tcp://',
|
||||
'timeout' => 30,
|
||||
'enabled' => true
|
||||
);
|
||||
$this->_eventListeners = array();
|
||||
$this->_incomingMsgObjectList = array();
|
||||
$this->_lastActionId = false;
|
||||
|
|
@ -69,14 +79,17 @@ class aminterface
|
|||
if ($this->_config['enabled']) {
|
||||
$this->load_subspace();
|
||||
}
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
if ($this->_config['enabled']) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -329,14 +342,6 @@ class aminterface
|
|||
}
|
||||
print_r("<br>------------E dispatch----------<br>");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
function core_list_all_exten($keyfld = '', $filter = array())
|
||||
{
|
||||
$result = array();
|
||||
return $result;
|
||||
}
|
||||
|
||||
//-------------------Adaptive Function ------------------------------------------------------------
|
||||
|
||||
function core_list_hints()
|
||||
|
|
@ -387,7 +392,7 @@ class aminterface
|
|||
$result = array();
|
||||
if ($this->_connect_state) {
|
||||
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDevicesAction();
|
||||
$result = $this->send($_action)->getResult();
|
||||
$result = (array)$this->send($_action)->getResult();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
|
@ -410,7 +415,7 @@ class aminterface
|
|||
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPDeviceRestartAction($devicename, $action);
|
||||
}
|
||||
$_response = $this->send($_action);
|
||||
$result['data'] = 'Device :'.$devicename.' Result: '.$_response->getMessage();
|
||||
$result['data'] = 'Device: '.$devicename.' Result: '.$_response->getMessage();
|
||||
$result['Response']=$_response->getKey('Response');
|
||||
}
|
||||
return $result;
|
||||
|
|
@ -426,18 +431,22 @@ class aminterface
|
|||
}
|
||||
return $result;
|
||||
}
|
||||
function getSCCPVersion()
|
||||
{
|
||||
$result = array();
|
||||
function getSCCPConfigMetaData($segment = '') {
|
||||
if ($this->_connect_state) {
|
||||
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPConfigMetaDataAction();
|
||||
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPConfigMetaDataAction($segment);
|
||||
$metadata = $this->send($_action)->getResult();
|
||||
}
|
||||
//return $result;
|
||||
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 = explode('.', $metadata['Version']);
|
||||
$result['vCode'] = 0;
|
||||
$version_parts = array_map('intval',explode('.', $metadata['Version']));
|
||||
if ($version_parts[0] === 4) {
|
||||
switch ($version_parts[1]) {
|
||||
case 1:
|
||||
|
|
@ -446,11 +455,10 @@ class aminterface
|
|||
case 2:
|
||||
$result['vCode'] = 420;
|
||||
break;
|
||||
case 3. . .5:
|
||||
if($version_parts[2] == 3){
|
||||
$result['vCode'] = 433;
|
||||
} else {
|
||||
case 3:
|
||||
$result['vCode'] = 430;
|
||||
if($version_parts[2] >= 3){
|
||||
$result['vCode'] = 433;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -458,31 +466,17 @@ class aminterface
|
|||
break;
|
||||
}
|
||||
}
|
||||
/* 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 (isset($metadata['RevisionNum'])) {
|
||||
$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
|
||||
if ($metadata['RevisionNum'] >= 11063) { // new method, RevisionNum is incremental
|
||||
$result['vCode'] = 433;
|
||||
}
|
||||
$result['RevisionNum'] = $metadata["RevisionNum"];
|
||||
}
|
||||
if (isset($metadata['ConfigureEnabled'])) {
|
||||
$result['futures'] = implode(';', $metadata['ConfigureEnabled']);
|
||||
$result['buildInfo'] = $metadata['ConfigureEnabled'];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
|
@ -493,7 +487,7 @@ class aminterface
|
|||
// Initialise array with default values to eliminate testing later
|
||||
$result = array();
|
||||
$cmd_res = array();
|
||||
$cmd_res = ['sccp' => ['message' => 'default value', 'realm' => '', 'status' => 'ERROR']];
|
||||
$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();
|
||||
|
|
@ -515,4 +509,16 @@ class aminterface
|
|||
}
|
||||
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'];
|
||||
}
|
||||
}
|
||||
|
|
@ -17,11 +17,12 @@ class dbinterface
|
|||
public function __construct($parent_class = null)
|
||||
{
|
||||
$this->paren_class = $parent_class;
|
||||
$this->db = \FreePBX::Database();
|
||||
}
|
||||
|
||||
public function info()
|
||||
{
|
||||
$Ver = '13.0.2'; // This should be updated
|
||||
$Ver = '14.0.0.1'; // This should be updated
|
||||
return array('Version' => $Ver,
|
||||
'about' => 'Data access interface ver: ' . $Ver);
|
||||
}
|
||||
|
|
@ -32,7 +33,7 @@ class dbinterface
|
|||
public function get_db_SccpTableByID($dataid, $data = array(), $indexField = '')
|
||||
{
|
||||
$result = array();
|
||||
$raw = $this->HWextension_db_SccpTableData($dataid, $data);
|
||||
$raw = $this->getSccpDeviceTableData($dataid, $data);
|
||||
if (empty($raw) || empty($indexField)) {
|
||||
return $raw;
|
||||
}
|
||||
|
|
@ -43,27 +44,44 @@ class dbinterface
|
|||
return $result;
|
||||
}
|
||||
|
||||
public function HWextension_db_SccpTableData($dataid, $data = array())
|
||||
public function getSccpDeviceTableData(string $dataid, $data = array())
|
||||
{
|
||||
// $stmt is a single row fetch, $stmts is a fetchAll.
|
||||
$dbh = \FreePBX::Database();
|
||||
// $stmt is a single row fetch, $stmts is a fetchAll while stmtU is fetchAll UNIQUE
|
||||
$stmt = '';
|
||||
$stmts = '';
|
||||
if ($dataid == '') {
|
||||
return false;
|
||||
}
|
||||
$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'])) {
|
||||
$stmts = $dbh->prepare('SELECT * FROM sccpline ORDER BY name');
|
||||
$stmtU = $this->db->prepare('SELECT name, sccpline.* FROM sccpline ORDER BY name');
|
||||
} else {
|
||||
$stmts = $dbh->prepare('SELECT * FROM sccpline WHERE name = :name');
|
||||
$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 as description';
|
||||
$fld = 'name, name as mac, type, button, addon, description';
|
||||
} else {
|
||||
switch ($data['fields']) {
|
||||
case "all":
|
||||
|
|
@ -78,48 +96,49 @@ class dbinterface
|
|||
}
|
||||
}
|
||||
if (!empty($data['name'])) { //either filter by name or by type
|
||||
$stmt = $dbh->prepare('SELECT ' . $fld . ' FROM sccpdeviceconfig WHERE name = :name ORDER BY name');
|
||||
$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 = $dbh->prepare('SELECT ' . $fld . ' FROM sccpdeviceconfig WHERE TYPE LIKE \'%-sip\' ORDER BY name');
|
||||
$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 = $dbh->prepare('SELECT ' . $fld . ' FROM sccpdeviceconfig WHERE TYPE not LIKE \'%-sip\' ORDER BY name');
|
||||
$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 = $dbh->prepare("SELECT {$fld} FROM sccpdeviceconfig ORDER BY name");
|
||||
$stmts = $this->db->prepare("SELECT {$fld} FROM sccpdeviceconfig ORDER BY name");
|
||||
}
|
||||
break;
|
||||
case 'HWSipDevice':
|
||||
$raw_settings = $this->getDb_model_info($get = "sipphones", $format_list = "model");
|
||||
break;
|
||||
case 'HWDevice':
|
||||
$raw_settings = $this->getDb_model_info($get = "ciscophones", $format_list = "model");
|
||||
break;
|
||||
case 'HWextension':
|
||||
$raw_settings = $this->getDb_model_info($get = "extension", $format_list = "model");
|
||||
break;
|
||||
case 'get_columns_sccpdevice':
|
||||
$stmts = $dbh->prepare('DESCRIBE sccpdevice');
|
||||
$stmtU = $this->db->prepare('DESCRIBE sccpdevice');
|
||||
break;
|
||||
case 'get_columns_sccpuser':
|
||||
$stmts = $dbh->prepare('DESCRIBE sccpuser');
|
||||
$stmts = $this->db->prepare('DESCRIBE sccpuser');
|
||||
break;
|
||||
case 'get_columns_sccpline':
|
||||
$stmtU = $this->db->prepare('DESCRIBE sccpline');
|
||||
break;
|
||||
case 'get_sccpdevice_byid':
|
||||
$stmt = $dbh->prepare('SELECT t1.*, types.dns, types.buttons, types.loadimage, types.nametemplate as nametemplate,
|
||||
$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 = $dbh->prepare('SELECT * FROM sccpuser WHERE name = :name');
|
||||
$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'])) {
|
||||
|
|
@ -129,7 +148,7 @@ class dbinterface
|
|||
$sql .= (empty($sql)) ? 'ref = :ref' : ' and ref = :ref';
|
||||
}
|
||||
if (!empty($sql)) {
|
||||
$stmts = $dbh->prepare("SELECT * FROM sccpbuttonconfig WHERE {$sql} ORDER BY instance");
|
||||
$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'])) {
|
||||
|
|
@ -142,6 +161,8 @@ class dbinterface
|
|||
$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();
|
||||
|
|
@ -149,43 +170,25 @@ class dbinterface
|
|||
} 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()
|
||||
{
|
||||
$dbh = \FreePBX::Database();
|
||||
try {
|
||||
$stmt = $dbh->prepare('SELECT keyword, data, type, seq FROM sccpsettings ORDER BY type, seq');
|
||||
$stmt = $this->db->prepare('SELECT keyword, sccpsettings.* FROM sccpsettings ORDER BY type, seq');
|
||||
$stmt->execute();
|
||||
foreach ($stmt->fetchAll() as $var) {
|
||||
$mysccpvalues[$var['keyword']] = array('keyword' => $var['keyword'], 'data' => $var['data'], 'seq' => $var['seq'], 'type' => $var['type']);
|
||||
}
|
||||
return $mysccpvalues;
|
||||
} catch(\PDOException $e) {
|
||||
// sccpsettings table does not yet exist. FreePBX is instantiating
|
||||
// a SCCP_Manager object from the Installer before the installer can
|
||||
// create the table so will create here.
|
||||
$stmt = $dbh-> prepare('CREATE TABLE IF NOT EXISTS sccpsettings (
|
||||
keyword VARCHAR (50) NOT NULL,
|
||||
data VARCHAR (255) NOT NULL,
|
||||
seq TINYINT (1),
|
||||
type TINYINT (1) NOT NULL default 0,
|
||||
PRIMARY KEY (keyword, seq, type )
|
||||
);');
|
||||
$stmt->execute();
|
||||
//if ($dbh::IsError($check)) {
|
||||
// die_freepbx("Can not create sccpsettings table, error: $check\n");
|
||||
//}
|
||||
return array();
|
||||
}
|
||||
$settingsFromDb = $stmt->fetchAll(\PDO::FETCH_ASSOC|\PDO::FETCH_UNIQUE);
|
||||
return $settingsFromDb;
|
||||
}
|
||||
|
||||
public function get_db_sysvalues()
|
||||
{
|
||||
$dbh = \FreePBX::Database();
|
||||
$stmt = $dbh->prepare('SHOW VARIABLES LIKE \'%group_concat%\'');
|
||||
$stmt = $this->db->prepare('SHOW VARIABLES LIKE \'%group_concat%\'');
|
||||
$stmt->execute();
|
||||
return $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
|
@ -196,10 +199,9 @@ class dbinterface
|
|||
|
||||
function getDb_model_info($get = 'all', $format_list = 'all', $filter = array())
|
||||
{
|
||||
$dbh = \FreePBX::Database();
|
||||
$sel_inf = '*, 0 as validate';
|
||||
if ($format_list === 'model') {
|
||||
$sel_inf = 'model, vendor, dns, buttons, 0 as validate';
|
||||
$sel_inf = "model, vendor, dns, buttons, '-;-' as validate";
|
||||
}
|
||||
switch ($get) {
|
||||
case 'byciscoid':
|
||||
|
|
@ -208,10 +210,10 @@ class dbinterface
|
|||
if (!strpos($filter['model'], 'loadInformation')) {
|
||||
$filter['model'] = 'loadInformation' . $filter['model'];
|
||||
}
|
||||
$stmt = $dbh->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (loadinformationid = :model ) ORDER BY 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 = $dbh->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
|
||||
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -219,32 +221,32 @@ class dbinterface
|
|||
case 'byid':
|
||||
if (!empty($filter)) {
|
||||
if (!empty($filter['model'])) {
|
||||
$stmt = $dbh->prepare('SELECT ' . $sel_inf . ' FROM sccpdevmodel WHERE model = :model ORDER BY 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 = $dbh->prepare('SELECT ' . $sel_inf . ' FROM sccpdevmodel ORDER BY model');
|
||||
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'extension':
|
||||
$stmt = $dbh->prepare('SELECT ' . $sel_inf . ' FROM sccpdevmodel WHERE (dns = 0) and (enabled = 1) ORDER BY model');
|
||||
$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.
|
||||
//$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 = $dbh->prepare('SELECT ' . $sel_inf . ' FROM sccpdevmodel WHERE (dns > 0) and (enabled = 1) ORDER BY model ');
|
||||
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel WHERE (dns != 0) and (enabled = 1) ORDER BY model");
|
||||
break;
|
||||
case 'ciscophones':
|
||||
$stmt = $dbh->prepare('SELECT ' . $sel_inf . ' FROM sccpdevmodel WHERE (dns > 0) and (enabled = 1) AND vendor NOT LIKE \'%-sip\' ORDER BY model');
|
||||
$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 = $dbh->prepare('SELECT ' . $sel_inf . ' FROM sccpdevmodel WHERE (dns > 0) and (enabled = 1) AND `vendor` LIKE \'%-sip\' ORDER BY model');
|
||||
$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 = $dbh->prepare('SELECT ' . $sel_inf . ' FROM sccpdevmodel ORDER BY model');
|
||||
$stmt = $this->db->prepare("SELECT {$sel_inf} FROM sccpdevmodel ORDER BY model");
|
||||
break;
|
||||
}
|
||||
$stmt->execute();
|
||||
|
|
@ -255,37 +257,26 @@ class dbinterface
|
|||
{
|
||||
// mode clear - Empty table before update
|
||||
// mode update - update / replace record
|
||||
$dbh = \FreePBX::Database();
|
||||
$result = false;
|
||||
$delete_value = array();
|
||||
switch ($table_name) {
|
||||
case 'sccpsettings':
|
||||
if ($mode == 'replace') { // Change mode name to be more transparent
|
||||
$dbh->prepare('TRUNCATE sccpsettings')->execute();
|
||||
$stmt = $dbh->prepare('INSERT INTO sccpsettings (keyword, data, seq, type) VALUES (:keyword,:data,:seq,:type)');
|
||||
$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 = $dbh->prepare('REPLACE INTO sccpsettings (keyword, data, seq, type) VALUES (:keyword,:data,:seq,:type)');
|
||||
$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) && isset($dataArr['data'])) {
|
||||
if ($dataArr['data'] == $this->val_null) {
|
||||
$delete_value[] = $save_value[$key]['keyword'];
|
||||
break;
|
||||
}
|
||||
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();
|
||||
}
|
||||
if (!empty($delete_value)) {
|
||||
$stmt = $dbh->prepare('DELETE FROM sccpsettings WHERE keyword = :keyword');
|
||||
foreach ($delete_value as $del_key) {
|
||||
$stmt->bindParam(':keyword',$del_key,\PDO::PARAM_STR);
|
||||
$result = $stmt->execute();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'sccpdevmodel': // Fall through to next intentionally
|
||||
case 'sccpdevice': // Fall through to next intentionally
|
||||
|
|
@ -308,13 +299,13 @@ class dbinterface
|
|||
if (!empty($sql_var)) {
|
||||
switch ($mode) {
|
||||
case 'delete':
|
||||
$stmt = $dbh->prepare('DELETE FROM '. $table_name . ' WHERE ' . $sql_key);
|
||||
$stmt = $this->db->prepare("DELETE FROM {$table_name} WHERE {$sql_key}");
|
||||
break;
|
||||
case 'update':
|
||||
$stmt = $dbh->prepare('UPDATE ' . $table_name . ' SET ' . $sql_var . ' WHERE ' . $sql_key);
|
||||
$stmt = $this->db->prepare("UPDATE {$table_name} SET {$sql_var} WHERE {$sql_key}");
|
||||
break;
|
||||
case 'replace':
|
||||
$stmt = $dbh->prepare('REPLACE INTO ' . $table_name . ' SET ' . $sql_var);
|
||||
$stmt = $this->db->prepare("REPLACE INTO {$table_name} SET {$sql_var}");
|
||||
break;
|
||||
// no default mode - must be explicit.
|
||||
}
|
||||
|
|
@ -325,35 +316,37 @@ class dbinterface
|
|||
switch ($mode) {
|
||||
case 'delete':
|
||||
$sql = 'DELETE FROM sccpbuttonconfig WHERE ref = :hwid';
|
||||
$stmt = $dbh->prepare($sql);
|
||||
$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 = $dbh->prepare('UPDATE sccpbuttonconfig SET name =:name WHERE ref = :ref AND reftype =:reftype AND instance = :instance AND buttontype = :buttontype');
|
||||
$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['type'],\PDO::PARAM_STR);
|
||||
$stmt->bindParam(':buttontype', $button_array['buttontype'],\PDO::PARAM_STR);
|
||||
$stmt->bindParam(':name', $button_array['name'],\PDO::PARAM_STR);
|
||||
$result= $dbh->execute();
|
||||
$stmt->bindParam(':options', $button_array['options'],\PDO::PARAM_STR);
|
||||
$result= $stmt->execute();
|
||||
}
|
||||
break;
|
||||
case 'add':
|
||||
foreach ($save_value as $button_array) {
|
||||
$stmt = $dbh->prepare('INSERT INTO sccpbuttonconfig (ref, reftype, instance, buttontype, name, options) VALUES (:ref, :reftype, :instance, :buttontype, :name, :options)');
|
||||
$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['type'],\PDO::PARAM_STR);
|
||||
$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.
|
||||
// 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;
|
||||
|
|
@ -362,6 +355,36 @@ class dbinterface
|
|||
}
|
||||
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 ??!
|
||||
|
|
@ -374,19 +397,22 @@ class dbinterface
|
|||
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()
|
||||
{
|
||||
$dbh = \FreePBX::Database();
|
||||
$result = 0;
|
||||
$check_fields = [
|
||||
'430' => ['_hwlang' => "varchar(12)"],
|
||||
'431' => ['private'=> "enum('on','off')"],
|
||||
'433' => ['directed_pickup'=>'']
|
||||
];
|
||||
$stmt = $dbh->prepare('DESCRIBE sccpdevice');
|
||||
$stmt = $this->db->prepare('DESCRIBE sccpdevice');
|
||||
$stmt->execute();
|
||||
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $value) {
|
||||
$id_result[$value['Field']] = $value['Type'];
|
||||
|
|
@ -406,4 +432,19 @@ class dbinterface
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
455
sccpManClasses/extconfigs.class.php
Normal file
455
sccpManClasses/extconfigs.class.php
Normal file
|
|
@ -0,0 +1,455 @@
|
|||
<?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
|
|
@ -15,17 +15,57 @@ 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.4';
|
||||
$Ver = '13.0.6';
|
||||
return array('Version' => $Ver,
|
||||
'about' => 'Create XML data interface ver: ' . $Ver);
|
||||
}
|
||||
|
|
@ -86,7 +126,6 @@ class xmlinterface
|
|||
} 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'];
|
||||
|
|
@ -94,7 +133,6 @@ class xmlinterface
|
|||
$xnode->name = '';
|
||||
$xnode->langCode = '';
|
||||
}
|
||||
// $this -> replaceSimpleXmlNode($xml_work->$key,$xnode);
|
||||
break;
|
||||
case 'networkLocale':
|
||||
$lang = $data_values['netlang'];
|
||||
|
|
@ -105,7 +143,6 @@ class xmlinterface
|
|||
}
|
||||
break;
|
||||
}
|
||||
//$this-> replaceSimpleXmlNode($xml_work->$value, $xnode );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,12 +152,17 @@ class xmlinterface
|
|||
$node->addAttribute('model', $var['vendor'] . ' ' . $var['model']);
|
||||
}
|
||||
}
|
||||
$xml_work->asXml($xml_name); // Save XMLDefault1.cnf.xml
|
||||
$this->saveXml($xml_work, $xml_name); // Save XMLDefault1.cnf.xml
|
||||
}
|
||||
}
|
||||
|
||||
function create_SEP_XML($store_path = '', $data_values = array(), $dev_config = array(), $dev_id = '', $lang_info = array())
|
||||
function create_SEP_XML($store_path, $data_values, $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',
|
||||
|
|
@ -128,30 +170,31 @@ class xmlinterface
|
|||
'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'
|
||||
'phonepersonalization' => 'phonepersonalization'
|
||||
);
|
||||
$var_xml_general_vars = array('capfAuthMode' => 'null', 'capfList' => 'null', 'mobility' => 'null',
|
||||
'phoneServices' => 'null', 'certHash' => 'null',
|
||||
'deviceSecurityMode' => '1');
|
||||
|
||||
// $var_hw_config = $this->dbinterface->HWextension_db_SccpTableData("get_sccpdevice_byid", array('id' => $dev_id));
|
||||
|
||||
if (empty($dev_config)) {
|
||||
return false;
|
||||
$data_path = $dev_config['tftp_templates_path'];
|
||||
if (empty($data_path)) {
|
||||
die('Create_SEP_XML tftp_templates_path not defined');
|
||||
}
|
||||
$data_path = $dev_config['tftp_path'];
|
||||
|
||||
if (empty($store_path) || empty($data_path) || empty($data_values) || empty($dev_id)) {
|
||||
return;
|
||||
$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 . '/templates/' . $dev_config['nametemplate'];
|
||||
$xml_template = "{$data_path}/{$dev_config['nametemplate']}";
|
||||
} else {
|
||||
$xml_template = $data_path . '/templates/SEP0000000000.cnf.xml_79df_template';
|
||||
$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_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) {
|
||||
|
|
@ -208,32 +251,15 @@ class xmlinterface
|
|||
$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) {
|
||||
if (empty($data_values[$srst_pro]) || ($data_values['srst_Option'] == 'disable') ) {
|
||||
$srst_data =array();
|
||||
} else {
|
||||
$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 = ((empty($srs_val[1])) ? "2000": $srs_val[1]);
|
||||
// $xnode->$nod = $srs_val[1];
|
||||
$si++;
|
||||
}
|
||||
while ($si < 4) {
|
||||
$nod = $srs_put[0] . $si;
|
||||
$xnode->$nod = '';
|
||||
$nod = $srs_put[1] . $si;
|
||||
$xnode->$nod = '';
|
||||
$si++;
|
||||
}
|
||||
// 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':
|
||||
|
|
@ -263,50 +289,6 @@ class xmlinterface
|
|||
}
|
||||
$ifc++;
|
||||
}
|
||||
/* 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);
|
||||
|
|
@ -314,12 +296,20 @@ class xmlinterface
|
|||
case 'vendorconfig':
|
||||
$xml_node = $xml_work->$key;
|
||||
foreach ($xml_work->$key->children() as $dkey => $ddata) {
|
||||
$dkey_l = strtolower($dkey);
|
||||
$vtmp_key = $key_l.'_'.$dkey_l;
|
||||
if (isset($data_values[$vtmp_key])) {
|
||||
$vtmp_data = $data_values[$vtmp_key];
|
||||
if ((!empty($vtmp_data)) || ($vtmp_data == "0")) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -330,28 +320,24 @@ class xmlinterface
|
|||
$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;
|
||||
$hw_addon = explode(',', $dev_config['addon']);
|
||||
$hw_addon = explode(';', $dev_config['addon']);
|
||||
foreach ($hw_addon as $add_key) {
|
||||
// foreach ($dev_config['addon_info'] as $add_key => $add_val) {
|
||||
if (!empty($dev_config['addon_info'][$add_key])) {
|
||||
$add_val = $dev_config['addon_info'][$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++;
|
||||
}
|
||||
}
|
||||
// $this->appendSimpleXmlNode($xml_work , $xnode_obj);
|
||||
}
|
||||
break;
|
||||
case 'commonprofile':
|
||||
|
|
@ -361,52 +347,50 @@ class xmlinterface
|
|||
break;
|
||||
|
||||
case 'userlocale':
|
||||
case 'networklocaleinfo':
|
||||
case 'networklocale':
|
||||
$hwlang = '';
|
||||
$lang = '';
|
||||
if (!empty($dev_config["_hwlang"])) {
|
||||
$hwlang = explode(':', $dev_config["_hwlang"]);
|
||||
// Device language
|
||||
$lang = $data_values['devlang'];
|
||||
if (!empty($dev_config['devlang'])) {
|
||||
$lang = $dev_config['devlang'];
|
||||
}
|
||||
if (($key_l == 'networklocaleinfo') || ($key_l == '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_l == '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'];
|
||||
if ($key_l == 'userlocale') {
|
||||
$xml_node->winCharSet = $lang_info[$lang]['codepage'];
|
||||
$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;
|
||||
// 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');
|
||||
}
|
||||
$this->saveXml($xml_work, $xml_name); // Save
|
||||
|
||||
return time();
|
||||
}
|
||||
|
||||
|
|
@ -420,20 +404,11 @@ class xmlinterface
|
|||
}
|
||||
$ip_fill = true;
|
||||
if (!empty($data_values['ccm_address'])) {
|
||||
$ccm_address = $data_values['ccm_address'];
|
||||
if (strpos($ccm_address, 'internal') === false && strpos($ccm_address, '0.0.0.0') === false) {
|
||||
$tmp_data = explode(';', $ccm_address);
|
||||
$ip_fill = false;
|
||||
foreach ($tmp_data as $tmp_row) {
|
||||
if (strpos($tmp_row, '/') !== false) {
|
||||
$ttmp_r = explode('/', $tmp_row); // IPv6 - ????
|
||||
$rkey = $ttmp_r[0];
|
||||
$res[$rkey] = array('ip' => $rkey, 'port' => $ttmp_r[1]);
|
||||
} else {
|
||||
$rkey = $tmp_row;
|
||||
$res[$rkey] = array('ip' => $rkey, 'port' => $data_values['port']);
|
||||
}
|
||||
}
|
||||
// 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) {
|
||||
|
|
@ -463,44 +438,12 @@ class xmlinterface
|
|||
return $res;
|
||||
}
|
||||
|
||||
/*
|
||||
private function get_server_sip_bind($data_values = array()) {
|
||||
$res = array();
|
||||
|
||||
if (!empty($data_values['sipbind']) and ( $data_values['sipbind'] != '0.0.0.0')) {
|
||||
$res[0] = array('ip' => $data_values['sipbind'], 'port' => $data_values['sipbindport'], 'tlsport' => $data_values['tlsport'], 'proto' => $data_values['sipsuportproto']);
|
||||
}
|
||||
|
||||
$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', $data_values['sipbind']), true) && ($ip_valid)) {
|
||||
$res[] = array('ip' => $value['ip'], 'port' => $data_values['sipbindport'], 'tlsport' => $data_values['tlsport'], 'proto' => $data_values['sipsuportproto']);
|
||||
}
|
||||
}
|
||||
}
|
||||
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'
|
||||
'phonePersonalization' => 'phonepersonalization'
|
||||
);
|
||||
$var_xml_sipProfile = array('phoneLabel' => 'description',
|
||||
'transferOnhookEnabled' => 'transferOnhookEnabled', 'enableVad' => 'enableVad', 'voipControlPort' => 'sipport'
|
||||
|
|
@ -511,7 +454,7 @@ class xmlinterface
|
|||
'phoneServices' => 'null', 'certHash' => 'null', 'deviceProtocol' => 'SIP',
|
||||
'deviceSecurityMode' => '1');
|
||||
|
||||
// $var_hw_config = $this->dbinterface->HWextension_db_SccpTableData("get_sccpdevice_byid", array('id' => $dev_id));
|
||||
// $var_hw_config = $this->dbinterface->getSccpDeviceTableData("get_sccpdevice_byid", array('id' => $dev_id));
|
||||
|
||||
if (empty($dev_config)) {
|
||||
return false;
|
||||
|
|
@ -531,7 +474,6 @@ class xmlinterface
|
|||
$xml_template = $data_path . '/templates/SEP0000000000.cnf.xml_79df_sip_template';
|
||||
}
|
||||
$xml_name = $store_path . '/' . $dev_id . '.cnf.xml';
|
||||
//$sip_bind = $this->get_server_sip_bind($data_values);
|
||||
$sip_bind = $data_values['sbind'];
|
||||
$bind_proto = 'tcp';
|
||||
$bind_ip_def = '';
|
||||
|
|
@ -574,10 +516,8 @@ class xmlinterface
|
|||
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'];
|
||||
|
|
@ -587,43 +527,6 @@ class xmlinterface
|
|||
}
|
||||
// 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;
|
||||
$ifc = 0;
|
||||
|
|
@ -706,23 +609,19 @@ class xmlinterface
|
|||
$ifc++;
|
||||
}
|
||||
}
|
||||
// $xnode = &$xml_node->$dkey->members;
|
||||
//$xnode = null;
|
||||
break;
|
||||
case 'softKeyFile':
|
||||
case 'dialTemplate': // Доработать !
|
||||
$xml_ext_file = '';
|
||||
$templet_path = (($dkey == 'softKeyFile') ? $dev_config['tftp_softkey'] : $dev_config['tftp_dialplan']);
|
||||
$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');
|
||||
}
|
||||
// $xml_node->$dkey = $templet_path . '/' . $xml_ext_file.'---'.$dev_config[$tmp_key];
|
||||
// break;
|
||||
if (empty($xml_ext_file) || !file_exists($templet_path . '/' . $xml_ext_file)) {
|
||||
if (empty($xml_ext_file) || !file_exists($template_path . '/' . $xml_ext_file)) {
|
||||
$xml_ext_file = (($dkey == 'softKeyFile') ? 'softkeydefault.xml' : 'dialplan.xml');
|
||||
}
|
||||
if (file_exists($templet_path . '/' . $xml_ext_file)) {
|
||||
if (file_exists($template_path . '/' . $xml_ext_file)) {
|
||||
$xml_node->$dkey = $xml_ext_file;
|
||||
} else {
|
||||
$xml_node->$dkey = null;
|
||||
|
|
@ -743,17 +642,19 @@ class xmlinterface
|
|||
} 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) {
|
||||
$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++;
|
||||
}
|
||||
// $this->appendSimpleXmlNode($xml_work , $xnode_obj);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'commonProfile':
|
||||
|
|
@ -761,51 +662,50 @@ class xmlinterface
|
|||
$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"]);
|
||||
case 'userlocale':
|
||||
// Device language
|
||||
$lang = $data_values['devlang'];
|
||||
if (!empty($dev_config['devlang'])) {
|
||||
$lang = $dev_config['devlang'];
|
||||
}
|
||||
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'];
|
||||
if ($key == 'userLocale') {
|
||||
$xml_node->winCharSet = $lang_info[$lang]['codepage'];
|
||||
$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;
|
||||
// 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
|
||||
$this->saveXml($xml_work, $xml_name); // Save
|
||||
} else {
|
||||
die('Error Hardware template :' . $xml_template . ' not found');
|
||||
}
|
||||
|
|
@ -829,7 +729,7 @@ class xmlinterface
|
|||
foreach ($dialFelds as $fld) {
|
||||
if (isset($value[$fld])) {
|
||||
if ($value[$fld] == 'empty' || $value[$fld] == '') {
|
||||
//
|
||||
|
||||
} else {
|
||||
$xmlstr .= ' ' . $fld . '="' . (string) $value[$fld] . '"';
|
||||
}
|
||||
|
|
@ -852,11 +752,10 @@ class xmlinterface
|
|||
$put_file = (string) $get_settings['idtemplate'];
|
||||
}
|
||||
} else {
|
||||
$errors = array('Fields Dial Plan Name is requered !!');
|
||||
$errors = array('Fields Dial Plan Name is required !!');
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
// $put_file = 'test';
|
||||
$put_file = str_replace(array("\n", "\r", "\t", "/", "\\", ".", ","), '', $put_file);
|
||||
$file = $confDir . '/dial' . $put_file . '.xml';
|
||||
file_put_contents($file, $xmlstr);
|
||||
|
|
@ -869,9 +768,9 @@ class xmlinterface
|
|||
{
|
||||
if (empty($config[$name])) {
|
||||
if ($name == 'default') {
|
||||
$typeSoft = $confDir["tftp_templates"] . '/SIPDefaultSoftKey.xml_template';
|
||||
$typeSoft = $confDir["tftp_templates_path"] . '/SIPDefaultSoftKey.xml_template';
|
||||
if (file_exists($typeSoft)) {
|
||||
$file = $confDir["tftp_softkey"] . '/softkey' . $name . '.xml';
|
||||
$file = $confDir["tftp_softkey_path"] . '/softkey' . $name . '.xml';
|
||||
if (!copy($typeSoft, $file)) {
|
||||
return array('error' => 'Access error' . $name);
|
||||
}
|
||||
|
|
@ -884,8 +783,7 @@ class xmlinterface
|
|||
$errors = array();
|
||||
$xmlstr = "<softKeyCfg>\n";
|
||||
$xmlstr .= "<versionStamp>" . time() . "</versionStamp>\n";
|
||||
// $xmlstr .= "<typeSoftKey></typeSoftKey>\n";
|
||||
$typeSoft = $confDir["tftp_templates"] . '/SIPTypeSoftKey.xml_template';
|
||||
$typeSoft = $confDir["tftp_templates_path"] . '/SIPTypeSoftKey.xml_template';
|
||||
$read_soft = "";
|
||||
if (file_exists($typeSoft)) {
|
||||
$f_read = fopen($typeSoft, 'r');
|
||||
|
|
@ -895,7 +793,6 @@ class xmlinterface
|
|||
fclose($f_read);
|
||||
}
|
||||
$xmlstr .= $read_soft;
|
||||
// $xmlstr .= $read_soft."\n</typeSoftKey>\n";
|
||||
$xmlstr .= " <softKeySets>\n";
|
||||
foreach ($config[$name] as $key => $value) {
|
||||
$xmlstr .= ' <softKeySet id="' . $key . '">' . "\n";
|
||||
|
|
@ -908,8 +805,7 @@ class xmlinterface
|
|||
|
||||
$xmlstr .= '</softKeyCfg>';
|
||||
if (empty($errors)) {
|
||||
// $put_file = str_replace(array("\n", "\r", "\t", "/", "\\", ".", ","), '', $put_file);
|
||||
$file = $confDir["tftp_softkey"] . '/softkey' . $name . '.xml';
|
||||
$file = $confDir["tftp_softkey_path"] . '/softkey' . $name . '.xml';
|
||||
file_put_contents($file, $xmlstr);
|
||||
}
|
||||
|
||||
|
|
@ -934,7 +830,6 @@ class xmlinterface
|
|||
dom_import_simplexml($element),
|
||||
true
|
||||
);
|
||||
// $dom->parentNode->appendChild($import, $dom);
|
||||
$dom->parentNode->appendChild($import->cloneNode(true));
|
||||
}
|
||||
}
|
||||
788
sccpManTraits/ajaxHelper.php
Normal file
788
sccpManTraits/ajaxHelper.php
Normal file
|
|
@ -0,0 +1,788 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
153
sccpManTraits/bmoFunctions.php
Normal file
153
sccpManTraits/bmoFunctions.php
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
523
sccpManTraits/helperFunctions.php
Normal file
523
sccpManTraits/helperFunctions.php
Normal file
|
|
@ -0,0 +1,523 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
21
sccpManagerUpdater.json
Normal file
21
sccpManagerUpdater.json
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
105
uninstall.php
105
uninstall.php
|
|
@ -1,19 +1,41 @@
|
|||
<?php
|
||||
/* $Id:$ */
|
||||
|
||||
/* !TODO!: In an ideal world this should roll back everything the install.php script did, except for what existed before install.php was run */
|
||||
/* !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.
|
||||
/*
|
||||
function CreateBackUpConfig() {
|
||||
if (!defined('FREEPBX_IS_AUTH')) {
|
||||
die('No direct script access allowed');
|
||||
}
|
||||
|
||||
global $db;
|
||||
$version = FreePBX::Config()->get('ASTVERSION');
|
||||
global $sqlTables;
|
||||
$sqlTables = array('sccpbuttonconfig','sccpdevice','sccpline','sccpuser','sccpsettings','sccpdevmodel');
|
||||
createBackUpConfig();
|
||||
|
||||
function createBackUpConfig()
|
||||
{
|
||||
global $amp_conf;
|
||||
outn("<li>" . _("Create Config BackUp") . "</li>");
|
||||
global $sqlTables;
|
||||
outn("<li>" . _("Creating Config BackUp") . "</li>");
|
||||
$cnf_int = \FreePBX::Config();
|
||||
$backup_files = array('extconfig','extconfig','res_mysql', 'res_config_mysql','sccp');
|
||||
$backup_ext = array('_custom.conf', '.conf');
|
||||
$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) {
|
||||
|
|
@ -23,60 +45,37 @@ function CreateBackUpConfig() {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (file_exists($sqlBuFile)) {
|
||||
$zip->addFile($sqlBuFile);
|
||||
}
|
||||
$zip->close();
|
||||
} else {
|
||||
outn("<li>" . _("Error Create BackUp: ") . $filename ."</li>");
|
||||
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();
|
||||
}
|
||||
outn("<li>" . _("Create Config BackUp: ") . $filename ."</li>");
|
||||
}
|
||||
*/
|
||||
if (!defined('FREEPBX_IS_AUTH')) {
|
||||
die('No direct script access allowed');
|
||||
unlink($sqlBuFile);
|
||||
outn("<li>" . _("Config backup created: ") . $filename ."</li>");
|
||||
}
|
||||
|
||||
global $db;
|
||||
$version = FreePBX::Config()->get('ASTVERSION');
|
||||
|
||||
out('Removing all Sccp_manager tables');
|
||||
$tables = array('sccpdevmodel', 'sccpsettings');
|
||||
foreach ($tables as $table) {
|
||||
$sql = "DROP TABLE IF EXISTS {$table}";
|
||||
$result = $db->query($sql);
|
||||
if (DB::IsError($result)) {
|
||||
die_freepbx($result->getDebugInfo());
|
||||
}
|
||||
unset($result);
|
||||
}
|
||||
if (!empty($version)) {
|
||||
// Woo, we have a version
|
||||
$check = $db->getRow("SELECT 1 FROM `kvstore` LIMIT 0", DB_FETCHMODE_ASSOC);
|
||||
if (!(DB::IsError($check))) {
|
||||
//print_r("none, creating table :". $value);
|
||||
echo "Deleting keys FROM kvstore..";
|
||||
outn("<li>" . _("Deleting keys FROM kvstore..") . "</li>");
|
||||
sql("DELETE FROM kvstore WHERE module = 'sccpsettings'");
|
||||
sql("DELETE FROM kvstore WHERE module = 'Sccp_manager'");
|
||||
}
|
||||
// By accessing the database, we have recreated sccpsettings table so now delete
|
||||
// Need to rewrite this uninstaller.
|
||||
$sql = "DROP TABLE IF EXISTS sccpsettings";
|
||||
$result = $db->query($sql);
|
||||
if (DB::IsError($result)) {
|
||||
die_freepbx($result->getDebugInfo());
|
||||
}
|
||||
unset($result);
|
||||
// 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");
|
||||
|
||||
/* 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 safe to drop/delete them */
|
||||
|
||||
/* DROP VIEW IF EXISTS`sccpdeviceconfig`;
|
||||
DROP TABLE IF EXISTS `sccpbuttonconfig`;
|
||||
DROP TABLE IF EXISTS `sccpdevice`;
|
||||
DROP TABLE IF EXISTS `sccpdevmodel`;
|
||||
DROP TABLE IF EXISTS `sccpline`;
|
||||
DROP TABLE IF EXISTS `sccpsettings`;
|
||||
DROP TABLE IF EXISTS `sccpuser`;
|
||||
*
|
||||
*/
|
||||
}
|
||||
|
||||
echo "done<br>\n";
|
||||
outn("<li>" . _("Uninstall Complete") . "</li>");
|
||||
?>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -12,12 +12,12 @@
|
|||
<div class="display no-border">
|
||||
<h1><?php echo _("Cisco Dial Template") ?></h1>
|
||||
<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"> </i><?php echo _("Add Dialplan") ?></a>
|
||||
<a class="btn btn-default" href="config.php?display=sccp_adv&tech_hardware=dialplan&extdisplay=*new*"><i class="fa fa-plus"> </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>
|
||||
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
|
||||
</button>
|
||||
</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&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>
|
||||
<tr>
|
||||
<!-- <th data-checkbox="true"></th> -->
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
$keymultiselect = array('AllRight' =>'>>', 'Right' => '>', 'AllLeft' => '<<', 'Left' => '<');
|
||||
|
||||
// ------------------------------------- Key Set Value ---------------------------------------------------------
|
||||
$keysetarray = $this->extconfigs->getextConfig('keyset');
|
||||
$keysetarray = $this->extconfigs->getExtConfig('keyset');
|
||||
|
||||
/*$keysetarray1 = array('onhook' => array('redial','newcall','cfwdall','dnd','pickup','gpickup','private'),
|
||||
'connected' => array('hold','endcall','park','vidmode','select','cfwdall','cfwdbusy','idivert'),
|
||||
|
|
@ -46,23 +46,21 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
|
|||
<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="Submit" value="Submit">
|
||||
|
||||
<div class="fpbx-container container-fluid">
|
||||
<div class="fpbx-container container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="display no-border">
|
||||
<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>
|
||||
</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&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">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th data-checkbox="true"></th> -->
|
||||
<th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($keynamearray as $key => $value) {
|
||||
if ($i < 9) {
|
||||
if ($i < 12) {
|
||||
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
|
||||
}
|
||||
$i ++;
|
||||
|
|
@ -78,7 +76,7 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Begin Form Input New / Edit -->
|
||||
|
|
@ -90,18 +88,27 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
|
|||
<h4 class="modal-title" id="gridSystemModalLabel">Add New KeySet</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
|
||||
<style type="text/css">
|
||||
input:invalid {border: red solid 3px;}
|
||||
</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>
|
||||
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_devmodel"></i>
|
||||
</div><div class="col-md-9">
|
||||
<input type="text" maxlength="15" class="form-control" id="new_keySetname" name="new_keySetname" value="SoftKeyset">
|
||||
</div> </div></div>
|
||||
<div class="row"><div class="col-md-12">
|
||||
<span id="new_devmodel-help" class="help-block fpbx-help-block">Help. max len = 15</span>
|
||||
</div></div></div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<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 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">
|
||||
|
||||
<?php
|
||||
|
|
@ -157,8 +164,6 @@ foreach ($keysetarray as $key => $value) {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
function DispayActionsKeyFormatter(value, row, index) {
|
||||
var exp_model = '';
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
$requestType = 'firmware';
|
||||
global $amp_conf;
|
||||
?>
|
||||
|
||||
<div class="fpbx-container container-fluid">
|
||||
|
|
@ -32,8 +33,10 @@
|
|||
<li><a class="dropitem" data-id="all" tabindex="-1" href="#"><span><?php echo _('Show All') ?></span></a></li>
|
||||
</ul>
|
||||
</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>
|
||||
<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&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">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-checkbox="true"></th>
|
||||
|
|
@ -42,9 +45,9 @@
|
|||
<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-field="buttons"><?php echo _('Buttons');?></th>
|
||||
<th data-sortable="false" data-formatter="SetColColorFirm" data-field="loadimage"><?php echo _('Loadimage');?></th>
|
||||
<th data-sortable="false" data-formatter="SetColFirmNf" data-field="loadimage"><?php echo _('Loadimage');?></th>
|
||||
<th data-sortable="false" data-field="loadinformationid"><?php echo _('Loadinformation ID');?></th>
|
||||
<th data-sortable="false" data-formatter="SetColColorTempl" data-field="nametemplate"><?php echo _('Model template');?></th>
|
||||
<th data-sortable="false" data-formatter="SetColTemplNf" data-field="nametemplate"><?php echo _('Model template');?></th>
|
||||
<th data-field="actions" data-formatter="DispayActionsModelFormatter"><?php echo _('Actions');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -61,7 +64,7 @@
|
|||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="gridSystemModalLabel"><?php echo _('Modal title');?></h4>
|
||||
<h4 class="modal-title" id="gridSystemModalLabel"><?php echo _('Add new model');?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
|
||||
|
|
@ -141,12 +144,34 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<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 without Enabled');?></button>
|
||||
<button type="button" class="btn btn-primary sccp_update" data-id="model_add" id="add_new_model" data-dismiss="modal"><?php echo _('Add New model - Disabled');?></button>
|
||||
</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-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
|
|
@ -261,18 +286,17 @@
|
|||
return exp_model;
|
||||
}
|
||||
|
||||
function SetColColorFirm(value, row, index) {
|
||||
function SetColFirmNf(value, row, index) {
|
||||
if (row['validate'].split(';')[0] === 'no') {
|
||||
return 'No found '+ value;
|
||||
return "File not found<br />" + value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function SetColColorTempl(value, row, index) {
|
||||
function SetColTemplNf(value, row, index) {
|
||||
if (row['validate'].split(';')[1] === 'no') {
|
||||
return 'No found ' + value ;
|
||||
return "File not found<br /> " + value ;
|
||||
}
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
function SetRowColor(row, index) {
|
||||
|
|
|
|||
|
|
@ -4,37 +4,62 @@
|
|||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
$def_val = null;
|
||||
$def_val = array();
|
||||
$dev_id = null;
|
||||
$dev_new = null;
|
||||
$device_warning= null;
|
||||
// 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['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");
|
||||
|
||||
if (!empty($_REQUEST['new_id'])) {
|
||||
// Adding device that is connected but not in database
|
||||
$dev_id = $_REQUEST['new_id'];
|
||||
$val = str_replace(array('SEP','ATA','VG'), '', $dev_id);
|
||||
$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");
|
||||
// Overwrite some specific defaults based on $_REQUEST
|
||||
$def_val['type'] = array("keyword" => 'type', "data" => $_REQUEST['type'], "seq" => "99");
|
||||
if (!empty($_REQUEST['addon'])) {
|
||||
$def_val['addon'] = array("keyword" => 'type', "data" => $_REQUEST['addon'], "seq" => "99");
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_REQUEST['id'])) {
|
||||
// Editing an existing Device. Overwrite any defaults that are already set for this device.
|
||||
$dev_id = $_REQUEST['id'];
|
||||
$dev_new = $dev_id;
|
||||
$db_res = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
|
||||
|
||||
$db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id));
|
||||
foreach ($db_res as $key => $val) {
|
||||
if (!empty($val)) {
|
||||
switch ($key) {
|
||||
case 'type':
|
||||
$tmp_raw = $this->getSccpModelInformation('byid', true, 'all', array('model'=>$val));
|
||||
case 'phonepersonalization':
|
||||
$def_val['phonepersonalization'] = array("keyword" => 'phonepersonalization', "data" => $val, "seq" => "99");
|
||||
break;
|
||||
default:
|
||||
// Overwrite existing defaults after checking that data is still valid after schema updates
|
||||
// Do not strip underscores as these fields are new in the schema and so should be valid.
|
||||
$enumFields = $this->getTableEnums('sccpdevice', false);
|
||||
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;
|
||||
}
|
||||
$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];
|
||||
}
|
||||
|
|
@ -46,38 +71,14 @@ if (!empty($_REQUEST['id'])) {
|
|||
if ($tmpar[1] != 'yes') {
|
||||
$device_warning['Template'] = array('Missing device configuration template : '. $tmp_raw['nametemplate']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'name':
|
||||
$key = 'mac';
|
||||
$val = str_replace(array('SEP','ATA','VG'), '', $val);
|
||||
$val = implode('.', sscanf($val, '%4s%4s%4s')); // Convert to Cisco display Format
|
||||
break;
|
||||
case '_hwlang':
|
||||
$tmpar = explode(":", $val);
|
||||
$def_val['netlang'] = array("keyword" => 'netlang', "data" => $tmpar[0], "seq" => "99");
|
||||
$def_val['devlang'] = array("keyword" => 'devlang', "data" => $tmpar[1], "seq" => "99");
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
//print_r($db_res);
|
||||
|
||||
if (!empty($device_warning)) {
|
||||
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>';
|
||||
|
|
@ -93,20 +94,28 @@ if (!empty($device_warning)) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<?php } ?>
|
||||
<br>
|
||||
<?php }
|
||||
}
|
||||
} ?>
|
||||
|
||||
<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="Submit" value="Submit">
|
||||
|
||||
<?php
|
||||
if (empty($dev_new)) {
|
||||
|
||||
if (empty($dev_id)) {
|
||||
echo '<input type="hidden" name="sccp_deviceid" value="new">';
|
||||
} else {
|
||||
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
|
||||
$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 {
|
||||
|
|
@ -115,8 +124,27 @@ if (!empty($device_warning)) {
|
|||
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_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)) {
|
||||
echo '<input type="hidden" name="sccp_deviceid" value="new">';
|
||||
} else {
|
||||
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
|
||||
}
|
||||
*/
|
||||
if (empty($dev_id)) {
|
||||
echo $this->showGroup('sccp_hw_sip_dev', 1, 'sccp_hw', $def_val);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ $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->HWextension_db_SccpTableData('get_sccpuser', array("id" => $dev_id));
|
||||
$db_res = $this->dbinterface->getSccpDeviceTableData('get_sccpuser', array("id" => $dev_id));
|
||||
if (!empty($db_res)) {
|
||||
foreach ($db_res as $key => $val) {
|
||||
if (!empty($val)) {
|
||||
|
|
|
|||
|
|
@ -1,125 +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;
|
||||
$device_warning= null;
|
||||
// Default value from Server setings
|
||||
|
||||
$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['directed_pickup_context'] = array("keyword" => 'directed_pickup_context', "data" => $this->sccpvalues['directed_pickup_context']['data'], "seq" => "99");
|
||||
|
||||
if (!empty($_REQUEST['new_id'])) {
|
||||
$dev_id = $_REQUEST['new_id'];
|
||||
$val = str_replace(array('SEP','ATA','VG'), '', $dev_id);
|
||||
$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'])) {
|
||||
$def_val['addon'] = array("keyword" => 'type', "data" => $_REQUEST['addon'], "seq" => "99");
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_REQUEST['id'])) {
|
||||
$dev_id = $_REQUEST['id'];
|
||||
$dev_new = $dev_id;
|
||||
$db_res = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
|
||||
foreach ($db_res as $key => $val) {
|
||||
if (!empty($val)) {
|
||||
switch ($key) {
|
||||
case 'type':
|
||||
$tmp_raw = $this->getSccpModelInformation('byid', true, 'all', array('model'=>$val));
|
||||
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']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'name':
|
||||
$key = 'mac';
|
||||
$val = str_replace(array('SEP','ATA','VG'), '', $val);
|
||||
$val = implode('.', sscanf($val, '%4s%4s%4s')); // Convert to Cisco display Format
|
||||
break;
|
||||
case '_hwlang':
|
||||
$tmpar = explode(":", $val);
|
||||
$def_val['netlang'] = array("keyword" => 'netlang', "data" => $tmpar[0], "seq" => "99");
|
||||
$def_val['devlang'] = array("keyword" => 'devlang', "data" => $tmpar[1], "seq" => "99");
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
//print_r($db_res);
|
||||
|
||||
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">
|
||||
<?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_sedit">
|
||||
<input type="hidden" name="category" value="adddevice_form">
|
||||
<input type="hidden" name="Submit" value="Submit">
|
||||
<input type="hidden" name="sccp_device_typeid" value="sipdevice">
|
||||
|
||||
|
||||
<?php
|
||||
if (empty($dev_new)) {
|
||||
echo '<input type="hidden" name="sccp_deviceid" value="new">';
|
||||
} else {
|
||||
echo '<input type="hidden" name="sccp_deviceid" value="'.$dev_id.'">';
|
||||
}
|
||||
if (empty($dev_id)) {
|
||||
echo $this->showGroup('sccp_hw_sip_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_sip_conf', 1, 'sccp_hw', $def_val);
|
||||
// echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val);
|
||||
// echo $this->showGroup('sccp_hw_dev_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>
|
||||
|
|
@ -6,53 +6,51 @@
|
|||
* and open the template in the editor.
|
||||
*/
|
||||
$forminfo =array(
|
||||
array("name" => "dev_buttons", 'label' =>"Buttons Configuration"),
|
||||
array("name" => "button", 'label'=>"Buttons ", 'help' => "help.")
|
||||
array('name'=>'dev_buttons', 'label'=>'Buttons Configuration'),
|
||||
array('name'=>'button', 'label'=>'Buttons', 'help'=>'help')
|
||||
);
|
||||
//$buttons_type= array("empty","line","service","feature","speeddial");
|
||||
// "feature","service" -- Add leter !
|
||||
$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line");
|
||||
$feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status");
|
||||
/*
|
||||
button = feature,PDefault,ParkingLot,default,RetrieveSingle
|
||||
feature,P.slot,parkinglot,P.slot,
|
||||
|
||||
*/
|
||||
if ($_REQUEST['tech_hardware'] === 'cisco') {
|
||||
$lines_list = $this->dbinterface->getSccpDeviceTableData('SccpExtension');
|
||||
} else {
|
||||
$lines_list = $this->dbinterface->getSipTableData('extensionList');
|
||||
}
|
||||
|
||||
$lines_list = $this->dbinterface->HWextension_db_SccpTableData('SccpExtension');
|
||||
//$hint_list = $this->dbinterface->HWextension_db_SccpTableData('SccpExtension');
|
||||
$hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
|
||||
|
||||
// print_r($hint_list);
|
||||
$line_id =0;
|
||||
$max_buttons =56;
|
||||
$max_buttons =56; //Don't know hardware type so set a maximum. On save, this is set to actual max buttons
|
||||
$show_buttons =1;
|
||||
//print_r($hint_list);
|
||||
|
||||
if (!empty($_REQUEST['id'])) {
|
||||
$dev_id = $_REQUEST['id'];
|
||||
$db_buttons = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_buttons', array("id" => $dev_id));
|
||||
$db_device = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_byid', array("id" => $dev_id));
|
||||
$max_buttons = $db_device['buttons'];
|
||||
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array("id" => $dev_id));
|
||||
$db_device = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $dev_id));
|
||||
$show_buttons = $db_device['buttons'];
|
||||
if (!empty($db_device['addon_buttons'])) {
|
||||
$max_buttons += $db_device['addon_buttons'];
|
||||
$show_buttons += $db_device['addon_buttons'];
|
||||
}
|
||||
$show_buttons = $max_buttons;
|
||||
//$show_buttons = $max_buttons;
|
||||
}
|
||||
if (!empty($_REQUEST['new_id'])) {
|
||||
$val = $_REQUEST['type'];
|
||||
$dev_schema = $this-> getSccpModelInformation('byid', false, "all", array('model' =>$val));
|
||||
// $db_device = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_byid', array("id" => $val));
|
||||
$max_buttons = $dev_schema[0]['buttons'];
|
||||
// $db_device = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_byid', array("id" => $val));
|
||||
$show_buttons = $dev_schema[0]['buttons'];
|
||||
if (!empty($_REQUEST['addon'])) {
|
||||
$val = $_REQUEST['addon'];
|
||||
$dev_schema = $this-> getSccpModelInformation('byid', false, "all", array('model' =>$val));
|
||||
$max_buttons += $dev_schema[0]['buttons'];
|
||||
$show_buttons += $dev_schema[0]['buttons'];
|
||||
}
|
||||
$show_buttons = $max_buttons;
|
||||
//$show_buttons = $max_buttons;
|
||||
}
|
||||
if (!empty($_REQUEST['ru_id'])) {
|
||||
$dev_id = $_REQUEST['ru_id'];
|
||||
$db_buttons = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_buttons', array("id" => $dev_id));
|
||||
$db_buttons = $this->dbinterface->getSccpDeviceTableData('get_sccpdevice_buttons', array("id" => $dev_id));
|
||||
$show_buttons = $max_buttons;
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +59,9 @@ if (!empty($_REQUEST['ru_id'])) {
|
|||
<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="Submit" value="Submit">
|
||||
<input type="hidden" name="buttonscount" value="<?php echo $max_buttons?>">
|
||||
<input type="hidden" name="buttonscount" id="buttonscount" value="<?php echo $show_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'];?>">
|
||||
<h3><i class="fa fa-minus"></i><?php echo _($forminfo[0]['label']) ?></h3>
|
||||
</div>
|
||||
|
|
@ -90,8 +90,7 @@ if (!empty($_REQUEST['ru_id'])) {
|
|||
|
||||
</div></div>
|
||||
<?php
|
||||
for ($line_id = 0; $line_id <=$max_buttons; $line_id ++) {
|
||||
// print_r($db_buttons[$line_id]);
|
||||
for ($line_id = 0; $line_id <$max_buttons; $line_id ++) {
|
||||
$show_form_mode = '';
|
||||
$defaul_tv = (empty($db_buttons[$line_id])) ? "empty": $db_buttons[$line_id]['buttontype'];
|
||||
$defaul_btn = (empty($db_buttons[$line_id])) ? "": $db_buttons[$line_id]['name'];
|
||||
|
|
@ -143,13 +142,9 @@ if (!empty($_REQUEST['ru_id'])) {
|
|||
}
|
||||
}
|
||||
}
|
||||
// print_r($def_hint_btn);
|
||||
// print_r($defaul_opt);
|
||||
|
||||
echo '<!-- Begin button :'.$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">
|
||||
|
|
@ -159,7 +154,7 @@ if (!empty($_REQUEST['ru_id'])) {
|
|||
<div class="col-sm-5">
|
||||
<div class="col-xs-3">
|
||||
<!-- 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 buttontype" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_type';?>">
|
||||
<?php
|
||||
if ($line_id == 0) {
|
||||
echo '<option value="line" selected >DEF LINE</option>';
|
||||
|
|
@ -183,10 +178,10 @@ if (!empty($_REQUEST['ru_id'])) {
|
|||
?>
|
||||
</select>
|
||||
<!-- 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';?>" >
|
||||
<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';?>">
|
||||
<?php
|
||||
foreach ($lines_list as $data) {
|
||||
$select = (($data['name']==$defaul_btn)?"selected":"");
|
||||
$select = (($data['name']==$defaul_btn)?'selected="selected"':"");
|
||||
echo '<option value="'.$data['name'].'" '.$select.' >'.$data['name'].' / '.$data['label'].'</option>';
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,262 +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.
|
||||
*/
|
||||
$forminfo =array(
|
||||
array('name'=>'dev_buttons','label'=>'Buttons Configuration'),
|
||||
array('name'=>'button','label'=>'Buttons','help'=>'help')
|
||||
);
|
||||
//$buttons_type= array("empty","line","service","feature","speeddial");
|
||||
// "feature","service" -- Add leter !
|
||||
//$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line");
|
||||
$buttons_type= array('empty','line','speeddial');
|
||||
$feature_list= array('parkinglot'=>'Park Slots','monitor'=> 'Record Calls','devstate'=> 'Change Status');
|
||||
|
||||
//$lines_list = $this->dbinterface->HWextension_db_SccpTableData('SccpExtension');
|
||||
$lines_list = $this->sipconfigs->get_db_sip_TableData('Device');
|
||||
//$hint_list = $this->dbinterface->HWextension_db_SccpTableData('SccpExtension');
|
||||
$hint_list = $this->getHintInformation(true, array('context'=>'park-hints')) ;
|
||||
|
||||
// print_r($lines_list);
|
||||
$line_id =0;
|
||||
$max_buttons =56;
|
||||
$show_buttons =1;
|
||||
//print_r($hint_list);
|
||||
if (!empty($_REQUEST['id'])) {
|
||||
$dev_id = $_REQUEST['id'];
|
||||
$db_buttons = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_buttons', array('id' => $dev_id));
|
||||
$db_device = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_byid', array('id' => $dev_id));
|
||||
$max_buttons = $db_device['buttons'];
|
||||
if (!empty($db_device['addon_buttons'])) {
|
||||
$max_buttons += $db_device['addon_buttons'];
|
||||
}
|
||||
$show_buttons = $max_buttons;
|
||||
}
|
||||
if (!empty($_REQUEST['new_id'])) {
|
||||
$val = $_REQUEST['type'];
|
||||
$dev_schema = $this-> getSccpModelInformation('byid', false, 'all', array('model' =>$val));
|
||||
// $db_device = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_byid', array("id" => $val));
|
||||
$max_buttons = $dev_schema[0]['buttons'];
|
||||
if (!empty($_REQUEST['addon'])) {
|
||||
$val = $_REQUEST['addon'];
|
||||
$dev_schema = $this-> getSccpModelInformation('byid', false, 'all', array('model' =>$val));
|
||||
$max_buttons += $dev_schema[0]['buttons'];
|
||||
}
|
||||
$show_buttons = $max_buttons;
|
||||
}
|
||||
if (!empty($_REQUEST['ru_id'])) {
|
||||
$dev_id = $_REQUEST['ru_id'];
|
||||
$db_buttons = $this->dbinterface->HWextension_db_SccpTableData('get_sccpdevice_buttons', array('id' => $dev_id));
|
||||
$show_buttons = $max_buttons;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<form autocomplete="off" name="frm_editbuttons" id="frm_editbuttons" class="fpbx-submit" action="" method="post" data-id="hw_sedit">
|
||||
<input type="hidden" name="category" value="frm_editbuttons">
|
||||
<input type="hidden" name="Submit" value="Submit">
|
||||
<input type="hidden" name="buttonscount" value="<?php echo $max_buttons?>">
|
||||
<div class="section-title" data-for="<?php echo $forminfo[0]['name'];?>">
|
||||
<h3><i class="fa fa-minus"></i><?php echo _($forminfo[0]['label']) ?></h3>
|
||||
</div>
|
||||
<div class="section" data-id="<?php echo $forminfo[0]['name'];?>">
|
||||
<div class="row"> <div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
<label class="control-label">Help</label>
|
||||
<i class="fa fa-question-circle fpbx-help-icon" data-for="frmbuttons"></i>
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<span id="frmbuttons-help" class="help-block fpbx-help-block"><?php echo _("buttons come in the following flavours: <br>
|
||||
<ul>
|
||||
<li>empty: Empty button (no options)</li>
|
||||
<li>line: Registers the line with identifier specified as [name]</li>
|
||||
<li>silent: buttons equal 'Line' with out ring</li>
|
||||
<li>monitor: buttons mode speeddial + show status</li>
|
||||
<li>speeddial: Adds a speeddial with label [name] and [option1] as number Optionally, [option2] can be used to specify a hint by extension@context as usual.</li>
|
||||
<li>service (not implemented): Adds a service url Feature buttons have an on/off status represented on the device with a tick-box and can be used to set the device in a particular state. Currently Possible [option1],[option2] combinations:</li>
|
||||
<ul>
|
||||
<li>privacy,callpresent = Make a private call, number is suppressed</li><li>privacy,hint = Make a private call, hint is suppressed</li><li>cfwdall,number = Forward all calls </li><li>cfwbusy,number = Forward on busy</li><li>
|
||||
cfwnoaswer,number = Forward on no-answer (not implemented yet)<br> DND,busy = Do-not-disturb, return Busy signal to Caller <br> DND,silent = Do-not-disturb, return nothing to caller <br>
|
||||
monitor = Record Calls using AutoMon (asterisk 1.6.x only)</li><li>devstate,custom_devstate = Device State Feature Button (asterisk 1.6.1 and up). custom_devstate is the name of the custom devicestate to be toggled (How to use devicestate)
|
||||
hold = To be implemented</li><li>transfer = To be implemented</li><li>multiblink = To be implemented</li><li>mobility = To be implemented</li><li>conference = To be implemented</li>
|
||||
</ui></ui>");?></span>
|
||||
</div>
|
||||
|
||||
</div></div>
|
||||
<?php
|
||||
for ($line_id = 0; $line_id <=$max_buttons; $line_id ++) {
|
||||
// print_r($db_buttons[$line_id]);
|
||||
$show_form_mode = '';
|
||||
$defaul_tv = (empty($db_buttons[$line_id])) ? 'empty': $db_buttons[$line_id]['buttontype'];
|
||||
$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']);
|
||||
|
||||
$show_form_mode = $defaul_tv;
|
||||
$def_hint = ''; // Hint check Box
|
||||
$def_hint_btn = ''; // Hint Combo Box
|
||||
$def_silent = '';
|
||||
$defaul_advline = '';
|
||||
if (strpos($defaul_btn, '@') >0) {
|
||||
$defaul_tv = 'adv.line';
|
||||
$show_form_mode = 'adv.line';
|
||||
$defaul_btn = strtok($defaul_btn, '@');
|
||||
$defaul_advline = strtok('@');
|
||||
}
|
||||
if ($line_id == 0) {
|
||||
$show_form_mode = 'line';
|
||||
}
|
||||
if (stripos($defaul_btn, '!') >0) {
|
||||
$defaul_btn = strtok($defaul_btn, '!');
|
||||
$defaul_tv = 'silent';
|
||||
$def_silent = 'checked';
|
||||
}
|
||||
if ($defaul_tv == "feature") {
|
||||
$defaul_ftr = $defaul_opt[0];
|
||||
$defaul_fcod = (empty($defaul_opt[1])) ? '': $defaul_opt[1];
|
||||
// print_r($defaul_fcod);
|
||||
}
|
||||
|
||||
foreach ($defaul_opt as $data_i) {
|
||||
if (strpos($data_i, '@')>0) {
|
||||
$test_btn = strtok($data_i, '@');
|
||||
$def_hint = 'checked';
|
||||
$defaul_btn = $data_i;
|
||||
$def_hint_btn = $data_i;
|
||||
if ($test_btn == $defaul_opt[0]) {
|
||||
foreach ($lines_list as $data) {
|
||||
if ($data['id']==$test_btn) {
|
||||
$show_form_mode = 'line';
|
||||
$defaul_tv = 'monitor';
|
||||
$defaul_btn = $test_btn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// print_r($def_hint_btn);
|
||||
// print_r($defaul_opt);
|
||||
|
||||
echo '<!-- Begin button :'.$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="col-sm-2">
|
||||
<label class="control-label" for="<?php echo $forminfo[1]['name'].$line_id; ?> "><?php echo _($forminfo[1]['label'].$line_id).(($line_id =="0")?' Default ':''); ?></label>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<div class="col-xs-3">
|
||||
<!-- Line Type Select -->
|
||||
<select class="form-control buttontype" data-id="<?php echo $line_id;?>" name="<?php echo $forminfo[1]['name'].$line_id.'_type';?>" >
|
||||
<?php
|
||||
if ($line_id == 0) {
|
||||
echo '<option value="line" selected >DEF LINE</option>';
|
||||
} else {
|
||||
foreach ($buttons_type as $data) {
|
||||
$select = (($data == $defaul_tv)?"selected":"");
|
||||
echo '<option value="'.$data.'" '.$select.' >'.$data.'</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<!-- if Line Type = feature Show Futures -->
|
||||
<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';?>" >
|
||||
<?php
|
||||
foreach ($feature_list as $fkey => $fval) {
|
||||
$select = (($fkey == $defaul_ftr)?"selected":"");
|
||||
echo '<option value="'.$fkey.'" '.$select.' >'.$fval.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<!-- 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';?>" >
|
||||
<?php
|
||||
foreach ($lines_list as $data) {
|
||||
$select = (($data['id']==$defaul_btn)?"selected":"");
|
||||
echo '<option value="'.$data['id'].'" '.$select.' >'.$data['id'].' / '.$data['callerid'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<!-- if Line Type = Othe Show Input -->
|
||||
<div data-type='speeddial' class="lineid_<?php echo $line_id.(($show_form_mode=='speeddial')? '':' hidden');?>" >
|
||||
<?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'].'" >';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<!-- 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';?>">
|
||||
<?php
|
||||
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 '</div><div class="col-xs-2 radioset" data-toggle="buttons">';
|
||||
echo '<input class="form-control" type="checkbox" name="'.$forminfo[1]['name'].$line_id.'_hint" id="'.$forminfo[1]['name'].$line_id.'_hint" '.$def_hint.' value= "hint">';
|
||||
echo '<label for="'.$forminfo[1]['name'].$line_id.'_hint">hints</label>';
|
||||
echo '</div><div class="col-xs-5">';
|
||||
|
||||
echo '<select class="form-control" name="'.$forminfo[1]['name'].$line_id.'_hline" >';
|
||||
|
||||
foreach ($hint_list as $data) {
|
||||
$select = (($data['key']==$def_hint_btn)?"selected":"");
|
||||
echo '<option value="'.$data['key'].'" '.$select.' >'.$data['exten'].' / '.$data['label'].'</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
echo '</div>';
|
||||
?>
|
||||
</div>
|
||||
<!-- if Line Type = feature Show Futures Park -->
|
||||
<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">
|
||||
<?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'].'" >';
|
||||
?>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<?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.'" >';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 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="col-xs-5">
|
||||
<?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.'" >';
|
||||
?>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<?php
|
||||
echo '<input class="form-control" type="text" id="'.$forminfo[1]['name'].$line_id.'_advopt" name="'.$forminfo[1]['name'].$line_id.'_advopt" placeholder="ButtonLabel,Options" value="'.$db_buttons[$line_id]['options'].'" >';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div></div>
|
||||
</div>
|
||||
<?php
|
||||
echo '<!-- End button :'.$line_id.' -->';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<div class="section-butom" data-for="<?php echo $forminfo[0]['name'];?>">
|
||||
<h3></h3>
|
||||
</div>
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
<div class="element-container"> <div class="row"> <div class="form-group">
|
||||
<div class="col-md-3"> <label class="control-label" for="ERROR">Error Load form config </label>
|
||||
<div class="col-md-3"> <label class="control-label" for="ERROR">Error loadinging form configuration </label>
|
||||
<i class="fa fa-question-circle fpbx-help-icon" data-for="ERROR"></i>
|
||||
</div></div></div></div>
|
||||
|
||||
|
|
|
|||
113
views/formShowSysDefs.php
Normal file
113
views/formShowSysDefs.php
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<?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>';
|
||||
}
|
||||
?>
|
||||
85
views/getFileModal.html
Normal file
85
views/getFileModal.html
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<!--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">×</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-->
|
||||
|
|
@ -18,18 +18,15 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
|
|||
<div class="display no-border">
|
||||
<h1><?php echo _("Extensions (Line)") ?></h1>
|
||||
<div id="toolbar-sccp-extension">
|
||||
<a class="btn btn-default" href="config.php?display=extensions&tech_hardware=sccp_custom"><i class="fa fa-plus"> </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>
|
||||
<a class="btn btn-default" href="config.php?display=extensions&tech_hardware=sccp_custom"><i class="fa fa-plus"> </i><?php echo _("Add Extension") ?></a>
|
||||
</div>
|
||||
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&command=getExtensionGrid&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">
|
||||
<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">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th data-checkbox="true"></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="line_statustext"><?php echo _('Status') ?></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>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<div class="display no-border">
|
||||
<h1><?php echo _("Device SCCP Phone") ?></h1>
|
||||
<div id="toolbar-sccp-phone">
|
||||
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco"><i class="fa fa-plus"> </i><?php echo _("Add Device Phone") ?></a>
|
||||
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco"><i class="fa fa-plus"> </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>
|
||||
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
|
||||
</button>
|
||||
|
|
@ -31,12 +31,15 @@
|
|||
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Token Device') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp" 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="mac">
|
||||
<table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp"
|
||||
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>
|
||||
<tr>
|
||||
<th data-checkbox="true"></th>
|
||||
<th data-sortable="true" data-field="mac"><?php echo _('Device SEP ID') ?></th>
|
||||
<th data-sortable="true" data-field="description"><?php echo _('Device Descriptions') ?></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>
|
||||
|
|
@ -78,8 +81,7 @@
|
|||
exp_model += '</a> <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 --';
|
||||
|
|
|
|||
|
|
@ -1,23 +1,33 @@
|
|||
<div id="toolbar-sccpbnav">
|
||||
<a href="config.php?display=sccp_phone#sccpdevice" class = "btn btn-default"><i class="fa fa-list"></i> <?php echo _("List Device")?></a>
|
||||
<a href="config.php?display=sccp_phone&tech_hardware=cisco" class = "btn btn-default"><i class="fa fa-plus"></i> <?php echo _("Add Device")?></a>
|
||||
<div id="toolbar-sccp-rnav">
|
||||
<a class="btn btn-default" href="config.php?display=sccp_phone#sccpdevice">
|
||||
<i class="fa fa-list"></i>
|
||||
<?php echo _("List Device")?>
|
||||
</a>
|
||||
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco">
|
||||
<i class="fa fa-plus"> </i>
|
||||
<?php echo _("Add Device")?>
|
||||
</a>
|
||||
</div>
|
||||
<table id="sccpnavgrid"
|
||||
data-search="true"
|
||||
data-toolbar="#toolbar-sccpnav"
|
||||
data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp"
|
||||
data-toolbar="#toolbar-sccp-rnav"
|
||||
data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp"
|
||||
data-cache="false"
|
||||
data-toggle="table"
|
||||
class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<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="name"><?php echo _('SEP ID')?></th>
|
||||
<th data-sortable="true" data-field="description"><?php echo _('Descriptions')?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$("#sccpnavgrid").on('click-row.bs.table',function(e,row,elem){
|
||||
window.location = '?display=sccp_phone&tech_hardware=cisco&id='+row['mac'];
|
||||
if (row['new_hw'] == 'Y' ) {
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
* and open the template in the editor.
|
||||
*/
|
||||
// vim: set ai ts=4 sw=4 ft=phtml:
|
||||
|
||||
?>
|
||||
|
||||
<div class="fpbx-container container-fluid">
|
||||
|
|
@ -14,23 +13,23 @@
|
|||
<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"> </i><?php echo _("Add Device Phone") ?></a>
|
||||
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco-sip"><i class="fa fa-plus"> </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_sccp_sphone_xml" class="btn sccp_update btn-default" data-id="create-cnf">
|
||||
<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>
|
||||
<button name="reset_sccp_sphone" class="btn sccp_update btn-default" data-id="reset_dev">
|
||||
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Device') ?></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="mac">
|
||||
<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="mac"><?php echo _('Device SEP ID') ?></th>
|
||||
<th data-sortable="true" data-field="description"><?php echo _('Device Descriptions') ?></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>
|
||||
|
|
@ -45,6 +44,21 @@
|
|||
</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") {
|
||||
|
|
@ -59,21 +73,8 @@
|
|||
exp_model += '</a> <a class="btn-item-delete" data-for="hardware" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
|
||||
}
|
||||
return exp_model;
|
||||
}
|
||||
|
||||
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 LineFormatterS(value, row, index) {
|
||||
function LineFormatter(value, row, index) {
|
||||
if (value === null) {
|
||||
return '-- EMPTY --';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,12 @@
|
|||
|
||||
<?php
|
||||
|
||||
// originally, this was populated by sccpgeneral.xml but that should be static
|
||||
// now will populate from the db defaults.
|
||||
$defaultVals = $this->getTableDefaults('sccpdevice', true);
|
||||
|
||||
echo $this->showGroup('sccp_srst', 1);
|
||||
echo $this->showGroup('sccp_advant', 1);
|
||||
// echo $this->showGroup('sccp_dev_time',1);
|
||||
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'sccpdevice', $defaultVals);
|
||||
|
||||
?>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -6,39 +6,19 @@
|
|||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
|
||||
$def_val = null;
|
||||
$dev_id = null;
|
||||
$sccp_codec = $this->getCodecs('audio', true);
|
||||
$video_codecs = $this->getCodecs('video', true);
|
||||
$sccp_disalow_def = $this->extconfigs->getextConfig('sccpDefaults', 'disallow');
|
||||
$sccp_disalow = $sccp_disalow_def;
|
||||
$audio_codecs = $this->getCodecs('audio');
|
||||
$video_codecs = $this->getCodecs('video');
|
||||
$sccp_disallow_def = $this->sccpvalues['disallow']['data'];
|
||||
$sys_disallow_def = $this->sccpvalues['disallow']['systemdefault'];
|
||||
|
||||
if (!empty($_REQUEST['id'])) {
|
||||
$dev_id = $_REQUEST['id'];
|
||||
$db_res = $this->dbinterface->HWextension_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;
|
||||
if (empty($sccp_disallow_def)) {
|
||||
$sccp_disallow_def = $sys_disallow_def;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- TODO: Codec selection has moved to the line level in newer chan-sccp versions and should be moved -->
|
||||
<!-- 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">
|
||||
<input type="hidden" name="category" value="codecform">
|
||||
<input type="hidden" name="Submit" value="Submit">
|
||||
|
|
@ -55,8 +35,8 @@ if (!empty($_REQUEST['id'])) {
|
|||
<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_disalow ?>">
|
||||
<label for="sccp_disallow"><?php echo _("default : " . $sccp_disalow_def) ?></label>
|
||||
<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>
|
||||
|
|
@ -64,7 +44,7 @@ if (!empty($_REQUEST['id'])) {
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<span id="sccp_disallow-help" class="help-block fpbx-help-block"><?php echo _("Default : all. Please enter format: alaw,ulaw,...") ?></span>
|
||||
<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>
|
||||
|
|
@ -89,20 +69,25 @@ if (!empty($_REQUEST['id'])) {
|
|||
</div>
|
||||
<div class="col-md-9">
|
||||
<div>
|
||||
<?php echo show_help(_("This is the default Codec setting for SCCP Device.")) ?>
|
||||
<?php echo show_help(_("These are the default audio codec settings for this site. Unchecked codecs cannot be assigned to extensions.
|
||||
<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>
|
||||
<?php
|
||||
$seq = 1;
|
||||
|
||||
echo '<ul class="sortable">';
|
||||
foreach ($codec_list as $codec => $codec_state) {
|
||||
foreach ($audio_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="voicecodecs[' . $codec . ']" '
|
||||
. 'name="audiocodecs[' . $codec . ']" '
|
||||
. 'id="' . $codec . '" '
|
||||
. 'class="audio-codecs" '
|
||||
. $codec_checked
|
||||
|
|
@ -140,12 +125,13 @@ if (!empty($_REQUEST['id'])) {
|
|||
</div>
|
||||
<div class="col-md-9">
|
||||
<div>
|
||||
<?php echo show_help(_("This is the default Codec setting for SCCP Device.")) ?>
|
||||
<?php echo show_help(_("These are the default video codec settings for this site.")) ?>
|
||||
</div>
|
||||
<?php
|
||||
$seq = 1;
|
||||
|
||||
echo '<ul class="sortable">';
|
||||
// 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' : '';
|
||||
|
|
@ -153,9 +139,9 @@ if (!empty($_REQUEST['id'])) {
|
|||
. '<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="voicecodecs[' . $codec . ']" '
|
||||
. 'name="audiocodecs[' . $codec . ']" '
|
||||
. 'id="' . $codec . '" '
|
||||
. 'class="audio-codecs" '
|
||||
. 'class="video-codecs" '
|
||||
. $codec_checked
|
||||
. ' />'
|
||||
. ' <label for="' . $codec . '"> '
|
||||
|
|
|
|||
|
|
@ -10,12 +10,24 @@
|
|||
<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="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
|
||||
|
||||
$def_val_line = $this->getTableDefaults('sccpline');
|
||||
$def_val_device = $this->getTableDefaults('sccpdevice');
|
||||
|
||||
//echo $this->showGroup('sccp_dev_config', 1, 'sccpdevice', $def_val_device);
|
||||
echo $this->showGroup('sccp_dev_config', 1);
|
||||
echo $this->showGroup('sccp_dev_group_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>
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@
|
|||
|
||||
$test_ami = 0;
|
||||
$test_any = 0;
|
||||
global $amp_conf;
|
||||
|
||||
$driver = $this->FreePBX->Core->getAllDriversInfo();
|
||||
$core = $this->srvinterface->getSCCPVersion();
|
||||
$ast_realtime = $this->srvinterface->sccp_realtime_status();
|
||||
$core = $this->aminterface->getSCCPVersion();
|
||||
$ast_realtime = $this->aminterface->getRealTimeStatus();
|
||||
|
||||
//$ast_realm = (empty($ast_realtime['sccp']) ? '' : 'sccp');
|
||||
|
||||
|
|
@ -26,33 +27,61 @@ foreach ($ast_realtime as $key => $value) {
|
|||
$conf_realtime = $this->extconfigs->validate_RealTime($ast_realm);
|
||||
$db_Schema = $this->dbinterface->validate();
|
||||
$mysql_info = $this->dbinterface->get_db_sysvalues();
|
||||
$compatible = $this->srvinterface->get_compatible_sccp();
|
||||
$compatible = $this->aminterface->get_compatible_sccp();
|
||||
$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['dbinterface'] = $this->dbinterface->info();
|
||||
$info['aminterface'] = $this->aminterface->info();
|
||||
$info['XML'] = $this->xmlinterface->info();
|
||||
$info['sccp_class'] = $driver['sccp'];
|
||||
$info['Core_sccp'] = array('Version' => $core['Version'], 'about' => 'Sccp ver.' . $core['Version'] . ' r' . $core['vCode'] . ' Revision :' . $core['RevisionNum'] . ' Hash :' . $core['RevisionHash']);
|
||||
if (!$this->srvinterface->useAmiInterface) {
|
||||
$info['aminterface']['about'] .= ' -- Disabled';
|
||||
$info['Core_sccp'] = array('Version' => $core['Version'], 'about' => 'Sccp ver.' . $core['Version'] . ' r' . $core['vCode'] . ' Revision :' . $core['RevisionNum'] . ' Hash :' . $core['RevisionHash'] . ' ----Warning: Upgrade chan_sccp to use full ami functionality');
|
||||
}
|
||||
$info['Asterisk'] = array('Version' => FreePBX::Config()->get('ASTVERSION'), 'about' => 'Asterisk.');
|
||||
$info['Core_sccp'] = array('Version' => $core['Version'],
|
||||
'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.');
|
||||
|
||||
if (!empty($this->sccpvalues['SccpDBmodel'])) {
|
||||
$info['DB Model'] = array('Version' => $this->sccpvalues['SccpDBmodel']['data'], 'about' => 'SCCP DB Configure');
|
||||
}
|
||||
if (!empty($this->sccpvalues['tftp_rewrite'])) {
|
||||
if ($this->sccpvalues['tftp_rewrite']['data'] == 'pro') {
|
||||
$info['Provision_SCCP'] = array('Version' => 'base', 'about' => 'Provision Sccp enabled');
|
||||
} else {
|
||||
$info['TFTP_Rewrite'] = array('Version' => 'base', 'about' => 'Rewrite Supported');
|
||||
|
||||
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]);
|
||||
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');
|
||||
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 {
|
||||
$info['TFTP_Mapping'] = array('Version' => 'off', 'about' => "Mapping capability is not built into the TFTP server. To enable Provision, upgrade the TFTP server.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Finished testing tftp server options
|
||||
$info['Сompatible'] = array('Version' => $compatible, 'about' => 'Ok');
|
||||
if (!empty($this->sccpvalues['SccpDBmodel'])) {
|
||||
if ($compatible > $this->sccpvalues['SccpDBmodel']['data']) {
|
||||
|
|
@ -89,6 +118,8 @@ if (empty($ast_realtime)) {
|
|||
}
|
||||
// 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)) {
|
||||
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> Realtime configuration was not found</div>');
|
||||
|
|
@ -111,9 +142,9 @@ if ($mysql_info['Value'] <= '2000') {
|
|||
}
|
||||
|
||||
|
||||
// Check Time Zone comatable
|
||||
// Check Time Zone compatibility
|
||||
$conf_tz = $this->sccpvalues['ntp_timezone']['data'];
|
||||
$cisco_tz = $this->extconfigs->getextConfig('sccp_timezone', $conf_tz);
|
||||
$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));
|
||||
|
|
@ -124,333 +155,6 @@ if ($cisco_tz['offset'] == 0) {
|
|||
}
|
||||
}
|
||||
|
||||
global $amp_conf;
|
||||
|
||||
|
||||
if ($test_any == 1) {
|
||||
# Output option list, HTML.
|
||||
|
||||
$timezone_identifiers = DateTimeZone::listIdentifiers();
|
||||
$timezone_abbreviations = DateTimeZone::listAbbreviations();
|
||||
$a = DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC);
|
||||
|
||||
|
||||
$Ts_set = $a[200];
|
||||
|
||||
|
||||
// ************************************************************************************
|
||||
print_r("<br> Help Info:<br><pre>");
|
||||
print_r("<br>");
|
||||
//print_r(array_column($timezone_abbreviations, 'timezone_id'));
|
||||
print_r($Ts_set);
|
||||
$tz_tmp = array();
|
||||
|
||||
foreach ($timezone_abbreviations as $subArray) {
|
||||
$dddd = array_search($Ts_set, array_column($subArray, 'timezone_id'));
|
||||
if (!empty($dddd)) {
|
||||
$tz_tmp[] = $subArray[$dddd];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($tz_tmp)) {
|
||||
print_r('erroe');
|
||||
}
|
||||
if (count($tz_tmp)==1) {
|
||||
$time_set = $tz_tmp[0];
|
||||
} else {
|
||||
$tmp_dt = new DateTime(null, new DateTimeZone($Ts_set));
|
||||
$tmp_ofset = $tmp_dt->getOffset();
|
||||
foreach ($tz_tmp as $subArray) {
|
||||
if ($subArray['offset'] == $tmp_ofset) {
|
||||
$time_set = $subArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_r("<br>");
|
||||
//print_r($time_set);
|
||||
print_r($this->sccpvalues['ntp_timezone']);
|
||||
//print_r($tz_tmp);
|
||||
print_r("<br>");
|
||||
print_r("<br>");
|
||||
|
||||
print_r("<br>");
|
||||
//print_r($timezone_abbreviations);
|
||||
//print_r($timezone_identifiers);
|
||||
//print_r($timezone);
|
||||
//print_r($transitions);
|
||||
|
||||
|
||||
print_r("<br>");
|
||||
print_r("</pre>");
|
||||
// print_r("DIRECT START");
|
||||
// print_r($this->sccpvalues['ccm_address']);
|
||||
//print_r($this->get_php_classes('\\FreePBX\\modules'));
|
||||
// print_r(get_declared_classes());
|
||||
// $a = $this->aminterface->_config;
|
||||
// print_r($a);
|
||||
// print_r($this->aminterface->info());
|
||||
//print_r(get_declared_classes());
|
||||
// print_r($this->aminterface->open());
|
||||
// $time_start = microtime_float();
|
||||
// $this->aminterface->open();
|
||||
// $time_connect = microtime_float();
|
||||
// print_r($this->aminterface->send(new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowSoftkeySetsAction()));
|
||||
// $a = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowSoftkeySetsAction();
|
||||
// $a = new \FreePBX\modules\Sccp_manager\aminterface\ExtensionStateListAction();
|
||||
// $a = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDeviceAction('SEP00070E36555C');
|
||||
// $a = new \FreePBX\modules\Sccp_manager\aminterface\SCCPDeviceRestartAction('SEP00070E36555C');
|
||||
// $a = new \FreePBX\modules\Sccp_manager\aminterface\ReloadAction('chan_sccp');
|
||||
//$a = new \FreePBX\modules\Sccp_manager\aminterface\CommandAction('core show hints');
|
||||
/*
|
||||
$time_start = microtime_float();
|
||||
print_r($this->srvinterface->t_get_ami_data());
|
||||
$time_get_dl = microtime_float()-$time_start;
|
||||
print_r('<br> Delta :'); print_r($time_get_dl);
|
||||
$time_start = microtime_float();
|
||||
$tmp_data = $this->aminterface->sccp_get_active_device(); print_r($tmp_data);
|
||||
$time_get_dl = microtime_float()-$time_start;
|
||||
print_r('<br> Delta :'); print_r($time_get_dl);
|
||||
|
||||
die();
|
||||
|
||||
/*
|
||||
*/
|
||||
// $a = new \FreePBX\modules\Sccp_manager\aminterface\CommandAction('realtime mysql status');
|
||||
// $a = new \FreePBX\modules\Sccp_manager\aminterface\SCCPConfigMetaDataAction();
|
||||
// $response = $this->aminterface->send($a);
|
||||
//
|
||||
// $response = $this->aminterface->getRealTimeStatus();
|
||||
// $time_get_a = microtime_float();
|
||||
// print_r($response);
|
||||
// $tmp_data = $this->aminterface->core_sccp_reload();
|
||||
// print_r($tmp_data);
|
||||
// print_r($response -> getResult());
|
||||
// $events = $response->getEvents();
|
||||
// $events = $response->Events2Array();
|
||||
//
|
||||
// print_r($events);
|
||||
// print_r('--- RESULT A -----------------');
|
||||
// $b = $this->oldinterface->sccp_realtime_status();
|
||||
// print_r($b);
|
||||
// $b = $this->srvinterface->sccp_realtime_status();
|
||||
// print_r($response->getMessage());
|
||||
// print_r($a);
|
||||
// $events = $response ->getTableNames();
|
||||
// $events = $response->getEvents();
|
||||
// print_r($events);
|
||||
// $b = $response->Table2Array($events[0]);
|
||||
// $b = $response->getResult();
|
||||
// $b = $response->getResult();
|
||||
// print_r($b);
|
||||
// $time_get_ra = microtime_float();
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
// $tmp_data = $this->aminterface->sccp_get_active_device();
|
||||
// print_r($tmp_data);
|
||||
}
|
||||
|
||||
/* Test Ok
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($test_ami == 1) {
|
||||
$time_ami = 0;
|
||||
$time_old = 0;
|
||||
$test_info = array();
|
||||
$tmp_test_name = 'get_version';
|
||||
print_r('<br>-------------- OLD: ' . $tmp_test_name . '---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->oldinterface->get_compatible_sccp();
|
||||
print_r($tmp_data);
|
||||
$tmp_data = $this->oldinterface->getSCCPVersion();
|
||||
print_r($tmp_data);
|
||||
$tmp_data = $this->oldinterface->getChanSCCPVersion();
|
||||
print_r($tmp_data);
|
||||
$tmp_data = $this->oldinterface->sccp_realtime_status();
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
|
||||
$test_info[$tmp_test_name]['old'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
$time_get_start = $time_get_dl;
|
||||
|
||||
print_r('<br>-------------- AMI: ' . $tmp_test_name . ' ---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->srvinterface->get_compatible_sccp();
|
||||
print_r($tmp_data);
|
||||
print_r('<br>Not Use<br>');
|
||||
$tmp_data = $this->srvinterface->getChanSCCPVersion();
|
||||
print_r($tmp_data);
|
||||
$tmp_data = $this->srvinterface->sccp_realtime_status();
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['ami'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
|
||||
|
||||
$tmp_test_name = 'getdevice_info';
|
||||
print_r('<br>-------------- OLD: ' . $tmp_test_name . '---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->oldinterface->sccp_getdevice_info('SEP00070E36555C');
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['old'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
|
||||
print_r('<br>-------------- AMI: ' . $tmp_test_name . ' ---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->srvinterface->sccp_getdevice_info('SEP00070E36555C');
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['ami'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
|
||||
$tmp_test_name = 'get_active_device';
|
||||
print_r('<br>-------------- OLD: ' . $tmp_test_name . '---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->oldinterface->sccp_get_active_device();
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['old'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
|
||||
print_r('<br>-------------- AMI: ' . $tmp_test_name . ' ---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->aminterface->sccp_get_active_device();
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['ami'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
|
||||
$tmp_test_name = 'sccp_list_keysets';
|
||||
print_r('<br>-------------- OLD: ' . $tmp_test_name . '---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->oldinterface->sccp_list_keysets();
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['old'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
print_r('<br>-------------- AMI: ' . $tmp_test_name . ' ---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->aminterface->sccp_list_keysets();
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['ami'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
|
||||
$tmp_test_name = 'list_all_hints';
|
||||
print_r('<br>-------------- OLD: ' . $tmp_test_name . '---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->oldinterface->sccp_list_all_hints();
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['old'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
print_r('<br>-------------- AMI: ' . $tmp_test_name . ' ---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->aminterface->core_list_all_hints();
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['ami'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
|
||||
$tmp_test_name = 'sccp_list_hints';
|
||||
print_r('<br>-------------- OLD: ' . $tmp_test_name . '---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->oldinterface->sccp_list_hints();
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['old'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
print_r('<br>-------------- AMI: ' . $tmp_test_name . ' ---------------------------<br>');
|
||||
$time_get_start = microtime_float();
|
||||
$tmp_data = $this->aminterface->core_list_hints();
|
||||
print_r($tmp_data);
|
||||
$time_get_dl = microtime_float();
|
||||
$test_info[$tmp_test_name]['ami'] = $time_get_dl - $time_get_start;
|
||||
print_r('<br> Delta :');
|
||||
print_r($time_get_dl - $time_get_start);
|
||||
|
||||
print_r('<br>--- Stat -----------------<br>');
|
||||
|
||||
print_r('<div class="fpbx-container container-fluid"><div class="row"><div class="container"> <div class="table-responsive"><table class="table"><thead><tr><th>Function</th><th>Old Time</th><th> Ami Time</th></tr></thead><tbody>');
|
||||
$time_ami = 0;
|
||||
$time_old = 0;
|
||||
foreach ($test_info as $key => $value) {
|
||||
print_r('<tr><td>' . $key . '</td><td>' . $value['old'] . '</td><td>' . $value['ami'] . '</td></tr>');
|
||||
$time_ami += $value['ami'];
|
||||
$time_old += $value['old'];
|
||||
}
|
||||
print_r('</tbody></table></div></div></div></div>');
|
||||
print_r('<br>Ami Response :');
|
||||
print_r($time_ami);
|
||||
print_r('<br>PBX Response :');
|
||||
print_r($time_old);
|
||||
print_r('<br>--- Stat -----------------<br>');
|
||||
}
|
||||
/*
|
||||
*/
|
||||
|
||||
// $events = $response->getEvents();
|
||||
// print_r($events);
|
||||
//$b = $response->Table2Array($events[0]);
|
||||
//$b = $response->getResult();
|
||||
// print_r('--- RESULT 2 -----------------<br>');
|
||||
//print_r($events);
|
||||
// print_r($b);
|
||||
// $ser = serialize($response);
|
||||
// print_r($ser);
|
||||
// $result2 = unserialize($ser);
|
||||
// print_r($result2);
|
||||
/* $events = $result2->getEvents();
|
||||
$this->assertEquals($result2->getMessage(), 'Channels will follow');
|
||||
$this->assertEquals($events[0]->getName(), 'CoreShowChannelsComplete');
|
||||
$this->assertEquals($events[0]->getListItems(), 0);
|
||||
*/
|
||||
// print_r('--- RESULT 3 -----------------');
|
||||
// print_r($a);
|
||||
// print_r('--- С RESULT -----------------');
|
||||
// print_r($this->aminterface::SCCPShowDevicesAction());
|
||||
//
|
||||
// print_r($this->aminterface->close());
|
||||
//
|
||||
//
|
||||
//print_r($this->dbinterface->HWextension_db_SccpTableData('SccpExtension'));
|
||||
// print_r($this->srvinterface->getеtestChanSCC());
|
||||
// $test_data = $this->srvinterface-> astman_GetRaw('ExtensionStateList');
|
||||
// print_r($test_data);
|
||||
// print_r($this->srvinterface-> core_list_all_exten());
|
||||
// print_r($this->getHintInformation());
|
||||
// print_r($this->aminterface->open());
|
||||
// print_r($this->aminterface-> core_list_all_exten('exten'));
|
||||
// print_r($this->aminterface->Sok_param['total']);
|
||||
// print_r($this->srvinterface->t_get_meta_data());
|
||||
// print_r($this->sccp_metainfo);
|
||||
print(" ");
|
||||
/* */
|
||||
// ************************************************************************************
|
||||
// $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK');
|
||||
// print_r('<br>');
|
||||
// print_r(timezone_identifiers_list());
|
||||
// print_r('<br>');
|
||||
//print_r($this->dbinterface->info());
|
||||
|
||||
if (!empty($this->info_warning)) {
|
||||
?>
|
||||
<div class="fpbx-container container-fluid">
|
||||
|
|
@ -501,7 +205,7 @@ if (!empty($this->class_error)) {
|
|||
<div class="fpbx-container container-fluid">
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
<h2>Sccp Manager V.<?php print_r($this->sccp_manager_ver); ?> Info </h2>
|
||||
<h2>Sccp Manager v<?php print_r((string) $moduleXml->version); ?> Info </h2>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@
|
|||
</div>
|
||||
</div>
|
||||
<?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_net', 1);
|
||||
echo $this->showGroup('sccp_lang', 1);
|
||||
echo $this->showGroup('sccp_qos_config', 1);
|
||||
echo $this->showGroup('sccp_extpath_config', 1);
|
||||
|
||||
?>
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="gridSystemModalLabel_Net">Add New Network</h4>
|
||||
<h4 class="modal-title" id="gridSystemModalLabel_Net">Device</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
|
|
@ -56,4 +56,3 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
<input type="hidden" name="category" value=" deviceurlform">
|
||||
<input type="hidden" name="Submit" value="Submit">
|
||||
<?php
|
||||
echo $this->showGroup('sccp_dev_url', 1);
|
||||
echo $this->showGroup('sccp_dev_url', 1,);
|
||||
?>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in a new issue