[asterisk-commits] mjordan: branch certified-11.2 r381410 - in /certified/branches/11.2: ./ apps/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 14 09:19:16 CST 2013


Author: mjordan
Date: Thu Feb 14 09:19:12 2013
New Revision: 381410

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381410
Log:
app_page and app_confbridge: Fix custom announcement on entering conference.

The Page and ConfBridge custom announcement did not play when users
entered the conference.

* Fix the CONFBRIDGE(user,announcement) file not getting played.  The code
to do this got removed accidentally when the ConfBridge code was
restructured to be more state machine like.

* Fixed play_prompt_to_user() doxygen comments.

* Fixed the Page A(x) and n options for the caller.  The caller never
played the announcement file and totally ignored the n option.  The code
to do this was lost when the application was converted to use ConfBridge.

* Factored out setup_profile_bridge(), setup_profile_paged(), and
setup_profile_caller() routines to setup ConfBridge profiles.  Made each
profile setup routine use the default template if one has not already been
setup by dialplan.

(closes issue ASTERISK-20990)
Reported by: Jeremy Kister
Tested by: rmudgett
........

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

Modified:
    certified/branches/11.2/   (props changed)
    certified/branches/11.2/apps/app_confbridge.c
    certified/branches/11.2/apps/app_page.c

Propchange: certified/branches/11.2/
------------------------------------------------------------------------------
--- branch-11-merged (original)
+++ branch-11-merged Thu Feb 14 09:19:12 2013
@@ -1,1 +1,1 @@
-/branches/11:378038,378287,378321,378409-378411,378582,378687,378690,378984,379513,379790,380465,381306
+/branches/11:378038,378287,378321,378409-378411,378582,378687,378690,378984,379513,379790,380465,380894,381306

