Ticket #1950 (new Module Submissions)

Opened 3 years ago

Last modified 3 months ago

Auto Provisioning For Polycom & Grandstream Phones

Reported by: thisboyiscrazy Assigned to:
Priority: minor Milestone: Cut Line
Component: Other Module Version: 2.2.1
Keywords: Cc:
Confirmation: Confirmed SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

Here is a module that will assist in Auto Provisioning Polycom Phones

You add a MAC and map it to a device on "Add phone"

It will download 000000000000.cfg.template and phone1.cfg.template from your ftp server and replace varibles then upload them to the ftp server as (mac).cfg and (mac)-phone1.cfg

The varibles are replaced with values from the sip table e.g. account in the sip table will replace any occerance of %ACCOUNT% in the template files, %MAC% is also replaced with the mac address of the phone.

currently the ftp host, username, and password are hard coded.

Under settings there is:

"Update All" - which will recreate the config files.
and
"Detect and map phones" - which will search for polycom MAC addresses and allow you to quickly assing them (uses the nmap scaning on DevicesTakeTwo )

This is my first module and the coding is a little bit of a mess but here you go.

Attachments

autoconfig.tgz (3.5 kB) - added by thisboyiscrazy on 05/17/07 11:29:11.
autoprovision.tgz (6.1 kB) - added by thisboyiscrazy on 05/18/07 11:38:09.
Auto Provisioning Module
autoprovision.2.tgz (6.7 kB) - added by thisboyiscrazy on 05/22/07 11:41:20.
Updated version
autoconf.php (2.9 kB) - added by thisboyiscrazy on 06/04/07 06:33:49.
autoconfig update from phone
extensions_custom.conf (0.6 kB) - added by thisboyiscrazy on 06/04/07 06:34:34.
customer app for autoconf.php
functions.inc.php (11.3 kB) - added by jmarches23 on 04/22/09 10:26:19.
functions.inc.2.php (11.3 kB) - added by warmbowski on 05/18/10 15:34:16.
new functions.inc.php replacing device with of deviceid at line 386

Change History

05/17/07 11:29:11 changed by thisboyiscrazy

  • attachment autoconfig.tgz added.

05/18/07 11:38:09 changed by thisboyiscrazy

  • attachment autoprovision.tgz added.

Auto Provisioning Module

05/18/07 11:49:50 changed by thisboyiscrazy

The module now works with polycom and grand stream

there was a redisign on how it works. now inside the autoprovision modules directory the is a template files directory. a feature should be added that the user can upload these.

The basic idea is the same take a template from the templates folder substitute vars. and upload the new file

for grandstream it also uses autoprovision/helpers/config.php to create the config files for the phones.

it uses a exec call to "tftp localhost -c put" to upload the files. this should also be change to a "setting". allow the to be a exec call allow the user to select how he want the files uploaded: tftp, ftp, mv, scp, etc.

also todo:
Change "Settings" to "Tools"
Upload of config files
Add in setting where you can set other vars. e.g. NTP server

05/20/07 05:19:24 changed by mbrevda

  • summary changed from Auto Provisioning For Polycom Phones to Auto Provisioning For Polycom & Grandstream Phones.

05/22/07 11:41:20 changed by thisboyiscrazy

  • attachment autoprovision.2.tgz added.

Updated version

05/22/07 11:47:58 changed by thisboyiscrazy

Made some updates, mainly cleaned up the code. added a Auto Provision section to extensions and devices, this adds a MAC address field and an enable, disable.

might help with #459 and #103

05/23/07 07:50:17 changed by p_lindheimer

two quick notes. First - we have been doing a lot of work on the auto-provisioning (silently) and it will work quite different. We'll look through your work if there is some stuff to leverage but want to make sure you are aware so you don't put more work into this then you really want to.

another note - all the guielements library will be deprecrated and removed within the next release or so - so be careful how much time you invest into using those libraries. Feel free to find me on the #freepbx-dev irc if you have questions and for now thanks for the submissions.

06/04/07 06:33:49 changed by thisboyiscrazy

  • attachment autoconf.php added.

autoconfig update from phone

06/04/07 06:34:34 changed by thisboyiscrazy

  • attachment extensions_custom.conf added.

customer app for autoconf.php

06/04/07 06:43:23 changed by thisboyiscrazy

Added files
autoconf.php - goes in /var/lib/asterisk/agi-bin/
extensions_custom.conf - goes in /etc/asterisk/

the idea of thies is that you can make Auto Provisioning changes from the phone (current by dialing *456)

For example on polycom phones: set up a default 000000000000.cfg that assings the phone a temp account from the phone then you assign the phone it's actual device account.

This would allow installing and configuing the phones in one job.

TODO: make the extension for Auto Provision changes a feature code
TODO: password protect or use pins sets

11/13/07 12:18:56 changed by p_lindheimer

  • confirmation set to Confirmed.
  • milestone deleted.

07/25/08 08:00:55 changed by ryppn

  • milestone set to Cut Line.

08/19/08 10:26:35 changed by warmbowski

I installed this module on FreePBX 2.4.1.0 (PiaF 1.2) and it all worked fine. That ought to get me through until the official provisioning module comes out in v3.0.

04/22/09 10:25:48 changed by jmarches23

We had problems with this module running on FreePBX 2.5.1.0 and received MySQL duplicate entry errors when making updates in the Extension setup page. Editing from the Auto Provisioning page worked fine, but edits from the Extension page failed to delete and edit records in the autoprovision database table.

I changed the autoprovision_configprocess() function in "autoprovision/functions.inc.php" and added a function to check the db for the ext and mac addr. I also added a timestamp to the autoprovision log file.

04/22/09 10:26:19 changed by jmarches23

  • attachment functions.inc.php added.

(follow-up: ↓ 11 ) 05/18/10 15:30:53 changed by warmbowski

When editing a device (device and user mode) in FreePBX 2.6.0.2, the autoprovision module wouldn't replace any instance of %ACCOUNT% with the device number in the file written from the MAC-phone1.cfg template. When I looked at the log t.txt, it showed that the Device variable was blank. I checked the code and a debug with Firefox and Firebug showed that the _REQUEST(device) should be _REQUEST(deviceid). I edited the autoprovision_configprocess() function in the functions.inc.php file posted by jmarches23 and used it to replaced the one distributed in autoprovision.2.tgz. I will attach the file.

Thanks for adding the log file, jmarches23, that helped a lot with the debug.

05/18/10 15:34:16 changed by warmbowski

  • attachment functions.inc.2.php added.

new functions.inc.php replacing device with of deviceid at line 386

(in reply to: ↑ 10 ; follow-up: ↓ 12 ) 05/23/10 21:36:51 changed by carribbrother

how do you install this?

(in reply to: ↑ 11 ) 05/23/10 21:37:52 changed by carribbrother

I added the module and copied the files to the directories what else do you have to do to get this work. freepbx 2.7.

thank you in advance.

05/23/10 21:43:18 changed by carribbrother

what is the difference between autoconfig and autoprovision?

05/23/10 23:06:56 changed by mbrevda

carribbrother, please you the forums or irc for support.