[svn-commits] dvossel: branch dvossel/hd_confbridge r310882 - in /team/dvossel/hd_confbridg...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 15 12:42:30 CDT 2011


Author: dvossel
Date: Tue Mar 15 12:42:26 2011
New Revision: 310882

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310882
Log:
Allow user moh class to be specified in user profile

Modified:
    team/dvossel/hd_confbridge/apps/app_confbridge.c
    team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
    team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
    team/dvossel/hd_confbridge/configs/confbridge.conf.sample

Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=310882&r1=310881&r2=310882
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Tue Mar 15 12:42:26 2011
@@ -374,7 +374,7 @@
 		 * allowing a marked user to enter while the prompt was playing
 		 */
 		if (!conference_bridge->markedusers && ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MUSICONHOLD)) {
-			ast_moh_start(conference_bridge_user->chan, conference_bridge_user->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
+			ast_moh_start(conference_bridge_user->chan, conference_bridge_user->u_profile.moh_class, NULL);
 		}
 	}
 }
@@ -400,7 +400,7 @@
 		 * participant could have joined while the above prompt was playing for the first user.
 		 */
 		if (conference_bridge->users == 1 && ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MUSICONHOLD)) {
-			ast_moh_start(conference_bridge_user->chan, conference_bridge_user->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
+			ast_moh_start(conference_bridge_user->chan, conference_bridge_user->u_profile.moh_class, NULL);
 		}
 		return;
 	}
@@ -625,7 +625,7 @@
 					other_participant->kicked = 1;
 					ast_bridge_remove(conference_bridge->bridge, other_participant->chan);
 				} else if (ast_test_flag(&other_participant->u_profile, USER_OPT_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, other_participant->chan)) {
-					ast_moh_start(other_participant->chan, other_participant->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
+					ast_moh_start(other_participant->chan, other_participant->u_profile.moh_class, NULL);
 					ast_bridge_unsuspend(conference_bridge->bridge, other_participant->chan);
 				}
 			}
@@ -634,7 +634,7 @@
 			struct conference_bridge_user *first_participant = AST_LIST_FIRST(&conference_bridge->users_list);
 
 			if (ast_test_flag(&first_participant->u_profile, USER_OPT_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, first_participant->chan)) {
-				ast_moh_start(first_participant->chan, first_participant->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
+				ast_moh_start(first_participant->chan, first_participant->u_profile.moh_class, NULL);
 				ast_bridge_unsuspend(conference_bridge->bridge, first_participant->chan);
 			}
 		}
@@ -1158,7 +1158,7 @@
 	/* See if music on hold needs to be started back up again */
 	ao2_lock(conference_bridge);
 	if (conference_bridge->users == 1 && ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MUSICONHOLD)) {
-		ast_moh_start(bridge_channel->chan, conference_bridge_user->opt_args[OPTION_MUSICONHOLD_CLASS], NULL);
+		ast_moh_start(bridge_channel->chan, conference_bridge_user->u_profile.moh_class, NULL);
 	}
 	ao2_unlock(conference_bridge);
 

Modified: team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c?view=diff&rev=310882&r1=310881&r2=310882
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Tue Mar 15 12:42:26 2011
@@ -196,6 +196,7 @@
 	/* set defaults */
 	u_profile->flags = 0;
 	memset(u_profile->pin, 0, sizeof(u_profile->pin));
+	memset(u_profile->moh_class, 0, sizeof(u_profile->moh_class));
 	for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
 		if (!strcasecmp(var->name, "type")) {
 			continue;
@@ -241,6 +242,8 @@
 				u_profile->flags & ~USER_OPT_ANNOUNCE_JOIN_LEAVE;
 		} else if (!strcasecmp(var->name, "pin")) {
 			ast_copy_string(u_profile->pin, var->value, sizeof(u_profile->pin));
+		} else if (!strcasecmp(var->name, "music_on_hold_class")) {
+			ast_copy_string(u_profile->moh_class, var->value, sizeof(u_profile->moh_class));
 		} else if (!strcasecmp(var->name, "denoise")) {
 			u_profile->flags = ast_true(var->value) ?
 				u_profile->flags | USER_OPT_DENOISE :
@@ -477,6 +480,9 @@
 	ast_cli(a->fd,"MOH When Empty:      %s\n",
 		u_profile.flags & USER_OPT_MUSICONHOLD ?
 		"enabled" : "disabled");
+	ast_cli(a->fd,"MOH Class:           %s\n",
+		ast_strlen_zero(u_profile.moh_class) ?
+		"default" : u_profile.moh_class);
 	ast_cli(a->fd,"Quiet:               %s\n",
 		u_profile.flags & USER_OPT_QUIET ?
 		"enabled" : "disabled");

Modified: team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h?view=diff&rev=310882&r1=310881&r2=310882
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Tue Mar 15 12:42:26 2011
@@ -103,6 +103,7 @@
 struct user_profile {
 	char name[128];
 	char pin[MAX_PIN];
+	char moh_class[128];
 	unsigned int flags;
 	int delme;
 };
@@ -113,12 +114,6 @@
 	unsigned int max_members;          /*!< The maximum number of participants allowed in the conference */
 	unsigned int internal_sample_rate; /*!< The internal sample rate of the bridge. 0 when set to auto adjust mode. */
 	int delme;
-};
-
-enum {//todohere this must move or go away somewhere
-	OPTION_MUSICONHOLD_CLASS,            /*!< If the 'M' option is set, the music on hold class to play */
-	/*This must be the last element */
-	OPTION_ARRAY_SIZE,
 };
 
 /*! \brief The structure that represents a conference bridge */
@@ -144,7 +139,6 @@
 	char menu_name[64];                          /*!< The name of the DTMF menu assigned to this user */
 	char name_rec_location[PATH_MAX];            /*!< Location of the User's name recorded file if it exists */
 	struct ast_channel *chan;                    /*!< Asterisk channel participating */
-	char *opt_args[OPTION_ARRAY_SIZE];           /*!< Arguments to options passed when application was called */
 	struct ast_bridge_features features;         /*!< Bridge features structure */
 	unsigned int kicked:1;                       /*!< User has been kicked from the conference */
 	AST_LIST_ENTRY(conference_bridge_user) list; /*!< Linked list information */

Modified: team/dvossel/hd_confbridge/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/configs/confbridge.conf.sample?view=diff&rev=310882&r1=310881&r2=310882
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Tue Mar 15 12:42:26 2011
@@ -20,6 +20,7 @@
                                ; one person is in the conference or when the
                                ; the user is waiting on a marked user to enter
                                ; the conference. Off by default.
+;music_on_hold_class=default   ; The MOH class to use for this user.
 ;quiet=yes     ; Sets if no audio prompts should be played.  There are some prompts,
                ; such as the prompt to enter a PIN number, that must be played regardless
                ; of what this option is set to.  Off by default




More information about the svn-commits mailing list