[svn-commits] mjordan: branch certified-11.2 r382084 - in /certified/branches/11.2: ./ apps...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 26 10:46:56 CST 2013


Author: mjordan
Date: Tue Feb 26 10:46:52 2013
New Revision: 382084

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382084
Log:
Ensure that the default bridge/user profiles are always available

ConfBridge and Page require that there always be a default bridge and user
profile available. While properties of the default profiles can be overriden
in the configuration file, removing them can create situations where neither
application can function properly.

This patch ensures that if an administrator removes the profiles from the
confbridge.conf configuration file, the profiles are added upon load.
Documentation clarifying this has been added to the confbridge.conf.sample file.

Review: https://reviewboard.asterisk.org/r/2356/

(closes issue AST-1115)
Reported by: John Bigelow
Tested by: John Bigelow
........

Merged revisions 382066 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    certified/branches/11.2/   (props changed)
    certified/branches/11.2/apps/confbridge/conf_config_parser.c
    certified/branches/11.2/configs/confbridge.conf.sample

Propchange: certified/branches/11.2/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: certified/branches/11.2/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/11.2/apps/confbridge/conf_config_parser.c?view=diff&rev=382084&r1=382083&r2=382084
==============================================================================
--- certified/branches/11.2/apps/confbridge/conf_config_parser.c (original)
+++ certified/branches/11.2/apps/confbridge/conf_config_parser.c Tue Feb 26 10:46:52 2013
@@ -46,6 +46,7 @@
 	struct ao2_container *menus;
 };
 
+static int verify_default_profiles(void);
 static void *bridge_profile_alloc(const char *category);
 static void *bridge_profile_find(struct ao2_container *container, const char *category);
 static struct bridge_profile_sounds *bridge_profile_sounds_alloc(void);
@@ -179,6 +180,7 @@
 
 CONFIG_INFO_STANDARD(cfg_info, cfg_handle, confbridge_cfg_alloc,
 	.files = ACO_FILES(&confbridge_conf),
+	.pre_apply_config = verify_default_profiles,
 );
 
 /*! bridge profile container functions */
@@ -1279,6 +1281,41 @@
 	return 0;
 }
 
+static int verify_default_profiles(void)
+{
+	RAII_VAR(struct user_profile *, user_profile, NULL, ao2_cleanup);
+	RAII_VAR(struct bridge_profile *, bridge_profile, NULL, ao2_cleanup);
+	struct confbridge_cfg *cfg = aco_pending_config(&cfg_info);
+
+	if (!cfg) {
+		return 0;
+	}
+
+	bridge_profile = ao2_find(cfg->bridge_profiles, DEFAULT_BRIDGE_PROFILE, OBJ_KEY);
+	if (!bridge_profile) {
+		bridge_profile = bridge_profile_alloc(DEFAULT_BRIDGE_PROFILE);
+		if (!bridge_profile) {
+			return -1;
+		}
+		ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_BRIDGE_PROFILE);
+		aco_set_defaults(&bridge_type, DEFAULT_BRIDGE_PROFILE, bridge_profile);
+		ao2_link(cfg->bridge_profiles, bridge_profile);
+	}
+
+	user_profile = ao2_find(cfg->bridge_profiles, DEFAULT_USER_PROFILE, OBJ_KEY);
+	if (!user_profile) {
+		user_profile = user_profile_alloc(DEFAULT_USER_PROFILE);
+		if (!user_profile) {
+			return -1;
+		}
+		ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_USER_PROFILE);
+		aco_set_defaults(&user_type, DEFAULT_USER_PROFILE, user_profile);
+		ao2_link(cfg->user_profiles, user_profile);
+	}
+
+	return 0;
+}
+
 int conf_load_config(int reload)
 {
 	if (!reload) {

Modified: certified/branches/11.2/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/certified/branches/11.2/configs/confbridge.conf.sample?view=diff&rev=382084&r1=382083&r2=382084
==============================================================================
--- certified/branches/11.2/configs/confbridge.conf.sample (original)
+++ certified/branches/11.2/configs/confbridge.conf.sample Tue Feb 26 10:46:52 2013
@@ -8,6 +8,10 @@
 ; The default_user and default_bridge sections are applied
 ; automatically to all ConfBridge instances invoked without
 ; a user, or bridge argument.  No menu is applied by default.
+;
+; Note that while properties of the default_user or default_bridge
+; profile can be overridden, if removed, they will be automatically
+; added and made available to the dialplan upon module load.
 ;
 
 ; --- ConfBridge User Profile Options ---




More information about the svn-commits mailing list