Compare commits

..

598 commits

Author SHA1 Message Date
Diederik de Groot 5752d9f393
Revert previous change 2022-01-30 15:16:15 +01:00
Diederik de Groot b28ec36e20
Update cisco_language table
Note: I changed 'ISO8859-1' to 'ISO-8859-1', please check if this is php compatible before applying this PR.
2022-01-30 14:40:36 +01:00
steve-lad 9519f0243a
Update sccpManagerUpdater.json 2022-01-28 11:24:50 +01:00
stevenA f5e51a52b7 Resolve issue of softkeysets lost across installs 2022-01-28 11:14:34 +01:00
stevenA 4cf414e995 Fix issue where values with spaces are truncate
Need to quote value in html
Fix installer overwriting valid sccpdevmodel
2022-01-28 10:00:13 +01:00
stevenA fb66f0e239 Fix issue where values with spaces are truncated
value needs to be quoted
2022-01-28 09:51:02 +01:00
steve-lad 60e973b4a6
Update sccpManagerUpdater.json 2022-01-27 19:29:51 +01:00
steve-lad 2ea478c117
Update sccpManagerUpdater.json 2022-01-27 19:29:27 +01:00
steve-lad fbbbefb25e
Update module.xml 2022-01-27 19:26:14 +01:00
steve-lad e7bc2492ef
Update module.xml 2022-01-27 19:18:23 +01:00
steve-lad f7e13505e9
Update sccpManagerUpdater.json 2022-01-27 19:05:29 +01:00
stevenA b752640f81 Update ajaxHelper.php 2022-01-27 18:50:18 +01:00
steve-lad da62493384
Update sccpManagerUpdater.json 2022-01-27 12:20:04 +01:00
stevenA 722285bc3d Update version
Revert 1 line from backport from 16
2022-01-27 12:15:51 +01:00
stevenA 09acfd097d Fix Issue #32
Standardise handling of IED fields (net and ip addresses)
Correct writing to db (seq was assigned a new value which caused duplication in sccpsettings and apparent unsaved data)
Remove inherit button in device and standardise to inherit server settings. Show users what will be set.
2022-01-27 12:03:50 +01:00
stevenA bd84870c6b Close Issue #29
Added warning and additional info for Hotline.
2022-01-19 14:41:43 +01:00
stevenA 60777bf3e3 Fix saving of custom soft keysets
Red border if invalid set name
Clean up modal indenting
Define valid chars
Only initialise general section at each save (previously initialised all clearing soft key sets)
2022-01-19 13:46:47 +01:00
steve-lad 1c5fa400ae
Update sccpManagerUpdater.json 2022-01-19 12:22:08 +01:00
steve-lad a8e3dbdd30
Update module.xml 2022-01-19 12:17:05 +01:00
stevenA 381fe184bd Fix Issue #59
Correct error in update mode selection
Save all buttons, rather than to last empty - buttons do not need to be allocated sequentially
Remove on duplicate case - add should always be new as either device is new, or have deleted device data before.
2022-01-19 12:07:41 +01:00
stevenA e08ad858f5 Update module.xml 2022-01-19 10:06:24 +01:00
stevenA ddd10f3ca9 Update rewrite.rules
Add case for dialplan.xml
2022-01-19 09:55:14 +01:00
stevenA d7ad8397da Update ajaxHelper.php 2022-01-19 08:36:57 +01:00
stevenA 4e17791fa1 Change wincharset selection method
Use utf-8 for java based phones
2022-01-17 10:43:50 +01:00
steve-lad 5796297bae
Update sccpManagerUpdater.json 2022-01-16 16:34:52 +01:00
stevenA 546de5add1 Modify installer db calls to remove IF EXISTS
IF EXISTS is not correct in MariaDb v5, used in all FreePbx Packages.
2022-01-16 16:04:41 +01:00
steve-lad b1769e6378
Update sccpManagerUpdater.json 2022-01-15 10:55:44 +01:00
stevenA 360ceea6cd Upgrade Installer
Installer was dropping new 14.3 columns data as these columns did not exist in module.xml schema.
Modify schema to include all columns, including legacy columns, and then move data prior to modifying schema.
2022-01-15 10:48:36 +01:00
stevenA 0dec44161f Update module.xml 2022-01-13 13:09:05 +01:00
stevenA 6808154c3a Update xmlinterface.class.php
Return binary vendor config values when necessary
2022-01-13 13:08:34 +01:00
stevenA e25fab14ff Update module.xml 2022-01-13 11:42:29 +01:00
stevenA e088deee12 Update xmlinterface.class.php
Fix langcode selection
2022-01-13 11:34:12 +01:00
stevenA 8051c30987 Update module.xml 2022-01-13 10:28:40 +01:00
stevenA 5c4848442a Update rewrite.rules
Optional rules were not commented out causing phones to look in tftproot/firmware/firmware
2022-01-13 10:24:26 +01:00
steve-lad 24cc8be3a7
Update module.xml 2022-01-11 15:40:47 +01:00
steve-lad 4f468517e7
Add PHP dependancy 2022-01-11 15:25:06 +01:00
steve-lad c3089d6d7f
Update sccpManagerUpdater.json 2022-01-11 11:59:19 +01:00
steve-lad 12cb1307ba
Update sccpManagerUpdater.json 2022-01-10 14:08:03 +01:00
stevenA 3ce99c94d8 Fix reversion - not returning to correct page after save
Settings and device save require different r=treatment on reload after save
2022-01-10 14:00:07 +01:00
steve-lad 70b318019e
Update sccpManagerUpdater.json 2022-01-10 11:37:59 +01:00
stevenA 82bd9cbaef Update module.xml
Update version
2022-01-10 11:33:42 +01:00
stevenA 34d6e976f2 Fix minor issues when saving settings
Page was not reloading correctly
Devices were not restarting (returning too soon)
2022-01-10 11:31:26 +01:00
steve-lad 6681a07c96
Update sccpManagerUpdater.json 2022-01-09 13:11:05 +01:00
stevenA 8013474e75 Fix issue where selecting new device in rnav caused exception
Correct window.location redirect syntax
2022-01-09 13:05:35 +01:00
steve-lad 88f4fba2c0
Update README.md 2022-01-06 15:26:13 +01:00
steve-lad a8dfaac9bb
Update sccpManagerUpdater.json 2022-01-06 15:09:06 +01:00
stevenA 745ef87fea Merge branch 'develop' of https://github.com/chan-sccp/sccp_manager into develop 2022-01-06 15:00:35 +01:00
stevenA 048077fce8 Update SIP device Handling & Fix Issue#53
Fix Issue #53
Consolidate forms to facilitate maintenance, reduce code, and apply changes to SIP handling introduce for sccp
Delete form.addsdevice.php
Delete form.sbuttons.php
Delete sipconfigs class and move db functions to dbinterface class, and other function to helperfunctions
create new field type for SIP line
update 9951 buttons count in installer
simplify segregation of sip and sccp requests
2022-01-06 15:00:24 +01:00
steve-lad fa9f28aac3
Update sccpManagerUpdater.json 2022-01-04 14:48:16 +01:00
stevenA 1f73ade196 Fix Issue #54
Do not try to write SEP file if no line defined. Save settings and warn user via toast
Fix feedback to ajax by separately submitting data before return
Fix freepbx overwriting data and causing fail, by separating json into two blocks and only parsing the first
Fix return to tab on save (set location hash) when tabs changed in settings
Fix return to calling page on save when device updated
2022-01-04 14:41:43 +01:00
steve-lad 8c725874d7
Update sccpManagerUpdater.json 2022-01-02 15:02:04 +01:00
steve-lad b39983c690
Update module.xml 2022-01-02 14:58:38 +01:00
stevenA 8f91e2c6e6 Update sipconfigs.class.php 2022-01-02 14:24:47 +01:00
steve-lad 463ab79add
Update sccpManagerUpdater.json 2022-01-02 13:12:21 +01:00
stevenA 198b3fffa8 Update save SIP device
Fail if no valid FreePbx sip bindings available

Fix SIP display issue

Correct line protocol selection
2022-01-02 13:06:41 +01:00
stevenA 21f9123ece Update formcreate.class.php
Clean up form create
2022-01-01 16:37:17 +01:00
stevenA 3381ad189b Update formcreate.class.php
Clean up code
2022-01-01 16:28:36 +01:00
stevenA b9ca187d30 Update module.xml
Update develop version
2022-01-01 13:50:29 +01:00
stevenA 2d9a272589 Update xmlinterface.class.php
change phonePersonalization from camel
2022-01-01 13:47:03 +01:00
steve-lad a68ac219d3
Update sccpManagerUpdater.json 2022-01-01 12:53:26 +01:00
steve-lad 4833638c8e
Update module.xml 2022-01-01 12:48:15 +01:00
steve-lad ad698eb5c0
Update module.xml 2022-01-01 12:46:17 +01:00
steve-lad 6cf10cc13b
Merge pull request #52 from chan-sccp/Fix-Issue-#49
Fix Issue #49 and improve handling of edit defaults
2022-01-01 12:45:46 +01:00
stevenA 378d3b2ff7 Fix Issue #49 and improve handling of edit defaults
keepalive was on 2 pages, so the value was being written then overwritten

Improved handling of customise and restore javascript to ensure that if the option was subsequently unselected, the original value was retained
2022-01-01 12:44:02 +01:00
steve-lad 354e3a2f47
Update sccpManagerUpdater.json 2021-12-31 15:38:18 +01:00
steve-lad ce365acdf2
Merge pull request #51 from chan-sccp/Fix-Issue-#50
Fix issue #50
2021-12-31 15:34:45 +01:00
stevenA 84b65309a3 Update Version 2021-12-31 15:32:44 +01:00
stevenA 89b1a1cd3f Fix defaults for string settings
Hack to fix bindaddr / externip
2021-12-31 15:31:56 +01:00
stevenA 8953484e1f Fix reset of defaults for text fields
Still need to address bindaddress:port and externalIP: Name
2021-12-31 15:01:02 +01:00
stevenA 8268bbf81a Fix restore defaults for radio buttons
Fix restore defaults for radio buttons
2021-12-31 12:45:12 +01:00
steve-lad 10a0ddb123
Update sccpManagerUpdater.json 2021-12-30 15:40:57 +01:00
steve-lad 8d412ce4ae
Merge pull request #48 from chan-sccp/Fix-issue-#47
Fix issue #47 - Defaults toggling with repeated saves
2021-12-30 15:27:25 +01:00
steve-lad 61beae544e
Merge branch 'develop' into Fix-issue-#47 2021-12-30 15:27:15 +01:00
stevenA c473c62ada Fix issue #47 - Defaults toggling with repeated saves
Remove unused group from server.settings.php
Correct testing for use of system defaults
Correct application of system defaults
ToDo:Numeric values are not being saved, or do not revert to defaults when button clicked
2021-12-30 15:22:20 +01:00
steve-lad fe780283a8
Update sccpManagerUpdater.json 2021-12-30 11:01:29 +01:00
steve-lad 7d4c7c5e50
Merge pull request #46 from chan-sccp/Fix-Issue-#44-part-2
Fix writing settings to sccp.conf
2021-12-30 10:55:55 +01:00
stevenA f4aa2eda1c Fix writing settings to sccp.conf
Only write chan-sccp allowed settings to sccp.conf
Clean sccp.conf on install
Move createDefaultSccpConfig to traits so that can access from installer
tighten calls to createDefaultSccpConfig
2021-12-30 09:39:28 +01:00
steve-lad 03206f8384
Update sccpManagerUpdater.json 2021-12-29 12:50:53 +01:00
steve-lad c0e7a3bc0a
Update sccpManagerUpdater.json 2021-12-29 12:50:33 +01:00
steve-lad 9a6bff2d27
Merge pull request #45 from chan-sccp/Fix-Issue-#44
Fix dndFeature setting not saved
2021-12-29 12:45:03 +01:00
stevenA 0bc2eed76b Fix dndFeature setting not saved
dndFeature setting was not saved
check for existence of chan-sccp flags
add helper to list chan-sccp flags
fix version compatibility check
update version to 14.3.0.19
2021-12-29 12:42:57 +01:00
stevenA 1489968b9e Merge branch 'develop' of https://github.com/chan-sccp/sccp_manager into develop 2021-12-29 08:55:17 +01:00
stevenA 3737462fa7 replace vtmp_key 2021-12-29 08:55:09 +01:00
steve-lad 380a9a52f2
Update README.md 2021-12-28 16:27:34 +01:00
steve-lad eb73d61684
Update README.md 2021-12-28 16:26:35 +01:00
steve-lad bca54bddff
Update README.md 2021-12-28 16:25:52 +01:00
steve-lad 01a703f5cf
Update sccpManagerUpdater.json 2021-12-28 16:14:55 +01:00
steve-lad 90ebbd20f8
Update sccpManagerUpdater.json 2021-12-28 16:14:39 +01:00
stevenA 5586a896cb Update module.xml 2021-12-28 16:11:54 +01:00
steve-lad f8f447b89c
Merge pull request #43 from chan-sccp/Fix-issue-#42
Remove vendor config prefix when matching data in create SEP Xml
2021-12-28 16:07:02 +01:00
stevenA 64ab034443 Remove vendor config prefix when matching data in create SEP Xml
Vendor config data is no longer prefixed. Create xml was looking for a prefix and so no vendor config data was updated
2021-12-28 16:06:09 +01:00
stevenA 88409eb6c8 Change label on sccp connector
Change from default to legacy
2021-12-28 11:30:40 +01:00
steve-lad 9470072e7c
Update sccpManagerUpdater.json 2021-12-28 11:13:08 +01:00
steve-lad 00a83d65ca
Update sccpManagerUpdater.json 2021-12-28 11:12:44 +01:00
steve-lad 00781216d9
Update module.xml 2021-12-28 11:08:33 +01:00
stevenA a395120fac Change version number in Sccp Info
Use module.xml to get version
2021-12-28 10:56:49 +01:00
steve-lad c2fb5f4492 modify details for automatic updates 2021-12-27 12:18:59 +01:00
steve-lad ef944e37c3 test for automatic updating 2021-12-27 11:55:03 +01:00
steve-lad 2830dfeeb1
Merge pull request #41 from chan-sccp/Fix-issue-39
Fix issue 39
2021-12-27 11:11:53 +01:00
steve-lad a2217e6e37 Fix issue #39
Get masterFilesList at install direct from Provisioner. If not available, install a copy from the module
2021-12-27 11:09:42 +01:00
steve-lad 1b979222fa Create masterFilesStructure.xml
Add file to distro so that download from internet is not required
2021-12-26 16:01:58 +01:00
steve-lad 04738f0657 Version update
WIP - fix various vendor config settings.
2021-12-03 11:17:35 +01:00
steve-lad ec9d1cc720 Fix Vendor Config Labels
Labels were incorrect and non descriptive
2021-12-03 11:03:06 +01:00
steve-lad 2b90440df7
Update README.md 2021-11-27 14:22:47 +01:00
steve-lad aca38997c7
Update README.md 2021-11-27 14:21:17 +01:00
steve-lad 2e990783bb
Update README.md 2021-11-27 14:18:08 +01:00
steve-lad e69db63dd2
Update README.md 2021-11-27 14:16:37 +01:00
steve-lad c674fdea96
Merge pull request #37 from chan-sccp/v14.2
V14.2 Merge into develop
2021-11-27 14:13:35 +01:00
steve-lad 0d2bfdbecd
Merge branch 'develop' into v14.2 2021-11-27 14:12:55 +01:00
steve-lad 48ace0574a Force installer to update sccpdevmodel
Ensure changes in sccpdevmodel are implimented. Update number of burttons on 894X
2021-10-16 15:32:53 +02:00
steve-lad 5bd1455e91 Update version 2021-10-14 09:13:43 +02:00
steve-lad 67f2a8b2a3 Quote device name in xpath request
Xpath requires quotes if non numeric device name (eg 894x)
2021-10-14 09:12:57 +02:00
steve-lad 2dc613f063 Fix variable name
arr_data was mistyped
2021-09-21 10:35:10 +02:00
steve-lad 6e97ce5fde
Update README.md 2021-09-07 12:17:22 +02:00
steve-lad 2d39f838b6
Update README.md 2021-09-07 12:16:41 +02:00
steve-lad 3a9d422252
Update README.md 2021-09-07 12:13:31 +02:00
steve-lad a0d7c81738
Update README.md 2021-09-07 12:12:54 +02:00
Phantom 1a09d4df1e
Update README.ru.md
Russian page.
2021-09-02 13:22:55 +03:00
Phantom 63679cd49c
Create README.ru.md 2021-09-02 13:20:54 +03:00
steve-lad 8f6c7be74e Optimise handle submit
Change order of treatment of returned data
Handle db calls outside of loops
Optimise parsing
2021-08-15 13:07:36 +02:00
steve-lad 570171bce0 Remove chan-sccp (null) defaults 2021-08-13 08:05:41 +02:00
steve-lad 1bea598588 Increase length of netlang and devlang fields
Increased to 50 - 25 caused truncation of certain locales
2021-08-13 07:01:16 +02:00
steve-lad 43677651df Refinements to installer handling of sccpvalues 2021-08-10 11:52:17 +02:00
steve-lad c209932eb5 Get all chan-sccp settings
Prior only included general section - now get from all sections

Get all settings fields even if empty or SccpClass will raise an exception
2021-08-10 09:48:53 +02:00
steve-lad 3a1a89fdb8 Update Sccp.class.php.v433 2021-08-10 08:11:08 +02:00
steve-lad fbb61be0f1 Update Sccp.class.php.v433 2021-08-10 08:10:30 +02:00
steve-lad b7d5851643 Update helperFunctions.php 2021-08-10 08:06:36 +02:00
steve-lad 90729f74aa Update for compatibility with PHP 7.4
PHP 7.4 gives warnings that are handled as exceptions
2021-08-10 07:08:10 +02:00
steve-lad 031ef0087e Compatibility update 2021-08-09 13:56:18 +02:00
steve-lad 91d6ad2f48 Fix incompatibility with new Describe table 2021-08-09 09:23:00 +02:00
steve-lad 662e2a4aa3 Update file extensions list to include .SBN and .LOADS
Some firmware has upper case extensions
2021-08-09 06:56:38 +02:00
steve-lad a40c110efe Update Defaults and correct site defaults to comply with new enum values
Legacy values for site defaults in sccpsettings are now converted to be compliant with current enums, or reset to system defaults (cleared)
2021-08-08 14:30:48 +02:00
steve-lad 0b03d58c09 Remove debug code and update version 2021-08-08 09:57:36 +02:00
steve-lad 481c8929a9 Correct handling of device vendor settings
Prefix was incorrect following removal of _column names
2021-08-08 09:56:04 +02:00
steve-lad 8dc1175b37 Update installer to add parent extensions to sccpline if they exist
Previously ignored sccp extensions in freepbx devices and so created 'orphans'. Now create rows for sccpline for devices that already exist as sccp extensions in devices.

Remove dbug code
2021-08-08 09:03:05 +02:00
steve-lad b30340eab5 Update ajaxHelper.php 2021-08-07 16:07:18 +02:00
steve-lad 31e8a48e12 Add videomode select - dropped in earlier commit 2021-08-07 16:01:19 +02:00
steve-lad 0f352eeb59 Fix addition of new device when not in db
Partial fix for issue#29

Populate available fields
Optimise code
2021-08-07 11:03:33 +02:00
steve-lad 14215b64ca Finalise chan-sccp build info 2021-08-06 08:42:39 +02:00
steve-lad 6567923ff1 Add chan-sccp build info to Sccp Info 2021-08-06 08:24:53 +02:00
steve-lad b3fc62caa7 Update dbinterface.class.php 2021-08-04 13:22:42 +02:00
steve-lad f1cc0f1bf6 Remove IF EXISTS condition on rename
Know that the column exists so this is unnecessary and fails in MariaDb 5.5
2021-08-04 12:36:18 +02:00
steve-lad b133b2bc3a Change sccpdeviceconfig view create statement
Should not use ALGORITHM=MERGE when using GROUP BY
2021-08-04 10:55:26 +02:00
steve-lad 2c8842d21a Correct initialisation
res_conf is an array
2021-08-04 07:24:28 +02:00
steve-lad 6775b6686b Simplify getPhoneGrid 2021-08-01 14:54:17 +02:00
steve-lad 4ffcfaf6b7 Correct getExtensionGrid method and optimise
Was dropping last line
Logic was overly complicated; optimise as called frequently
2021-08-01 13:58:11 +02:00
steve-lad 74ddfcd413 Update Sccp_manager.class.php 2021-08-01 12:14:13 +02:00
steve-lad 7ab6eba556 Finalise optimisation of getSccpModelInformation
Use foreach with reference instead of iterator.
2021-08-01 12:13:49 +02:00
steve-lad 28bb5a63da Optimise validate part of getSccpModelInformation
Remove needless iterations and use array functions.
Use basename to remove file extension to facilitate this
2021-08-01 11:57:03 +02:00
steve-lad ab7b295b87 switch basedir path source
Use $amp_conf['AMPWEBROOT'] instead of $_SERVER['DOCUMENT_ROOT'] as at least in one case the latter appears to be empty
2021-07-31 17:07:37 +02:00
steve-lad d8d2f946ce Minor optimisations 2021-07-31 15:41:32 +02:00
steve-lad 43a656cebc Correct XML Path in installer and optimise findAllFiles
XML Path in installer was in single quotes - corrected
Remove unnecessary tests in findallfiles
2021-07-31 12:30:24 +02:00
steve-lad e313b9da3f Change pathname style from {} to .
Instability seen when pathnames with globals enclosed in {} - revert to . style pathnames
2021-07-30 22:43:35 +02:00
steve-lad 3ea36f5459 add keepalive 2021-07-30 14:39:15 +02:00
steve-lad b7a64e854f Update ajaxHelper.php 2021-07-30 14:05:59 +02:00
steve-lad e8cabfbd1a Improve parsing of firewall rules 2021-07-30 14:05:00 +02:00
steve-lad 1338336dd9 Add phonecodepage column to sccpdeviceconfig 2021-07-30 12:04:32 +02:00
steve-lad 49fd6a5c91
Merge pull request #30 from chan-sccp/issue/28
Device SEP ID
2021-07-30 11:54:02 +02:00
steve-lad d8287157bd Remove videomode field from sccplineconfig
Not recognised by chan-sccp
2021-07-30 11:23:13 +02:00
steve-lad 85e77ab34c Insert missing field in sccplineconfig view 2021-07-30 11:04:01 +02:00
steve-lad 40cace04e4 Increase granularity of backup name 2021-07-30 10:36:38 +02:00
steve-lad 97c1f6d5d4 Minor settings changes 2021-07-30 10:18:27 +02:00
steve-lad 60f7d74cf4 Update Sccp Info 2021-07-30 09:12:51 +02:00
steve-lad a267f075c8 include silent lines in extension view 2021-07-30 08:39:53 +02:00
steve-lad d432ff7a05 Ensure that addons cannot be added in edit on devices that do not have addons 2021-07-30 07:27:31 +02:00
steve-lad 472d73489e Update ajaxHelper.php 2021-07-29 17:21:18 +02:00
steve-lad fb25407611 Improve presentation of shared lines 2021-07-29 17:20:43 +02:00
steve-lad f2d15ebd5e Correct del extension to remove all associated buttons 2021-07-29 16:28:05 +02:00
steve-lad 1f910c7e97 Force entry of correct mac address before save is enabled
Move focus to Mac field and stay until a correct Mac address is entered, disabling Save buttons until correct

