|
Home Projects Wiki
Table of Contents
VoicePulse Global Provisioning System (VGPS)by Ketan Patel, Copyright (C) 2006 VoicePulse Inc. The VoicePulse Global Provisioning System (VGPS) is a PHP/MySQL-based provisioning system intended to generate vendor-specific configuration files for via a generic HTTP API. 1.0 BACKGROUNDThe VoicePulse Global Provisioning System is the latest version of VoicePulse‘s in-house provisioning system for Voice-over-IP phone configuration files. As most others who have tried to tackle the issue of mass configuring phones, we have gone through the usual revisions:
you want to support a new setting).
2.0 CONCEPTSThere are two key concepts that drive the VoicePulse Global Provisioning System – templates and generic features. 2.1 TEMPLATESUsing templates in their original form allows for much easier implementation and troubleshooting of configuration files. We generally obtain templates from documentation or utilities (such as Sipura’s spc.exe). It is not mandatory that the template have every possible setting supported by the device, but it’s easier to start with a known working template than creating one by hand. When a request to regenerate a configuration file is submitted via the API, VGPS will determine the model of device, open it’s template file and modify just the unique settings for that device before saving the unique output configuration file. Template files are found in the “input” directory. The name of the file is entered into the `models` table when support for that model is added to the database. 2.2 GENERIC FEATURESPrevious systems have required the calling application (your GUI or customer service management interface) to know the exact name and value that needs to be set in the configuration file. This means if you want to support a different model device, all of your applications have to know how to translate that request for different devices. e.g. to set the SIP username on a Linksys, output "<User_ID_1_>VoicePulseUser</User_ID_1_>" but to set it on a Grandstream, output "P35 = VoicePulseUser" This can make it almost impossible to support a new device if there are numerous applications which must be updated to do so. A key concept of the VGPS is the generic feature. Using generic features, you can tell VGPS: Set "line_01_username" to "VoicePulseUser" for device "000E01234567" Since you have already entered the device MAC address and model into VGPS, it will automatically look up the model, and translate your request into: "<User_ID_1_>VoicePulseUser</User_ID_1_>" for a Linksys phone or "sip line1 user name: VoicePulseUser" for an Aastra phone or "P35 = VoicePulseUser" for a Grandstream phone This means your GUI no longer has to have any knowledge of device-specific settings! If you add a new device to the system at a later time, your GUI does not have to be updated! 3.0 ARCHITECTUREThis section will describe the major entities in the VGPS. Understanding how these entities are related will make it easier for you to use and improve VGPS. 3.1 MODELSA model is defined for each manufacturer you are provisioning devices for. You can also define multiple models for different firmware versions of the same device if the configuration files are different. You may also create different models of the same device if you want to use different templates for different deployments of the same device (e.g. Linksys PAP2T’s in the main office and a remote office). A model is defined as:
The sample models already include the common formats: key with spaces: value key_without_spaces: value key = value (←- alphanumeric key) 123 = value (←- numeric key)
3.2 DEVICESA device is defined for every unique device that configuration files will be generated for. The MAC address of the device is the unique identifier used in all API calls. A device is defined as:
NOTE: An optional text field to be used to keep notes on this device. 3.3 GENERIC SETTINGSA generic setting is defined for every configuration file setting you may want to set, regardless of the model of the device. The database is pre-populated with generic settings for the most common settings – proxy, username, password, display name, and call waiting.
3.4 GENERIC MAPPINGSA generic mapping is defined for every combination of model and generic setting. This is because you must tell the system what to translate the generic settings into for a specific model (e.g. for a Linksys PAP2T, generic setting line_01_username translates into User_ID_1_ in the final device-specific configuration file).
3.5 GENERIC TRANSLATIONSA generic translation is defined for every combination of model and generic setting. This is because you must tell the system what to translate the generic settings into for a specific model (e.g. for a Linksys PAP2T, generic value 0 translates into No in the final device-specific configuration file. If there is no translation, the value supplied by the API will be set directly, with no translation.
3.6 DEVICE SETTINGSThis table holds the device settings that have been defined for each device. The values stored in this table are translated into their final key/pair values. * This values in this table should not be set/modified directly. * 4.0 INSTALLATION4.1 DOWNLOADDownload the necessary files from http://www.sourceforge.net/vgps/. 4.2 EXTRACTTo uncompress and extract the VGPS files, run: tar -zxvf vgps-0.1.tar.gz Since VGPS is a web based system, you probably want to extract the files into: /var/www/html/vgps/ (or your equivalent web root directory) 4.3 DATABASEA SQL script is provided to initialize the VGPS database. To run the script, type the following from the command line (assumes Mysql is running on localhost): mysql -h localhost -u root -p < vgps.sql WARNING! This will drop any existing VGPS database! After running the script, you should see the following in your Mysql database: mysql> use voicepulse_global_provisioning_system; Database changed mysql> show tables; +-------------------------------------------------+ | Tables_in_voicepulse_global_provisioning_system | +-------------------------------------------------+ | device_settings | | devices | | generic_mappings | | generic_settings | | generic_translations | | models | +-------------------------------------------------+ 6 rows in set (0.00 sec) 4.4 TESTTo test your installation, change to the directory you extracted the files into. Assuming you extracted them into /var/www/html/vgps/ and the URL to reach those files is http://localhost/vgps/: cd /var/www/html/vgps/ php test.php If the test is successful, you should see: [root@host vgps]# php test.php Content-type: text/html X-Powered-By: PHP/4.3.11 SUCCESS SUCCESS SUCCESS ... You should also see the generated configuration files for the sample devices in the output directory. [root@host vgps]# cd output [root@host output]# ls 000413000000.htm 00085D000000.cfg 000B82000000.cfg 000E08000000.xml phone0004F2000000.cfg If the URL of your VGPS installation is not http://localhost/vgps/, you must edit $root_url in test.php. 4.5 REQUIREMENTSPHP 4.3.11 or greater Mysql 4 or greater Apache 5.0 INTEGRATIONTo integrate your systems with the VGPS, you have to submit HTTP GET requests to the execute.php file. A working sample can be found in index.php and client_lib.php. ADD/MODIFY A DEVICEhttp://localhost/vgps/execute.php?op=set_device&model=$model&mac=$mac&location=$location¬e=$note Returns a string containing: ERROR: Error message with details or SUCCESS DELETE A DEVICEhttp://localhost/vgps/execute.php?op=delete_device&mac=$mac Returns a string containing: ERROR: Error message with details or SUCCESS SET A DEVICE SETTINGhttp://localhost/vgps/execute.php?op=set_setting&mac=$mac&key=$key&value=$value Returns a string containing: ERROR: Error message with details or SUCCESS DELETE A DEVICE SETTINGhttp://localhost/vgps/execute.php?op=delete_setting&mac=$mac&key=$key Returns a string containing: ERROR: Error message with details or SUCCESS REGENERATEhttp://localhost/vgps/execute.php?op=regen&mac=$mac Returns a string containing: ERROR: Error message with details or SUCCESS LIST DEVICEShttp://localhost/vgps/execute.php?op=list_devices Returns a string with a header row, data fields delimited with ||, and rows delimited with \n: mac_address||location||note||name||tag 000413000000||||Sample Snom 300||Snom 300||snom_300 0004F2000000||||Sample Polycom Soundpoint IP 501||Polycom Soundpoint IP 501||polycom_soundpoint_ip_501 00085D000000||||Sample Aastra 480i||Aastra 480i||aastra_480i 000B82000000||||Sample Grandstream GXP2000 1.1.0.16||Grandstream GXP2000 1.1.0.16||grandstream_gxp2000_1_1_0_16 000E08000000||||Sample Linksys PAP2||Linksys PAP2T||linksys_pap2t LIST DEVICE SETTINGShttp://localhost/vgps/execute.php?op=list_device_settings&mac=$mac Returns a string with data fields delimited with ||, and rows delimited with \n: line_01_password||vppassword line_01_proxy||sip.voicepulse.com line_01_username||vpusername LIST MODELShttp://localhost/vgps/execute.php?op=list_models Returns a string with a header row, data fields delimited with ||, and rows delimited with \n: name||tag Aastra 480i||aastra_480i Grandstream GXP2000 1.1.0.16||grandstream_gxp2000_1_1_0_16 Linksys PAP2T||linksys_pap2t Polycom Soundpoint IP 501||polycom_soundpoint_ip_501 Snom 300||snom_300 6.0 CONTRIBUTINGIf you would like VGPS to support a device that is currently not included in this version, it’s very easy to do so! 6.1 TEMPLATESThe first step in supporting a new device is providing the template file that will go in the input directory. We would prefer templates that were provided directly from the manufacturer or created by a utility provided by the manufacturer. 6.2 SQL SCRIPT(NOTE: if your screen is not wide enough some lines will not be visible to the end. Select that paragraph and paste it into a text editor to view the whole text or read the readme file in the distro archive. this oddity has been brought to you by Cascading Syles Sheets!) The next step is to provide the appropriate data to be entered into Mysql. The SQL script that comes with VGPS, vgps.sql, shows how to populate the data for a new device. We will walk through the required items below:
INSERT INTO `voicepulse_global_provisioning_system`.`models` (
`name`, `tag`, `format`, `regex`, `input_filename`, `output_filename`, `post_processing`)
VALUES ('Linksys PAP2T', 'linksys_pap2t', 'XML', '', 'input/linksys_pap2t.xml', 'output/[MAC].xml', '');
SET @MODEL_ID = (SELECT LAST_INSERT_ID());
INSERT INTO `voicepulse_global_provisioning_system`.`generic_mappings` ( `model_id`, `generic_setting_id`, `profile_key`) SELECT @MODEL_ID, generic_setting_id, tag FROM voicepulse_global_provisioning_system`.`generic_settings`;
Follow this pattern: UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '[SET_THE_PROFILE_KEY_HERE]' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'admin_password';
UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/Admin_Passwd' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'admin_password'; UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/Proxy_1_' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'line_01_proxy'; UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/User_ID_1_' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'line_01_username'; UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/Password_1_' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'line_01_password'; UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/Display_Name_1_' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'line_01_display_name'; UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/CW_Setting_1_' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'line_01_call_waiting'; UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/Proxy_2_' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'line_02_proxy'; UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/User_ID_2_' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'line_02_username'; UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/Password_2_' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'line_02_password'; UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/Display_Name_2_' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'line_02_display_name'; UPDATE `voicepulse_global_provisioning_system`.`generic_mappings` SET `profile_key` = '/flat-profile/CW_Setting_2_' WHERE `model_id` = @MODEL_ID AND `profile_key` = 'line_02_call_waiting';
→ First, select the generic setting you need a mapping for: SET @GENERIC_SETTING_ID = ( SELECT generic_setting_id FROM `voicepulse_global_provisioning_system`.`generic_settings` WHERE `tag` = 'line_01_call_waiting'); → Next, insert the two mappings: INSERT INTO `voicepulse_global_provisioning_system`.`generic_translations` ( `model_id`, `generic_setting_id`, `generic_value`, `profile_value`) SELECT @MODEL_ID, @GENERIC_SETTING_ID, '0', 'No'; INSERT INTO `voicepulse_global_provisioning_system`.`generic_translations` ( `model_id`, `generic_setting_id`, `generic_value`, `profile_value`) SELECT @MODEL_ID, @GENERIC_SETTING_ID, '1', 'Yes'; → Again, select the generic setting you need a mapping for: SET @GENERIC_SETTING_ID = (SELECT generic_setting_id FROM `voicepulse_global_provisioning_system`.`generic_settings` WHERE `tag` = 'line_02_call_waiting'); → Again, insert the two mappings: INSERT INTO `voicepulse_global_provisioning_system`.`generic_translations` ( `model_id`, `generic_setting_id`, `generic_value`, `profile_value`) SELECT @MODEL_ID, @GENERIC_SETTING_ID, '0', 'No'; INSERT INTO `voicepulse_global_provisioning_system`.`generic_translations` ( `model_id`, `generic_setting_id`, `generic_value`, `profile_value`) SELECT @MODEL_ID, @GENERIC_SETTING_ID, '1', 'Yes'; → Finally, you should insert a sample device for testing purposes. INSERT INTO `voicepulse_global_provisioning_system`.`devices` ( model_id, mac_address, location, note) VALUES (@MODEL_ID, '000E08000000', '', 'Sample Linksys PAP2'); 6.3 TEST.PHPFinally, you should modify test.php to call the three set_setting API calls using the MAC address of the sample device you have added. If test.php runs successfully, you should see the generated output file in the output directory. This file should have the values of the line 1 username, password, and proxy set to the values used in test.php. |