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)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429934 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2014-12-22 02:35:05 +00:00
parent b137a92aef
commit b79a4a464f
5 changed files with 67 additions and 5 deletions

View File

@@ -306,7 +306,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
</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
@@ -314,6 +314,28 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
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">
<synopsis>Sets how confbridge handles video distribution to the conference participants</synopsis>
<description><para>
@@ -1524,10 +1546,20 @@ static char *handle_cli_confbridge_show_bridge_profile(struct ast_cli_entry *e,
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);
} else {
@@ -2096,8 +2128,11 @@ int conf_load_config(void)
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 */