[asterisk-commits] mjordan: trunk r429934 - in /trunk: ./ apps/ apps/confbridge/ apps/confbridge...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Dec 21 20:35:13 CST 2014


Author: mjordan
Date: Sun Dec 21 20:35:05 2014
New Revision: 429934

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=429934
Log:
app_confbridge: Add the ability to pass options/command to MixMonitor

This patch adds the ability to pass options and a command to MixMontor when
recording a conference using ConfBridge.

New options are -

* record_options: Options to MixMontor, eg: m(), W() etc.
* record_command: The command to execute when recording is over.
* record_file_timestamp: Append the start time to the file name.

These options can also be used with the CONFBRIDGE function, e.g.,
Set(CONFBRIDGE(bridge,record_command)=/path/to/command ^{MIXMONITOR_FILENAME}))

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

ASTERISK-24351 #close
Reported by: Gareth Palmer
patches:
  record_command-428838.patch uploaded by Gareth Palmer (License 5169)


Modified:
    trunk/CHANGES
    trunk/apps/app_confbridge.c
    trunk/apps/confbridge/conf_config_parser.c
    trunk/apps/confbridge/include/confbridge.h
    trunk/configs/samples/confbridge.conf.sample

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=429934&r1=429933&r2=429934
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Sun Dec 21 20:35:05 2014
@@ -11,6 +11,21 @@
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 13 to Asterisk 14 --------------------
 ------------------------------------------------------------------------------
+
+Applications
+------------------
+
+ConfBridge
+------------------
+ * Added the ability to pass options to MixMonitor when recording is used with
+   ConfBridge. This includes the addition of the following configuration
+   parameters for the 'bridge' object:
+   - record_file_timestamp: whether or not to append the start time to the
+     recorded file name
+   - record_options: the options to pass to the MixMonitor application
+   - record_command: a command to execute when recording is finished
+   Note that these options may also be with the CONFBRIDGE function.
+
 
 Channel Drivers
 ------------------

Modified: trunk/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_confbridge.c?view=diff&rev=429934&r1=429933&r2=429934
==============================================================================
--- trunk/apps/app_confbridge.c (original)
+++ trunk/apps/app_confbridge.c Sun Dec 21 20:35:05 2014
@@ -569,7 +569,7 @@
 	ast_str_reset(*filename);
 	if (ast_strlen_zero(rec_file)) {
 		ast_str_set(filename, 0, "confbridge-%s-%u.wav", conference->name, (unsigned int)now);
-	} else {
+	} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_TIMESTAMP)) {
 		/* insert time before file extension */
 		ext = strrchr(rec_file, '.');
 		if (ext) {
@@ -578,11 +578,14 @@
 		} else {
 			ast_str_set(filename, 0, "%s-%u", rec_file, (unsigned int)now);
 		}
-	}
-
-	if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND)) {
-		ast_str_append(filename, 0, ",a");
-	}
+	} else {
+		ast_str_set(filename, 0, "%s", rec_file);
+	}
+
+	ast_str_append(filename, 0, ",%s%s,%s",
+		ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND) ? "a" : "",
+		conference->b_profile.rec_options,
+		conference->b_profile.rec_command);
 }
 
 static int is_new_rec_file(const char *rec_file, struct ast_str **orig_rec_file)

Modified: trunk/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/confbridge/conf_config_parser.c?view=diff&rev=429934&r1=429933&r2=429934
==============================================================================
--- trunk/apps/confbridge/conf_config_parser.c (original)
+++ trunk/apps/confbridge/conf_config_parser.c Sun Dec 21 20:35:05 2014
@@ -306,12 +306,34 @@
 					</para></description>
 				</configOption>
 				<configOption name="record_file_append" default="yes">
-					<synopsis>Append record file when starting/stopping on same conference recording</synopsis>
+					<synopsis>Append to record file when starting/stopping on same conference recording</synopsis>
 					<description><para>
 						When <replaceable>record_file_append</replaceable> is set to yes, stopping and starting recording on a
 						conference adds the new portion to end of current record_file. When this is
 						set to no, a new <replaceable>record_file</replaceable> is generated every time you start then stop recording
 						on a conference.
+					</para></description>
+				</configOption>
+				<configOption name="record_file_timestamp" default="yes">
+					<synopsis>Append the start time to the <replaceable>record_file</replaceable> name so that it is unique.</synopsis>
+					<description><para>
+						When <replaceable>record_file_timestamp</replaceable> is set to yes, the start time is appended to
+						<replaceable>record_file</replaceable> so that the filename is unique. This allows you to specify
+						a <replaceable>record_file</replaceable> but not overwrite existing recordings.
+					</para></description>
+				</configOption>
+				<configOption name="record_options" default="">
+					<synopsis>Pass additional options to MixMonitor when recording</synopsis>
+					<description><para>
+						Pass additional options to MixMonitor when <replaceable>record_conference</replaceable> is set to yes.
+						See <literal>MixMonitor</literal> for available options.
+					</para></description>
+				</configOption>
+				<configOption name="record_command" default="">
+					<synopsis>Execute a command after recording ends</synopsis>
+					<description><para>
+						Executes the specified command when recording ends. Any strings matching <literal>^{X}</literal> will be
+						unescaped to <variable>X</variable>. All variables will be evaluated at the time ConfBridge is called.
 					</para></description>
 				</configOption>
 				<configOption name="video_mode">
