[Home]

Summary:ASTERISK-17542: [patch] Configurable phoneprov path
Reporter:Paul Dugas (pdugas)Labels:
Date Opened:2011-03-10 22:33:11.000-0600Date Closed:2012-02-15 08:43:23.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_phoneprov
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) list.html
( 1) res_phoneprov-absolute-paths.patch
( 2) res_phoneprov-absolute-paths-2.patch
( 3) res_phoneprov-absolute-paths-3.patch
Description:I maintain a few Asterisk installations using the RPMs from Digium's YUM repository and have to deal with files in my AST_DATADIR/phoneprov folder being overwritten with packages are updated.  I keep /etc/asterisk in an SVN repository.   I keep my provisioning files and templates in /etc/asterisk/phoneprov and change /var/lib/asterisk/phoneprov to be a link to there.  

I'm not sure what the "right" way to do this is but I'd like to be able to point the res_phoneprov module to an alternate path for its content and templates.  I can code and am willing to develop a patch but would like some guidance on the "correct" way to handle this.  Is this worthy of a new entry in asterisk.conf's [directories] section?  Or, is this a new setting in phoneprov.conf?  Perhaps another I'm not thinking of?
Comments:By: Andrew Latham (lathama) 2011-03-11 05:50:44.000-0600

You should be able to use absolute paths for your static folder and your dynamic files.

By: Paul Dugas (pdugas) 2011-03-11 07:47:08.000-0600

It doesn't seem to work that way now.  I'll look into a patch to allow it though.

By: Andrew Latham (lathama) 2011-03-11 07:50:10.000-0600

I can test right now...  Absolute paths outside of the data dir do not work.

By: Andrew Latham (lathama) 2011-03-11 07:53:24.000-0600

Relative paths do work....

andy.html => ../../../../root/andy.html,text/html

worked for me...

By: Paul Dugas (pdugas) 2011-03-11 08:03:14.000-0600

The attached patch is against rev 310330 on branches/1.8.  I've done some minimal testing with both a static and a dynamic file and it appears to work.  It allows me to use an absolute path for "staticdir" as well as templates in phoneprov.conf like so.

staticdir => /etc/asterisk/phoneprov/static/
${TOLOWER(${MAC})}.cfg => /etc/asterisk/phoneprov/000000000000.cfg

By: Andrew Latham (lathama) 2011-03-11 08:04:42.000-0600

I would suggest a patch with updated documentation to the phoneprov.conf.sample file...

By: Paul Dugas (pdugas) 2011-03-11 08:22:09.000-0600

I'm no wordsmith so I borrowed language from another config file that allows absolute paths.  Updated patch attached with changes to the sample config.

By: Andrew Latham (lathama) 2011-03-11 08:31:12.000-0600

pdugas, thanks, patch + documentation is better than just a patch :D

suggestion on your phoneprov.conf.sample

"request to /phoneprov/sip.cfg"
replace with
"requests to http://server:port/phoneprov/sip.cfg"

my reason is that the beginning / may confuse the user, however the http:// tells them that we are talking about url paths and not file system paths.

By: Andrew Latham (lathama) 2011-03-11 08:42:45.000-0600

I uploaded a demo to use for testing.  Use it with a few hundred users to test the processing time for the http response.

By: Paul Dugas (pdugas) 2011-03-11 09:22:59.000-0600

Suggestion applied and new patch attached.

By: Andrew Latham (lathama) 2011-03-11 09:23:51.000-0600

Awesome!

By: Paul Dugas (pdugas) 2011-03-11 09:44:12.000-0600

I used your demo with 500 users.  Browser says it took 29ms to get the response.  Not sure what that helps with as this patch only affects the initial loading of the template.  Maybe I'm not understanding what you're asking for?

By: Andrew Latham (lathama) 2011-03-11 09:49:04.000-0600

Cool, the file is just a method of making it work a little...  A normal phone config only sets a few values.  This is my way of putting the system to work, go mule go... :D

By: Andrew Latham (lathama) 2012-02-15 08:43:23.088-0600

Lack of interest and testers