Modified: certified/branches/11.2/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/11.2/apps/app_confbridge.c?view=diff&rev=381410&r1=381409&r2=381410
==============================================================================
--- certified/branches/11.2/apps/app_confbridge.c (original)
+++ certified/branches/11.2/apps/app_confbridge.c Thu Feb 14 09:19:12 2013
@@ -722,9 +722,8 @@
 /*!
  * \brief Play back an audio file to a channel
  *
- * \param conference_bridge Conference bridge they are in
- * \param chan Channel to play audio prompt to
- * \param file Prompt to play
+ * \param cbu User to play audio prompt to
+ * \param filename Prompt to play
  *
  * \return Returns 0 on success, -1 if the user hung up
  * \note Generally this should be called when the conference is unlocked to avoid blocking
@@ -1104,6 +1103,15 @@
 	}
 
 	ao2_unlock(conference_bridge);
+
+	/* If an announcement is to be played play it */
+	if (!ast_strlen_zero(conference_bridge_user->u_profile.announcement)) {
+		if (play_prompt_to_user(conference_bridge_user,
+			conference_bridge_user->u_profile.announcement)) {
+			leave_conference(conference_bridge_user);
+			return NULL;
+		}
+	}
 
 	/* Announce number of users if need be */
 	if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_ANNOUNCEUSERCOUNT)) {
@@ -1413,7 +1421,6 @@
 	if (args.argc > 2 && !ast_strlen_zero(args.u_profile_name)) {
 		u_profile_name = args.u_profile_name;
 	}
-
 	if (!conf_find_user_profile(chan, u_profile_name, &conference_bridge_user.u_profile)) {
 		ast_log(LOG_WARNING, "Conference user profile %s does not exist\n", u_profile_name);
 		res = -1;

Modified: certified/branches/11.2/apps/app_page.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/11.2/apps/app_page.c?view=diff&rev=381410&r1=381409&r2=381410
==============================================================================
--- certified/branches/11.2/apps/app_page.c (original)
+++ certified/branches/11.2/apps/app_page.c Thu Feb 14 09:19:12 2013
@@ -141,6 +141,70 @@
 	struct ast_flags flags;
 };
 
+/*!
+ * \internal
+ * \brief Setup the page bridge profile.
+ *
+ * \param chan Setup bridge profile on this channel.
+ * \param options Options to setup bridge profile.
+ *
+ * \return Nothing
+ */
+static void setup_profile_bridge(struct ast_channel *chan, struct page_options *options)
+{
+	/* Use default_bridge as a starting point */
+	ast_func_write(chan, "CONFBRIDGE(bridge,template)", "");
+	if (ast_test_flag(&options->flags, PAGE_RECORD)) {
+		ast_func_write(chan, "CONFBRIDGE(bridge,record_conference)", "yes");
+	}
+}
+
+/*!
+ * \internal
+ * \brief Setup the paged user profile.
+ *
+ * \param chan Setup user profile on this channel.
+ * \param options Options to setup paged user profile.
+ *
+ * \return Nothing
+ */
+static void setup_profile_paged(struct ast_channel *chan, struct page_options *options)
+{
+	/* Use default_user as a starting point */
+	ast_func_write(chan, "CONFBRIDGE(user,template)", "");
+	ast_func_write(chan, "CONFBRIDGE(user,quiet)", "yes");
+	ast_func_write(chan, "CONFBRIDGE(user,end_marked)", "yes");
+	if (!ast_test_flag(&options->flags, PAGE_DUPLEX)) {
+		ast_func_write(chan, "CONFBRIDGE(user,startmuted)", "yes");
+	}
+	if (ast_test_flag(&options->flags, PAGE_ANNOUNCE)
+		&& !ast_strlen_zero(options->opts[OPT_ARG_ANNOUNCE])) {
+		ast_func_write(chan, "CONFBRIDGE(user,announcement)", options->opts[OPT_ARG_ANNOUNCE]);
+	}
+}
+
+/*!
+ * \internal
+ * \brief Setup the caller user profile.
+ *
+ * \param chan Setup user profile on this channel.
+ * \param options Options to setup caller user profile.
+ *
+ * \return Nothing
+ */
+static void setup_profile_caller(struct ast_channel *chan, struct page_options *options)
+{
+	/* Use default_user as a starting point if not already setup. */
+	ast_func_write(chan, "CONFBRIDGE(user,template)", "");
+	ast_func_write(chan, "CONFBRIDGE(user,quiet)", "yes");
+	ast_func_write(chan, "CONFBRIDGE(user,marked)", "yes");
+	if (!ast_test_flag(&options->flags, PAGE_NOCALLERANNOUNCE)
+		&& ast_test_flag(&options->flags, PAGE_ANNOUNCE)
+		&& !ast_strlen_zero(options->opts[OPT_ARG_ANNOUNCE])) {
+		ast_func_write(chan, "CONFBRIDGE(user,announcement)", options->opts[OPT_ARG_ANNOUNCE]);
+	}
+}
+
 static void page_state_callback(struct ast_dial *dial)
 {
 	struct ast_channel *chan;
@@ -152,22 +216,8 @@
 		return;
 	}
 
-	ast_func_write(chan, "CONFBRIDGE(bridge,template)", "default_bridge");
-
-	if (ast_test_flag(&options->flags, PAGE_RECORD)) {
-		ast_func_write(chan, "CONFBRIDGE(bridge,record_conference)", "yes");
-	}
-
-	ast_func_write(chan, "CONFBRIDGE(user,quiet)", "yes");
-	ast_func_write(chan, "CONFBRIDGE(user,end_marked)", "yes");
-
-	if (!ast_test_flag(&options->flags, PAGE_DUPLEX)) {
-		ast_func_write(chan, "CONFBRIDGE(user,startmuted)", "yes");
-	}
-
-	if (ast_test_flag(&options->flags, PAGE_ANNOUNCE) && !ast_strlen_zero(options->opts[OPT_ARG_ANNOUNCE])) {
-		ast_func_write(chan, "CONFBRIDGE(user,announcement)", options->opts[OPT_ARG_ANNOUNCE]);
-	}
+	setup_profile_bridge(chan, options);
+	setup_profile_paged(chan, options);
 }
 
 static int page_exec(struct ast_channel *chan, const char *data)
@@ -302,17 +352,10 @@
 	}
 
 	if (!res) {
-		ast_func_write(chan, "CONFBRIDGE(bridge,template)", "default_bridge");
-
-		if (ast_test_flag(&options.flags, PAGE_RECORD)) {
-			ast_func_write(chan, "CONFBRIDGE(bridge,record_conference)", "yes");
-		}
-
-		ast_func_write(chan, "CONFBRIDGE(user,quiet)", "yes");
-		ast_func_write(chan, "CONFBRIDGE(user,marked)", "yes");
+		setup_profile_bridge(chan, &options);
+		setup_profile_caller(chan, &options);
 
 		snprintf(confbridgeopts, sizeof(confbridgeopts), "%u", confid);
-
 		pbx_exec(chan, app, confbridgeopts);
 	}
 




More information about the asterisk-commits mailing list