@@ -1524,9 +1546,19 @@
 		b_profile.flags & BRIDGE_OPT_RECORD_FILE_APPEND ?
 		"yes" : "no");
 
+	ast_cli(a->fd,"Record File Timestamp: %s\n",
+		b_profile.flags & BRIDGE_OPT_RECORD_FILE_TIMESTAMP ?
+		"yes" : "no");
+
 	ast_cli(a->fd,"Record File:          %s\n",
 		ast_strlen_zero(b_profile.rec_file) ? "Auto Generated" :
 		b_profile.rec_file);
+
+	ast_cli(a->fd,"Record Options:       %s\n",
+		b_profile.rec_options);
+
+	ast_cli(a->fd,"Record Command:       %s\n",
+		b_profile.rec_command);
 
 	if (b_profile.max_members) {
 		ast_cli(a->fd,"Max Members:          %u\n", b_profile.max_members);
@@ -2096,8 +2128,11 @@
 	aco_option_register(&cfg_info, "record_conference", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_CONFERENCE);
 	aco_option_register_custom(&cfg_info, "video_mode", ACO_EXACT, bridge_types, NULL, video_mode_handler, 0);
 	aco_option_register(&cfg_info, "record_file_append", ACO_EXACT, bridge_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_FILE_APPEND);
+	aco_option_register(&cfg_info, "record_file_timestamp", ACO_EXACT, bridge_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_FILE_TIMESTAMP);
 	aco_option_register(&cfg_info, "max_members", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, max_members));
 	aco_option_register(&cfg_info, "record_file", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_file));
+	aco_option_register(&cfg_info, "record_options", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_options));
+	aco_option_register(&cfg_info, "record_command", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_command));
 	aco_option_register(&cfg_info, "language", ACO_EXACT, bridge_types, "en", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, language));
 	aco_option_register_custom(&cfg_info, "^sound_", ACO_REGEX, bridge_types, NULL, sound_option_handler, 0);
 	/* This option should only be used with the CONFBRIDGE dialplan function */

Modified: trunk/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/confbridge/include/confbridge.h?view=diff&rev=429934&r1=429933&r2=429934
==============================================================================
--- trunk/apps/confbridge/include/confbridge.h (original)
+++ trunk/apps/confbridge/include/confbridge.h Sun Dec 21 20:35:05 2014
@@ -68,6 +68,7 @@
 	BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED = (1 << 2), /*!< Set if conference should feed video of first marked user to all participants. */
 	BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER = (1 << 3), /*!< Set if conference set the video feed to follow the loudest talker.  */
 	BRIDGE_OPT_RECORD_FILE_APPEND = (1 << 4), /*!< Set if the record file should be appended to between start/stops.  */
+	BRIDGE_OPT_RECORD_FILE_TIMESTAMP = (1 << 5), /*< Set if the record file should have a timestamp appended */
 };
 
 enum conf_menu_action_id {
@@ -198,6 +199,8 @@
 	char name[64];
 	char language[MAX_LANGUAGE];		  /*!< Language used for playback_chan */
 	char rec_file[PATH_MAX];
+	char rec_options[128];
+	char rec_command[128];
 	unsigned int flags;
 	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. */

Modified: trunk/configs/samples/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/samples/confbridge.conf.sample?view=diff&rev=429934&r1=429933&r2=429934
==============================================================================
--- trunk/configs/samples/confbridge.conf.sample (original)
+++ trunk/configs/samples/confbridge.conf.sample Sun Dec 21 20:35:05 2014
@@ -162,6 +162,12 @@
                                ; allows the record name to be specified and a unique name to be chosen.
                                ; By default, the record_file is stored in Asterisk's spool/monitor directory
                                ; with a unique filename starting with the 'confbridge' prefix.
+
+;record_file_append=yes        ; Append record file when starting/stopping on same conference recording.
+;record_file_timestamp=yes     ; Append the start time to the record file name.
+
+;record_options=               ; Pass additional options to MixMonitor.
+;record_command=</path/to/command> ; Command to execute when recording finishes.
 
 ;internal_sample_rate=auto     ; Sets the internal native sample rate the
                                ; conference is mixed at.  This is set to automatically




More information about the asterisk-commits mailing list