So all of those requests go to a script that outputs the XML structure for the directory: We do this for both the 000000000000and the [mac-address]file because one is requested at initial boot (the 000000000000file is intended to be a "seed" directory), whereas subsequent requests are for the MAC address specific file.Getting the log files Polycoms log, and occasionally the logs are useful for debug purposes.For example, the base template file for the IP-330 looks something like this: The script outputs this when the phone requests it. So, for now, we generate those dynamically as well when the phone requests any of its *files.This one's pretty easy since 1) we don't allow the endpoints to customize their directories (yet), and 2) because every phone has the same directory.When the phone receives the server from option 66 and requests 000000000000from the root directory, we instead forward it on to our file, which handles the initial configuration.Our script looks at the HTTPThese files all contain a variation of my previous auto-provisioning configuration config, which tells it the proper directory to look in for phone-specific configuration.In practice this all works very well, and cut the time it used to take me to configure a phone from 5-10 minutes to about 30 seconds. I don't earn any money from this site - I run no ads, sell no products and participate in no affiliate programs.
Generating configs on the fly We're going to skip the first rewrite rule (we'll talk about that one in a little bit since it has to do with plug-in auto provisioning).
This directory, on my server, is /www/asterisk/prov/polycom_ip XXX, where XXX in the phone model.
Right now we deploy the IP-330, IP-331 and IP-4000.
Well, that's what the last two rewrite lines do.
We rewrite those PUT requests to a PHP script and parse the data off stdin, adding it to the database. Even at low settings Polycom phones are chatty with their logs.
The one we're concerned with is the next one, which rewrites [mac-address]requests to our provisioning script. A lot of the settings custom to the company and shared among the various phones are in a master file, and included with each phone (it was added to the 000000000000file). Generating the company directory Polycom phones support directories.