Index: configs/phoneprov.conf.sample =================================================================== --- configs/phoneprov.conf.sample (revision 310330) +++ configs/phoneprov.conf.sample (working copy) @@ -56,9 +56,13 @@ ; TIMEZONE [polycom] -staticdir => configs/ ; Sub directory of AST_DATA_DIR/phoneprov that static files reside - ; in. This allows a request to /phoneprov/sip.cfg to pull the file - ; from /phoneprov/configs/sip.cfg +staticdir => configs/ ; Directory that static files reside in. The path + ; specified can be either an absolute path (starts + ; with '/'), or a relative path; relative paths are + ; interpreted as being relative to the 'astdatadir' + ; in asterisk.conf which defaults to /var/lib/asterisk. + ; The example allows a request to /phoneprov/sip.cfg to + ; pull from AST_DATA_DIR/phoneprov/configs/sip.cfg mime_type => text/xml ; Default mime type to use if one isn't specified or the ; extension isn't recognized static_file => bootrom.ld,application/octet-stream ; Static files the phone will download @@ -126,10 +130,15 @@ static_file => SoundPointIPLocalization/Dutch_Netherlands/SoundPointIP-dictionary.xml static_file => SoundPointIPLocalization/Korean_Korea/SoundPointIP-dictionary.xml -${MAC}.cfg => 000000000000.cfg ; Dynamically generated files. -${MAC}-phone.cfg => 000000000000-phone.cfg ; (relative to AST_DATA_DIR/phoneprov) -config/${MAC} => polycom.xml ; Dynamic Filename => template file +; Dynamically generated files. +; FILENAME => TEMPLATE +; The TEMPLATE path is relative to AST_DATA_DIR/phoneprov unless it's +; absolute (starts with '/'). +${MAC}.cfg => 000000000000.cfg +${MAC}-phone.cfg => 000000000000-phone.cfg +config/${MAC} => polycom.xml ${MAC}-directory.xml => 000000000000-directory.xml + setvar => CUSTOM_CONFIG=/var/lib/asterisk/phoneprov/configs/custom.cfg ; Custom variable ;snom 300, 320, 360, 370, 820, 821, 870 support Index: res/res_phoneprov.c =================================================================== --- res/res_phoneprov.c (revision 310330) +++ res/res_phoneprov.c (working copy) @@ -422,7 +422,11 @@ goto out404; } - snprintf(path, sizeof(path), "%s/phoneprov/%s", ast_config_AST_DATA_DIR, route->file->template); + if (route->file->template[0] == '/') { + strncpy(path, route->file->template, sizeof(path)); + } else { + snprintf(path, sizeof(path), "%s/phoneprov/%s", ast_config_AST_DATA_DIR, route->file->template); + } if (!route->user) { /* Static file */ @@ -1157,7 +1161,11 @@ return 0; } - snprintf(path, sizeof(path), "%s/phoneprov/%s", ast_config_AST_DATA_DIR, args.template); + if (args.template[0] == '/') { + strncpy(path, args.template, sizeof(path)); + } else { + snprintf(path, sizeof(path), "%s/phoneprov/%s", ast_config_AST_DATA_DIR, args.template); + } filelen = load_file(path, &file); if (filelen < 0) { ast_log(LOG_WARNING, "Could not load file: %s (%d)\n", path, filelen);