[asterisk-commits] dvossel: branch dvossel/hd_confbridge r314596 - in /team/dvossel/hd_confbridg...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 21 11:43:05 CDT 2011


Author: dvossel
Date: Thu Apr 21 11:43:03 2011
New Revision: 314596

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=314596
Log:
Addition of join and leave sound options in bridge 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=314596&r1=314595&r2=314596
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Thu Apr 21 11:43:03 2011
@@ -75,8 +75,7 @@
                     </parameter>
             </syntax>
             <description>
-                    <para>Enters the user into a specified conference bridge. The user can exit the conference by hangup only.</para>
-                    <para>The join sound can be set using the <literal>CONFBRIDGE_JOIN_SOUND</literal> variable and the leave sound can be set using the <literal>CONFBRIDGE_LEAVE_SOUND</literal> variable. These can be unique to the caller.</para>
+                    <para>Enters the user into a specified conference bridge. The user can exit the conference by hangup or DTMF menu option.</para>
             </description>
     </application>
 	<function name="CONFBRIDGE" language="en_US">
@@ -299,7 +298,12 @@
 		return S_OR(custom_sounds->unlockednow, "conf-unlockednow");
 	case CONF_SOUND_ERROR_MENU:
 		return S_OR(custom_sounds->errormenu, "conf-errormenu");
-	}
+	case CONF_SOUND_JOIN:
+		return S_OR(custom_sounds->join, "beep");
+	case CONF_SOUND_LEAVE:
+		return S_OR(custom_sounds->leave, "beeperr");
+	}
+
 	return "";
 }
 
@@ -1150,6 +1154,7 @@
 static int confbridge_exec(struct ast_channel *chan, const char *data)
 {
 	int res = 0, volume_adjustments[2];
+	int quiet = 0;
 	char *parse;
 	const char *b_profile_name = DEFAULT_BRIDGE_PROFILE;
 	const char *u_profile_name = DEFAULT_USER_PROFILE;
@@ -1160,8 +1165,6 @@
 		.tech_args.silence_threshold = DEFAULT_SILENCE_THRESHOLD,
 		.tech_args.drop_silence = 0,
 	};
-	const char *tmp, *join_sound = NULL, *leave_sound = NULL;
-	int quiet = 0;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(conf_name);
 		AST_APP_ARG(b_profile_name);
@@ -1286,16 +1289,6 @@
 		}
 	}
 
-	/* Grab join/leave sounds from the channel */
-	ast_channel_lock(chan);
-	if ((tmp = pbx_builtin_getvar_helper(chan, "CONFBRIDGE_JOIN_SOUND"))) {
-		join_sound = ast_strdupa(tmp);
-	}
-	if ((tmp = pbx_builtin_getvar_helper(chan, "CONFBRIDGE_LEAVE_SOUND"))) {
-		leave_sound = ast_strdupa(tmp);
-	}
-	ast_channel_unlock(chan);
-
 	/* if this user has a intro, play it before entering */
 	if (!ast_strlen_zero(conference_bridge_user.name_rec_location)) {
 		ast_autoservice_start(chan);
@@ -1305,8 +1298,10 @@
 		ast_autoservice_stop(chan);
 	}
 
-	/* If there is 1 or more people already in the conference then play our join sound unless overridden */
-	if (!quiet && !ast_strlen_zero(join_sound) && conference_bridge->users >= 2) {
+	/* Play the Join sound to both the conference and the user entering. */
+	if (!quiet) {
+		const char *join_sound = conf_get_sound(CONF_SOUND_JOIN, conference_bridge_user.b_profile.sounds);
+		ast_stream_and_wait(chan, join_sound, "");
 		ast_autoservice_start(chan);
 		play_sound_file(conference_bridge, join_sound);
 		ast_autoservice_stop(chan);
@@ -1330,8 +1325,9 @@
 		ast_autoservice_stop(chan);
 	}
 
-	/* If there is 1 or more people (not including us) already in the conference then play our leave sound unless overridden */
-	if (!quiet && !ast_strlen_zero(leave_sound) && conference_bridge->users >= 2) {
+	/* play the leave sound */
+	if (!quiet) {
+		const char *leave_sound = conf_get_sound(CONF_SOUND_LEAVE, conference_bridge_user.b_profile.sounds);
 		ast_autoservice_start(chan);
 		play_sound_file(conference_bridge, leave_sound);
 		ast_autoservice_stop(chan);

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=314596&r1=314595&r2=314596
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Thu Apr 21 11:43:03 2011
@@ -249,6 +249,10 @@
 		ast_string_field_set(sounds, lockednow, sound_file);
 	} else if (!strcasecmp(sound_name, "sound_error_menu")) {
 		ast_string_field_set(sounds, errormenu, sound_file);
+	} else if (!strcasecmp(sound_name, "sound_join")) {
+		ast_string_field_set(sounds, join, sound_file);
+	} else if (!strcasecmp(sound_name, "sound_leave")) {
+		ast_string_field_set(sounds, leave, sound_file);
 	} else {
 		return -1;
 	}
@@ -968,6 +972,9 @@
 	} else {
 		ast_cli(a->fd,"Max Members:          No Limit\n");
 	}
+
+	ast_cli(a->fd,"sound_join:           %s\n", conf_get_sound(CONF_SOUND_JOIN, b_profile.sounds));
+	ast_cli(a->fd,"sound_leave:          %s\n", conf_get_sound(CONF_SOUND_LEAVE, b_profile.sounds));
 	ast_cli(a->fd,"sound_only_person:    %s\n", conf_get_sound(CONF_SOUND_ONLY_PERSON, b_profile.sounds));
 	ast_cli(a->fd,"sound_has_joined:     %s\n", conf_get_sound(CONF_SOUND_HAS_JOINED, b_profile.sounds));
 	ast_cli(a->fd,"sound_has_left:       %s\n", conf_get_sound(CONF_SOUND_HAS_LEFT, b_profile.sounds));

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=314596&r1=314595&r2=314596
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Thu Apr 21 11:43:03 2011
@@ -149,6 +149,8 @@
 	CONF_SOUND_LOCKED_NOW,
 	CONF_SOUND_UNLOCKED_NOW,
 	CONF_SOUND_ERROR_MENU,
+	CONF_SOUND_JOIN,
+	CONF_SOUND_LEAVE,
 };
 
 struct bridge_profile_sounds {
@@ -171,6 +173,8 @@
 		AST_STRING_FIELD(lockednow);
 		AST_STRING_FIELD(unlockednow);
 		AST_STRING_FIELD(errormenu);
+		AST_STRING_FIELD(leave);
+		AST_STRING_FIELD(join);
 	);
 };
 

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=314596&r1=314595&r2=314596
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Thu Apr 21 11:43:03 2011
@@ -174,6 +174,8 @@
 ; sound file found in the sounds directory when announcing someone's name is joining the
 ; conference.
 
+;sound_join  ; The sound played to everyone when someone enters the conference.
+;sound_leave ; The sound played to everyone when someone leaves the conference.
 ;sound_has_joined ; The sound played before announcing someone's name has
                   ; joined the conference. This is used for user intros.
                   ; Example "_____ has joined the conference"




More information about the asterisk-commits mailing list