[Asterisk-code-review] apps/confbridge: Added hearjoin option to control who hears sound_join (asterisk[16])

Michael Cargile asteriskteam at digium.com
Wed Feb 23 10:29:53 CST 2022


Michael Cargile has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18072 )


Change subject: apps/confbridge: Added hearjoin option to control who hears sound_join
......................................................................

apps/confbridge: Added hearjoin option to control who hears sound_join

Added the hearjoin option to the confbridge user profile to control who
hears the sound_join audio file. When set to 'yes' the user entering
the conference and the participants already in the conference will hear
the sound_join audio file. When set to 'no' the user entering the
conference will not hear the sound_join audio file, but the participants
already in the conference will hear the sound_join audio file.

ASTERISK-29931
Added by Michael Cargile

Change-Id: I856bd66dc0dfa057323860a6418c1371d249abd2
---
M apps/app_confbridge.c
M apps/confbridge/conf_config_parser.c
M apps/confbridge/include/confbridge.h
M configs/samples/confbridge.conf.sample
4 files changed, 24 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/72/18072/1

diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index 2eaae41..4c70746 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -2724,13 +2724,19 @@
 	if (!quiet) {
 		const char *join_sound = conf_get_sound(CONF_SOUND_JOIN, conference->b_profile.sounds);
 
-		if (strcmp(conference->b_profile.language, ast_channel_language(chan))) {
-			ast_stream_and_wait(chan, join_sound, "");
+		if (ast_test_flag(&user.u_profile, USER_OPT_HEAR_JOIN) ) {
+			if (strcmp(conference->b_profile.language, ast_channel_language(chan))) {
+				ast_stream_and_wait(chan, join_sound, "");
+				ast_autoservice_start(chan);
+				play_sound_file(conference, join_sound);
+				ast_autoservice_stop(chan);
+			} else {
+				async_play_sound_file(conference, join_sound, chan);
+			}
+		} else {
 			ast_autoservice_start(chan);
 			play_sound_file(conference, join_sound);
 			ast_autoservice_stop(chan);
-		} else {
-			async_play_sound_file(conference, join_sound, chan);
 		}
 	}
 
diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c
index 4f58c18..88eb038 100644
--- a/apps/confbridge/conf_config_parser.c
+++ b/apps/confbridge/conf_config_parser.c
@@ -97,6 +97,9 @@
 				<configOption name="quiet">
 					<synopsis>Silence enter/leave prompts and user intros for this user</synopsis>
 				</configOption>
+				<configOption name="hearjoin">
+                                        <synopsis>Determines if the user also hears the join sound when they enter a conference</synopsis>
+                                </configOption>
 				<configOption name="announce_user_count">
 					<synopsis>Sets if the number of users should be announced to the user</synopsis>
 				</configOption>
@@ -1574,6 +1577,9 @@
 	ast_cli(a->fd,"Quiet:                   %s\n",
 		u_profile.flags & USER_OPT_QUIET ?
 		"enabled" : "disabled");
+	ast_cli(a->fd,"Hear Join:               %s\n",
+                u_profile.flags & USER_OPT_HEAR_JOIN ?
+                "enabled" : "disabled");
 	ast_cli(a->fd,"Wait Marked:             %s\n",
 		u_profile.flags & USER_OPT_WAITMARKED ?
 		"enabled" : "disabled");
@@ -2396,6 +2402,7 @@
 	aco_option_register(&cfg_info, "startmuted", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_STARTMUTED);
 	aco_option_register(&cfg_info, "music_on_hold_when_empty", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_MUSICONHOLD);
 	aco_option_register(&cfg_info, "quiet", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_QUIET);
+	aco_option_register(&cfg_info, "hearjoin", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_HEAR_JOIN);
 	aco_option_register_custom(&cfg_info, "announce_user_count_all", ACO_EXACT, user_types, "no", announce_user_count_all_handler, 0);
 	aco_option_register(&cfg_info, "announce_user_count", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANNOUNCEUSERCOUNT);
 	/* Negative logic. Defaults to "yes" and evaluates with ast_false(). If !ast_false(), USER_OPT_NOONLYPERSON is cleared */
diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h
index 95a0732..f86afee 100644
--- a/apps/confbridge/include/confbridge.h
+++ b/apps/confbridge/include/confbridge.h
@@ -70,6 +70,7 @@
 	USER_OPT_ECHO_EVENTS = (1 << 18), /*!< Send events only to the admin(s) */
 	USER_OPT_TEXT_MESSAGING = (1 << 19), /*!< Send text messages to the user */
 	USER_OPT_ANSWER_CHANNEL = (1 << 20), /*!< Sets if the channel should be answered if currently unanswered */
+	USER_OPT_HEAR_JOIN  = (1 << 21), /*!< Set if the caller should hear the join sound */
 };
 
 enum bridge_profile_flags {
diff --git a/configs/samples/confbridge.conf.sample b/configs/samples/confbridge.conf.sample
index eecbb65..3f5cba2 100644
--- a/configs/samples/confbridge.conf.sample
+++ b/configs/samples/confbridge.conf.sample
@@ -41,6 +41,12 @@
                ; 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
+;hearjoin=yes     ; Sets if a user joining the conference should hear the sound_join 
+                  ; audio sound when they enter the conference. If set to 'no' the 
+                  ; user will not hear the sound_join audio but the other participants 
+                  ; in the conference will still hear the audio. If set to 'yes' 
+                  ; everyone hears the sound_join audio when this user enters the conference. 
+                  ; On by default
 ;announce_user_count=yes  ; Sets if the number of users should be announced to the
                           ; caller.  Off by default.
 ;announce_user_count_all=yes ; Sets if the number of users should be announced to

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18072
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I856bd66dc0dfa057323860a6418c1371d249abd2
Gerrit-Change-Number: 18072
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Cargile <mikec at vicidial.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220223/18514cb2/attachment.html>


More information about the asterisk-code-review mailing list