Polycom SLA Provisioning

=Provisioning Polycom VVX with SLA= This document is meant as a guide to configure provisioning, make alterations per the authors preferences, and enable SLA w/ presence to emulate a 'key system'. All testing and development of this guide was on Polycom VVX 400/410 phones. This guide by syadnom_* in freenode/#fusionpbx

Prerequisites

 * a fusionpbx installation
 * nginx as web server
 * basic abilities on linux cli to edit files
 * some basic familiarity with fusionpbx

Info

 * This guide is using the Broadsoft SCA/SLA method preferred by freeswitch
 * There are only 2 fully function phone brand/series that do SLA with freeswitch, Polycom (SoundPoint and VVX) and Cisco/Linksys SPA
 * This guide also works for the SPA line but needs additional rewrites and changes to provisioning files
 * Aastra phones have partial support for SLA, I have a number of 53i/55i running from this config with changes to rewrites and provisioning, but the partial support kills the usefulness
 * I choose the Polycom VVX series as a long time SoundPoint and FreePBX user and it's ability to do SLA
 * This guide was built with huge help from a number of regulars in freenode/#fusionpbx, as well as data pulled from this wiki.

Provisioning tool
Access the provisioning editor at Advanced/Provisioning Editor navigate to Files/polycom/vvx

{$mac}.cfg
alter the line to add the [PHONE_MAC_ADDRESS]-features.cfg file to initial provisioning. This tells the phone to make use of the features.cfg file where a few settings like parking lots and background images can be configured. 

{$mac}-registration.cfg
for SLA to work, thirdPartyName needs to be blanked. Also, this needs cleared if you plan to alter the Label as this guide directs. Change the following fields. reg.{$row.line_number}.label="{$row.display_name}" reg.{$row.line_number}.type="shared" reg.{$row.line_number}.thirdPartyName=""

features.cfg
we will add some variables so that background images can be configured from 'Default settings'. find the following section     change it to     the setting "2,1" is essentially 'enable' '2', 'image' 1, so defaulting to use bg.color.bm.1.name.

Rewrite Rules
the apply only to nginx, and by default are in /etc/nginx/sites-enabled/fusionpbx rewrite "^.*/provision/000000000000.cfg$" "/app/provison/?mac=$1&file=%7b%24mac%7d.cfg"; rewrite "^.*/provision/(.*).(png|jpg|gif)" "/app/provision/backgrounds/$host/$1.$2"; rewrite "^.*/provision/([A-Fa-f0-9]{12})-features.cfg$" /app/provision/?mac=$1&file=features.cfg; rewrite "^.*/provision/([A-Fa-f0-9]{12})-sip.cfg$" /app/provision/?mac=$1&file=sip.cfg; rewrite "^.*/provision/([A-Fa-f0-9]{12})-phone.cfg$" /app/provision/?mac=$1; rewrite "^.*/provision/([A-Fa-f0-9]{12})-registration.cfg$" "/app/provision/?mac=$1&file=%7b%24mac%7d-registration.cfg"; rewrite "^.*/provision/([A-Fa-f0-9]{12})-site.cfg$" /app/provision/?mac=$1&file=site.cfg; rewrite "^.*/provision/([A-Fa-f0-9]{12})-web.cfg$" /app/provision/?mac=$1&file=web.cfg;
 * 1) polycom

Background Images
Create your background images, in this case 320x240 jpg,png, or gif. you will need to create directories and set permissions to match each of your domains, and then add the files to individual folders. The rewrite rule above takes the domain used in the URL and directs the request to the per-domain directories below. The FQDN entires MUST match the domain exactly. Image filenames must match the bg1 and bg2 variables set below exactly. The PUBLIC and PRIVATE ip options are there in case you connect directly to the IP for provisioning (single domain for instance) and can be if this is only multi-tenant. mkdir -p /var/www/fusionpbx/app/provision/backgrounds/ mkdir -p /var/www/fusionpbx/app/provision/backgrounds/ mkdir -p /var/www/fusionpbx/app/provision/backgrounds/ mkdir -p /var/www/fusionpbx/app/provision/backgrounds/ chown -R www-data.www-data /var/www/fusionpbx/app/provision/backgrounds/

Default Settings
navigate to Advanced/Default Settings.

Provisioning
add/update the entries to match
 * ideally the bg1 variable could be set by domain for multi-tenancy, haven't figured that one out yet

Phone Configuration
for 'manual' phone configuration, browse to the phone's IP address and alter the following Settings>Provisioning Server