From cc595f7353c4b2c5fc71223a8b1ded601e068e04 Mon Sep 17 00:00:00 2001 From: George Joseph Date: Thu, 9 Oct 2014 17:46:23 +0000 Subject: res_phoneprov: Refactor phoneprov to allow pluggable config providers This patch makes res_phoneprov more modular so other modules (like pjsip) can provide configuration information instead of res_phoneprov relying solely on users.conf and sip.conf. To accomplish this a new ast_phoneprov public API is now exposed which allows config providers to register themselves, set defaults (server profile, etc) and add user extensions. * ast_phoneprov_provider_register registers the provider and provides callbacks for loading default settings and loading users. * ast_phoneprov_provider_unregister clears the defaults and users. * ast_phoneprov_add_extension should be called once for each user/extension by the provider's load_users callback to add them. * ast_phoneprov_delete_extension deletes one extension. * ast_phoneprov_delete_extensions deletes all extensions for the provider. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/3970/ ........ Merged revisions 424963 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 424964 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424965 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- configs/samples/phoneprov.conf.sample | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'configs') diff --git a/configs/samples/phoneprov.conf.sample b/configs/samples/phoneprov.conf.sample index 17d8b1f49..7d14013b2 100644 --- a/configs/samples/phoneprov.conf.sample +++ b/configs/samples/phoneprov.conf.sample @@ -1,4 +1,7 @@ [general] +; This section applies only to the default sip.conf/users.conf config provider +; embedded in res_phoneprov. Other providers may provide their own default settings. + ; The default behavior of res_phoneprov will be to set the SERVER template variable to ; the IP address that the phone uses to contact the provisioning server and the ; SERVER_PORT variable to the bindport setting in sip.conf. Unless you have a very @@ -15,7 +18,8 @@ default_profile=polycom ; The default profile to use if none specified in users. ; with the provisioning server. You can define either static files, or dynamically ; generated files that can have dynamic names and point to templates that variables ; can be substituted into. You can also set arbitrary variables for the profiles -; templates to have access to. Example: +; templates to have access to. Profiles are shared across all config providers. +; Example: ;[example] ;mime_type => application/octet-stream @@ -25,7 +29,9 @@ default_profile=polycom ; The default profile to use if none specified in users. ;setvar => DB_CIDNAME=${ODBC_CID_NAME_LOOKUP(${USERNAME})} ; Dynamically generated files have a filename registered with variable substitution -; with variables obtained while reading users.conf. +; with variables obtained from various config providers. The default provider +; embedded in res_phoneprov reads users.conf. Other providers will have their own +; sources for the variables and may provide additional variables not listed here. ; Built in variables and the options in users.conf that they come from ; MAC (macaddress) -- cgit v1.2.3