Motive: a device record with an empty Mac address requires manual removal.
2021-07-29 15:40:23 +02:00
steve-lad d43570b471 Enable addition of sidecars to an existing device 2021-07-29 13:50:31 +02:00
steve-lad b753482898 Correct defaults after db schema change 2021-07-29 08:43:40 +02:00
steve-lad 646a975a5f Update xmlinterface.class.php
Update locale cases for SIP phones
2021-07-29 08:26:11 +02:00
steve-lad 48a2793886 Add directed_pickup field
Previously shown but not updated
2021-07-29 08:05:33 +02:00
steve-lad b659f55170 Remove _ prefixes in db column names
Mariadb does not accept _prefixed fields by spec, and these columns may give future issues. Migrate all fields in installer to remove this prefix (without data loss) and:
Create new view sccplineconfig for chan-sccp where only accepted fields are shown
Update sccpdeviceconfig to only show accepted fields
Update extconfigs.conf to use sccplineconfig
Remove references to _ prefixed fields
2021-07-28 15:48:57 +02:00
steve-lad 4e9dcb09f3 Fix return link if default button changed 2021-07-25 16:03:02 +02:00
Diederik de Groot a1e52d01a4 Rename Device SEP ID to Device ID
Use "XX:XX:XX:XX:XX:XX" as the default display format for device MAC Address
References #28
2021-07-25 12:27:05 +00:00
steve-lad 26f750296a Fix various issues with buttons
Add choice of default line on add device
Partially fix buttoncount (will not work if default device is selected)
Correct database save logic for buttons - triggers should be OK but more verification needed
Fix various save issues where defaults not correctly set
Delete default buttons when deleting line to avoid orphans
2021-07-25 13:42:42 +02:00
steve-lad 80cf629c0f Update ajaxHelper.php 2021-07-24 09:39:57 +02:00
steve-lad 75858d7cc1 Optimise and add error handling to getFilesFromProvisioner 2021-07-24 09:31:30 +02:00
steve-lad 97cfa12fea Update rewrite.rules 2021-07-23 13:05:09 +02:00
steve-lad 312229d4cf Update rewrite.rules 2021-07-23 12:54:21 +02:00
steve-lad 83d54c0fad Update rewrite.rules 2021-07-23 12:40:30 +02:00
steve-lad 4a6caf1eac Remove update link
Currently FreePbx uses a post to get the dta which fails with GitHub. Disable link until fixed by freepbx
2021-07-23 12:22:29 +02:00
steve-lad 4151b4fdae Restructure languages and locales management
Base off of provision file structure
Store netlang and devlang
Stop usage of extconfig ->sccplang
2021-07-23 12:14:46 +02:00
steve-lad 215cacae41 Get Country tones with locales
Get country files with locales
WIP incompatibility between provision, its rewrite rules and the file structure
WIP - need to clean up get files from provisioner
2021-07-21 16:44:23 +02:00
steve-lad 3a53e9ac8b Optimise database calls
Remove unnecessary post processing on returned object
2021-07-21 12:54:05 +02:00
steve-lad 3475efc2c6 Database request modifications and page improvements
Add device to extensions page - permits to see unassigned  lines and shared lines easily
Reformat status to centred
change 'replace' in sccp class to only 'insert on duplicate key' (UPSET equivalent)
Change request in phoneGrid to left join to show all lines, even unassigned to a device
2021-07-21 11:30:50 +02:00
steve-lad a4aa4eb03b Simplify db queries and change alignment 2021-07-21 08:57:43 +02:00
steve-lad 97c1395eb1 Fix Fill Phone status column
Add db query to include mac to allow join with ami active device data
Change output fields
2021-07-20 18:03:44 +02:00
steve-lad 65f3a6cd37 Fix saving empty num value to db
Replace with NULL
2021-07-20 15:56:44 +02:00
steve-lad 4b40811d60 Fix issue with uninitialised adv.ini
Change logic to ensure adv.ini is initialised - necessary as used __Construct before sccp_manager installer can initialise.
2021-07-20 15:40:35 +02:00
steve-lad be5890e61f Update extconfigs.class.php 2021-07-20 12:55:23 +02:00
steve-lad 477eb69146 Fix phonepersonalisation
Set expected numeric value for phonepersonalization
WIP fix - adv.ini
2021-07-20 12:53:29 +02:00
steve-lad 2898f5e3c9 Fix bug codecs storage
codecs were stored as a ',' separated list while chan-sccp expects a ';' separated list
Correct all existing db values when running installer
make sure that disallow is not unset in installer (set to all)
make sure that disallow is not empty
correct help text
2021-07-20 09:32:01 +02:00
steve-lad b3b3858965 standardise get ext file modal and add via include
Create standard modal for insertion via include in firmcreate class and adserver view
2021-07-19 08:04:12 +02:00
steve-lad d9fa0ad8bf Update module.xml 2021-07-18 12:51:16 +02:00
steve-lad 3d69090767 Fix finding master file 2021-07-18 12:50:53 +02:00
steve-lad 5c4bbaabba Ignore $adv_ini if not set
Installer and sccp_manager construct - empty variable. Do not use if not set (will be set later)
2021-07-18 12:33:08 +02:00
steve-lad 913cbd14c4 Set default for LangDir
When Sccp_manager construct is called by the installer, this variable is not set. The installer sets it later
2021-07-18 12:23:17 +02:00
steve-lad d7fd77dfe8 Get locales from provisioner
Add progress bar and xhr handler
2021-07-18 11:30:19 +02:00
steve-lad 1b32e0977e Optimise locale (language) management
Optimise function calls
Use array functions instead of loops
findInstalledlangs is currently called by the construct - as this is called frequently, maximise its efficiency
2021-07-15 12:12:07 +02:00
steve-lad a4f8fa4600 Impliment retrieving firmware from Provision_sccp
WIP - need to handle exceptions etc
2021-07-14 17:16:27 +02:00
steve-lad ef77bce159 Add retrieve device files 2021-07-14 13:10:15 +02:00
steve-lad 2ffe4028e6 Add download function
WIP - debug with ringtones
2021-07-12 16:32:57 +02:00
steve-lad 6e26428b1d Update rewrite rules
Add header with credits
Add specific rule for sccp_manager
Add correct fields to parse xml for sccpvalues
Add new option to update files from @dkgroot/provision
2021-07-12 13:50:09 +02:00
steve-lad 2b709c9037 remove index.cnf
Is created by extconfigs with actual server values
2021-07-12 12:36:29 +02:00
steve-lad 651f3adb44 Finalise TFTP Mapping treatment
User no longer can select on or pro: If remapping is enabled and rules are set, then must use pro or phones will not find files
Otherwise is Off (flat directory)
2021-07-12 12:26:56 +02:00
steve-lad 5a184ededb Integrate Provision functionality into Sccp_Manager
Create required directory structure
Check if mapping support is enabled
Check if mapping rules are defined
Change options available based on above
Create index.cnf and sccpManagerRewrite.rules
2021-07-11 16:52:24 +02:00
steve-lad 248abe6cb7 Clean up and correct missing save settings
Remove unnecessary method from formcreate
Correct indentation in formcreate
Remove debug code in Sccp.class
correct logic for updating TFTP mode
2021-07-10 17:51:55 +02:00
steve-lad bf7556ed81
Merge pull request #27 from chan-sccp/Fix-Issue-#23
Correct rewrite rules
2021-07-10 13:09:23 +02:00
steve-lad ffaab80ee2 Correct rewrite rules
Supplied by and thanks to @vaDrn
2021-07-10 13:08:27 +02:00
steve-lad 30cbe1ba95 Correct output regex
Supplied by and thanks to @vaDrn
2021-07-10 13:05:28 +02:00
steve-lad 2a98d8cfdb Override chan-sccp default context 2021-07-10 12:17:46 +02:00
steve-lad 71fef35ebd Finalise FormShowSysDefs
Remove debug conditionals in Sccp_manager
Pass missing arguments for tftpLang
Remove unused items from sccpgeneral.xml
2021-07-10 10:45:42 +02:00
steve-lad ce115dab8b Create formCreate class
Move anonymous class frpm formShowSysDefs to own class
2021-07-10 09:03:06 +02:00
steve-lad d966bfa303 Minor typo corrections and add defaults button to device add/edit 2021-07-09 14:06:25 +02:00
steve-lad ba4dfb2f0d Reset line codec choices to site defaults
If all codecs are unchecked, restores values to site codecs
Remove options that have no input (do not offer user empty lists)
Respect site dndFeature by hiding option if off
2021-07-09 11:18:53 +02:00
steve-lad acb0141d99 Refine Sccp.class
Move help and other defs to sccpgeneral so that have one interface across system
Correct defaults in line with chan-sccp
Standardise db object, and move sql to dbinterface to remove second dependancy
2021-07-08 17:22:50 +02:00
steve-lad 6429b6add9 Finalise Codec Management
Add video codec treatment
Correct missing defaults
Simplify defaults in Sccp.class
2021-07-08 08:56:42 +02:00
steve-lad 11da8356a5 Update Sccp_manager.class.php 2021-07-06 17:20:42 +02:00
steve-lad 945e77f9bc Simplify getCodecs by using array functions 2021-07-06 17:18:17 +02:00
steve-lad f929267910 Provide mechanism to reset codecs to system defaults
Unchecking all codecs will return to chan-sccp defaults
Document this behaviour
Remove various debug code
2021-07-06 16:12:25 +02:00
steve-lad 2e5028f438 Finalise Codecs tab for site defaults
Partially revert changes to sccpvalues keys
Remove obsolete code
Improve help and set as open by default
Move getMyConfig to AjaxHelper as only used there
2021-07-06 15:22:12 +02:00
steve-lad acdf777bcc Clean up xml in cnf files
Indentation was not satisfactory. Improves readability and presentation of cnf files created

Thanks to @dkgroot for proposing this improvement
2021-07-06 12:24:34 +02:00
steve-lad 8b06495938 Update installer to handle chan-sccp parsable fields
chan-sccp has parsable fields where two values are separated by a |.
Parse these fields and their associated values and create two fields.
Remove the unparsed field if it exists.
2021-07-06 11:54:46 +02:00
steve-lad fea6d88aa5 Modify default values
Change sccpgeneral to remove inherit - now inherit default values automatically
Add default values to form groups
Revert changes informShow
Update getTableDefaults to better manage underscores with chan-sccp
Change Defaults in Install

Remove Inherit processing

Remove functionality added to hide inherit in default configs - Inherit has been removed from sccpgeneral.xml
2021-07-06 09:31:44 +02:00
steve-lad 5af3c7d2eb
Merge pull request #26 from chan-sccp/Fix-Issue-#25
Fix issue #25
2021-07-06 09:08:14 +02:00
steve-lad 47522b4a25 Update SIP cnf as well 2021-07-06 09:06:10 +02:00
steve-lad 4ad33852fd Revert "Revert "Fix Issue #25""
This reverts commit 6fa4c8626e.
2021-07-06 09:01:26 +02:00
steve-lad 6fa4c8626e Revert "Fix Issue #25"
This reverts commit c1aab666b3.
2021-07-06 08:58:47 +02:00
steve-lad c1aab666b3 Fix Issue #25
Fix incorrect separator and key reference.
2021-07-06 08:58:03 +02:00
steve-lad 44e0846761 Update server.codec.php
Add Recommendation for disallow
2021-07-06 08:30:38 +02:00
steve-lad a6a9850a3c rewrite codec methods to be more compliant with chan-sccp
Update db Fields for defaults
Update save logic
WIP update save defaults Field  in sccpline
2021-07-05 17:08:01 +02:00
steve-lad b15729a340 Change earlyrtp enum
chan-sccp enum is now yes / no and all older values equate to one of these. Help updated in chan-sccp revision: 566c8695
2021-07-05 11:17:03 +02:00
steve-lad a493165153 Insert missing </div> at end of SL type
</div> was commented out
Change sccpdevice type to IE ( using a list suggests changes are legitimate. While true, they are not recommended, so now user must know exactly what to enter.
2021-07-05 11:02:52 +02:00
steve-lad 2809b0796e Simplify List Button Presentation
Standardise method for all SL Types
WIP - unused method needs to be removed after full testing
2021-07-05 10:27:26 +02:00
steve-lad 503f227b98 Convert formShowSysDefs to anonymous class
Allows use of methods per type, which allows clearer compartmentalisation of variables and code.
Improves loading as FreePBX instantiates only once
WIP - create a full class loaded with Sccp_Manager
2021-07-04 16:46:18 +02:00
steve-lad b6dfb51993 Conditional include of Use chan-sccp defaults/Customise button
If there is no chan-sccp default, do not add the button to use chan-sccp default/customise

This adds a large block of html + php enclosed within {}. Add documentation so that this is clear
2021-07-04 09:02:33 +02:00
steve-lad 6ecc981a02 Align more defaults 2021-07-03 16:44:52 +02:00
steve-lad dd9888e55e (re)Align Defaults and Default values with chan-sccp
Ensure all defaults use same vales as chan-sccp (partial revert of earlier changes)
Initialise UsingSysDefaults
Clarify html
2021-07-03 16:29:31 +02:00
steve-lad 7dc4438ad8 Enable/Disable buttons when setting chan-sccp defaults
First version - Needs simplifying!
2021-07-03 12:10:44 +02:00
steve-lad 93fe6d45e1 Extend defaults to all pages
Change enum in installer to correspond to chan-sccp
2021-07-02 12:27:06 +02:00
steve-lad 927186151e Update checkbox defaults logic 2021-07-02 08:29:15 +02:00
steve-lad dcd9c75886 WIP Partial fix for setting default radio buttons 2021-07-01 10:11:02 +02:00
steve-lad 02f0b401d0 Impliment defaults for class IS
WIP
2021-06-30 16:31:29 +02:00
steve-lad e50c32a1ac Correct Indents for IS data type 2021-06-30 15:04:09 +02:00
steve-lad 3b91ad2188 Update JS
Default settings for customise are chan-sccp settings
Include QOS page group
Change help text
2021-06-30 14:27:39 +02:00
steve-lad 01b5e9e868 Use Dynamic Checkbox 2021-06-30 13:43:52 +02:00
steve-lad 64624fa597 Simplify chan-sccp help usage
Convert array to string when loaded, and rename arrays that hold the data for clarity
2021-06-30 08:14:15 +02:00
steve-lad 3ec730b71b Standardise between different formShow pages 2021-06-30 07:05:17 +02:00
steve-lad ace4945eb0 Load help from chan-sccp
Load metainfo descriptions which provide help if not in XML
2021-06-30 07:02:22 +02:00
steve-lad b7766fcf64 First test of new interface to manage defaults hierarchy
WIP
Need to better manage display of system defaults when customising
Need to override XML defaults
2021-06-29 16:41:53 +02:00
steve-lad 063556f898 Prepare siteDefaults Page
First pass with input array structure
2021-06-28 16:39:32 +02:00
steve-lad d1e72714af add systemdefault field to sccpvalues for savesccpsettings 2021-06-28 13:02:24 +02:00
steve-lad 22d845ced3 Initialise all chan_sccp defaults in sccp_settings
Get default system settings from chan_sccp and add to sccpsettings
Remove legacy settings from sccpsettings
Change tftpReadTestFile to accept host as argument
Change sccpsettings structure to include systemdefaults
2021-06-28 11:51:05 +02:00
steve-lad f882a66eb4 Tighten TFTP read controls
Avoid hanging if no data received by setting timeout. Thanks to @dkgroot  for soulution
2021-06-28 07:17:51 +02:00
steve-lad ee419ae193 Change SQL for adding system defaults 2021-06-27 17:46:00 +02:00
steve-lad f74978c1b3 Add timer on TFTP read; Get Metadata
TFTP read caused a hang if no server available

Set to DONTWAIT and loop and then check for valid data

Use metadat to set system defaults
2021-06-27 17:12:10 +02:00
steve-lad 7721e7a8a0
Tidy up installer
Clean SQL statements
Solidify dbsettings management
2021-06-27 12:48:24 +02:00
steve-lad b1a7fe3510
Update db exception handling in installer
DB object returns errors on warnings, so was failing.

Ignore the warnings and only die on exceptions (usually violations) as it is normal that there are warnings if we are changing VARCHAR to ENUM
2021-06-27 11:42:21 +02:00
steve-lad 4fcf16b317
Do not die on SQL warning
If we change a field from VARCHAR to enum, we will get warnings as possibly truncating data. Accept this and carry on.

Only fail on an error.
2021-06-27 11:06:33 +02:00
steve-lad d8cc6f3ba1
Remove empty - checking to find actual and overwrite any existing 2021-06-27 10:43:01 +02:00
steve-lad bab83c7e3e
Change TFTP detection logic
Accept first hit
2021-06-27 10:19:20 +02:00
steve-lad d83c3ab93f
Merge pull request #24 from chan-sccp/tftpDetection
Tftp detection
2021-06-27 10:03:54 +02:00
dkgroot 4da4f391d6 Fixes based on review by @steve-lad 2021-06-27 07:54:00 +00:00
dkgroot 838ff633aa Reverse the logic when detecting tftpserver existence and path
- write a sentinel probe file to the known/possible distro tftp directories
 - try fetching it through tftp
 - if we manage to fetch the file, we have the correct path
 - remove sentinel probe file

When creating directories in tftpboot directory we should not set write permissions, using 0755 instead.
2021-06-26 23:19:53 +00:00
Diederik de Groot a6a7b517d1
Added file explaining config parsing and inheritance by chan-sccp. 2021-06-26 11:03:42 +02:00
steve-lad 3a03815daf Change tftp_path names
Change for clarity
2021-06-25 06:52:43 +02:00
steve-lad fb9ea64134 Fix SQL in Install Rename
Change SQL in Installer rename column
Change TFTP variable name for better clarity
2021-06-25 06:35:51 +02:00
steve-lad 97c4c93fb6 Display Device description even if not connected 2021-06-24 16:11:33 +02:00
steve-lad 852156878d Simplify method name 2021-06-24 15:40:36 +02:00
steve-lad 0e36336033 Delete sccpsimple.xml.v433
Not required and complicates maintainability
2021-06-24 15:32:07 +02:00
steve-lad 9be50bab5c Update Create_SEP_XML and defaults
Merge data_values and dev_config so that device specific settings are written to the SEP file
Add sccp general device defaults
Allow saving empty sccpvalues
Add new fields to sccpdevice
move phonepersonalization to sccpdevice from sccpline
Change advanced display block for personalisation to correctly pickup defaults
2021-06-24 15:25:26 +02:00
steve-lad e841c7cb40 Reversions and corrections to previous commit
Restore saveSccpSettings to Sccp_Manager construct (deleted in error)
Initialise ntp_timezone without check (may have been changed externally)
Load xml data in ShowGroup instead of construct.
2021-06-24 10:59:00 +02:00
steve-lad ff1c451fe1 Update Installer and Sccp_manager Construct
Move initial defaults reading from Construct to Install
Move initVarFromXml to helper functions - no longer used as defaults should come from db
Remove extraneous initialisations from Sccp_manager - these are now handled in Installer
Save TFTP structure to sccpsettings in Installer
Pass tftp_root to extconfigs ( if changed or uninitialised, was not written back to settingsFromDb before being passed to extconfigs
2021-06-24 10:02:26 +02:00
steve-lad 4d7463f341 Update sccpgeneral.xml.v433 2021-06-23 19:52:00 +02:00
steve-lad 9daf307081 Correct defaults 2021-06-23 19:46:32 +02:00
steve-lad cdac0f0276 Fix incorrect variable declaration 2021-06-23 17:43:58 +02:00
steve-lad d7e196cf21 Clean up installer and partially revert externconfigs
Remove ancillary function to traits
Move tftp directory management back to extern configs
Remove call to extern configs from InitialiseSccpPath and so from Construct
Need to add call to updateTftpStructure when settings changed ---WIP ---
2021-06-23 17:03:24 +02:00
steve-lad ec79925661 add asterisk etc dir to sccp settings 2021-06-23 13:21:19 +02:00
steve-lad d422776ad6 Create full TFTP Pro structure and save relevant settings
Default structure now created is ready for pro use and settings have been moved to sccp settings and not stored in array sccppath
2021-06-23 12:35:33 +02:00
steve-lad 4e15376181 Update install.php 2021-06-22 20:53:41 +02:00
steve-lad cb890aa264 Update installer to check TFTP server is running and usable
Use dummy put to test and locate the TFTP server
Move all TFTP tests from extconfigs to install (reduces module constructor)
2021-06-22 17:18:01 +02:00
steve-lad 95cd7b4d9b Correct getExtConfig method
sccp_lang did not accept index arg
2021-06-22 10:17:57 +02:00
steve-lad c271dbf3c2 Update edit device to apply current schema
Add defaults if they are unset for the device
If device fields are now an enum, make sure that legacy values are valid or replace with defaults
2021-06-20 16:25:44 +02:00
steve-lad 0692b3cd6a Update module version 2021-06-20 13:15:49 +02:00
steve-lad def22582e3 Correct SQL in INSTALLER 2021-06-20 13:14:54 +02:00
steve-lad 649b717ce7 Correct SQL for SET DEFAULT 2021-06-20 13:06:53 +02:00
steve-lad 34a7f6a163 Remove hidden tab in SQL 2021-06-20 12:08:37 +02:00
steve-lad be8aa5cd92 Initialise Defaults in Driver
Add Constructor to get and set line_defaults
Add defaults to SCCP tab
2021-06-20 11:53:24 +02:00
steve-lad 55285cf625 Move install functions from sccp_manager to installer
Change core driver to be an include
Move driver to sccpManClasses to improve maintainability and eliminate possible version issues
Add driver in installer (remove
from extConfigs)
Create sccp.conf in installer if it does not exist (remove from extconfigs)

Update extconfigs.class.php

Update Sccp.class.php.v433
2021-06-20 09:24:19 +02:00
steve-lad 2dad547e3d Redefine defaults from db in sccp driver 2021-06-19 17:42:01 +02:00
steve-lad aad6fa31c6
Merge pull request #21 from chan-sccp/Fix-Issue-#20
Fix Issue #20
2021-06-19 15:24:56 +02:00
steve-lad fd21a94821 Fix Issue #20
During initial migration of Sccp_Manager to chan-sccp, the incorrect version of sccp class driver was imported.

This corrects that and modifies the original driver
2021-06-19 15:23:42 +02:00
steve-lad 310256dc5d Update Sccp Driver class
During initial import to chan sccp, the wrong version of this class was used, and the SCCP Tab was not shown when adding or editing extensions.

Also comment out  GUI hooks as not currently used, and can present issues because of FreePBX caching.
2021-06-19 15:15:26 +02:00
steve-lad d6cfa86978 Control MAC address entry
Warning and refocus if not conform to indicated requirements
2021-06-18 16:50:15 +02:00
steve-lad 510b4259ac Optimise handlerSubmit and activate TZ
Simplify process
Reenable TZ offset test on save
2021-06-18 13:13:38 +02:00
steve-lad de3c58178b Remove Inherit processing
Remove functionality added to hide inherit in default configs - Inherit has been removed from sccpgeneral.xml
2021-06-18 12:10:26 +02:00
steve-lad 57bc13f782 Modify default values
Change sccpgeneral to remove inherit - now inherit default values automatically
Add default values to form groups
Revert changes informShow
Update getTableDefaults to better manage underscores with chan-sccp
Change Defaults in Install
2021-06-18 11:58:00 +02:00
steve-lad f36c224f87 Move most Ajax Submit functions into handleSubmit
Improves readability and simplifies variables
2021-06-17 19:23:40 +02:00
steve-lad efdf2d0469 Added sccpline fields
WIP Still have issue with def_modify in installer
2021-06-17 18:39:32 +02:00
steve-lad afe3382aed Move handleSubmit to AjaxHelper 2021-06-17 15:54:04 +02:00
steve-lad 82772eed71 Bugfix Incorrect object for execute
Change object for execute in SaveButtons
2021-06-17 15:12:50 +02:00
steve-lad 5df918a04b Save Defaults to Db Defaults
Initial changes. Need to update other tables and fields

Minor bugfix in dbinterface

Correct XML version
2021-06-17 15:10:31 +02:00
steve-lad 416cedc425 Create new function to get device defaults
Add new function in helperFunctions and use
2021-06-17 10:18:07 +02:00
steve-lad a146cd2354 Set defaults for Add Device
Get default values from db for add new device
Tidy up AjaxHelper get phone grid removing unnecessary tests and using clearer variable names
Correct typos in sccpgeneral
2021-06-17 09:40:24 +02:00
steve-lad b420f35ad2 WIP Fix formshow prefix logic for IS
Currently only fixed for IS

FormShow was adding the prefix to the full child name, making a useless result.

Need to remove form_prefix from childname to return to db values
2021-06-16 16:58:04 +02:00
steve-lad 815b7dbd2a Update Vendor defaults from db
Use db default values instead of xml as these are dynamic.
2021-06-16 13:21:44 +02:00
steve-lad 790b5f7949 Add vendorconfig data to Edit Device
Translate DB fields to formshow fields

These field translations need to be simplified
2021-06-16 12:42:07 +02:00
steve-lad b2ee6ad853 Correct NOT NULL fields
Ensure all enums are NOT NULL
Correct variable name to lowercase
2021-06-16 10:27:28 +02:00
steve-lad 922ae3eaf7 Update fields so that ignored by chan-sccp
To avoid unnecessary changes to chan-sccp, these fields are prefixed with an underscore and should be ignored.
They are used to create the SEPXXXX file
2021-06-16 10:13:29 +02:00
steve-lad 218e1c66ee Clean Installer
Remove unused functions
Remove unused cases
Remove duplicate code
2021-06-16 09:28:47 +02:00
steve-lad 4c40809071 Update installer for new db version
Define new sccpdevice fields
Remove obsolete code
Remove duplicate code
2021-06-16 09:22:43 +02:00
steve-lad 5e5cf3ffda Remove unused cases in Save Device
These Fields do not exist in sccpdevice
2021-06-16 07:52:58 +02:00
steve-lad 5e7bdbe40b Revert Settings Changes
Move changes to new version 14.2
2021-06-16 07:05:40 +02:00
steve-lad 8c4b0ce240 Disable Inherit in default system button settings
Disable Inherit buttons in system defaults (should only be used for specific devices)

Add Device Vendor settings to Add Device (WIP - may need db change)

Change various names to be more readable
2021-06-15 17:56:37 +02:00
steve-lad 92ef25bc62 Change Version 2021-06-15 09:41:39 +02:00
steve-lad 2b49bbc373
Change Stable Branch Link 2021-06-15 09:27:07 +02:00
steve-lad fb8f4ec00e Bug Fix - Default line not added on Device Create
Default line was only set after Device edit and save, not after Device creation.
2021-06-15 08:56:19 +02:00
steve-lad 61818026ff Update module.xml
Update version after bug fix
2021-06-14 16:24:04 +02:00
steve-lad d2e9ac3184 Bug Fix
Wrong response class in MessageClass
2021-06-14 16:17:18 +02:00
steve-lad 5ea2c83115 Correct Device Reset page reload
Stay on page with page reset
Correct output
Switch from modal to Toast
2021-06-14 16:00:03 +02:00
steve-lad 707371cb92 Fix update button labels
Convert modal responses to Toast
Correct reload parameters to stay on page and redraw table
Correct output text
2021-06-14 15:19:45 +02:00
steve-lad d7bc3e500b Replace more modals with Toast 2021-06-14 14:24:11 +02:00
steve-lad 79f59de92e Update module.xml
Update change log
Increment version
2021-06-14 12:27:57 +02:00
steve-lad 1751e9dd9c Remove old comments
Remove old commented text and update comments
2021-06-14 12:21:18 +02:00
steve-lad 9ac0d59c66 Leave table deletion to FreePBX
FreePBX and Director remove all tables that it has installed. If they do not exist, uninstaller gives errors
2021-06-14 12:18:40 +02:00
steve-lad 09db30fe9f Update Uninstaller
Create Backup of SCCP tables
Remove all tables
Remove views and keys
2021-06-14 11:47:09 +02:00
steve-lad 808e676972 Clean up model display
Improve message and add newline
2021-06-14 10:43:21 +02:00
steve-lad e6c5dd63a0 Replace Save and Continue modal
Use Toast
2021-06-14 10:31:23 +02:00
steve-lad 89fe90d2ca Replace modal on save config
Remove modal with close waiting on user input and replace with Toast
2021-06-14 10:23:23 +02:00
steve-lad be2b21f8cf Update extconfigs.class.php
Fix missing .
2021-06-14 07:45:09 +02:00
steve-lad f159ab72f6 Clean up defaults
Set new base defaults to 433
Remove obsolete conf files to enhance maintainability
2021-06-13 16:55:26 +02:00
steve-lad 0e82da2492 Merge branch 'develop' of https://github.com/chan-sccp/sccp_manager into develop 2021-06-13 16:43:38 +02:00
steve-lad 7107dbe86b Fix issue with not saving all settings
An erroneous break instead of continue was truncating sccpsettings

Simplify logic by avoiding create then delete for settings where data was empty
2021-06-13 16:43:31 +02:00
steve-lad 6260f79b86
Update Version 2021-06-13 15:46:06 +02:00
steve-lad 3d1b8015c5
Merge pull request #18 from chan-sccp/Fix-Issue-#14
Fix issue #14
2021-06-13 15:43:48 +02:00
steve-lad 007330159e Disable TZ selection
TZ is a FreePBX property and should be only changed there.

Now only display for info with help

Ensure that at each initiation, we load the system value
2021-06-13 15:39:43 +02:00
steve-lad 3fee812cc6 Get TZ Offset from timezone
Remove unnecessary methods
2021-06-13 13:12:37 +02:00
steve-lad bbd811e578 New TZ and Cisco Code Algorithm
Simplify getting cisco_code and DST settings
2021-06-13 11:06:26 +02:00
steve-lad 3b5fb64589
Merge pull request #17 from chan-sccp/Fix-Issue-#15
Partial Revert of 212c437
2021-06-13 09:10:55 +02:00
steve-lad f20146b7ef Partial Revert of 212c437
If outbound caller id is not set by user, do not set here (no default value).

$label is not declared in this class and so causes exception when called from Quick Create Extension

Only redirect when called from SCCP Phone add extension or from Extensions add extension
2021-06-13 09:09:55 +02:00
steve-lad 67c43fea6c
Merge pull request #16 from chan-sccp/Fix-Issue-#12
Change DB Spec for compatibility with older MariaDB
2021-06-13 08:28:33 +02:00
steve-lad 7aaee83d4a Change DB Spec for compatibility with older MariaDB
Older versions of MariaDB, which are included in some distros, reject a VARCHAR that is a key and can be NULL longer than 190 (Director default is 255)

Change for backward compatibility
2021-06-13 08:27:14 +02:00
steve-lad 30933c6bfb Update module.xml
Update length of buttontype
2021-06-12 17:04:34 +02:00
steve-lad 8303ec28a4 Find correct Cisco TZ Code 2021-06-12 11:29:26 +02:00
steve-lad 878dd7c29a Update install.php
Remove extra .
2021-06-12 10:07:14 +02:00
steve-lad 1182d65971 Correct file names
cnf_read and cnf_wr can only write to a filename (not a path) inside /etc/asterisk
2021-06-12 09:56:59 +02:00
steve-lad f51f839e9c Update module.xml
Set Default on non null field
2021-06-12 08:37:59 +02:00
steve-lad 84925a334e Update TZ selection method
Change Cisco code determination
2021-06-12 07:30:18 +02:00
steve-lad 50d2f25326
Merge pull request #13 from chan-sccp/Fix-Issue-#12
Fix issue 12
2021-06-11 11:09:30 +02:00
steve-lad 5b67c8d6f9 Fix issue 12
Remove empty defaults from database definitions - Doctrine parses incorrectly
Add case in installer to create extconfig.conf if does not exist
2021-06-11 11:08:32 +02:00
steve-lad 7adaaeea09
Update README.md 2021-06-11 09:20:03 +02:00
steve-lad 5b3111e047
Update README.md 2021-06-11 09:18:59 +02:00
steve-lad 78feebc894
Merge pull request #11 from chan-sccp/Fix-Issue-#8
Fix issue #8
2021-06-11 08:58:22 +02:00
steve-lad 9547cfe927 Clean up and document redirect changes
Add comments
Standardise URL's
Remove surplus cases
2021-06-11 08:54:24 +02:00
Diederik de Groot d0873cdd16
Update sccpManagerUpdater.json 2021-06-10 21:38:42 +02:00
Diederik de Groot 5c656e409b
Update sccpManagerUpdater.json 2021-06-10 21:32:34 +02:00
steve-lad 1a96c523b7
Update README.md 2021-06-10 19:25:24 +02:00
steve-lad 7427fcabb8 Standardise URL
Standardise URL based on PHP Defaults
2021-06-10 17:41:18 +02:00
steve-lad cf546961fe Add redirect after saving to sccp_line
Add redirect after saving to sccpline
Revert changes in page script formatting
2021-06-10 16:57:19 +02:00
steve-lad 214509e2c7 Use BMO Hooks
Use BMO Hooks
Correct HTML
2021-06-10 12:15:18 +02:00
steve-lad 7f96c121fa Update module category in updater.json
Update module category in updater.json - this is used in Module Admin
Remove unused JS
2021-06-08 15:23:43 +02:00
steve-lad dface29681
Delete .nfs.2005102d.05d5
Delete extraneous file
2021-06-08 14:43:13 +02:00
steve-lad 03057edd6c Fix Broken Rnav in add device
Replace _DIR_ with absolute path; _DIR_ references sccpTraits
Fix error in toolbar id
2021-06-08 14:39:23 +02:00
steve-lad 5ad6f5bae0 Update button labels
Update button labels in Server Config
Atom whitespace removal in hardware.phone
2021-06-08 12:50:48 +02:00
steve-lad 0fa539bd6a Remove unused delete button
Remove disabled delete button
2021-06-07 16:23:21 +02:00
steve-lad 4ec741e1fa Revert "Update module to point to other updateurl branch"
This reverts commit 0c2df2d529.
2021-06-07 12:44:18 +02:00
dkgroot 0c2df2d529 Update module to point to other updateurl branch 2021-06-06 18:12:50 +00:00
dkgroot 792cf34522 Update json file 2021-06-06 18:10:08 +00:00
dkgroot 668bc3355c Update version number to 14.2.0.2 2021-06-06 14:07:07 +00:00
dkgroot 9e360240d9 Fix module.xml database definition 2021-06-06 13:51:44 +00:00
steve-lad e97dc89a49 Update install.php
Check realtime configuration
Impose correct version
2021-06-06 11:00:00 +02:00
steve-lad d7ebf7d0ec Simplify logic and correct SQL
Correct SQL for modify defaults
Remove unnecessary tests
Simplify remaining tests
2021-06-06 08:16:41 +02:00
steve-lad 6250f1b186
Update README.md 2021-06-05 08:42:36 +02:00
steve-lad 17293287fa Correct Default values
Correct default values
Fix SQL syntax error
2021-06-04 17:02:27 +02:00
steve-lad e8dae84512 Update install.php 2021-06-04 16:20:52 +02:00
steve-lad 98a0f4e8b7 Update installer
Change default values in Sccp.class
Change SQL statements
Change DB schema
2021-06-04 16:20:18 +02:00
steve-lad f7d88e68bb Correct defaults for call transfer
This field is an enum in db and so must be on/off
2021-06-04 08:12:09 +02:00
steve-lad fc9c060b26 Merge branch 'develop' of https://github.com/chan-sccp/sccp_manager into develop 2021-06-04 07:57:47 +02:00
steve-lad 355b0b0ca3 Fix issue - sccpline row not created
Remove unnecessary escaping of quotation marks that caused SQL to reject command
2021-06-04 07:56:20 +02:00
steve-lad 8244ce5366
Update sccpManagerUpdater.json 2021-06-03 15:25:50 +02:00
steve-lad 883f8ae674
Update sccpManagerUpdater.json 2021-06-03 14:57:26 +02:00
steve-lad ec54af5b9d
Update sccpManagerUpdater.json 2021-06-03 14:57:00 +02:00
steve-lad 337da918d4
Update sccpManagerUpdater.json 2021-06-03 14:54:16 +02:00
steve-lad 868ebbecc8
Update sccpManagerUpdater.json 2021-06-03 14:52:06 +02:00
steve-lad d683f686e5 Update module.xml 2021-06-03 14:39:35 +02:00
steve-lad c8ccef50c9 Impliment FreePBX Updater
Add json file to repo
2021-06-03 14:24:46 +02:00
steve-lad 3f7d59ee34 Update dbinterface.class.php
Standardise SQL quoting and style
2021-06-03 14:14:02 +02:00
steve-lad a8d12501de Update page.html.php 2021-06-03 13:58:50 +02:00
steve-lad d72a19f9e8 Minor Formatting 2021-06-03 13:51:38 +02:00
steve-lad f4927793ee Modify installer
Change load sequence
Delegate table creation to module.xml
Correct module.xml tables
Correct timezone typo
2021-06-03 13:07:26 +02:00
steve-lad 1c78d23df8 Update xmlinterface.class.php
Clean up
2021-06-03 09:14:19 +02:00
steve-lad 495ede0df2 Update Sccp_manager.class.php
Update version
2021-06-03 09:05:24 +02:00
steve-lad 8341cba1ca Update Sccp_manager.class.php
Remove unnecessary tests
2021-06-03 08:56:04 +02:00
steve-lad c1f35ace41 Update Sccp_manager.class.php
Remove unnecessary page code - this version only works with chan-sccp >433
2021-06-03 08:37:43 +02:00
steve-lad cd0da5b6a3 Update Sccp_manager.class.php
Reset settings page tab order
2021-06-03 08:25:57 +02:00
steve-lad 8c7c7d6fef Update module.xml
Remove duplicate tag
2021-06-03 08:08:32 +02:00
steve-lad 41033edc44 Remove duplicate Technical note folder 2021-06-02 16:54:24 +02:00
steve-lad 13778ce657 Update Sccp_manager.class.php
Move SccpInfo to first tab leaving General as default
2021-06-02 16:39:02 +02:00
steve-lad 7d641e3b2d Update Sccp_manager.class.php
Remove unused methods
Substitute single line methods
Clean up page presentation (this changes the previous tab order)
2021-06-02 16:31:38 +02:00
steve-lad 4620df53c4 Change Function names 2021-06-02 15:30:21 +02:00
steve-lad 6df032c137 Remove unused methods 2021-06-02 15:21:53 +02:00
steve-lad 2f487d1a32 Create BMO Trait
Move BMO code to separate trait
2021-06-02 15:10:12 +02:00
steve-lad 4ee26a9871 Name Changes 2021-06-02 15:03:38 +02:00
steve-lad f6bdd27335 Use Traits to simplify Sccp_Manager.class
Move helper functions to trait
Move Ajax to trait (WIP - next step to create subclass to simplify initialisation)
Rename Directories to eliminate punctuation
Add new directory for traits
2021-06-02 14:55:39 +02:00
steve-lad 91986cb674 Merge branch 'develop' into RetireOldInterface 2021-06-02 10:35:42 +02:00
steve-lad c9e52cc0c5 Update README.md 2021-06-02 10:32:46 +02:00
steve-lad bd80580933 Update README.md 2021-06-02 10:29:35 +02:00
steve-lad 975dd84853
Update README.md 2021-06-02 10:22:18 +02:00
steve-lad 32e465d635
Update README.md 2021-06-02 10:19:09 +02:00
steve-lad 538e4eeb0c
Update README.md 2021-06-02 10:17:08 +02:00
steve-lad 42b41d8bd0 Update README
Add required PHP classes
Delete Russian version as not maintained
2021-06-02 08:26:46 +02:00
steve-lad 80cc601da4 Update Installer - WIP
Add database definitions in module.xml
Catch exception if PHP Zip not installed
2021-06-02 08:17:35 +02:00
Diederik de Groot 9ef59f0df4
Add updateurl to module.xml 2021-06-01 18:51:29 +02:00
steve-lad 09a5daa593 Clean up install.php
Remove obsolete/non-applicable code
2021-05-31 18:45:48 +02:00
steve-lad 67c02aabf1 Return RevisionNum
Return RevisionNum - omitted in previous commit
2021-05-31 16:16:52 +02:00
steve-lad d0fd1f2cdb Remove incompatible files
Simplify compatibility checking. This version is only compatible with chan-sccp 433 or greater.
2021-05-31 16:11:07 +02:00
steve-lad 2eab67a117 Bug fix
Missing closing bracket
2021-05-31 12:57:16 +02:00
steve-lad 97c02f125f Add error message for chan-sccp compatibility
Ad error message in install if chan-sccp version is too low
Minor formatting
2021-05-31 12:52:56 +02:00
steve-lad ee0fda775e Retire Old Interface
Use exclusively AMI interface
Delete oldinterface
Delete srvinterface and move aminterface to Sccp_manager.inc
All calls now pass directly to aminterface
2021-05-31 12:33:35 +02:00
steve-lad a065884a8b Merge branch 'develop' of https://github.com/chan-sccp/sccp_manager into develop 2021-05-31 10:00:14 +02:00
steve-lad ac71164055 Update install.php
Clean up formatting and remove unnecessary quotations
2021-05-31 10:00:06 +02:00
dkgroot 524e15b2c4 Update version number 2021-05-30 14:37:49 +00:00
steve-lad d846af6913
Merge pull request #6 from chan-sccp/UpdateDeviceEdit
Update device edit as per 9e95071
2021-05-30 16:02:11 +02:00
steve-lad b138c3ac81 Enable edit of phones as per 9e95071
Reintegrate edit of phones as per original patch by @dkgroot
Corrections in HTML
Simplify Installer mods
2021-05-30 16:01:02 +02:00
Diederik de Groot 51dad690ef Fix: Default models should have at least 1 button if number is currently no known
Enh: allow all model information to be edited.
Fix: edit/load loadinformationid
Fix: Modal Title -> Model

With help from @steve-lad

References: #91

Signed-off-by: Diederik de Groot <dkgroot@talon.nl>
2021-05-30 15:03:38 +02:00
steve-lad 85e4bce407 Simplify tests
Use Isset instaed of empty twice
2021-05-30 14:27:45 +02:00
steve-lad 7cf12356c1 Update Sccp.class.php.v433
Correct indentation
Rewrite SQL Replace statement to simplify
2021-05-30 13:22:46 +02:00
steve-lad 9c4c94cba7 ReIndent Sccp.class.v433 2021-05-30 12:50:48 +02:00
steve-lad a77aa65f74
Merge pull request #5 from chan-sccp/ParseOutboundCID
parse outboundcid content into cid_num and cid_name sccpline fields
2021-05-30 11:49:17 +02:00
Diederik de Groot 212c43782b parse outboundcid content into cid_num and cid_name sccpline fields
If outboundcid contains '"name" <num>' the content needs to be split to cid_name and cid_num.
If not the content should be a number and should be copied to cid_num only, in that case we fill cid_name with the value of $label

Fixes: #72

Signed-off-by: Diederik de Groot <dkgroot@talon.nl>
2021-05-30 11:47:47 +02:00
steve-lad 16104a0589
Merge pull request #4 from chan-sccp/MoveDisallowBox
Move disallow box
2021-05-30 11:35:41 +02:00
steve-lad f8a3c8c81d Reapply patch wriiten by DKGroot
Move the disallow box to the top of the codec page
Correct english
2021-05-30 11:34:35 +02:00
Diederik de Groot fa7fa4772f Move the disallow box to the top of the form, the order is important.
Signed-off-by: Diederik de Groot <dkgroot@talon.nl>
2021-05-30 11:29:49 +02:00
steve-lad 4ce789cd3e Fix reversion errors
When rebasing, errors were introduced. This commit reverses those errors. It may also revert some commits
2021-05-29 15:50:04 +02:00
steve-lad ad1184af43 Merge branch 'develop' of https://github.com/chan-sccp/sccp_manager into develop 2021-05-24 16:24:25 +02:00
steve-lad 3859be72be
Merge pull request #3 from chan-sccp/issueswiki
Update README.md
2021-05-24 16:20:20 +02:00
Diederik de Groot 2bd2e814d7
Fix image link 2021-05-24 16:17:00 +02:00
Diederik de Groot d3e44c955b
Update module.xml and PhantomVl references 2021-05-24 16:15:28 +02:00
steve-lad b4301ebd14 Update README.md
Remove reference to extension_mobility
2021-05-24 16:02:50 +02:00
Diederik de Groot 8bdd6beee8
Couple of small changes 2021-05-24 15:55:24 +02:00
steve-lad cd30a20cf6 Update README.md
Reflect move of sccp_manager to chan-sccp, updating links and readme.
2021-05-24 15:14:55 +02:00
steve-lad 12c8f30464
Fix Issue with SQL syntax reported by kc2vrj
Correct quotation and simplify logic to avoid complex SQL statements.

Bind strings

Confirmed fix of issue reported by kc2vrj.
2021-05-24 13:55:36 +02:00
Diederik de Groot 0011581fc0
Merge branch 'PR108' into extension_mobility_rebased_on_develop 2021-05-24 13:46:19 +02:00
steve-lad d451b36363 Fix Issue with SQL syntax reported by kc2vrj
Correct quotation and simplify logic to avoid complex SQL statements.

Bind strings

Confirmed fix of issue reported by kc2vrj.
2021-04-29 16:44:33 +02:00
Diederik de Groot 9e95071bad
Fix: Default models should have at least 1 button if number is currently no known
Enh: allow all model information to be edited.
Fix: edit/load loadinformationid
Fix: Modal Title -> Model

With help from @steve-lad

References: #91

Signed-off-by: Diederik de Groot <dkgroot@talon.nl>
2021-04-02 15:30:03 +02:00
Diederik de Groot 07be691c16
parse outboundcid content into cid_num and cid_name sccpline fields
If outboundcid contains '"name" <num>' the content needs to be split to cid_name and cid_num.
If not the content should be a number and should be copied to cid_num only, in that case we fill cid_name with the value of $label

Fixes: #72

Signed-off-by: Diederik de Groot <dkgroot@talon.nl>
2021-04-02 15:30:03 +02:00
Diederik de Groot 1ef1fe1e31
Move the disallow box to the top of the form, the order is important.
Signed-off-by: Diederik de Groot <dkgroot@talon.nl>
2021-04-02 15:30:02 +02:00
steve-lad 7f93f0179b
Remove PHP % incompatible code 2021-04-02 15:29:36 +02:00
steve-lad 8fb29b93fd
Update dbinterface.class.php
Correct syntax
2021-04-02 15:29:36 +02:00
steve-lad ef4fc4fe12
Fix Sccp Button Save
Correct PDO statements and implimentation concept
2021-04-02 15:29:36 +02:00
steve-lad 9f5459f7c5
Update dbinterface.class.php
Check that labels exist before binding or an exception will occur
2021-04-02 15:29:36 +02:00
steve-lad bd257cec9b
Correct string quoting
String quoting was incompatible with PHP 7
2021-04-02 15:29:36 +02:00
steve-lad 594367cbd4
Update dbinterface.class.php
Bug fix
2021-04-02 15:29:36 +02:00
steve-lad 31ac0746ba
Bug fixes
Correct SQL statement
Correct Message Handler
Correct Message interpreter
2021-04-02 15:29:36 +02:00
steve-lad e1c6a1d39b
Remove tmp nfs files 2021-04-02 15:29:36 +02:00
steve-lad c4cd6cbdbf
Update install.php
Populate sccpdevmodel if empty
2021-04-02 15:29:36 +02:00
steve-lad 3ed43600d4
Merge Fix-dbinterface-class 2021-04-02 15:29:36 +02:00
steve-lad 36192599f1
Migrate from global db object
As per FreePBX BMO, no longer use global db object
2021-04-02 15:29:34 +02:00
steve-lad f4f11157e1
Fix exception if sccpsettings table does not exist
Before the installer can create sccpsettings, FreePBX instantiates an SCCP_Manager object which requires sccpsettings.
Catch the exception and create the table
2021-04-02 15:29:17 +02:00
steve-lad d3ae6536d1
Update dbinterface.class.php 2021-04-02 15:29:17 +02:00
steve-lad 19e1bb9b3e
Remove dbugs 2021-04-02 15:29:17 +02:00
steve-lad dac622c745
Final version
Standardise some calls and add notes
2021-04-02 15:29:15 +02:00
steve-lad 09beeb449e
Use bindParam on db executes
Use bind param to have stricter typing

Fix bug in Sccp-Manager where key and keyword were not the same
2021-04-02 15:28:55 +02:00
steve-lad 5892afc653
Update Transactions and fix errors
Reduce quoting level, and fix errors introduced by prior commits
2021-04-02 15:28:54 +02:00
steve-lad 4a3f21dc5d
Further clean ups and annotations
Document changes
2021-04-02 15:28:35 +02:00
steve-lad cfcbe23816
Switch to PDO model
Switch to PDO model and correct transactions
2021-04-02 15:28:06 +02:00
steve-lad fd8c5f9f96
Cleaning up
Simplify structure and fix errors
2021-04-02 15:27:28 +02:00
steve-lad a1c020c772
Switch to PDO model
Switch to PDO model and correct transactions
2021-04-02 15:27:27 +02:00
steve-lad c77c8b76cc
Test for chan_sccp_b version compatibility
SoftKeySets fails with chan_sccp-b prior to revision number 11048.

Check the version with the installer, and subsequently to ensure do not get exception.
2021-04-02 15:25:56 +02:00
steve-lad 91c2d233d4
Use bindParam on db executes
Use bind param to have stricter typing

Fix bug in Sccp-Manager where key and keyword were not the same
2021-04-02 15:25:32 +02:00
steve-lad 3fbccb982f
Update Transactions and fix errors
Reduce quoting level, and fix errors introduced by prior commits
2021-04-02 15:25:32 +02:00
steve-lad 7f047f7c10
Further clean ups and annotations
Document changes
2021-04-02 15:25:31 +02:00
steve-lad bda7518932
Cleaning up
Simplify structure and fix errors
2021-04-02 15:25:31 +02:00
steve-lad 95405190cc
Switch to PDO model
Switch to PDO model and correct transactions
2021-04-02 15:25:31 +02:00
steve-lad 92ca19ed41
Test for chan_sccp_b version compatibility
SoftKeySets fails with chan_sccp-b prior to revision number 11048.

Check the version with the installer, and subsequently to ensure do not get exception.
2021-04-02 15:25:30 +02:00
steve-lad 9d29d11a08
Apply PR 101 2021-04-02 15:23:55 +02:00
steve-lad 40e9b01510
Correct type declarations
type declarations must be lowercase or will be treated as local instance names
2021-04-02 15:23:55 +02:00
steve-lad e94fa4e8d1
Tidy up
Remove unused variables
Close socket if not using
2021-04-02 15:23:55 +02:00
steve-lad 673f6d45e0
Tighten Ami controls
Check that have compatible version of chan-sccp for AMI and disable AMI  if not found
Check returned values
Add new classes for response to reduce testing
2021-04-02 15:23:54 +02:00
steve-lad 315a693894
Correct Field and add new event classes
add 2 new event classes for SCCPShowDevice

correct translator in ShowSCCPDevice_Response
2021-04-02 15:23:54 +02:00
steve-lad 5beee7f9a2
Tidy up exception handling
Simplify handling of AMI lists and trap exceptions
2021-04-02 15:23:54 +02:00
steve-lad a89866e81e
Bug Fixes and optimisations as a result of issue 106
Fix bugs in Response Class causing exceptions
Update extconfigs class to correctly check database connectors and improve feedback
Move some constructors to start of class for lisibility
Tidy up Response class with Typing to eliminate unnecessary tests
2021-04-02 15:23:54 +02:00
Andrea Diotallevi 9b730a998a
Fixed recognition of chan-sccp release version 4.3.3 2021-04-02 15:23:54 +02:00
steve-lad ca5cf9571b
Updated GenericResponse
Updated generic response handler for table case
2021-04-02 15:23:54 +02:00
steve-lad 929f8036b1
Update AMI Response
Bring branch up to level of previous Pull which can now be deleted
2021-04-02 15:23:54 +02:00
steve-lad 6ccc9bbccb
Cleaned up messages
Improved message readability. Atom removed extraneous white spaces and lines
2021-04-02 15:23:54 +02:00
steve-lad 2f69bdb3fa
Match to previous commit
Add missing comments
2021-04-02 15:23:54 +02:00
steve-lad 11af87ca38
Remove extraneous calls
Duplicate calls from page.settings removed
2021-04-02 15:23:53 +02:00
steve-lad e4a4630ad2
Installer failed to update db version
Error in sytax at 745, and in exception handler at 747

Tidied up messages

Standardised Exception handler trap

Atom deleted whitespaces
2021-04-02 15:23:53 +02:00
PhantomVl e08e9b49b9
-- Bug Fix NTP Config 2021-04-02 15:23:53 +02:00
PhantomVl 30db2da52d
Fixes: #88
-- Bug Fix SRST Config
-- A template was added for 7975
2021-04-02 15:23:53 +02:00
PhantomVl 7268007ebd
-- Bug Fix SRST Config 2021-04-02 15:23:53 +02:00
PhantomVl 3bf8857759
-- Bug Fix Delete Empty Key 2021-04-02 15:23:53 +02:00
PhantomVl 7b48b289af
Fixes: #77
Fixes: #82
Fixes: #85
Fixes: #87
--- Bugfix sip protocol
Special thanks for help Diederik de Groot
2021-04-02 15:23:53 +02:00
PhantomVl f93b846dc1
--- Add support for setting "setvar=xxx=xxx" entries
--- Writing sccp.conf also check/create sccp_custom.conf #87
--- Fix the getCodec function. #85
--- Switching around the general deny/permit order. #82
--- Thank Josh2893 for the templet #77
Special thanks for help Diederik de Groot
2021-04-02 15:23:53 +02:00
PhantomVl 19e50dd4d9
-- Bug fix @BossLX 2021-04-02 15:23:53 +02:00
PhantomVl 8fc5fca817
-- Bug fix @BossLX 2021-04-02 15:23:53 +02:00
PhantomVl 8dc4f6b07c
-- Bug fix @BossLX 2021-04-02 15:23:52 +02:00
PhantomVl a3c240b63f
-- Bug fix issues/74 2021-04-02 15:23:52 +02:00
PhantomVl 1637731d99
-- Bug fix Thanks for the help @BossLX
-- Bug fix issues/73
2021-04-02 15:23:52 +02:00
PhantomVl 1e0e19cf26
-- Bug fix Thanks for the help @BossLX 2021-04-02 15:23:52 +02:00
PhantomVl 2f1cf6ca74
-- Bug fix 2021-04-02 15:23:52 +02:00
PhantomVl 6c0d37e25a
-- Bug fix
-- DB add field 'videomode'
2021-04-02 15:23:52 +02:00
PhantomVl 6740aab4f2
-- Bug fix
-- DB add field 'videomode'
2021-04-02 15:23:52 +02:00
PhantomVl 347f6f6702
-- Bug fix 2021-04-02 15:23:52 +02:00
PhantomVl 5cebb936c9
-- Bug fix 2021-04-02 15:23:52 +02:00
PhantomVl 14cb629f61
-- Added new features for the future (now disabled)
-- Changed time zone settings
-- Changed the list of supported codecs
-- Added the ability to specify the DNS name as the server interface
-- Bug Fix
-- Add Vendor Config Options
2021-04-02 15:23:51 +02:00
Diederik de Groot 6feed566d5
Fix get_server_sccp_bind when a bindaddr is specified in the frontend it should return an array of array indexed by the 'bindaddr'
Signed-off-by: Diederik de Groot <dkgroot@talon.nl>
2021-04-02 15:23:51 +02:00
Diederik de Groot 1afe5c5438
Fix Spelling Sccp_manager.class.php
Switch to using camelCase for functions in Sccp_manager.class.php
Remove old TODO comments
Remove comments that don't add information

Signed-off-by: Diederik de Groot <dkgroot@talon.nl>
2021-04-02 15:23:51 +02:00
Diederik de Groot de0a07562f
Ran: .......................................... 42 / 42 (100%)
No fixable errors were found

Time: 10.05 secs; Memory: 41.75MB
Signed-off-by: Diederik de Groot <dkgroot@talon.nl>
2021-04-02 15:23:44 +02:00
Diederik de Groot ca16773fa5
First round of spelling corrections
Signed-off-by: Diederik de Groot <dkgroot@talon.nl>
2021-04-02 15:23:27 +02:00
PhantomVl 413bcf1b38
-- Added new features for the future (now disabled)
-- Changed time zone settings
-- Changed the list of supported codecs
-- Added the ability to specify the DNS name as the server interface
2021-04-02 15:23:05 +02:00
Phantom 809c11fc0c
Update extconfigs.class.php 2021-04-02 15:23:05 +02:00
Phantom 5586e006c0
Update Sccp.class.php.v433 2021-04-02 15:23:05 +02:00
Phantom 3c7bd16342
Update Sccp.class.php.v431 2021-04-02 15:23:05 +02:00
PhantomVl f855b99bb7
- Fix not Bug 2021-04-02 15:23:05 +02:00
PhantomVl 3b33d83739
- Add Support "Callforward NOANSWER"
- Add Support "park"
2021-04-02 15:23:05 +02:00
PhantomVl c0990954e5
- Bug Fix Sip 2021-04-02 15:23:05 +02:00
PhantomVl 320da7b86f
- Bug Fix. Create addons information 2021-04-02 15:23:05 +02:00
PhantomVl bbe4b72fe7
- Button assignment form adjustment 2021-04-02 15:23:05 +02:00
PhantomVl 8121a69607
- New style of information message 2021-04-02 15:23:04 +02:00
PhantomVl 49aa1f0ecc
- Fix SCCP
- Fix SIP
2021-04-02 15:23:04 +02:00
PhantomVl b6bc649758
- Fix SCCP
- Fix SIP
2021-04-02 15:23:04 +02:00
PhantomVl 1905431be4
- ADD SIP TFTP
- Activate Dial Template
2021-04-02 15:23:04 +02:00
PhantomVl de7633ace7
- ADD SIP TFTP
- Activate Dial Template
2021-04-02 15:23:04 +02:00
PhantomVl f5c5d1f79e
- Change Sccp class driver 2021-04-02 15:23:04 +02:00
PhantomVl 4cd6d7958a
- Change Sccp class driver 2021-04-02 15:23:04 +02:00
PhantomVl 3f7c56a553
- Add Video codecs supported in Global config 2021-04-02 15:23:04 +02:00
PhantomVl 743d61d7eb
- Add Video codecs supported in Global config 2021-04-02 15:23:04 +02:00
PhantomVl 2e88b605bc
- Add Video codecs supported in Global config 2021-04-02 15:23:03 +02:00
PhantomVl 7f0ddf8f69
- Remove sccp_extensions.conf
- Remove sccp_hardware.conf
2021-04-02 15:23:03 +02:00
PhantomVl 180d832042
- Remove sccp_extensions.conf
- Remove sccp_hardware.conf
2021-04-02 15:23:03 +02:00
PhantomVl 8d92da8426
- Remove spaces and special characters from the name Softkey 2021-04-02 15:22:54 +02:00
PhantomVl 81d42b0b25
- Bug Fix 2021-04-02 15:22:30 +02:00
PhantomVl 2146a78e11
- Bug Fix 2021-04-02 15:22:30 +02:00
PhantomVl eac9efb5ee
- Add Buton "Update Buton Labels". If you replace User nams, this functon Regenerate device labels 2021-04-02 15:22:30 +02:00
PhantomVl 2031587f29
- Add Buton "Update Buton Labels". If you replace User nams, this functon Regenerate device labels 2021-04-02 15:22:29 +02:00
PhantomVl 06031ad89c
- Installation procedure, detect chan_sccp 2021-04-02 15:21:44 +02:00
PhantomVl 83ec52ea56
- Bug fix, provision sccp 2021-04-02 15:21:24 +02:00
PhantomVl 597bed3bce
- Create Cisco phone service for user mobility. 2021-04-02 15:20:55 +02:00
PhantomVl 23aad30d89
- Change Db Code page 2021-04-02 15:18:57 +02:00
PhantomVl e40adbaf00
- Change Version 2021-04-02 15:18:57 +02:00
PhantomVl 573a2c9811
Initial add of feature mobility user table:
- Add extra user fields and sccp_config entries
 - Create new buttonconfig table
 - Add PhoneCodepages like cp1251
 - Add BackUp Config before Install
2021-04-02 15:18:55 +02:00
PhantomVl 7582061645
Initial add of feature mobility user table:
- Add extra user fields and sccp_config entries
 - Create new buttonconfig table
 - Add PhoneCodepages like cp1251
 - Add BackUp Config before Install
2021-04-02 15:17:17 +02:00
PhantomVl f4d2396a3c
Initial add of feature mobility user table:
- Add extra user fields and sccp_config entries
 - Create new buttonconfig table
 - Add PhoneCodepages like cp1251
2021-04-02 15:16:33 +02:00
PhantomVl 713d588d98
Initial add of feature mobility user table:
- Add extra user fields and sccp_config entries
 - Create new buttonconfig table
2021-04-02 15:15:58 +02:00
steve-lad 45db467e5d Remove PHP % incompatible code 2021-04-02 13:17:33 +02:00
steve-lad 42717424a2 Update dbinterface.class.php
Correct syntax
2021-03-31 13:38:03 +02:00
steve-lad b79498dcb5 Fix Sccp Button Save
Correct PDO statements and implimentation concept
2021-03-29 16:22:15 +02:00
steve-lad e3116d39cb Update dbinterface.class.php
Check that labels exist before binding or an exception will occur
2021-03-24 08:59:13 +01:00
steve-lad 03dd9bed5a Correct string quoting
String quoting was incompatible with PHP 7
2021-03-23 07:08:36 +01:00
steve-lad 118ff43ec4 Update dbinterface.class.php
Bug fix
2021-03-18 07:12:59 +01:00
steve-lad fe6ff74608 Bug fixes
Correct SQL statement
Correct Message Handler
Correct Message interpreter
2021-03-17 09:48:20 +01:00
steve-lad f560a1e1be Remove tmp nfs files 2021-03-14 14:04:46 +01:00
steve-lad 815e56994b Update install.php
Populate sccpdevmodel if empty
2021-03-13 16:48:41 +01:00
steve-lad c24f6ad8d9 Merge Fix-dbinterface-class 2021-03-13 15:50:45 +01:00
steve-lad fdf6c2ae83 Merge branch 'Fix-dbinterface-class' into Issue-106 2021-03-13 15:50:17 +01:00
steve-lad da9517a335 Apply PR 101 2021-03-13 15:10:24 +01:00
steve-lad 7030ec2bb5 Migrate from global db object
As per FreePBX BMO, no longer use global db object
2021-03-13 14:58:30 +01:00
steve-lad 9ae3638d04 Correct type declarations
type declarations must be lowercase or will be treated as local instance names
2021-03-13 11:35:35 +01:00
steve-lad cc8eb549d0 Fix exception if sccpsettings table does not exist
Before the installer can create sccpsettings, FreePBX instantiates an SCCP_Manager object which requires sccpsettings.
Catch the exception and create the table
2021-03-13 11:21:12 +01:00
steve-lad 0f9ebb8cd1 Tidy up
Remove unused variables
Close socket if not using
2021-03-12 14:40:31 +01:00
steve-lad d5290f18cf Tighten Ami controls
Check that have compatible version of chan-sccp for AMI and disable AMI  if not found
Check returned values
Add new classes for response to reduce testing
2021-03-12 14:03:50 +01:00
steve-lad 2b07718c30 Correct Field and add new event classes
add 2 new event classes for SCCPShowDevice

correct translator in ShowSCCPDevice_Response
2021-02-28 13:33:41 +01:00
steve-lad 6e2101d4fd Tidy up exception handling
Simplify handling of AMI lists and trap exceptions
2021-02-27 10:00:26 +01:00
steve-lad c6c2134e03 Bug Fixes and optimisations as a result of issue 106
Fix bugs in Response Class causing exceptions
Update extconfigs class to correctly check database connectors and improve feedback
Move some constructors to start of class for lisibility
Tidy up Response class with Typing to eliminate unnecessary tests
2021-02-24 15:22:04 +01:00
steve-lad 3362f5a7cf Update dbinterface.class.php 2021-02-11 15:01:57 +01:00
steve-lad 80923f5ce1 Remove dbugs 2021-02-11 12:52:08 +01:00
steve-lad 6bfa311281 Final version
Standardise some calls and add notes
2021-02-11 12:46:37 +01:00
steve-lad 63e5be2cce Merge branch 'Fix-dbinterface-class' of https://github.com/steve-lad/sccp_manager into Fix-dbinterface-class 2021-02-11 12:41:05 +01:00
steve-lad 73ea3023eb Use bindParam on db executes
Use bind param to have stricter typing

Fix bug in Sccp-Manager where key and keyword were not the same
2021-02-09 12:48:22 +01:00
steve-lad 7d7b8cdd05 Update Transactions and fix errors
Reduce quoting level, and fix errors introduced by prior commits
2021-02-09 12:48:22 +01:00
steve-lad 124f7052eb Further clean ups and annotations
Document changes
2021-02-09 12:48:22 +01:00
steve-lad 22a4eb6e9e Cleaning up
Simplify structure and fix errors
2021-02-09 12:45:37 +01:00
steve-lad 5e5633ed7b Switch to PDO model
Switch to PDO model and correct transactions
2021-02-09 12:45:37 +01:00
steve-lad 7993eec487 Test for chan_sccp_b version compatibility
SoftKeySets fails with chan_sccp-b prior to revision number 11048.

Check the version with the installer, and subsequently to ensure do not get exception.
2021-02-09 12:45:36 +01:00
steve-lad b3d31b669a Fix assignment sccp_compatible
Sccpvalues key and keyword must be same or causes hidden DB warnings because of duplicate primary keys after write / read / write
2021-02-09 12:43:26 +01:00
steve-lad 175346c2c1 Use bindParam on db executes
Use bind param to have stricter typing

Fix bug in Sccp-Manager where key and keyword were not the same
2021-02-09 12:31:06 +01:00
steve-lad 89d4e45f5e Update Transactions and fix errors
Reduce quoting level, and fix errors introduced by prior commits
2021-02-08 17:41:19 +01:00
steve-lad 6664ab97af Further clean ups and annotations
Document changes
2021-02-08 15:27:35 +01:00
steve-lad 1972e53eef Merge branch 'Fix-dbinterface-class' of https://github.com/steve-lad/sccp_manager into Fix-dbinterface-class 2021-02-08 10:24:02 +01:00
steve-lad 22e1939ace Cleaning up
Simplify structure and fix errors
2021-02-07 16:09:35 +01:00
steve-lad c104b0e8fe Switch to PDO model
Switch to PDO model and correct transactions
2021-02-07 15:02:45 +01:00
steve-lad c1fb9370bd Test for chan_sccp_b version compatibility
SoftKeySets fails with chan_sccp-b prior to revision number 11048.

Check the version with the installer, and subsequently to ensure do not get exception.
2021-02-07 14:48:49 +01:00
steve-lad 14199fca2e Switch to PDO model
Switch to PDO model and correct transactions
2021-02-06 17:26:37 +01:00
PhantomVl 96c9a82819 - Remove sccp_extensions.conf
- Remove sccp_hardware.conf
2019-07-08 15:47:08 +03:00
PhantomVl 898240e1d4 - Remove spaces and special characters from the name Softkey 2019-05-29 20:49:50 +03:00
PhantomVl d3aa9b7388 - Installation procedure, detect chan_sccp 2019-04-26 10:17:09 +03:00
Phantom f9bd447869
Merge pull request #36 from dkgroot/develop
Fix links in README.md / READMe.ru.md
2019-04-26 10:10:36 +03:00
PhantomVl 6e81e98dbb - Installation procedure, detect chan_sccp 2019-04-26 09:46:55 +03:00
Diederik de Groot 8b8778f746 Fix links in README.md / READMe.ru.md 2019-04-25 16:42:46 +02:00
PhantomVl 83169b5160 - Bug fix, provision sccp 2019-04-23 14:11:20 +03:00
PhantomVl c8182b6f8e - Change Db Code page 2019-04-02 15:00:38 +03:00
PhantomVl 3daa41135f - Bugfix
- Add Code Page
 - update install
2019-04-02 14:52:23 +03:00
PhantomVl a943aa4b96 - Bugfix
- Add Code Page
2019-04-01 14:11:42 +03:00
PhantomVl c38d42db98 Bugfix 2019-04-01 13:20:15 +03:00
83 changed files with 12080 additions and 15317 deletions

124
README.md
View file

@ -1,59 +1,56 @@
## Welcome to Develop Chan_SCCP GUI Manager for FreePBX
| [English](README.md) | [Russian](README.ru.md) | [OLD Stable Release](https://github.com/PhantomVl/sccp_manager/tree/master)
| [English :gb:/:us:](README.md) | [Russian :ru:](README.ru.md) | [Previous Stable Releases](https://github.com/PhantomVl/sccp_manager/tree/master)
![Gif](https://github.com/PhantomVl/sccp_manager/raw/develop/.dok/image/Demo_1s5.gif)
![Gif](https://github.com/chan-sccp/sccp_manager/raw/develop/.dok/image/Demo_1s5.gif)
* [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)
* [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)
## Link
[![Download Sccp-Mamager](https://img.shields.io/badge/SccpGUI-build-ff69b4.svg)](https://github.com/PhantomVl/sccp_manager/archive/master.zip)
[![Download Sccp-Mamager](https://img.shields.io/badge/SccpGUI-build-ff69b4.svg)](https://github.com/chan-sccp/sccp_manager/archive/tarball/develop)
[![Download Chan-SCCP channel driver for Asterisk](https://img.shields.io/sourceforge/dt/chan-sccp-b.svg)](https://github.com/chan-sccp/chan-sccp/releases/latest)
[![Chan-SCCP Documentation] (https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/chan-sccp/chan-sccp/wiki)
[![Chan-SCCP Documentation](https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/chan-sccp/chan-sccp/wiki)
This FreePBX module has been developed to help IT Staff with their Asterisk-Cisco infrastructure deployment,
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
on chan-sccp, so having the same repository will help improve integration.
This module has been developed to help IT Staff with their Asterisk-Cisco infrastructure deployment,
providing easily provisioning and managing Cisco IP phones and extensions in a similar way as it does with Cisco CallManager.
The idea of creating a module is borrowed from (https://github.com/Cynjut/SCCP_Manager)
SCCP Manager is free software. Please see the file COPYING for details.
This module has been developed to help IT Staff with their Asterisk-Cisco infrastructure deployment,
providing easily provisioning and managing Cisco IP phones and extensions in a similar way as it does with Cisco CallManager.
This module will suit you if you are planing the to migrate from CallManager to Asterisk (or did it), SCCP-Manager allows you to administer SCCP extensions and a wide range of Cisco phone types (including IP Communicator).
This module will suit you if you are planing the to migrate from CallManager to Asterisk (or have already done it). SCCP-Manager allows you to administer
SCCP extensions and a wide range of Cisco phone types (including IP Communicator).
You can control phone buttons (depending on the phone model) assigning multiple lines, speeddials and BLFs.
And you can use the driver functions "sccp_chain" from the GUI module.
### Wiki
You can find more information and documentation on our [![SCCP Manager Wiki](https://img.shields.io/badge/Wiki-new-blue.svg)](https://github.com/PhantomVl/sccp_manager/wiki)
You can find more information and documentation on our [![SCCP Manager Wiki](https://img.shields.io/badge/Wiki-new-blue.svg)](https://github.com/chan-sccp/wiki)
## 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
- pbx:
- asterisk >= 1.8 (absolute minimum & not recommended)
- asterisk >= 13.7 or asterisk >= 14.0 recommended
- gui:
- freepbx >= 13.0.192
- standard posix compatible applications like sed, awk, tr
- 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.1 (or later) channel driver for Asterisk: [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/Building-and-Installation-Guide)
- expected configure flags:
- 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"
- You will need the phone settings templates. You can use the templates taken from the distribution "chan-sccp"
```cp /usr/src/chan-sccp/conf/tftp/\*.xml\* /tftpboot/templates/```
- configure DHCP server [See our WIKI] (https://github.com/chan-sccp/chan-sccp/wiki/setup-dhcp-service)
- configure DHCP server [See our WIKI](https://github.com/chan-sccp/chan-sccp/wiki/setup-dhcp-service)
Important!
@ -65,35 +62,60 @@ 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
1. Goto to module into your local system. (/var/www/html/admin/modules/sccp_manager/)
> cd /var/www/html/admin/modules/sccp_manager/
> git fetch
> git pull
> git checkout extension_mobility
> or
> git checkout develop
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
```
### IMPORTANT NOTES:
- !!! If something stops working, use the master branch [master](https://github.com/PhantomVl/sccp_manager/tree/master)
!!! master branch does not support changes into chan-sccp made after October 2018.
- This system assumes/requires that you are using the Asterisk realtime database. If you are not yet using the realtime database,
### IMPORTANT NOTES:
- 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)
- You can use cisco language profiles (localization) to switch the phones to your locale.
### Chat
[![Gitter](https://badges.gitter.im/chan-sccp/chan-sccp.svg)](https://gitter.im/sccp_manager/community)

View file

@ -1,99 +1,118 @@
## Welcome to Develop Chan_SCCP GUI Manager for FreePBX
| [English](README.md) | [Russian](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)
![Gif](https://github.com/PhantomVl/sccp_manager/raw/develop/.dok/image/Demo_1s5.gif)
![Gif](https://github.com/chan-sccp/sccp_manager/raw/develop/.dok/image/Demo_1s5.gif)
* [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)
* [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)
## Link
[![Download Sccp-Mamager](https://img.shields.io/badge/SccpGUI-build-ff69b4.svg)](https://github.com/PhantomVl/sccp_manager/archive/master.zip)и традиционно добалены новые баги
[![Download Sccp-Mamager](https://img.shields.io/badge/SccpGUI-build-ff69b4.svg)](https://github.com/chan-sccp/sccp_manager/archive/tarball/develop)
[![Download Chan-SCCP channel driver for Asterisk](https://img.shields.io/sourceforge/dt/chan-sccp-b.svg)](https://github.com/chan-sccp/chan-sccp/releases/latest)
[![Chan-SCCP Documentation] (https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/chan-sccp/chan-sccp/wiki)
[![Chan-SCCP Documentation](https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/chan-sccp/chan-sccp/wiki)
### История
Корни идея создания этого проекта лежат в несовершенстве уже существующего и заброшенного проекта.
Для желающих попробовать себя на просторах программирования ссылка на проект (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 - Основные Инструкции по настройке
Вся документация лежит на Вики [![SCCP Manager Wiki](https://img.shields.io/badge/Wiki-new-blue.svg)](https://github.com/PhantomVl/sccp_manager/wiki)
Вся документация по проекту пока лежит на старой Вики [![SCCP Manager Wiki](https://img.shields.io/badge/Wiki-new-blue.svg)](https://github.com/PhantomVl/sccp_manager/wiki)
Вся документация по драйверу Chan-SCCP [![SCCP Manager Wiki](https://img.shields.io/badge/Wiki-new-blue.svg)](https://github.com/chan-sccp/wiki)
Ну и как водится у на SCCP Manager это бесплатное дополнение. И помни "(C)" означает "Копия верна". Please see the file COPYING for details.
### Prerequisites - как говориться все, что хуже этого возможно работать тоже будет .... но только вопрос как ?
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)
- Возможно, ты найдешь, то, что ищешь, в проекте (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)
### Chat
[![Gitter](https://badges.gitter.im/chan-sccp/chan-sccp.svg)](https://gitter.im/sccp_manager/community)

File diff suppressed because it is too large Load diff

View file

@ -1,181 +0,0 @@
<?php
/**
*
* Core Comsnd Interface
*
* https://www.voip-info.org/asterisk-manager-example-php/
*/
/* !TODO!: Re-Indent this file. -TODO-: What do you mean? coreaccessinterface ?? */
namespace FreePBX\modules\Sccp_manager\aminterface;
// ************************************************************************** Event *********************************************
abstract class Event extends IncomingMessage
{
protected $_events;
public function getName()
{
return $this->getKey('Event');
}
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->_events = array();
$this->_eventsCount = 0;
// $this->_completed = !$this->isList();
}
}
class UnknownEvent extends Event
{
public function __construct($rawContent = '')
{
print_r($rawContent);
// die();
}
}
class TableStart_Event extends Event
{
public function getTableName()
{
return $this->getKey('TableName');
}
}
class TableEnd_Event extends Event
{
public function getTableName()
{
return $this->getKey('TableName');
}
}
class SCCPSoftKeySetEntry_Event extends Event
{
protected $_data;
public function __construct($rawContent)
{
parent::__construct($rawContent);
return null;
}
}
class SCCPShowSoftKeySetsComplete_Event extends Event
{
public function getListItems()
{
return intval($this->getKey('ListItems'));
}
}
class ExtensionStatus_Event extends Event
{
public function getPrivilege()
{
return $this->getKey('Privilege');
}
public function getExtension()
{
return $this->getKey('Exten');
}
public function getContext()
{
return $this->getKey('Context');
}
public function getHint()
{
return $this->getKey('Hint');
}
public function getStatus()
{
return $this->getKey('Status');
}
}
class SCCPDeviceEntry_Event extends Event
{
}
class SCCPShowDeviceComplete_Event extends Event
{
public function getListItems()
{
return intval($this->getKey('ListItems'));
}
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->_completed = $this->getKey('EventList');
// return null;
}
}
class SCCPShowDevice_Event extends Event
{
public function getCapabilities()
{
$ret = array();
$codecs = explode(", ", substr($this->getKey('Capabilities'), 1, -1));
foreach ($codecs as $codec) {
$codec_parts = explode(" ", $codec);
$ret[] = array("name" => $codec_parts[0], "value" => substr($codec_parts[1], 1, -1));
}
return $ret;
}
public function getCodecsPreference()
{
$ret = array();
$codecs = explode(", ", substr($this->getKey('CodecsPreference'), 1, -1));
foreach ($codecs as $codec) {
$codec_parts = explode(" ", $codec);
$ret[] = array("name" => $codec_parts[0], "value" => substr($codec_parts[1], 1, -1));
}
return $ret;
}
}
class SCCPShowDevicesComplete_Event extends Event
{
public function getListItems()
{
return intval($this->getKey('ListItems'));
}
}
class SCCPDeviceButtonEntry_Event extends Event
{
}
class SCCPDeviceLineEntry_Event extends Event
{
}
class SCCPDeviceStatisticsEntry_Event extends Event
{
}
class SCCPDeviceSpeeddialEntry_Event extends Event
{
}
class ExtensionStateListComplete_Event extends Event
{
}

View file

@ -1,499 +0,0 @@
<?php
/**
*
* Core Comsnd Interface
*
* https://www.voip-info.org/asterisk-manager-example-php/
*/
/* !TODO!: Re-Indent this file. -TODO-: What do you mean? coreaccessinterface ?? */
namespace FreePBX\modules\Sccp_manager\aminterface;
// ************************************************************************** Response *********************************************
namespace FreePBX\modules\Sccp_manager\aminterface;
abstract class Response extends IncomingMessage
{
protected $_events;
protected $_completed;
protected $keys;
public function isComplete()
{
return $this->_completed;
}
public function __sleep()
{
$ret = parent::__sleep();
$ret[] = '_completed';
$ret[] = '_events';
return $ret;
}
public function addEvent($event)
{
$this->_events[] = $event;
if (stristr($event->getEventList(), 'complete') !== false
|| stristr($event->getName(), 'complete') !== false
|| stristr($event->getName(), 'DBGetResponse') !== false
) {
$this->_completed = true;
}
}
public function getEvents()
{
return $this->_events;
}
public function isSuccess()
{
return stristr($this->getKey('Response'), 'Error') === false;
}
public function isList()
{
return
stristr($this->getKey('EventList'), 'start') !== false
|| stristr($this->getMessage(), 'follow') !== false
;
}
public function getMessage()
{
return $this->getKey('Message');
}
public function setActionId($actionId)
{
$this->setKey('ActionId', $actionId);
}
public function getVariable($_rawContent, $_fields = '')
{
$lines = explode(Message::EOL, $_rawContent);
foreach ($_fields as $key => $value) {
foreach ($lines as $data) {
$_pst = strpos($data, $value);
if ($_pst !== false) {
$this->setKey($key, substr($data, $_pst + strlen($value)));
}
}
}
}
public function __construct($rawContent)
{
parent::__construct($rawContent);
$this->_events = array();
$this->_eventsCount = 0;
$this->_completed = !$this->isList();
}
}
//****************************************************************************
class Generic_Response extends Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
// print_r('<br>---- r --<br>');
// print_r($rawContent);
}
}
class Login_Response extends Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
return $this->isSuccess();
}
}
class Command_Response extends Response
{
private $_temptable;
public function __construct($rawContent)
{
// print_r('<br>---- r --<br>');
// print_r($rawContent);
// print_r('<br>---- re --<br>');
$this->_temptable = array();
parent::__construct($rawContent);
$lines = explode(Message::EOL, $rawContent);
foreach ($lines as $line) {
$content = explode(':', $line);
if (is_array($content)) {
switch (strtolower($content[0])) {
case 'actionid':
$this->_temptable['ActionID'] = trim($content[1]);
break;
case 'response':
$this->_temptable['Response'] = trim($content[1]);
break;
case 'privilege':
$this->_temptable['Privilege'] = trim($content[1]);
break;
case 'output':
// included for backward compatibility with earlier versions of chan_sccp_b. AMI api does not precede command output with Output
$this->_temptable['Output'] = explode(PHP_EOL,str_replace(PHP_EOL.'--END COMMAND--', '',trim($content[1])));
break;
default:
$this->_temptable['Output'] = explode(PHP_EOL,str_replace(PHP_EOL.'--END COMMAND--', '', trim($line)));
break;
}
}
}
/* Not required $_temptable cannot be empty as has at least an actionID - see also getResult
if (!empty($this->_temptable)) {
$this->setKey('output', 'array');
}
*/
$this->_completed = $this->isSuccess();
// return $this->isSuccess();
}
public function getResult()
{
/* Below test no longer valid as key no longer set
if (stristr($this->getKey('output'), 'array') !== false) {
$result = $this->_temptable;
} else {
$result = $this->getMessage();
}
*/ return $this->_temptable;
}
}
class SCCPGeneric_Response extends Response
{
protected $_tables;
private $_temptable;
public function addEvent($event)
{
// not eventlist (start/complete)
// print_r('<br>---- addEvent --<br>');
// print_r($event);
// print_r('<br>---- Event List--<br>');
// print_r($event->getEventList());
// Nothing to do with this - we need a table start
if (stristr($event->getEventList(), 'start')) { return; }
// This is empty as soon as we have received a TableStart.
// The next message is the first of the data sets
// We use this variable in the switch to add set entries
if ( empty($thisSetEventEntryType)) {
if (strpos($event->getName(), 'Entry')) {
$thisSetEventEntryType = $event->getName();
} else {
$thisSetEventEntryType = 'undefinedAsThisIsNotASet';
}
}
$unknownevent = "FreePBX\\modules\\Sccp_manager\\aminterface\\UnknownEvent";
if (!($event instanceof $unknownevent)) {
switch ( $event->getName()) {
case $thisSetEventEntryType :
$this->_temptable['Entries'][] = $event;
break;
case 'TableStart':
//initialise
$this->_temptable = array();
$this->_temptable['Name'] = $event->getTableName();
$this->_temptable['Entries'] = array();
$thisSetEventEntryType = '';
break;
case 'TableEnd':
//Close
if (!is_array($this->_tables)) {
$this->_tables = array();
}
$this->_tables[$event->getTableName()] = $this->_temptable;
unset($this->_temptable);
$thisSetEventEntryType = '';
// Finished the table. Now check to see if everything was received
// If counts do not match return false and table will not be
//loaded
if ($event->getKey('TableEntries') != count($this->_tables[$event->getTableName()]['Entries'])) {
return $this->_completed = false;
}
break;
default:
// add regular event
$this->_events[] = $event;
}
} else {
// add unknown event
$this->_events[] = $event;
}
// Received a complete eventList outside of a table.
if (stristr($event->getEventList(), 'complete') || stristr($event->getName(), 'complete')) {
return $this->_completed = true;
}
}
protected function ConvertTableData($_tablename, $_fkey, $_fields)
{
$_rawtable = $this->Table2Array($_tablename);
$result = array();
// Check that there is actually data to be converted
if (empty($_rawtable)) { return $result;}
foreach ($_rawtable as $_row) {
$all_key_ok = true;
if (is_array($_fkey)) {
foreach ($_fkey as $_fid) {
if (empty($_row[$_fid])) {
$all_key_ok = false;
} else {
$set_name[$_fid] = $_row[$_fid];
}
}
} else {
if (empty($_row[$_fkey])) {
$all_key_ok = false;
} else {
$set_name[$_fkey] = $_row[$_fkey];
}
}
$Data = &$result;
if ($all_key_ok) {
foreach ($set_name as $value_id) {
$Data = &$Data[$value_id];
}
foreach ($_fields as $value_key => $value_id) {
$Data[$value_id] = $_row[$value_key];
}
}
}
return $result;
}
protected function ConvertEventData($_fkey, $_fields)
{
$result = array();
foreach ($this->_events as $_row) {
$all_key_ok = true;
$tmp_result = $_row->getKeys();
$set_name = array();
if (is_array($_fkey)) {
foreach ($_fkey as $_fid) {
if (empty($tmp_result[$_fid])) {
$all_key_ok = false;
} else {
$set_name[$_fid] = $tmp_result[$_fid];
}
}
} else {
if (empty($tmp_result[$_fkey])) {
$all_key_ok = false;
} else {
$set_name[$_fkey] = $tmp_result[$_fkey];
}
}
$Data = &$result;
if ($all_key_ok) {
foreach ($set_name as $value_id) {
$Data = &$Data[$value_id];
}
foreach ($_fields as $value_id) {
$Data[$value_id] = $tmp_result[$value_id];
}
}
}
return $result;
}
public function hasTable()
{
if (is_array($this->_tables)) {
return true;
}
return false;
}
public function getTableNames()
{
return (is_array($this->_tables)) ? array_keys($this->_tables) : null;
}
public function Table2Array($tablename = '')
{
$result =array();
if (!is_string($tablename) || empty($tablename)) {
return false;
}
if ($this->hasTable()) {
foreach ($this->_tables[$tablename]['Entries'] as $trow) {
$result[]= $trow->getKeys();
}
return $result;
} else {
return false;
}
}
public function Events2Array()
{
$result =array();
if (is_array($this->_events)) {
foreach ($this->_events as $trow) {
$tmp_result = $trow->getKeys();
if (is_array($tmp_result)) {
$result = array_merge($result, $tmp_result);
} else {
$result [] = $tmp_result;
}
}
return $result;
} else {
return false;
}
}
public function getTable($tablename)
{
if ($this->hasTable() && array_key_exists($tablename, $this->_tables)) {
return $this->_tables[$tablename];
}
throw new PAMIException("No such table.");
}
public function getJSON()
{
if (strlen($this->getKey('JSON')) > 0) {
if (($json = json_decode($this->getKey('JSON'), true)) != false) {
return $json;
}
}
throw new AMIException("No JSON Key found to return.");
}
public function __construct($rawContent)
{
parent::__construct($rawContent);
$_fields = array("EventList" => "EventList:", "Message" => "Message:");
// $this->getVariable($rawContent, $_fields);
$this->_completed = !$this->isList();
}
public function getResult()
{
if ($this->getKey('JSON') != null) {
$result = $this->getJSON();
} else {
$result = $this->getMessage();
}
return $result;
}
}
class SCCPJSON_Response extends Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
$_fields = array("DataType" => "DataType:", "JSONRAW" => "JSON:");
$this->getVariable($rawContent, $_fields);
$js_res = $this->getKey('JSONRAW');
if (isset($js_res)) {
$this->setKey('Response', 'Success');
}
return $this->isSuccess();
}
}
class SCCPShowSoftkeySets_Response extends SCCPGeneric_Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
}
public function getResult()
{
$_fields = array('description'=>'description','label'=>'label','lblid'=>'lblid');
$result = $this->ConvertTableData('SoftKeySets', array('set','mode'), $_fields);
return $result;
}
}
class SCCPShowDevices_Response extends SCCPGeneric_Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
}
public function getResult()
{
$_fields = array('mac'=>'mac','address'=>'address','descr'=>'descr','regstate'=>'status',
'token'=>'token','act'=>'act', 'lines'=>'lines','nat'=>'nat','regtime'=>'regtime');
$result = $this->ConvertTableData('Devices', array('mac'), $_fields);
return $result;
}
}
class SCCPShowDevice_Response extends SCCPGeneric_Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
}
public function getResult()
{
$result = array();
$result = $this->Events2Array();
$result['Buttons'] = $this->ConvertTableData(
'Buttons',
array('id'),
array('id'=>'id','channelobjecttype'=>'channelobjecttype','inst'=>'inst',
'typestr'=>'typestr',
'type'=>'type',
'pendupdt'=>'pendupdt',
'penddel'=>'penddel',
'default'=>'default')
);
$result['SpeeddialButtons'] = $this->ConvertTableData(
'Buttons',
array('id'),
array('id'=>'id','channelobjecttype'=>'channelobjecttype','name'=>'name','number'=>'number','hint'=>'hint')
);
$result['CallStatistics'] = $this->ConvertTableData(
'CallStatistics',
array('type'),
array('type'=>'type','channelobjecttype'=>'channelobjecttype','calls'=>'calls','pcktsnt'=>'pcktsnt','pcktrcvd'=>'pcktrcvd',
'lost'=>'lost','jitter'=>'jitter','latency'=>'latency', 'quality'=>'quality','avgqual'=>'avgqual','meanqual'=>'meanqual',
'maxqual'=>'maxqual',
'rconceal'=>'rconceal',
'sconceal'=>'sconceal')
);
$result['SCCP_Vendor'] = array('vendor' => strtok($result['skinnyphonetype'], ' '), 'model' => strtok('('),
'model_id' => strtok(')'), 'vendor_addon' => strtok($result['configphonetype'], ' '),
'model_addon' => strtok(' '));
if (empty($result['SCCP_Vendor']['vendor']) || $result['SCCP_Vendor']['vendor'] == 'Undefined') {
$result['SCCP_Vendor'] = array('vendor' => 'Undefined', 'model' => $result['configphonetype'],
'model_id' => '', 'vendor_addon' => $result['SCCP_Vendor']['vendor_addon'],
'model_addon' => $result['SCCP_Vendor']['model_addon']);
}
$result['MAC_Address'] =$result['macaddress'];
return $result;
}
}
class ExtensionStateList_Response extends SCCPGeneric_Response
{
public function __construct($rawContent)
{
parent::__construct($rawContent);
}
public function getResult()
{
$result = $this->ConvertEventData(array('exten','context'), array('exten','context','hint','status','statustext'));
return $result;
}
}

View file

@ -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;
}
}

View file

@ -1,399 +0,0 @@
<?php
/**
*
* Core Comsnd Interface
*
*
*/
namespace FreePBX\modules\Sccp_manager;
class dbinterface
{
private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct($parent_class = null)
{
$this->paren_class = $parent_class;
}
public function info()
{
$Ver = '13.0.2';
return array('Version' => $Ver,
'about' => 'Data access interface ver: ' . $Ver);
}
/*
* Core Access Function
*/
public function get_db_SccpTableByID($dataid, $data = array(), $indexField = '')
{
$resut = array();
$raw = $this->HWextension_db_SccpTableData($dataid, $data);
if (empty($raw) || empty($indexField)) {
return $raw;
}
foreach ($raw as $value) {
$id = $value[$indexField];
$resut[$id] = $value;
}
return $resut;
}
public function HWextension_db_SccpTableData($dataid, $data = array())
{
if ($dataid == '') {
return false;
}
switch ($dataid) {
case "SccpExtension":
if (empty($data['name'])) {
$sql = "SELECT * FROM `sccpline` ORDER BY `name`";
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
} else {
$sql = "SELECT * FROM `sccpline` WHERE `name`='" . $data['name']. "'";
;
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
}
break;
case "SccpDevice":
$filtred ='';
$singlrow = false;
if (empty($data['fields'])) {
$fld = '`name`,`name` as `mac`, `type`, `button`, `addon`, `_description` as description';
} else {
switch ($data['fields']) {
case "all":
$fld ='*';
break;
case "sip_ext":
$fld ='button as sip_lines, description as description, addon';
break;
default:
$fld = $data['fields'];
break;
}
}
if (!empty($data['name'])) {
$filtred = "`name`='" . $data['name']. "'";
;
$singlrow = true;
}
if (!empty($data['type'])) {
switch ($data['type']) {
case "cisco-sip":
$filtred = "`TYPE` LIKE '%-sip'";
break;
case "cisco":
default:
$filtred = "`TYPE` not LIKE '%-sip'";
break;
}
}
if (empty($filtred)) {
$sql = "SELECT ". $fld ." FROM `sccpdeviceconfig` ORDER BY `name`";
} else {
$sql = "SELECT ". $fld ." FROM `sccpdeviceconfig` WHERE ".$filtred." ORDER BY `name`";
}
if ($singlrow) {
$raw_settings = sql($sql, "getRow", DB_FETCHMODE_ASSOC);
} else {
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
}
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_colums_sccpdevice":
$sql = "DESCRIBE sccpdevice";
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
break;
case "get_colums_sccpuser":
$sql = "DESCRIBE sccpuser";
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
break;
case "get_sccpdevice_byid":
$sql = 'SELECT t1.*, types.dns, types.buttons, types.loadimage, types.nametemplate as nametemplate, '
. 'addon.buttons as addon_buttons FROM sccpdevice AS t1 '
. 'LEFT JOIN sccpdevmodel as types ON t1.type=types.model '
. 'LEFT JOIN sccpdevmodel as addon ON t1.addon=addon.model WHERE name="' . $data['id'] . '";';
$raw_settings = sql($sql, "getRow", DB_FETCHMODE_ASSOC);
break;
case "get_sccpuser":
$sql = "SELECT * FROM `sccpuser` ";
if (!empty($data['id'])) {
$sql .= 'WHERE name="' . $data['id'] . '" ';
}
$sql .= "ORDER BY `name`;";
$raw_settings = sql($sql, "getRow", DB_FETCHMODE_ASSOC);
break;
case "get_sccpdevice_buttons":
$sql = '';
if (!empty($data['buttontype'])) {
$sql .= 'buttontype="' . $data['buttontype'] . '" ';
}
if (!empty($data['id'])) {
$sql .= (empty($sql)) ? 'ref="' . $data['id'] . '" ' : 'and ref="' . $data['id'] . '" ';
}
if (!empty($sql)) {
$sql = 'SELECT * FROM sccpbuttonconfig WHERE ' .$sql. 'ORDER BY `instance`;';
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
} else {
$raw_settings = array();
}
break;
}
return $raw_settings;
}
public function get_db_SccpSetting()
{
$sql = "SELECT `keyword`, `data`, `type`, `seq` FROM `sccpsettings` ORDER BY `type`, `seq`";
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
return $raw_settings;
}
public function get_db_sysvalues()
{
$sql = "SHOW VARIABLES LIKE '%group_concat%'";
$raw_settings = sql($sql, "getRow", DB_FETCHMODE_ASSOC);
return $raw_settings;
}
/*
* Get Sccp Device Model information
*/
function getDb_model_info($get = "all", $format_list = "all", $filter = array())
{
global $db;
switch ($format_list) {
case "model":
$sel_inf = "model, vendor, dns, buttons";
break;
case "all":
default:
$sel_inf = "*";
break;
}
$sel_inf .= ", '0' as 'validate'";
switch ($get) {
case "byciscoid":
if (!empty($filter)) {
if (!empty($filter['model'])) {
if (strpos($filter['model'], 'loadInformation')) {
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`loadinformationid` ='" . $filter['model'] . "') ORDER BY model ";
} else {
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`loadinformationid` ='loadInformation" . $filter['model'] . "') ORDER BY model ";
}
} else {
// $sql = "SELECT ".$filter['model'];
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel ORDER BY model ";
}
break;
}
break;
case "byid":
if (!empty($filter)) {
if (!empty($filter['model'])) {
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`model` ='" . $filter['model'] . "') ORDER BY model ";
} else {
// $sql = "SELECT ".$filter['model'];
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel ORDER BY model ";
}
break;
}
break;
case "extension":
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (dns = 0) and (enabled > 0) ORDER BY model ";
break;
case "enabled":
case "phones":
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (dns > 0) and (enabled > 0) ORDER BY model ";
// $sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (enabled > 0) ORDER BY model ";
break;
case "ciscophones":
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (dns > 0) and (enabled > 0) AND `vendor` not LIKE '%-sip' ORDER BY model ";
// $sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (enabled > 0) ORDER BY model ";
break;
case "sipphones":
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (dns > 0) and (enabled > 0) AND `vendor` LIKE '%-sip' ORDER BY model ";
// $sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (enabled > 0) ORDER BY model ";
break;
case "all":
default:
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel ORDER BY model ";
break;
}
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
return $raw_settings;
}
function write($db_name = "", $save_value = array(), $mode = 'update', $key_fld = "", $hwid = "")
{
// mode clear - Empty tabele before update
// mode update - update / replace record
global $db;
// global $amp_conf;
$result = "Error";
$delete_value = array();
switch ($db_name) {
case 'sccpsettings':
foreach ($save_value as $key_v => $data) {
if (!empty($data)) {
if (isset($data[1])) {
if ($data[1] == $this->val_null) {
$delete_value[] = $save_value[$key_v]['keyword'];
unset($save_value[$key_v]);
}
}
if (isset($data['data'])) {
if ($data['data'] == $this->val_null) {
$delete_value[] = $save_value[$key_v]['keyword'];
unset($save_value[$key_v]);
}
}
}
}
if ($mode == 'clear') {
$sql = 'truncate `sccpsettings`';
$stmt = $db->prepare($sql);
$stmt->execute();
$stmt = $db->prepare('INSERT INTO `sccpsettings` (`keyword`, `data`, `seq`, `type`) VALUES (?,?,?,?)');
$result = $db->executeMultiple($stmt, $save_value);
} else {
if (!empty($delete_value)) {
$stmt = $db->prepare('DELETE FROM `sccpsettings` WHERE `keyword`=?');
$result = $db->executeMultiple($stmt, $delete_value);
}
if (!empty($save_value)) {
$stmt = $db->prepare('REPLACE INTO `sccpsettings` (`keyword`, `data`, `seq`, `type`) VALUES (?,?,?,?)');
$result = $db->executeMultiple($stmt, $save_value);
}
}
break;
case 'sccpdevmodel':
case 'sccpdevice':
case 'sccpuser':
$sql_db = $db_name;
$sql_key = "";
$sql_var = "";
foreach ($save_value as $key_v => $data) {
if (!empty($sql_var)) {
$sql_var .= ', ';
}
if ($data === $this->val_null) {
$sql_var .= '`' . $key_v . '`=NULL';
} else {
$sql_var .= '`' . $key_v . '`="' . $data . '"';
}
if ($key_fld == $key_v) {
$sql_key = '`' . $key_v . '`="' . $data . '"';
}
}
if (!empty($sql_var)) {
if ($mode == 'delete') {
$req = 'DELETE FROM `' . $sql_db . '` WHERE ' . $sql_key . ';';
} else {
if ($mode == 'update') {
$req = 'UPDATE `' . $sql_db . '` SET ' . $sql_var . ' WHERE ' . $sql_key . ';';
} else {
$req = 'REPLACE INTO `' . $sql_db . '` SET ' . $sql_var . ';';
}
}
}
$stmt = $db->prepare($req);
$result = $stmt->execute();
break;
case 'sccpbuttons':
if (($mode == 'clear') || ($mode == 'delete')) {
$sql = 'DELETE FROM `sccpbuttonconfig` WHERE ref="' . $hwid . '";';
$stmt = $db->prepare($sql);
$stmt->execute();
}
if ($mode == 'delete') {
break;
}
if (empty($save_value)) {
break;
}
if ($mode == 'replace') {
$sql = 'UPDATE `sccpbuttonconfig` SET `name`=? WHERE `ref`= ? AND `reftype`=? AND `instance`=? AND `buttontype`=?;';
// $sql = 'INSERT INTO `sccpbuttonconfig` (`ref`, `reftype`,`instance`, `buttontype`, `name`, `options`) VALUES (?,?,?,?,?,?);';
// die(print_r($save_value,1));
$stmt = $db->prepare($sql);
$result= $db->executeMultiple($stmt, $save_value);
} else {
$sql = 'INSERT INTO `sccpbuttonconfig` (`ref`, `reftype`,`instance`, `buttontype`, `name`, `options`) VALUES (?,?,?,?,?,?);';
// die(print_r($save_value,1));
$stmt = $db->prepare($sql);
$result = $db->executeMultiple($stmt, $save_value);
}
break;
}
return $result;
}
/*
* My be Replace by SccpTables ??!
*
*/
public function dump_sccp_tables($data_path, $database, $user, $pass)
{
$filename = $data_path.'/sccp_backup_'.date('G_a_m_d_y').'.sql';
$result = exec('mysqldump '.$database.' --password='.$pass.' --user='.$user.' --single-transaction >'.$filename, $output);
return $filename;
}
/*
* Check Table structure
*/
public function validate()
{
global $db;
$check_fields = array('430' => array('_hwlang' => "varchar(12)"), '431' => array('private'=> "enum('on','off')"), '433' => array('directed_pickup'=>'') );
$sql = "DESCRIBE `sccpdevice`;";
$raw_result = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
$result = 0;
foreach ($raw_result as $value) {
$id_result[$value['Field']] = $value['Type'];
}
foreach ($check_fields as $key => $value) {
$sub_result = true;
foreach ($value as $skey => $svalue) {
if (!empty($svalue)) {
if (empty($id_result[$skey])) {
$sub_result = false;
} else {
if (strtolower($id_result[$skey]) != strtolower($svalue)) {
$sub_result = false;
}
}
} else {
if (!empty($id_result[$skey])) {
$sub_result = false;
}
}
}
if ($sub_result) {
$result = $key;
} else {
break;
}
}
return $result;
}
}

View file

@ -1,515 +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;
}
public function validate_RealTime($realm = '')
{
global $amp_conf;
$res = array();
/* if (empty($realm)) {
$realm = 'sccp';
}
*/ $cnf_int = \FreePBX::Config();
$cnf_wr = \FreePBX::WriteConfig();
$cnf_read = \FreePBX::LoadConfig();
$def_config = array('sccpdevice' => 'mysql,' . $realm . ',sccpdeviceconfig', 'sccpline' => 'mysql,' . $realm . ',sccpline');
$backup_ext = array('_custom.conf', '.conf', '_additional.conf');
$def_bd_config = array('dbhost' => $amp_conf['AMPDBHOST'], 'dbname' => $amp_conf['AMPDBNAME'],
'dbuser' => $amp_conf['AMPDBUSER'], 'dbpass' => $amp_conf['AMPDBPASS'],
'dbport' => '3306', 'dbsock' => '/var/lib/mysql/mysql.sock');
$def_bd_sec = 'sccp';
$dir = $cnf_int->get('ASTETCDIR');
$res_conf_sql = ini_get('pdo_mysql.default_socket');
$res_conf_old = '';
$res_conf = '';
$ext_conf = '';
foreach ($backup_ext as $fext) {
if (file_exists($dir . '/extconfig' . $fext)) {
$ext_conf = $cnf_read->getConfig('extconfig' . $fext);
if (!empty($ext_conf['settings']['sccpdevice'])) {
// Add chek line
if (strtolower($ext_conf['settings']['sccpdevice']) == strtolower($def_config['sccpdevice'])) {
$res['sccpdevice'] = 'OK';
$res['extconfigfile'] = 'extconfig' . $fext;
} else {
$res['sccpdevice'] = 'Error in line sccpdevice ' . $res['sccpdevice'];
}
}
if (!empty($ext_conf['settings']['sccpline'])) {
if (strtolower($ext_conf['settings']['sccpline']) == strtolower($def_config['sccpline'])) {
$res['sccpline'] = 'OK';
} else {
$res['sccpline'] = 'Error in line sccpline';
}
}
}
}
$res['extconfig'] = 'OK';
if (empty($res['sccpdevice'])) {
$res['extconfig'] = ' 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;
}
}
if (file_exists($dir . '/res_mysql.conf')) {
$res_conf = $cnf_read->getConfig('res_mysql.conf');
if (empty($res_conf[$realm])) {
$res['mysqlconfig'] = 'Config not found in file: res_mysql.conf';
} else {
if ($res_conf[$realm]['dbsock'] != $def_bd_config['dbsock']) {
$res['mysqlconfig'] = 'Mysql Socket Error in file: res_mysql.conf';
}
}
if (empty($res['mysqlconfig'])) {
$res['mysqlconfig'] = 'OK';
}
}
if (file_exists($dir . '/res_config_mysql.conf')) {
$res_conf = $cnf_read->getConfig('res_config_mysql.conf');
if (empty($res_conf[$realm])) {
$res['mysqlconfig'] = 'Not Config in file: res_config_mysql.conf';
} else {
if ($res_conf[$realm]['dbsock'] != $def_bd_config['dbsock']) {
$res['mysqlconfig'] = 'Mysql Socket Error in file: res_config_mysql.conf';
}
}
if (empty($res['mysqlconfig'])) {
$res['mysqlconfig'] = 'OK';
}
}
if (empty($res['mysqlconfig'])) {
$res['mysqlconfig'] = 'Realtime Error: not found res_config_mysql.conf or res_mysql.conf configutation on the path :' . $dir;
}
return $res;
}
}

View file

@ -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;
*
*/
}
}

View file

@ -1,395 +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;
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()) {
$this->aminterface->open();
}
$this->ami_mode = $this->aminterface->status();
}
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) {
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;
}
}
} else {
return $this->oldinterface->sccp_core_commands($params);
}
}
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->oldinterface->sccp_realtime_status();
} else {
return $this->aminterface->getRealTimeStatus();
/* if (is_array($ast_out)) {
foreach ($ast_out as $aline) {
if (strlen($aline) > 3) {
$ast_key = strstr(trim($aline), ' ', true);
$ast_res[$ast_key] = array('message' => $aline, 'status' => strpos($aline, 'connected') ? 'OK' : 'ERROR');
}
}
}
return $ast_res;
*/ }
}
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;
}
}
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->oldinterface->getChanSCCPVersion();
} else {
$result = array();
$metadata = $this->aminterface->getSCCPVersion();
if ($metadata && array_key_exists("Version", $metadata)) {
$result["Version"] = $metadata["Version"];
$version_parts = explode(".", $metadata["Version"]);
$result["vCode"] = 0;
if ($version_parts[0] == "4") {
switch ($version_parts[1]) {
case "1":
$result["vCode"] = 410;
break;
case "2":
$result["vCode"] = 420;
break;
case 3. . .5:
if($version_parts[2] == "3"){
$result["vCode"] = 433;
} else {
$result["vCode"] = 430;
}
break;
default:
$result["vCode"] = 400;
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 (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;
}
}
// ---------------------------- 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;
}
}

View file

@ -95,98 +95,98 @@
<phonePassword></phonePassword>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>2</callLogBlfEnabled>
</commonProfile>
</commonProfile>
<vendorConfig>
<ehookEnable>1</ehookEnable>
<!--
Headset Hookswitch Control
<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.
Disable only the speakerphone functionality.
Disabling speakerphone functionality will not affect the handset.
true = Disabled.
false = Enabled (default).
false = Enabled (default).
-->
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
<!--
Enables and disables the speakerphone and headset.
true = Disabled.
false = Enabled (default).
false = Enabled (default).
-->
<pcPort>0</pcPort>
<!--
Enables and disables the Ethernet switch port on the phone so the IP phone can
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.
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.
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
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
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.
1 = Disabled.
-->
<videoCapability>1</videoCapability>
<!--
a 7975G doesn't have any "real" video capability, it requires software
<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
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).
1 = Enabled (default).
-->
<webAccess>0</webAccess>
<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.
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.
2 = Read Only.
-->
<daysDisplayNotActive>1,7</daysDisplayNotActive> <!-- sunday = 1, sat = 7 -->
<displayOnTime>08:00</displayOnTime>
<displayOnDuration>12:00</displayOnDuration>
@ -200,52 +200,52 @@
<!-- <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
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.
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.
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.
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
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.
2 = Disabled. Disables wideband headset on phone.
-->
<spanToPCPort>1</spanToPCPort>
<!--
Enables and disables the path between the Ethernet switch port of an IP phone
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.
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.
2 = Enabled. Enables G.722-64K codec on phone.
See also advertiseG722Codec
-->
@ -256,10 +256,10 @@
<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>
<!--
@ -275,8 +275,8 @@
-->
<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.
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
@ -286,13 +286,13 @@
<!--
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.
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>
@ -300,11 +300,11 @@
<specialNumbers></specialNumbers>
<!--
Only on 7921/7925/7926
Special numbers are telephone numbers that do not require unlocking the phone to call.
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.
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
@ -313,7 +313,7 @@
<PushToTalkURL></PushToTalkURL>
<!--
Only on 7921/7925/7926
This parameter specifies the URL which the phone contacts for application services.
-->
<sendKeyAction></sendKeyAction>
@ -331,7 +331,7 @@
-->
<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.
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>
<!--
@ -349,7 +349,7 @@
<!--
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.
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.
-->
@ -420,10 +420,10 @@
</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.
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.
@ -457,26 +457,32 @@
<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
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.
URL of CiscoIPPhoneImage.
Requires a non-zero setting in idleTimeout.
-->
<idleTimeout>3600</idleTimeout>
<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>
<blfAudibleAlertSettingOfIdleStation>1</blfAudibleAlertSettingOfIdleStation>
<blfAudibleAlertSettingOfBusyStation>1</blfAudibleAlertSettingOfBusyStation>
<advertiseG722Codec>1</advertiseG722Codec>
<advertiseG722Codec>1</advertiseG722Codec>
<mobility>
<handoffdn></handoffdn>
@ -488,7 +494,7 @@
<dtmfTxfCode>*84</dtmfTxfCode>
<dtmfCnfCode>*85</dtmfCnfCode>
</mobility>
<dscpForSCCPPhoneConfig>104</dscpForSCCPPhoneConfig>
<dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices>
<dscpForCm2Dvce>184</dscpForCm2Dvce>
@ -508,7 +514,7 @@
1 = Use ServicerURL / DirectoryURL and MessagesURL (Above)
2 = Use Both (Merge Both)
-->
<!-- Below
type = 0 -> applicaton menu
type = 1 -> contacts menu

View 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.

View file

@ -10,10 +10,9 @@ and open the template in the editor.
.sccpmultiselect {
min-height: 100px;
padding: 1px 1px;
}
.sccpbtn {
min-height: 10px;
padding: 1px 1px;
}

View file

@ -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,27 +87,27 @@ $(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 ) {
location.reload();
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,7 +210,23 @@ $(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) {
var kid = $(this).data('id');
@ -256,7 +241,7 @@ $(document).ready(function () {
}
}
});
});
$('.buttontype').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');
$('#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') < btn_dev + btn_add) {
if ($(this).data('id') < totButtons) {
$(this).removeClass('hidden');
$(this).removeAttr('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"];
@ -550,7 +572,8 @@ $(document).ready(function () {
}
if ($(this).data('id') === 'model_apply') {
var dev_cmd = 'model_update';
var dev_fld = ["model", "loadimage", "nametemplate"];
//var dev_fld = ["model", "loadimage", "nametemplate"];
var dev_fld = ["model", "vendor", "dns", "buttons", "loadimage", "loadinformationid", "nametemplate"];
datas = '';
for (var i = 0; i < dev_fld.length; i++) {
datas = datas + dev_fld[i] + '=' + $('#editd_' + dev_fld[i]).val() + '&';
@ -609,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'] + '&';
@ -627,7 +650,7 @@ $(document).ready(function () {
i++;
});
}
if (datas === '') {
if (confirm(conf_msg)) {
datas = 'name[0]=all';
@ -642,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);
@ -675,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'));
@ -692,7 +792,7 @@ $(document).ready(function () {
//});
// Bootstrap table Enabled / Disabled buttons ( class="btn-tab-select")
// Bootstrap table Enable / Disable buttons ( class="btn-tab-select")
$("table").on('check-all.bs.table', function (rows) {
var id_fld = $(this).data('id');
$(".btn-tab-select").each(function () {
@ -816,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"),
ourid = last.data('nextid'),
nextid = ourid + 1;
var html = "<div class = '" + pcls + " form-group form-inline' data-nextid=" + nextid + ">";
jdata = JSON.parse(hex2bin($(this).data('json')));
var last = $("." + pcls).last(),
ourid = last.data('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);
}
}
last.after(html);
$('#' + pname + prow + '-btn-add').remove();
});
function del_dynamic_table(pe, pclass, vdefault)
{
@ -1011,7 +1130,7 @@ function bs_page_reload()
}
function bs_alert(data, status, reload)
{
if (document.getElementById('hwalert') === null) {
if (Array.isArray(data)) {
data.forEach(function (entry) {
@ -1027,7 +1146,7 @@ function bs_alert(data, status, reload)
if (status === true) {
modal.find('.modal-title').text('Operation result');
} else {
modal.find('.modal-title').text('Erroe operation ');
modal.find('.modal-title').text('Error operation ');
}
} else {
modal.find('.modal-title').text('Operation result');
@ -1066,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 +1203,100 @@ 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
View 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>

View file

@ -39,7 +39,7 @@
</srstInfo>
<connectionMonitorDuration>120</connectionMonitorDuration>
</devicePool>
<versionStamp>{Jan 01 2003 00:00:00}</versionStamp>
<versionStamp>{Jan 01 2003 00:00:00}</versionStamp>
<loadInformation>P00308010100</loadInformation>
<vendorConfig>
<disableSpeaker>false</disableSpeaker>

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -1,562 +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',
'directed_pickup_context' => 'directed_pickup_context',
'directed_pickup' => 'directed_pickup',
'pickup_modeanswer' => 'pickup_modeanswer',
'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup',
"transfer" => 'transfer', "echocancel" => 'echocancel',
"language" => 'language', "description" => 'callerid',
"cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'mailbox',
"musicclass" => 'musicclass',"allow" => 'allow',"disallow" => 'disallow',
"videomode" => 'videomode',
"dnd" => 'dnd', "silencesuppression" => 'silencesuppression',
"secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone'
);
private $guidefaults =array(
'gui_checkset' => array( "elemname" => "", "prompttext" => "", "helptext" => "", "currentvalue" => "", "valarray" => array(), "jsonclick" => '',
"jsvalidation" => "", "failvalidationmsg" => "", "canbeempty" => true, "maxchars" => 0, "disable" => false, "inputgroup" => false,
"class" => "", "cblabel" => 'Enable', "disabled_value" => 'DEFAULT', "check_enables" => 'true', "cbdisable" => false, "cbclass" => '') );
/*
* Export Functions
* getInfo
* addDevice
* delDevice
* getDevice
* getDefaultDeviceSettings
* getDeviceDisplay
*
*/
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"),
// 11.4.v434m => 11.4 - Version; .v433 - revision (.v431, .v432, .v432, .v433 );
"Version" => "11.4.v433m",
"about" => "Sccp mysql class Base ver: 11.4, Sccp ver: 433, branch: m"
);
}
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];
}
}
}
$allow_codec = array();
foreach($settings as $key => $val) {
if (strpos($key,'codec_') !== false ) {
$allow_codec[] =substr($key,6);
}
}
$settings['allow']['value'] = implode(",", $allow_codec);
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));
$tech = Array();
$sql = "DESCRIBE `sccpline`";
foreach ($this->database->query($sql) as $row) {
$tech[$row["Field"]]=$row["Field"];
}
// die(print_r($tech));
$sql = 'REPLACE INTO sccpline (name';
$sqlv = 'values ("'.$id.'"';
foreach($this->data_fld as $key => $val) {
if (isset($tech[$key])) {
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();
$this->reload_line($id);
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));
$this->reload_line($id);
return true;
}
public function reload_line($id) {
global $astman;
$result = $astman->Command('sccp reload line ' . $id);
return $result;
}
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();
// print_r($sql);
try {
$sth->execute(array($id));
$tech = $sth->fetch();
$tech['dial']='SCCP/'.$id;
} catch(\Exception $e) {}
// print_r($tech);
// echo '<br><br>';
// print_r($sql);
// die(print_r($id));
// echo '<br><br>';
return $tech;
}
public function getNamedGroup() {
$sql = "select namedcallgroup from sccpline group by namedcallgroup";
$sth = $this->database->prepare($sql);
$result = array();
$tech = array();
// $tech['namedcallgroup'] = '';
// $tech['namedpickupgroup'] = '';
try {
$sth->execute();
$result = $sth->fetchAll();
foreach($result as $val) {
$tech['namedcallgroup'][] = $val[0];
}
} catch(\Exception $e) {}
$sql = "select namedpickupgroup from sccpline group by namedpickupgroup";
$sth = $this->database->prepare($sql);
try {
$sth->execute();
$result = $sth->fetchAll();
foreach($result as $val) {
$tech['namedpickupgroup'][] = $val[0];
}
} catch(\Exception $e) {}
return $tech;
}
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
$dial = 'SCCP';
$settings = array(
"mailbox" => array(
"value" => "",
"flag" => $flag++
),
"incominglimit" => array(
"value" => "2",
"flag" => $flag++
),
"directed_pickup_context" => array(
"value" => "from-internal",
"flag" => $flag++
),
"lcontext" => array(
"value" => "from-internal",
"flag" => $flag++
),
// "callgroup" => array(
// "value" => "from-internal",
// "flag" => $flag++
// ),
"namedcallgroup" => array(
"value" => "",
"flag" => $flag++
),
// "pickupgroup" => array(
// "value" => "",
// "flag" => $flag++
// ),
"namedpickupgroup" => array(
"value" => "",
"flag" => $flag++
),
"secondary_dialtone_digits" => array(
"value" => "9",
"flag" => $flag++
),
"secondary_dialtone_tone" => array(
"value" => "0x22",
"flag" => $flag++
),
"transfer" => array(
"value" => "on",
"flag" => $flag++
),
"echocancel" => array(
"value" => "on",
"flag" => $flag++
),
"dnd" => array(
"value" => "",
"flag" => $flag++
),
"silencesuppression" => array(
"value" => "off",
"flag" => $flag++
),
"musicclass" => array(
"value" => "default",
"flag" => $flag++
),
"pin" => array(
"value" => "",
"flag" => $flag++
),
"musicclass" => array(
"value" => "default",
"flag" => $flag++
),
"allow" => array(
"value" => "all",
"flag" => $flag++
),
"disallow" => array(
"value" => "all",
"flag" => $flag++
),
"videomode" => array(
"value" => "auto",
"flag" => $flag++
),
);
return array(
"dial" => $dial,
"settings" => $settings
);
}
public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) {
$section = _("SCCP Extension Details");
$section_с = _("SCCP Codec Details");
$gn_category = "sccp";
global $currentcomponent, $display;
$named_group = $this->getNamedGroup();
//add sccp category
$currentcomponent->addTabTranslation('sccp',_('SCCP'));
// $currentcomponent->addTabTranslation('Codec',_('Codec'));
//Fill Codecs Informations
// $Sccp_Codec = array('gsm','slin16','alaw','ulaw','g722','g723','g726','g728','g729','ilibc','opus','h264','h263','h265','h261');
$Sccp_Codec = array('alaw', 'ulaw', 'g722', 'g723', 'g726', 'g729', 'gsm', 'h264', 'h263', 'h261');
$allCodecs = $this->freepbx->Codecs->getAudio(true);
$allVCodecs = $this->freepbx->Codecs->getVideo();
$ACodec_cur = array('all');
$VCodec_cur = array('all');
foreach ($allCodecs as $c => $v) {
if (array_search($c,$Sccp_Codec) !=null) {
$currentcomponent->addoptlistitem('devinfo_sccp_codec', "devinfo_codec_"."$c", "$c");
if (isset($deviceInfo['allow'])) {
if (strpos($deviceInfo['allow'],$c)!== false) {
$ACodec_cur[] ="devinfo_codec_"."$c";
}
}
}
}
foreach ($allVCodecs as $c => $v) {
if (array_search($c,$Sccp_Codec) !=null) {
$currentcomponent->addoptlistitem('devinfo_sccp_vcodec', "devinfo_codec_"."$c", "$c");
if (isset($deviceInfo['allow'])) {
if (strpos($deviceInfo['allow'],$c)!== false) {
$VCodec_cur[] ="devinfo_codec_"."$c";
}
}
}
}
$el = array(
"elemname" => "devinfo_sccp_codec",
"prompttext" => _('Line Audio Codec:'),
"helptext" => _("Line Audio Codec"),
"currentvalue" => $ACodec_cur,
"valarray" => $currentcomponent->getoptlist('devinfo_sccp_codec'),
"class" => $section_с,
"disable" => 0
);
$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" => $VCodec_cur,
"valarray" => $currentcomponent->getoptlist('devinfo_sccp_vcodec'),
"class" => $section_с,
"disable" => 0
);
$currentcomponent->addguielem($section_с, new \gui_checkset(array_merge($this->guidefaults['gui_checkset'],$el)), $gn_category);
$tmparr = array();
$tt = _("Name or id of lincked maibox");
$tmparr['mailbox'] = array('prompttext' => _('Mailbox'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category);
$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,'category' => $gn_category);
$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,'category' => $gn_category);
$tt = _("Asterisk context this device will can pickup calls. Only change this is you know what you are doing.");
$tmparr['directed_pickup_context'] = array('prompttext' => _('Directed PickUp Сontext '), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category);
// $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,'category' => $gn_category);
// $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,'category' => $gn_category);
// $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,'category' => $gn_category);
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,'category' => $gn_category);
unset($select);
$select[] = array('value' => '', 'text' => 'Inherit');
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Enable/Disable the `directed` pickup softkey");
$tmparr['directed_pickup'] = array('prompttext' => _('Directed pickup'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
unset($select);
$select[] = array('value' => '', 'text' => 'Inherit');
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Should the picked/gpicked-up call be answered automatically");
$tmparr['pickup_modeanswer'] = array('prompttext' => _('Pickup Modeanswer'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
unset($select);
$select[] = array('value' => '', 'text' => 'Inherit');
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Allow call transfer.");
// $tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section, 'category' => 'general');
$tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
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,'category' => $gn_category);
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,'category' => $gn_category);
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,'category' => $gn_category);
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,'category' => $gn_category);
unset($select);
$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 ,'category' => $gn_category);
unset($select);
$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);
$tt = _("Codec disallow");
$tmparr['disallow'] = array('prompttext' => _('Codec disallow'), 'value' => 'all', 'tt' => $tt, 'level' => 1, 'section' => $section_с,'category' => $gn_category);
unset($select);
$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);
}
}

9
conf/mappingRulesHeader Normal file
View 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
#

View file

@ -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

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

View file

@ -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

File diff suppressed because it is too large Load diff

View file

@ -58,13 +58,13 @@ ri ^(P00405000700.sbn)$ firmware/7910/\1
ri ^(CP7912080004SCCP080108A.sbin)$ firmware/7912/\1
# 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
#

View file

@ -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

View file

@ -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;
}
*
*
*/

View file

@ -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:

View file

@ -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:

File diff suppressed because it is too large Load diff

View file

@ -1,27 +1,279 @@
<module>
<rawname>sccp_manager</rawname>
<name>SCCP Manager</name>
<version>14.0.0.2M</version>
<version>14.5.0.4</version>
<type>setup</type>
<category>SCCP Connectivity</category>
<publisher>Alex GP</publisher>
<repo>extended</repo>
<publisher>Steve Lad, Alex GP</publisher>
<repo>extended</repo>
<description>SCCP Phone and Extension Manager</description>
<menuitems>
<sccpsettings sort="1">Server Config</sccpsettings>
<sccp_adv sort="2">System Parameters</sccp_adv>
<sccp_phone sort="3">Phones Manager</sccp_phone>
<sccpsettings sort="1">Server Config</sccpsettings>
<sccp_adv sort="2">System Parameters</sccp_adv>
<sccp_phone sort="3">Phones Manager</sccp_phone>
</menuitems>
<changelog>
* Version 13.0.0.1 * - Alfa Release tested on freepbx v.13.0.192.16, v.14.0.1.5
* Version 13.0.0.2 * - Release tested
* Version 14.0.0.1 * - Alfa Release new DB structure Add User mobility
* Version 13.0.0.1 * - Alfa Release tested on freepbx v.13.0.192.16, v.14.0.1.5
* Version 13.0.0.2 * - Release tested
* Version 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/PhantomVl/sccp_manager</info>
<license>GPL</license>
<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>

View file

@ -21,7 +21,7 @@
<?php echo $page['content']?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>

View file

@ -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');

View 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")),
);
}
}

View file

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

View file

@ -27,6 +27,14 @@ abstract class Message
protected $createdDate;
private $_responseHandler;
public function __construct()
{
$this->lines = array();
$this->variables = array();
$this->keys = array();
$this->createdDate = time();
}
public function _ToDebug($level, $msg)
{
}
@ -168,7 +176,7 @@ abstract class Message
return (double) $value;
}
default:
throw new PAMIException("Don't know how to convert: '" . $value . "'\n");
throw new AMIException("Don't know how to convert: '" . $value . "'\n");
break;
}
}
@ -217,14 +225,6 @@ abstract class Message
{
return array('lines', 'variables', 'keys', 'createdDate');
}
public function __construct()
{
$this->lines = array();
$this->variables = array();
$this->keys = array();
$this->createdDate = time();
}
}
abstract class IncomingMessage extends Message
@ -242,6 +242,11 @@ abstract class IncomingMessage extends Message
return $this->rawContent;
}
public function isComplete()
{
return $this->_completed;
}
public function __sleep()
{
$ret = parent::__sleep();
@ -387,7 +392,7 @@ class SCCPTokenAckAction extends ActionMessage
{
parent::__construct('SCCPTokenAck');
$this->setKey('DeviceId', $DeviceName);
$this->setResponseHandler("SCCPGeneric");
$this->setResponseHandler("Generic");
}
}
@ -397,7 +402,7 @@ class SCCPDeviceRestartAction extends ActionMessage
public function __construct($DeviceName, $Type = "restart")
{
parent::__construct('SCCPDeviceRestart');
$this->setResponseHandler("SCCPGeneric");
$this->setResponseHandler("Generic");
if (empty($Type)) {
$Type = "restart";
}
@ -418,6 +423,6 @@ class SCCPConfigMetaDataAction extends ActionMessage
if ($segment != false) {
$this->setKey('Segment', $segment);
}
$this->setResponseHandler("SCCPGeneric");
$this->setResponseHandler("SCCPJSON");
}
}

View file

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

View file

@ -6,7 +6,6 @@
*
* 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;
@ -17,29 +16,30 @@ class aminterface
var $_error;
var $_config;
var $_test;
var $_countE;
private $_connect_state;
// var $ProcessingMessage;
private $_lastActionClass;
private $_lastActionId;
private $_lastRequestedResponseHandler;
private $_ProcessingMessage;
private $_DumpMessage;
private $_eventFactory;
private $_responseFactory;
private $debug_level = 1;
private $_incomingRawMessage;
private $eventListEndEvent;
public function load_subspace($parent_class = null)
{
$driverNamespace = "\\FreePBX\\Modules\\Sccp_manager\\aminterface";
$drivers = array('Message' => 'Message.class.php', 'Response' => 'Response.class.php', 'Event' => 'Event.class.php');
$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);
}
@ -54,12 +54,19 @@ 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->_eventFactory = new EventFactoryImpl(\Logger::getLogger('EventFactory'));
// $this->_responseFactory = new ResponseFactoryImpl(\Logger::getLogger('ResponseFactory'));
$this->_incomingQueue = array();
$this->_incomingMsgObjectList = array();
$this->_lastActionId = false;
$this->_incomingRawMessage = array();
$this->eventListEndEvent = '';
$fld_conf = array('user' => 'AMPMGRUSER', 'pass' => 'AMPMGRPASS');
if (isset($amp_conf['AMPMGRUSER'])) {
@ -72,21 +79,24 @@ 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();
}
}
}
}
public function info()
{
$Ver = '13.0.4';
if ($this->_config['enabled']) {
if ($this->_config['enabled']){
return array('Version' => $Ver,
'about' => 'AMI data ver: ' . $Ver, 'test' => get_declared_classes());
} else {
@ -95,9 +105,8 @@ class aminterface
}
}
/**
* Opens a tcp connection to ami.
*
/*
* Opens a socket connection to ami.
*/
public function open()
{
@ -134,7 +143,7 @@ class aminterface
return true;
}
/**
/*
* Closes the connection to ami.
*/
public function close()
@ -143,80 +152,86 @@ class aminterface
$this->_ProcessingMessage = '';
@stream_socket_shutdown($this->_socket, STREAM_SHUT_RDWR);
}
/*
* Send action message to ami, and wait for Response
*/
public function send($message)
{
$_incomingRawMessage = array();
$messageToSend = $message->serialize();
$length = strlen($messageToSend);
$this->_countE = 0;
$this->_DumpMessage = '';
$this->_lastActionId = $message->getActionId();
$this->_lastActionId = $message->getActionID();
$this->_lastRequestedResponseHandler = $message->getResponseHandler();
$this->_lastActionClass = $message;
$this->_incomingRawMessage[$this->_lastActionId] = '';
$this->eventListIsCompleted = array();
if (@fwrite($this->_socket, $messageToSend) < $length) {
$this->_errorException('Could not send message');
return false;
}
$time_connect = microtime_float();
$this->_msgToDebug(90, 'Time: '. ($time_connect));
while (1) {
// Have sent a message and now have to wait for and read the reply
// The below infinite loop waits for $this->completed to be true.
// The loop calls readBuffer, which calls GetMessages, which calls Process
// This loop then continues until we have _thisComplete as an object variable
$this->eventListIsCompleted[$this->_lastActionId] = false;
while (true) {
stream_set_timeout($this->_socket, 1);
// stream_set_timeout($this->_socket, (isset($this->socket_param['timeout']) ? $this->socket_param['timeout'] : 1));
$this->process();
$time_co = microtime_float();
$this->_msgToDebug(90, 'Time: '. ($time_co-$time_connect));
$this->readBuffer();
$info = stream_get_meta_data($this->_socket);
if ($info['timed_out'] == false) {
$response = $this->getRelated($message);
if ($response != false) {
$this->_lastActionId = false;
$this->_msgToDebug(98, '---- Dump MSG -------');
$this->_msgToDebug(98, $this->_DumpMessage);
if ($info['timed_out'] == true) {
$this->_errorException("Read waittime: " . ($this->socket_param['timeout']) . " exceeded (timeout).\n");
return false;
}
if ($this->eventListIsCompleted[$this->_lastActionId]) {
$response = $this->_incomingMsgObjectList[$this->_lastActionId];
// need to test that the list was successfully completed here
$allReceived = $response->getClosingEvent()
->listCorrectlyReceived($this->_incomingRawMessage[$this->_lastActionId],
$response->getCountOfEvents());
// now tidy up removing any temp variables or objects
$response->removeClosingEvent();
unset($_incomingRawMessage[$this->_lastActionId]);
unset($this->_incomingMsgObjectList[$this->_lastActionId]);
unset($this->_lastActionId);
if ($allReceived) {
return $response;
}
} else {
break;
// Something is missing from the events list received via AMI, or
// the control parameter at the end of the list has changed.
// This will cause an exception as returning a boolean instead of a Response
// Maybe should handle better, but
// need to break out of the loop as nothing more coming.
try {
throw new \invalidArgumentException("Counts do not match on returned AMI Result");
} catch ( \invalidArgumentException $e) {
echo substr(strrchr(get_class($response), '\\'), 1), " ", $e->getMessage(), "\n";
}
return $response;
}
}
$this->_errorException("Read waittime: " . ($this->socket_param['timeout']) . " exceeded (timeout).\n");
}
protected function getRelated($message)
protected function readBuffer ()
{
$ret = false;
$id = 0;
$id = $message->getActionID('ActionID');
if (isset($this->_incomingQueue[$id])) {
$response = $this->_incomingQueue[$id];
if ($response->isComplete()) {
unset($this->_incomingQueue[$id]);
$ret = $response;
}
$read = @fread($this->_socket, 65535);
// AMI never returns EOF
if ($read === false ) {
$this->_errorException('Error reading');
}
return $ret;
}
private function _messageToEvent($msg)
{
return $this->_eventFromRaw($msg);
// Do not return empty Messages
while ($read == "" ) {
$read = @fread($this->_socket, 65535);
}
// Add read to the rest of buffer from previous read
$this->_ProcessingMessage .= $read;
$this->getMessages();
}
protected function getMessages()
{
$msgs = array();
// Read something.
$read = @fread($this->_socket, 65535);
if ($read === false || @feof($this->_socket)) {
$this->_errorException('Error reading');
}
if ($read == "") {
usleep(100);
} else {
$this->_msgToDebug(98, '--- Not Empy AMI MSG --- ');
}
$this->_ProcessingMessage .= $read;
$this->_DumpMessage .= $read;
// Extract any complete messages and leave remainder for next read
while (($marker = strpos($this->_ProcessingMessage, aminterface\Message::EOM))) {
$msg = substr($this->_ProcessingMessage, 0, $marker);
$this->_ProcessingMessage = substr(
@ -225,56 +240,39 @@ class aminterface
);
$msgs[] = $msg;
}
return $msgs;
$this->process($msgs);
}
public function process()
public function process(array $msgs)
{
$msgs = $this->getMessages();
$this->_msgToDebug(90, $msgs);
$this->_countE++;
if ($this->_countE > 10000) {
$this->_msgToDebug(9, '--- Procecc Die, Dump --- ');
$this->_msgToDebug(9, $this->_DumpMessage);
$this->_msgToDebug(9, '--- END Procecc Die, Dump --- ');
die();
}
foreach ($msgs as $aMsg) {
$resPos = strpos($aMsg, 'Response:');
$evePos = strpos($aMsg, 'Event:');
// 2 types of message; Response or Event. Response only incudes data
// for JSON response and Command response. All other responses expect
// data in an event list - these events need to be attached to the response.
$resPos = strpos($aMsg, 'Response: '); // Have a Response message. This may not be 0.
$evePos = strpos($aMsg, 'Event: '); // Have an Event Message. This should always be 0.
// Add the incoming message to a string that can be checked
// against the completed message event when it is received.
$this->_incomingRawMessage[$this->_lastActionId] .= "\r\n\r\n" . $aMsg;
if (($resPos !== false) && (($resPos < $evePos) || $evePos === false)) {
$response = $this->_msgToResponse($aMsg); // resp Ok
$this->_incomingQueue[$this->_lastActionId] = $response;
} elseif ($evePos !== false) {
$event = $this->_messageToEvent($aMsg); // Event Ok
$this->_msgToDebug(99, '--- Response Type 2 --- ');
$this->_msgToDebug(99, $aMsg);
$this->_msgToDebug(99, '--- Event Response Type 2 --- ');
$this->_msgToDebug(99, $event);
if ($event != null) {
$response = $this->findResponse($event);
// print_r($response);
// print_r('<br>--- E2 Response Type 2 ----------<br>');
if ($response === false || $response->isComplete()) {
$this->dispatch($event); // не работает
} else {
$response->addEvent($event);
}
}
$response = $this->_responseObjFromMsg($aMsg); // resp Ok
$this->eventListEndEvent = $response->getKey('eventlistendevent');
$this->_incomingMsgObjectList[$this->_lastActionId] = $response;
$this->eventListIsCompleted[$this->_lastActionId] = $response->isComplete();
} elseif ($evePos === 0) { // Event must be at the start of the msg.
$event = $this->_eventObjFromMsg($aMsg); // Event Ok
$this->eventListIsCompleted[$this->_lastActionId] = $event->isComplete();
$this->_incomingMsgObjectList[$this->_lastActionId]->addEvent($event);
} else {
// broken ami most probably through changes in chan_sccp_b.
//sending a response with events without Event and ActionId
// AMI is sending a message which is neither a response nor an event.
$this->_msgToDebug(1, 'resp broken ami');
$bMsg = 'Event: ResponseEvent' . "\r\n";
$bMsg .= 'ActionId: ' . $this->_lastActionId . "\r\n" . $aMsg;
$event = $this->_messageToEvent($bMsg);
$response = $this->findResponse($event);
$response->addEvent($event);
$event = $this->_eventObjFromMsg($bMsg);
$this->_incomingMsgObjectList[$this->_lastActionId]->addEvent($event);
}
}
// print_r('<br>--- EProcecc ----------<br>');
}
private function _msgToDebug($level, $msg)
@ -287,74 +285,32 @@ class aminterface
print_r('<br>');
}
private function _msgToResponse($msg)
private function _responseObjFromMsg($message)
{
// print_r("<br>------------hmsg----------<br>");
// print_r($this->_lastActionClass);
// print_r($this->_lastRequestedResponseHandler);
// print_r("<br>------------emsg----------<br>");
// print_r($msg);
$response = $this->_msgFromRaw($msg, $this->_lastActionClass, $this->_lastRequestedResponseHandler);
// print_r("<br>------------rmsg----------<br>");
// print_r($response);
// print_r("<br>------------ermsg----------<br>");
$actionId = $response->getActionId();
if ($actionId === null) {
$actionId = $this->_lastActionId;
$response->setActionId($this->_lastActionId);
}
return $response;
}
/*
*
*
*/
public function _msgFromRaw($message, $requestingaction = false, $responseHandler = false)
{
$_className = false;
$responseclass = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\Generic_Response';
if ($responseHandler != false) {
$_className = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\' . $responseHandler . '_Response';
} elseif ($requestingaction != false) {
$_className = '\\FreePBX\\modules\\Sccp_manager\\' . substr(get_class($requestingaction), 20, -6) . '_Response';
$responseClass = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\Generic_Response';
if ($this->_lastRequestedResponseHandler != false) {
$_className = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\' . $this->_lastRequestedResponseHandler . '_Response';
}
if ($_className) {
if (class_exists($_className, true)) {
$responseclass = $_className;
$responseClass = $_className;
} elseif ($responseHandler != false) {
$this->_errorException('Response Class ' . $_className . ' requested via responseHandler, could not be found');
}
}
return new $responseclass($message);
}
protected function _errorException($msg)
{
$this->_error[] = $msg;
}
/*
* Replace or dublicate to AMI interface
*/
public function _eventFromRaw($message)
{
$eventStart = strpos($message, 'Event: ') + 7;
if ($eventStart > strlen($message)) {
return new aminterface\UnknownEvent($message);
$response = new $responseClass($message);
$actionId = $response->getActionID();
if ($actionId === null) {
$response->setActionId($this->_lastActionId);
}
$eventEnd = strpos($message, aminterface\Message::EOL, $eventStart);
if ($eventEnd === false) {
$eventEnd = strlen($message);
}
$name = substr($message, $eventStart, $eventEnd - $eventStart);
return $response;
}
public function _eventObjFromMsg($message)
{
$eventType = explode(aminterface\Message::EOL,$message,2);
$name = trim(explode(':',$eventType[0],2)[1]);
$className = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\' . $name . '_Event';
if (class_exists($className, true) === false) {
$className = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\UnknownEvent';
@ -362,40 +318,6 @@ class aminterface
return new $className($message);
}
public function _respnceFromRaw($message, $requestingaction = false, $responseHandler = false)
{
$responseclass = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\Response';
$_className = false;
if ($responseHandler != false) {
$_className = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\' . $responseHandler . '_Response';
} elseif ($requestingaction != false) {
$_className = '\\FreePBX\\modules\\Sccp_manager\\aminterface\\' . substr(get_class($requestingaction), 20, -6) . '_Response';
}
if ($_className) {
if (class_exists($_className, true)) {
$responseclass = $_className;
} elseif ($responseHandler != false) {
throw new AMIException('Response Class ' . $_className . ' requested via responseHandler, could not be found');
}
}
// if ($this->_logger->isDebugEnabled()) $this->_logger->debug('Created: ' . $responseclass . "\n");
print_r($responseclass);
die();
return new $responseclass($message);
}
// protected function findResponse(IncomingMessage $message) {
protected function findResponse($message)
{
$actionId = $message->getActionId();
if (isset($this->_incomingQueue[$actionId])) {
return $this->_incomingQueue[$actionId];
}
return false;
}
protected function dispatch($message)
{
print_r("<br>------------dispatch----------<br>");
@ -420,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()
@ -451,8 +365,7 @@ class aminterface
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\ExtensionStateListAction();
$_response = $this->send($_action);
$_res = $_response->getResult();
$_res = $this->send($_action)->getResult();
foreach ($_res as $key => $value) {
foreach ($value as $key2 => $value2) {
$result[$key.'@'.$key2] = $key.'@'.$key2;
@ -467,8 +380,7 @@ class aminterface
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowSoftkeySetsAction();
$_response = $this->send($_action);
$_res = $_response->getResult();
$_res = $this->send($_action)->getResult();
foreach ($_res as $key => $value) {
$result[$key] = $key;
}
@ -480,11 +392,7 @@ class aminterface
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDevicesAction();
$_response = $this->send($_action);
$result = $_response->getResult();
foreach ($result as $key => $value) {
$result[$key]['name'] = $key;
}
$result = (array)$this->send($_action)->getResult();
}
return $result;
}
@ -493,8 +401,7 @@ class aminterface
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPShowDeviceAction($devicename);
$_response = $this->send($_action);
$result = $_response->getResult();
$result = $this->send($_action)->getResult();
$result['MAC_Address'] = $result['macaddress'];
}
return $result;
@ -508,9 +415,8 @@ 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');
// $result = $_response->getResult();
}
return $result;
}
@ -521,19 +427,57 @@ class aminterface
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\ReloadAction('chan_sccp');
// $_action = new \FreePBX\modules\Sccp_manager\aminterface\CommandAction('sccp reload force'); // No Response Result !!
$_response = $this->send($_action);
$result = $_response->getMessage();
$result = ['Response' => $this->send($_action)->getMessage(), 'data' => ''];
}
return $result;
}
function getSCCPConfigMetaData($segment = '') {
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPConfigMetaDataAction($segment);
$metadata = $this->send($_action)->getResult();
}
return $metadata;
}
function getSCCPVersion()
{
$result = array();
if ($this->_connect_state) {
$_action = new \FreePBX\modules\Sccp_manager\aminterface\SCCPConfigMetaDataAction();
$_response = $this->send($_action);
$result = $_response->getResult();
//Initialise result array
$result = array( 'RevisionHash' => '', 'vCode' => 0, 'RevisionNum' => 0, 'buildInfo' => '', 'Version' => 0);
$metadata = $this->getSCCPConfigMetaData();
if (isset($metadata['Version'])) {
$result['Version'] = $metadata['Version'];
$version_parts = array_map('intval',explode('.', $metadata['Version']));
if ($version_parts[0] === 4) {
switch ($version_parts[1]) {
case 1:
$result['vCode'] = 410;
break;
case 2:
$result['vCode'] = 420;
break;
case 3:
$result['vCode'] = 430;
if($version_parts[2] >= 3){
$result['vCode'] = 433;
}
break;
default:
$result['vCode'] = 400;
break;
}
}
if (array_key_exists("RevisionHash", $metadata)) {
$result['RevisionHash'] = $metadata["RevisionHash"];
}
if (isset($metadata['RevisionNum'])) {
if ($metadata['RevisionNum'] >= 11063) { // new method, RevisionNum is incremental
$result['vCode'] = 433;
}
$result['RevisionNum'] = $metadata["RevisionNum"];
}
if (isset($metadata['ConfigureEnabled'])) {
$result['buildInfo'] = $metadata['ConfigureEnabled'];
}
}
return $result;
}
@ -543,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();
@ -565,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'];
}
}

View file

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

View file

@ -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

View file

@ -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);
}
@ -36,8 +76,8 @@ class xmlinterface
if (empty($store_path) || empty($data_path) || empty($data_values)) {
return;
}
$def_xml_fields = array('authenticationURL', 'informationURL', 'messagesURL', 'servicesURL', 'directoryURL',
'secureauthenticationURL', 'secureinformationURL', 'securemessagesURL', 'secureservicesURL', 'securedirectoryURL', 'secureidleURL',
$def_xml_fields = array('authenticationURL', 'informationURL', 'messagesURL', 'servicesURL', 'directoryURL',
'secureauthenticationURL', 'secureinformationURL', 'securemessagesURL', 'secureservicesURL', 'securedirectoryURL', 'secureidleURL',
'proxyServerURL', 'idleTimeout', 'idleURL');
$def_xml_locale = array('userLocale', 'networkLocaleInfo', 'networkLocale');
$xml_name = $store_path . '/XMLDefault.cnf.xml';
@ -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,298 +152,245 @@ 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',
'secureinformationurl' => 'dev_secureinformationURL', 'securemessagesurl'=>'dev_securemessagesURL',
'secureservicesurl'=>'dev_secureservicesURL', 'securedirectoryurl'=>'dev_securedirectoryURL', 'secureidleurl' => 'dev_secureidleURL',
'servicesurl' => 'dev_servicesURL', 'directoryurl' => 'dev_directoryURL', 'idleurl' => 'dev_idleURL',
'secureauthenticationurl' => 'dev_secureauthenticationURL',
'secureinformationurl' => 'dev_secureinformationURL', 'securemessagesurl'=>'dev_securemessagesURL',
'secureservicesurl'=>'dev_secureservicesURL', 'securedirectoryurl'=>'dev_securedirectoryURL', 'secureidleurl' => 'dev_secureidleURL',
'proxyserverurl' => 'dev_proxyServerURL', 'idletimeout' => 'dev_idleTimeout',
'sshuserid' => 'dev_sshUserId', 'sshpassword' => 'dev_sshPassword', 'deviceprotocol' => 'dev_deviceProtocol',
'phonepersonalization' => 'phonePersonalization'
'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)) {
$xml_work = simplexml_load_file($xml_template);
foreach ($var_xml_general_vars as $key => $data) {
if (isset($xml_work->$key)) {
if ($data != 'null') {
$xml_work->$key = $data;
} else {
$node = $xml_work->$key;
unset($node[0][0]);
}
}
}
foreach ($xml_work as $key => $data) {
// Set System global Values
$key_l = strtolower($key);
if (!empty($var_xml_general_fields[$key_l])) {
$xml_work->$key = $data_values[$var_xml_general_fields[$key_l]];
}
// Set section Values
$xml_node = $xml_work->$key;
switch ($key_l) {
case 'devicepool':
$xml_node = $xml_work->$key;
foreach ($xml_work->$key->children() as $dkey => $ddata) {
switch (strtolower($dkey)) {
case 'datetimesetting':
$xnode = &$xml_node->$dkey;
$tz_id = $data_values['ntp_timezone'];
$TZdata = $data_values['ntp_timezone_id'];
if (empty($TZdata)) {
$TZdata = array('offset' => '0', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
}
$xnode->name = $tz_id;
$xnode->dateTemplate = $data_values['dateformat'];
$xnode->timeZone = $TZdata['cisco_code'];
// $xnode->timeZone = $tz_id.' Standard'.((empty($TZdata['daylight']))? '': '/'.$TZdata['daylight']).' Time';
if ($data_values['ntp_config_enabled'] == 'on') {
$xnode->ntps->ntp->name = $data_values['ntp_server'];
$xnode->ntps->ntp->ntpMode = $data_values['ntp_server_mode'];
} else {
$xnode->ntps = null;
}
// Ntp Config
break;
case 'srstinfo':
if ($data_values['srst_Option'] == 'user') {
break;
}
$xnode = &$xml_node->$dkey;
$xnode->name = $data_values['srst_Name'];
$xnode->srstOption = $data_values['srst_Option'];
$xnode->userModifiable = $data_values['srst_userModifiable'];
$xnode->isSecure = $data_values['srst_isSecure'];
$srst_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++;
}
}
break;
case 'connectionmonitorduration':
$xml_node->$dkey = strval(intval(intval($data_values['keepalive']) * 0.75));
break;
case 'callmanagergroup':
$xnode = &$xml_node->$dkey->members;
$bind_tmp = $this->get_server_sccp_bind($data_values);
$ifc = 0;
foreach ($bind_tmp as $bind_value) {
$xnode_obj = clone $xnode->member;
$xnode_obj['priority'] = $ifc;
$xnode_obj->callManager->name = $data_values['servername'];
if (!is_null($xnode_obj->callManager->description)) {
$xnode_obj->callManager->description = $data_values['servername'];
}
$xnode_obj->callManager->ports->ethernetPhonePort = $bind_value['port'];
$xnode_obj->callManager->processNodeName = $bind_value['ip'];
if (!empty($xnode_obj->callManager->ports->mgcpPorts)) {
unset($xnode_obj->callManager->ports->mgcpPorts);
}
if ($ifc === 0) {
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
} else {
$this->appendSimpleXmlNode($xnode->member, $xnode_obj);
}
$ifc++;
}
/* if ($data_values['bindaddr'] == '0.0.0.0') {
$ifc = 0;
foreach ($data_values['server_if_list'] as $value) {
if (!empty($value['ip'])) {
$ip_valid = true;
if (!empty($data_values['ccm_address'])) {
if (strpos($data_values['ccm_address'], 'internal') !== false || strpos($data_values['ccm_address'], '0.0.0.0') !== false ) {
// Skip
} else {
if (strpos($data_values['ccm_address'], $value['ip']) === false) {
$ip_valid = false;
}
}
}
if (!in_array($value['ip'], array('0.0.0.0', '127.0.0.1'), true) && ($ip_valid)) {
$xnode_obj = clone $xnode->member;
// $xnode_obj = $xnode -> member;
// $xnode_obj = $xnode -> addChild($xnode->member);
$xnode_obj['priority'] = $ifc;
//$xnode_obj = &$xnode -> member -> callManager;
$xnode_obj->callManager->name = $data_values['servername'];
$xnode_obj->callManager->ports->ethernetPhonePort = $data_values['port'];
$xnode_obj->callManager->processNodeName = $value['ip'];
if ($ifc === 0) {
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
} else {
$this->appendSimpleXmlNode($xnode->member, $xnode_obj);
}
$ifc ++;
}
}
}
} else {
$xnode->member['priority'] = '0';
$xnode_obj = &$xnode->member->callManager;
$xnode_obj->name = $data_values['servername'];
$xnode_obj->ports->ethernetPhonePort = $data_values['port'];
$xnode_obj->processNodeName = $data_values['bindaddr'];
}
break;
*
*/
}
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case '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")) {
$xml_node->$dkey = $vtmp_data;
}
}
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'versionstamp':
$xml_work->$key = time();
break;
case 'loadinformation':
// Set Path Image ????
if (isset($dev_config["tftp_firmware"])) {
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["tftp_firmware"] . $dev_config["loadimage"] : '';
} else {
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["loadimage"] : '';
}
// $xml_work->$key = $dev_config["loadimage"];
if (!empty($dev_config['addon'])) {
$xnode = $xml_work->addChild('addOnModules');
$ti = 1;
$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];
$xnode_obj = $xnode->addChild('addOnModule');
$xnode_obj->addAttribute('idx', $ti);
$xnode_obj->addChild('loadInformation', $add_val);
$ti++;
}
}
// $this->appendSimpleXmlNode($xml_work , $xnode_obj);
}
break;
case 'commonprofile':
$xml_node->phonePassword = $data_values['dev_sshPassword'];
$xml_node->backgroundImageAccess = (($data_values['backgroundImageAccess'] == 'on') || ($data_values['backgroundImageAccess'] == 'true') ) ? 'true' : 'false';
$xml_node->callLogBlfEnabled = $data_values['callLogBlfEnabled'];
break;
case 'userlocale':
case 'networklocaleinfo':
case 'networklocale':
$hwlang = '';
$lang = '';
if (!empty($dev_config["_hwlang"])) {
$hwlang = explode(':', $dev_config["_hwlang"]);
}
if (($key_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'];
}
$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 {
$xml_name = "{$store_path}/{$dev_id}.cnf.xml";
if (!file_exists($xml_template)) {
die('Error Hardware template :' . $xml_template . ' not found');
}
$xml_work = simplexml_load_file($xml_template);
foreach ($var_xml_general_vars as $key => $data) {
if (isset($xml_work->$key)) {
if ($data != 'null') {
$xml_work->$key = $data;
} else {
$node = $xml_work->$key;
unset($node[0][0]);
}
}
}
foreach ($xml_work as $key => $data) {
// Set System global Values
$key_l = strtolower($key);
if (!empty($var_xml_general_fields[$key_l])) {
$xml_work->$key = $data_values[$var_xml_general_fields[$key_l]];
}
// Set section Values
$xml_node = $xml_work->$key;
switch ($key_l) {
case 'devicepool':
$xml_node = $xml_work->$key;
foreach ($xml_work->$key->children() as $dkey => $ddata) {
switch (strtolower($dkey)) {
case 'datetimesetting':
$xnode = &$xml_node->$dkey;
$tz_id = $data_values['ntp_timezone'];
$TZdata = $data_values['ntp_timezone_id'];
if (empty($TZdata)) {
$TZdata = array('offset' => '0', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
}
$xnode->name = $tz_id;
$xnode->dateTemplate = $data_values['dateformat'];
$xnode->timeZone = $TZdata['cisco_code'];
// $xnode->timeZone = $tz_id.' Standard'.((empty($TZdata['daylight']))? '': '/'.$TZdata['daylight']).' Time';
if ($data_values['ntp_config_enabled'] == 'on') {
$xnode->ntps->ntp->name = $data_values['ntp_server'];
$xnode->ntps->ntp->ntpMode = $data_values['ntp_server_mode'];
} else {
$xnode->ntps = null;
}
// Ntp Config
break;
case 'srstinfo':
if ($data_values['srst_Option'] == 'user') {
break;
}
$xnode = &$xml_node->$dkey;
$xnode->name = $data_values['srst_Name'];
$xnode->srstOption = $data_values['srst_Option'];
$xnode->userModifiable = $data_values['srst_userModifiable'];
$xnode->isSecure = $data_values['srst_isSecure'];
// srst addresses are now stored as json;
$srst_addrs = $this->convertCsvToArray($data_values['srst_ip']);
//Now have an array of srst addresses - maybe empty
foreach ($srst_addrs as $netKey => $netValue) {
$nodeName = "ipAddr${netKey}";
$xnode->$nodeName = $netValue['ip'];
$nodeName = "port${netKey}";
$xnode->$nodeName = $netValue['port'];
}
break;
case 'connectionmonitorduration':
$xml_node->$dkey = strval(intval(intval($data_values['keepalive']) * 0.75));
break;
case 'callmanagergroup':
$xnode = &$xml_node->$dkey->members;
$bind_tmp = $this->get_server_sccp_bind($data_values);
$ifc = 0;
foreach ($bind_tmp as $bind_value) {
$xnode_obj = clone $xnode->member;
$xnode_obj['priority'] = $ifc;
$xnode_obj->callManager->name = $data_values['servername'];
if (!is_null($xnode_obj->callManager->description)) {
$xnode_obj->callManager->description = $data_values['servername'];
}
$xnode_obj->callManager->ports->ethernetPhonePort = $bind_value['port'];
$xnode_obj->callManager->processNodeName = $bind_value['ip'];
if (!empty($xnode_obj->callManager->ports->mgcpPorts)) {
unset($xnode_obj->callManager->ports->mgcpPorts);
}
if ($ifc === 0) {
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
} else {
$this->appendSimpleXmlNode($xnode->member, $xnode_obj);
}
$ifc++;
}
}
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'vendorconfig':
$xml_node = $xml_work->$key;
foreach ($xml_work->$key->children() as $dkey => $ddata) {
if (isset($data_values[strtolower($dkey)])) {
$vtmp_data = $data_values[strtolower($dkey)];
if (!empty($vtmp_data)) {
switch ($vtmp_data) {
case 'off':
$xml_node->$dkey = 1;
break;
case 'on':
$xml_node->$dkey = 0;
break;
default:
$xml_node->$dkey = $vtmp_data;
break;
}
}
}
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'versionstamp':
$xml_work->$key = time();
break;
case 'loadinformation':
if (isset($dev_config["tftp_firmware"])) {
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["tftp_firmware"] . $dev_config["loadimage"] : '';
} else {
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["loadimage"] : '';
}
if (!empty($dev_config['addon'])) {
$xnode = $xml_work->addChild('addOnModules');
$ti = 1;
$hw_addon = explode(';', $dev_config['addon']);
foreach ($hw_addon as $add_key) {
if (!empty($dev_config['addon_info'][$dev_config['addon']])) {
$add_val = $dev_config['addon_info'][$dev_config['addon']];
$xnode_obj = $xnode->addChild('addOnModule');
$xnode_obj->addAttribute('idx', $ti);
$xnode_obj->addChild('loadInformation', $add_val);
$ti++;
}
}
}
break;
case 'commonprofile':
$xml_node->phonePassword = $data_values['dev_sshPassword'];
$xml_node->backgroundImageAccess = (($data_values['backgroundImageAccess'] == 'on') || ($data_values['backgroundImageAccess'] == 'true') ) ? 'true' : 'false';
$xml_node->callLogBlfEnabled = $data_values['callLogBlfEnabled'];
break;
case 'userlocale':
// Device language
$lang = $data_values['devlang'];
if (!empty($dev_config['devlang'])) {
$lang = $dev_config['devlang'];
}
$xml_node->winCharSet = $dev_config['phonecodepage'];
$xml_node->name = $dev_config['devlang'];
$xml_node->langCode = 'en';
if (isset($this->langCodeArray[$dev_config['devlang']])) {
$xml_node->langCode = $this->langCodeArray[$dev_config['devlang']];
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
break;
case 'networklocale':
$lang = $data_values['netlang'];
if (!empty($dev_config['netlang'])) {
$lang = $dev_config['netlang'];
}
if (isset($lang)) {
$xml_work->$key = $lang;
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
} else {
$xml_work->$key = '';
}
break;
case 'networklocaleinfo':
$lang = $data_values['netlang'];
if (!empty($dev_config['netlang'])) {
$lang = $dev_config['netlang'];
}
if (isset($lang)) {
$xml_node->name = $lang;
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
} else {
$xml_work->$key = '';
}
break;
default:
break;
}
}
$this->saveXml($xml_work, $xml_name); // Save
return time();
}
@ -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) {
$xnode_obj = $xnode->addChild('addOnModule');
$xnode_obj->addAttribute('idx', $ti);
$xnode_obj->addChild('loadInformation', $add_val);
$ti++;
$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];
$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'];
}
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'];
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
}
}
$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));
}
}

View 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);
}
}
?>

View 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;
}
}
}
?>

View 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
View 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"
}

View file

@ -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');
$zip = new \ZipArchive();
$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,52 +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'");
}
}
// 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>");
?>

View file

@ -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&amp;tech_hardware=dialplan&amp;extdisplay=*new*"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Dialplan") ?></a>
<a class="btn btn-default" href="config.php?display=sccp_adv&tech_hardware=dialplan&extdisplay=*new*"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Dialplan") ?></a>
<button id="remove-sccp-dialtemplate" class="btn btn-danger btn-remove" data-type="dialtemplate" data-section="sccp-dialtemplate" disabled>
<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&amp;command=getDialTemplate" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-dialtemplate" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-dialtemplate" data-id="id">
<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> -->
@ -39,4 +39,4 @@
}
return exp_model;
}
</script>
</script>

View file

@ -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,39 +46,37 @@ $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="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&amp;command=getSoftKey&amp;type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="softkey-all" data-unique-id="softkeys">
<thead>
<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) {
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
}
$i ++;
<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">
<thead>
<tr>
<th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th>
<?php
$i = 0;
foreach ($keynamearray as $key => $value) {
if ($i < 12) {
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
}
?>
<th data-field="actions" data-formatter="DispayActionsKeyFormatter"><?php echo _('Actions')?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
$i ++;
}
?>
<th data-field="actions" data-formatter="DispayActionsKeyFormatter"><?php echo _('Actions')?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
<!-- Begin Form Input New / Edit -->
@ -90,20 +88,29 @@ $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">
<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>
<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" 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
$i = 0;
foreach ($keysetarray as $key => $value) {
@ -129,7 +136,7 @@ foreach ($keysetarray as $key => $value) {
}
echo '<div class="element-container"><div class="row"><div class="form-group"><div class="col-md-3"><label class="control-label" for="'.$key.'">'._($keynamearray[$key]['name']).'</label>';
echo '<i class="fa fa-question-circle fpbx-help-icon" data-for="'.$key.'"></i></div>';
echo '<div class="col-md-4"><select multiple class="form-control sccpmultiselect" name="av_'.$key.'" id="source_'.$key.'">';
$row_dada= explode(',', $value);
foreach ($row_dada as $data) {
@ -145,20 +152,18 @@ foreach ($keysetarray as $key => $value) {
echo '</div></div></div></div>';
$i ++;
}
?>
</div>
?>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary sccp_update" data-id="keyset_add" data-mode="new" id="keyset_add" data-dismiss="modal">Save</button>
</div>
</div>
</div>
</div>
</div>
<script>
function DispayActionsKeyFormatter(value, row, index) {
var exp_model = '';
@ -168,4 +173,4 @@ foreach ($keysetarray as $key => $value) {
}
return exp_model;
}
</script>
</script>

View file

@ -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">
@ -13,12 +14,13 @@
<div class="display no-border">
<div id="toolbar-model">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target=".add_new_model"><i class="fa fa-bolt"></i> <?php echo _("Add model"); ?></button>
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target=".add_new_model"><i class="fa fa-bolt"></i> <?php echo _("Add model"); ?>
</button>
<button data-id="model_disabled" class="btn btn-danger sccp_update btn-tab-select" data-type="sccp_model" data-table="table-models" disabled data-section="all">
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Disabled') ?></span>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Disable') ?></span>
</button>
<button data-id="model_enabled" class="btn btn-danger sccp_update btn-tab-select" data-table="table-models" data-type="sccp_model" disabled data-section="all">
<i class="glyphicon glyphicon-active"></i> <span><?php echo _('Enabled') ?></span>
<i class="glyphicon glyphicon-active"></i> <span><?php echo _('Enable') ?></span>
</button>
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
@ -27,12 +29,14 @@
</a>
<ul class="dropdown-menu">
<li><a class="dropitem" data-id="enabled" tabindex="-1" href="#"><span><?php echo _('Show Enabled') ?></span></a></li>
<li><a class="dropitem" data-id="extension" tabindex="-1" href="#"><span><?php echo _('Expansion Module')?></span></a></li>
<li><a class="dropitem" data-id="all" tabindex="-1" href="#"><span><?php echo _('Show All') ?></span></a></li>
<li><a class="dropitem" data-id="extension" tabindex="-1" href="#"><span><?php echo _('Expansion Module')?></span></a></li>
<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&amp;command=getDeviceModel&amp;type=enabled" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-model" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-condensed" id="table-models" data-id="model" data-unique-id="model">
<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>
@ -41,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>
@ -60,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">&times;</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">
@ -98,7 +102,6 @@
<span id="new_dns-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_buttons"><?php echo _('Model Line Buttons');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_buttons"></i>
@ -108,8 +111,7 @@
<div class="row"><div class="col-md-12">
<span id="new_buttons-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_loadimage"><?php echo _('Load Image');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_loadimage"></i>
@ -129,7 +131,7 @@
<div class="row"><div class="col-md-12">
<span id="new_loadinformationid-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_nametemplate"><?php echo _('Model template XML');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_nametemplate"></i>
@ -142,14 +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>
</div>
<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">
@ -158,7 +180,6 @@
<h4 class="modal-title" id="gridSystemModalLabel"><?php echo _('Modal title');?></h4>
</div>
<div class="modal-body">
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_model"><?php echo _('Device Model');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_model"></i>
@ -169,10 +190,44 @@
<span id="editd_model-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_vendor"><?php echo _('Vendor name');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_vendor"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="editd_vendor" name="editd_vendor" value="CISCO">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_vendor-help" class="help-block fpbx-help-block">Use "CISCO" for the Skinny Client Control Protocol and "CISCO-SIP" for the CISCO Sip Protocol</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_dns"><?php echo _('Expansion Module');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_dns"></i>
</div><div class="col-md-9">
<select name="editd_dns" id="editd_dns">
<option value="1" selected='selected'>Phone - no sidecars.</option>
<option value="2">Phone - one sidecar.</option>
<option value="3">Phone - two sidecars.</option>
<option value="0">Sidecar</option>
</select>
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_dns-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_buttons"><?php echo _('Model Line Buttons');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_buttons"></i>
</div><div class="col-md-9">
<input type="number" min="1" min="96" class="form-control" id="editd_buttons" name="editd_buttons" value="1">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_buttons-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_loadimage"><?php echo _('Load Image');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="edit_devimage"></i>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_loadimage"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="editd_loadimage" name="editd_loadimage" value="">
</div> </div></div>
@ -180,6 +235,16 @@
<span id="editd_loadimage-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_loadinformationid"><?php echo _('Load Information ID');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_loadinformationid"></i>
</div><div class="col-md-9">
<input type="text" class="form-control" id="editd_loadinformationid" name="editd_loadinformationid" value="">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="editd_loadinformationid-help" class="help-block fpbx-help-block">Help.</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="editd_nametemplate"><?php echo _('Model template XML');?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="editd_nametemplate"></i>
@ -189,13 +254,11 @@
<div class="row"><div class="col-md-12">
<span id="editd_nametemplate-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 _('Close');?></button>
<button type="button" class="btn btn-primary sccp_update" data-id="model_apply" data-dismiss="modal"><?php echo _('apply');?></button>
</div>
</div>
</div>
</div>
</div>
@ -214,7 +277,7 @@
// function DispayInputFormatter(value, row, index) {
// return (value == null) ? '<input class="tabl-edit form-control" name="' + row['model'] + '_template" type="text" value="">' : '<input class="tabl-edit form-control" name="' + row['model'] + '_template" type="text" value="' + value + '">';
// }
function DispayActionsModelFormatter(value, row, index) {
var exp_model = '';
// exp_model += '<a href="#edit_model" class="btn btn-info" onclick="load_model(this, &quot;'+row['model']+'&quot;)" data-toggle="modal"><i class="fa fa-pencil"></i></a>';
@ -223,25 +286,24 @@
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) {
var tclass = "active";
if (row['enabled'] === 1) {
tclass = (index % 2 === 0) ? "info" : "info";
}
}
if ((row['validate'] === 'yes;yes') || (row['validate'] === 'yes;-')) {
// tclass = (row['enabled'] === '1') ? "danger" : "warning";
} else {
@ -249,7 +311,7 @@
}
return {classes: tclass};
}
function load_model(elmnt,clr) {
// $("#edit_devmodel").text(clr);
var drow = $("#table-models").bootstrapTable('getRowByUniqueId',clr);
@ -259,6 +321,10 @@
document.getElementById("editd_model").value = clr;
document.getElementById("editd_loadimage").value = drow['loadimage'];
document.getElementById("editd_nametemplate").value = drow['nametemplate'];
document.getElementById("editd_loadinformationid").value = drow['loadinformationid'];
document.getElementById("editd_dns").value = drow['dns'];
document.getElementById("editd_vendor").value = drow['vendor'];
document.getElementById("editd_buttons").value = drow['buttons'];
}
}
</script>

View file

@ -4,119 +4,147 @@
* 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));
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']);
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;
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>
if (!empty($def_val['type'])) {
$tmp_raw = $this->getSccpModelInformation('byid', true, 'all', array('model'=>$def_val['type']));
if (!empty($tmp_raw[0])) {
$tmp_raw = $tmp_raw[0];
}
if (!empty($tmp_raw['validate'])) {
$tmpar = explode(";", $tmp_raw['validate']);
if ($tmpar[0] != 'yes') {
$device_warning['Image'] = array('Device firmware not found : '.$tmp_raw['loadimage']);
}
if ($tmpar[1] != 'yes') {
$device_warning['Template'] = array('Missing device configuration template : '. $tmp_raw['nametemplate']);
}
if (!empty($device_warning)) {
?>
<div class="fpbx-container container-fluid">
<div class="row">
<div class="container">
<h2 style="border:2px solid Tomato;color:Tomato;" >Warning in the SCCP Device</h2>
<div class="table-responsive">
<pre>
<?php
foreach ($device_warning as $key => $value) {
echo '<h3>'.$key.'</h3>';
if (is_array($value)) {
echo '<li>'._(implode('</li><li>', $value)).'</li>';
} else {
echo '<li>'. _($value).'</li>';
}
}
?>
</pre>
</div>
</div>
</div>
</div>
</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 (empty($dev_id)) {
echo $this->showGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val);
} else {
echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val);
if ($_REQUEST['tech_hardware'] == 'cisco') {
echo '<input type="hidden" name="sccp_device_typeid" value="sccpdevice">';
if (empty($dev_id)) {
echo $this->showGroup('sccp_hw_dev', 1, 'sccp_hw', $def_val);
} else {
echo $this->showGroup('sccp_hw_dev_edit', 1, 'sccp_hw', $def_val);
}
echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
// echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); This are line properties and does not exist!
echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_dev_vendor_conf', 1, 'vendorconfig', $def_val);
echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
} else if ($_REQUEST['tech_hardware'] == 'cisco-sip') {
echo '<input type="hidden" name="sccp_device_typeid" value="sipdevice">';
/*
if (empty($dev_new)) {
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);
}
echo $this->showGroup('sccp_hw_dev2', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_advance', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val);
echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val);
?>
?>
</form>

View file

@ -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)) {

View file

@ -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>

View file

@ -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,12 +59,14 @@ 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>
<div class="section" data-id="<?php echo $forminfo[0]['name'];?>">
<div class="row"> <div class="form-group">
<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>
@ -87,11 +87,10 @@ if (!empty($_REQUEST['ru_id'])) {
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>
</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,23 +142,19 @@ 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">
?>
<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';?>" >
<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>';
}
?>
@ -212,7 +207,7 @@ if (!empty($_REQUEST['ru_id'])) {
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>';
@ -221,7 +216,7 @@ if (!empty($_REQUEST['ru_id'])) {
echo '</div>';
?>
</div>
<!-- if Line Type = feature Show Futures Park -->
<!-- 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-4">
<?php
@ -248,7 +243,7 @@ if (!empty($_REQUEST['ru_id'])) {
?>
</div>
</div>
<!-- if Line Type = feature Show Futures Park -->
<!-- if Line Type = feature Show Futures Park -->
<div data-type='featurep' class="lineid_<?php echo $line_id.(($show_form_mode=='feature')? (($defaul_ftr=='parkinglot')? ' ':' hidden'):' hidden');?>" name="<?php echo $forminfo[1]['name'].$line_id.'_park';?>">
<div class="col-xs-4">
<div class="radioset" data-toggle="buttons">
@ -267,12 +262,12 @@ if (!empty($_REQUEST['ru_id'])) {
<?php
echo '<!-- End button :'.$line_id.' -->';
}
?>
</div>
?>
</div>
</form>
<div class="section-butom" data-for="<?php echo $forminfo[0]['name'];?>">
<h3></h3>

View file

@ -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>

View file

@ -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="element-container"> <div class="row"> <div class="form-group">
<div class="col-md-3"> <label class="control-label" for="ERROR">Error loadinging form configuration </label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="ERROR"></i>
</div></div></div></div>

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

View file

@ -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&amp;tech_hardware=sccp_custom"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Extension") ?></a>
<button id="remove-sccp-extension" class="btn btn-danger btn-remove" data-type="extensions" data-section="sccp-extension" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button>
<a class="btn btn-default" href="config.php?display=extensions&tech_hardware=sccp_custom"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Extension") ?></a>
</div>
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&amp;command=getExtensionGrid&amp;type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name">
<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>
@ -47,7 +44,7 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
if (rmn_dev == 'yes') {
exp_dev += '<a href="config.php?display=sccp_phone&amp;tech_hardware=r_user&amp;ru_id=' + row['name'] + '"><i class="fa fa-bicycle"></i></a> &nbsp;';
}
return exp_dev;
return exp_dev;
return '<a href="config.php?display=extensions&amp;extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;<a class="clickable delete" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
}
</script>
</script>

View file

@ -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&amp;tech_hardware=cisco"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<button id="remove-sccp-phone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
<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&amp;command=getPhoneGrid&amp;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>
@ -62,7 +65,7 @@
}
}
return exp_model;
}
function DispayDeviceActionsKeyFormatter(value, row, index) {
var exp_model = '';
@ -70,29 +73,28 @@
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco&new_id=' + row['name'] + '&type='+ row['type'];
if (row['addon'] !== null ) {
exp_model += '&addon='+ row['addon'];
}
}
exp_model += '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
} else {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco&id=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="hardware" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
}
return exp_model;
}
}
function LineFormatter(value, row, index) {
if (value === null) {
return '-- EMPTY --';
}
var data = value.split(";");
var data = value.split(";");
result = '';
for (var i = 0; i < data.length; i++) {
var val = data[i].split(',');
if (val[0] === 'line') {
var val = data[i].split(',');
if (val[0] === 'line') {
result = result + val[1] + '<br>';
}
}
}
}
return result;
}
</script>
</script>

View file

@ -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>&nbsp;<?php echo _("List Device")?></a>
<a href="config.php?display=sccp_phone&amp;tech_hardware=cisco" class = "btn btn-default"><i class="fa fa-plus"></i>&nbsp;<?php echo _("Add Device")?></a>
<div id="toolbar-sccp-rnav">
<a class="btn btn-default" href="config.php?display=sccp_phone#sccpdevice">
<i class="fa fa-list"></i>&nbsp;
<?php echo _("List Device")?>
</a>
<a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco">
<i class="fa fa-plus">&nbsp;</i>
<?php echo _("Add Device")?>
</a>
</div>
<table id="sccpnavgrid"
data-search="true"
data-toolbar="#toolbar-sccpnav"
data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=sccp"
data-cache="false"
data-toggle="table"
class="table">
data-search="true"
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>
<tr>
<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>

View file

@ -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&amp;tech_hardware=cisco-sip"><i class="fa fa-plus">&nbsp;</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">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<button id="remove-sccp-sphone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button>
<button name="cr_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&amp;command=getPhoneGrid&amp;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,21 +44,8 @@
</div>
<script>
function DispayDeviceActionsKeyFormatterS(value, row, index) {
var exp_model = '';
if (row['new_hw'] == "Y") {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco-sip&new_id=' + row['name'] + '&type='+ row['type'];
if (row['addon'] !== null ) {
exp_model += '&addon='+ row['addon'];
}
exp_model += '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
} else {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco-sip&id=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="hardware" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
}
return exp_model;
}
function DispayTypeFormatter(value, row, index) {
var exp_model = value;
@ -71,21 +57,36 @@
exp_model += ' + ' + row['addon'];
}
}
return exp_model;
return exp_model;
}
function LineFormatterS(value, row, index) {
function DispayDeviceActionsKeyFormatterS(value, row, index) {
var exp_model = '';
if (row['new_hw'] == "Y") {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco-sip&new_id=' + row['name'] + '&type='+ row['type'];
if (row['addon'] !== null ) {
exp_model += '&addon='+ row['addon'];
}
exp_model += '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
} else {
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco-sip&id=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp; &nbsp;\n';
exp_model += '</a> &nbsp;<a class="btn-item-delete" data-for="hardware" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
}
return exp_model;
}
function LineFormatter(value, row, index) {
if (value === null) {
return '-- EMPTY --';
}
var data = value.split(";");
var data = value.split(";");
result = '';
for (var i = 0; i < data.length; i++) {
var val = data[i].split(',');
if (val[0] === 'line') {
var val = data[i].split(',');
if (val[0] === 'line') {
result = result + val[1] + '<br>';
}
}
}
}
return result;
}
</script>
</script>

View file

@ -9,12 +9,15 @@
<form autocomplete="off" name="frm_advanced" id="frm_ntp" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="advancedform">
<input type="hidden" name="Submit" value="Submit">
<?php
echo $this->showGroup('sccp_srst', 1);
echo $this->showGroup('sccp_advant', 1);
// echo $this->showGroup('sccp_dev_time',1);
?>
<?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_dev_vendor_conf', 1, 'sccpdevice', $defaultVals);
?>
</form>

View file

@ -6,46 +6,57 @@
* 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;
}
?>
<!-- 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">
<div class="section" data-id="sccp_dcodecs">
<!--Codec disallow-->
<div class="element-container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="sccp_disallow"><?php echo _("Disallow") ?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="sccp_disallow"></i>
</div>
<div class="col-md-9 radioset">
<input id="sccp_disallow" type="text" name="sccp_disallow" value="<?php echo $sccp_disallow_def ?>">
<label for="sccp_disallow"><?php echo _("Recomended default: all") ?></label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="sccp_disallow-help" class="help-block fpbx-help-block"><?php echo _("Default : all. If you wish to change (Not Recommended) please enter a semicolon separated list for example: alaw;ulaw;...") ?></span>
</div>
</div>
</div>
<!--END Codec disallow-->
</div>
<!--SCCP Audio Codecs-->
<div class="section-title" data-for="sccp_acodecs">
<h3><i class="fa fa-minus"></i><?php echo _("SCCP Audio Codecs ") ?></h3>
</div>
<div class="section" data-id="sccp_acodecs">
<!--Codecs-->
<div class="element-container">
@ -54,24 +65,29 @@ if (!empty($_REQUEST['id'])) {
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="codecw"><?php echo _("Allow (audio)") ?></label>
<label class="control-label" for="codecw"><?php echo _("Allow") ?></label>
</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
@ -90,8 +106,9 @@ if (!empty($_REQUEST['id'])) {
</div>
<!--END Codecs-->
<!--END SCCP Audio Codecs-->
</div>
<!--END SCCP Audio Codecs-->
<!--SCCP Video Codecs-->
<div class="section-title" data-for="sccp_vcodecs">
<h3><i class="fa fa-minus"></i><?php echo _("SCCP Video Codecs ") ?></h3>
@ -104,16 +121,17 @@ if (!empty($_REQUEST['id'])) {
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="codecw"><?php echo _("Allow (video)") ?></label>
<label class="control-label" for="codecw"><?php echo _("Allow") ?></label>
</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' : '';
@ -121,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
. ' />'
. '&nbsp;&nbsp;<label for="' . $codec . '"> '
@ -137,45 +155,8 @@ if (!empty($_REQUEST['id'])) {
</div>
</div>
</div>
<!--END Codecs-->
</div>
<!--END Codecs-->
<!--END SCCP Video Codecs-->
</div>
<div class="section-title" data-for="sccp_dcodecs">
<h3><i class="fa fa-minus"></i><?php echo _("SCCP Disallow Codecs ") ?></h3>
</div>
<div class="section" data-id="sccp_dcodecs">
<!--Codec disallow-->
<div class="element-container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="sccp_disallow"><?php echo _("Disallow") ?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="sccp_disallow"></i>
</div>
<div class="col-md-9 radioset">
<input id="sccp_disallow" type="text" name="sccp_disallow" value="<?php echo $sccp_disalow ?>">
<label for="sccp_disallow"><?php echo _("default : " . $sccp_disalow_def) ?></label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="sccp_disallow-help" class="help-block fpbx-help-block"><?php echo _("Default : all. Plz eneter format: alaw,ulaw") ?></span>
</div>
</div>
</div>
<!--END Codec disallow-->
</div>
</form>

View file

@ -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>

View file

@ -7,17 +7,18 @@
$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');
// if there are multiple connections, this will only return the first.
foreach ($ast_realtime as $key => $value) {
if (empty($ast_realm)) {
if ($value['status'] == 'OK') {
if ($value['status'] === 'OK') {
$ast_realm = $key;
}
}
@ -26,29 +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']);
$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']) {
@ -83,6 +116,10 @@ if (empty($ast_realtime)) {
}
$info['RealTime'] = array('Version' => $rt_sccp, 'about' => $rt_info);
}
// There are potential issues with string Type Declarations in PHP 5.
$info['PHP'] = array('Version' => phpversion(), 'about' => version_compare(phpversion(), '7.0.0', '>' ) ? 'OK' : 'PHP 7 Preferred - Please upgrade if possible');
$mariaDbInfo = exec('mysql -V');
$info['MariaDb'] = array('Version' => explode(" ",$mariaDbInfo)[3], 'about' => $mariaDbInfo);
if (empty($conf_realtime)) {
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about' => '<div class="alert signature alert-danger"> Realtime configuration was not found</div>');
@ -105,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));
@ -118,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">
@ -495,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>

View file

@ -22,14 +22,14 @@
</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);
?>
?>
</form>
@ -39,21 +39,20 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="gridSystemModalLabel_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">
<?php
// echo $this->showGroup('add_network_1',0);
?>
?>
</ul>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary sccp_update" data-id="network_add" data-mode="new" id="network_add" data-dismiss="modal">Save</button>
</div>
</div>
</div>
</div>
</div>

View file

@ -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>