summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2013-07-01 16:01:24 +0000
committerJonathan Rose <jrose@digium.com>2013-07-01 16:01:24 +0000
commitf306dbd8412778ef31df791b658dc38e15629ae3 (patch)
treef8203232ba890acc8cfdd5bd0ce8004c9801433b /main
parent909ee4bfb9180a87e02504acb47f27b47cb5adea (diff)
bridge_features: Support One touch Monitor/MixMonitor
In addition to porting those features, they now enjoy greater feature parity with one another. Specifically, AutoMixMon now has a start and stop message that can be specified with TOUCH_MIXMONITOR_MESSAGE_START and TOUCH_MIXMONITOR_MESSAGE_STOP. (closes issue ASTERISK-21553) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2620/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393309 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/features_config.c13
-rw-r--r--main/mixmonitor.c98
2 files changed, 110 insertions, 1 deletions
diff --git a/main/features_config.c b/main/features_config.c
index 9fe72a225..66fdbfae8 100644
--- a/main/features_config.c
+++ b/main/features_config.c
@@ -39,6 +39,9 @@
<configOption name="courtesytone">
<synopsis>Sound to play when automon or automixmon is activated</synopsis>
</configOption>
+ <configOption name="recordingfailsound">
+ <synopsis>Sound to play when automon or automixmon is attempted but fails to start</synopsis>
+ </configOption>
<configOption name="transferdigittimeout" default="3000">
<synopsis>Milliseconds allowed between digit presses when dialing a transfer destination</synopsis>
</configOption>
@@ -292,6 +295,7 @@
<enum name="pickupsound"><para><xi:include xpointer="xpointer(/docs/configInfo[@name='features']/configFile[@name='features.conf']/configObject[@name='globals']/configOption[@name='pickupsound']/synopsis/text())" /></para></enum>
<enum name="pickupfailsound"><para><xi:include xpointer="xpointer(/docs/configInfo[@name='features']/configFile[@name='features.conf']/configObject[@name='globals']/configOption[@name='pickupfailsound']/synopsis/text())" /></para></enum>
<enum name="courtesytone"><para><xi:include xpointer="xpointer(/docs/configInfo[@name='features']/configFile[@name='features.conf']/configObject[@name='globals']/configOption[@name='courtesytone']/synopsis/text())" /></para></enum>
+ <enum name="recordingfailsound"><para><xi:include xpointer="xpointer(/docs/configInfo[@name='features']/configFile[@name='features.conf']/configObject[@name='globals']/configOption[@name='recordingfailsound']/synopsis/text())" /></para></enum>
</enumlist>
</parameter>
</syntax>
@@ -338,6 +342,7 @@
/*! Default general options */
#define DEFAULT_FEATURE_DIGIT_TIMEOUT 1000
#define DEFAULT_COURTESY_TONE ""
+#define DEFAULT_RECORDING_FAIL_SOUND ""
/*! Default xfer options */
#define DEFAULT_TRANSFER_DIGIT_TIMEOUT 3000
@@ -787,6 +792,8 @@ static int general_set(struct ast_features_general_config *general, const char *
res = ast_parse_arg(value, PARSE_INT32, &general->featuredigittimeout);
} else if (!strcasecmp(name, "courtesytone")) {
ast_string_field_set(general, courtesytone, value);
+ } else if (!strcasecmp(name, "recordingfailsound")) {
+ ast_string_field_set(general, recordingfailsound, value);
} else {
/* Unrecognized option */
res = -1;
@@ -804,6 +811,8 @@ static int general_get(struct ast_features_general_config *general, const char *
snprintf(buf, len, "%u", general->featuredigittimeout);
} else if (!strcasecmp(field, "courtesytone")) {
ast_copy_string(buf, general->courtesytone, len);
+ } else if (!strcasecmp(field, "recordingfailsound")) {
+ ast_copy_string(buf, general->recordingfailsound, len);
} else {
/* Unrecognized option */
res = -1;
@@ -1595,8 +1604,10 @@ static int load_config(void)
aco_option_register_custom(&cfg_info, "featuredigittimeout", ACO_EXACT, global_options,
__stringify(DEFAULT_FEATURE_DIGIT_TIMEOUT), general_handler, 0);
+ aco_option_register_custom(&cfg_info, "recordingfailsound", ACO_EXACT, global_options,
+ DEFAULT_RECORDING_FAIL_SOUND, general_handler, 0);
aco_option_register_custom(&cfg_info, "courtesytone", ACO_EXACT, global_options,
- __stringify(DEFAULT_COURTESY_TONE), general_handler, 0);
+ DEFAULT_COURTESY_TONE, general_handler, 0);
aco_option_register_custom(&cfg_info, "transferdigittimeout", ACO_EXACT, global_options,
__stringify(DEFAULT_TRANSFER_DIGIT_TIMEOUT), xfer_handler, 0)
diff --git a/main/mixmonitor.c b/main/mixmonitor.c
new file mode 100644
index 000000000..6de72794a
--- /dev/null
+++ b/main/mixmonitor.c
@@ -0,0 +1,98 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2013, Digium, Inc.
+ *
+ * Jonathan Rose <jrose@digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief loadable MixMonitor functionality
+ *
+ * \author Jonathan Rose <jrose@digium.com>
+ */
+
+/*** MODULEINFO
+ <support_level>core</support_level>
+ ***/
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 390830 $")
+
+#include "asterisk/lock.h"
+#include "asterisk/logger.h"
+#include "asterisk/mixmonitor.h"
+#include "asterisk/utils.h"
+#include "asterisk/channel.h"
+
+AST_RWLOCK_DEFINE_STATIC(mixmonitor_lock);
+
+static struct ast_mixmonitor_methods mixmonitor_methods;
+static int table_loaded = 0;
+
+int ast_set_mixmonitor_methods(struct ast_mixmonitor_methods *method_table)
+{
+ SCOPED_WRLOCK(lock, &mixmonitor_lock);
+
+ if (table_loaded) {
+ /* If mixmonitor methods have already been provided, reject the new set */
+ ast_log(LOG_ERROR, "Tried to set mixmonitor methods, but something else has already provided them.\n");
+ return -1;
+ }
+
+ mixmonitor_methods = *method_table;
+
+ table_loaded = 1;
+ return 0;
+}
+
+int ast_clear_mixmonitor_methods(void)
+{
+ SCOPED_WRLOCK(lock, &mixmonitor_lock);
+
+ if (!table_loaded) {
+ ast_log(LOG_ERROR, "Tried to clear mixmonitor methods, but none are currently loaded.\n");
+ return -1;
+ }
+
+ memset(&mixmonitor_methods, 0, sizeof(mixmonitor_methods));
+
+ table_loaded = 0;
+ return 0;
+}
+
+int ast_start_mixmonitor(struct ast_channel *chan, const char *filename, const char *options)
+{
+ SCOPED_RDLOCK(lock, &mixmonitor_lock);
+
+ if (!mixmonitor_methods.start) {
+ ast_log(LOG_ERROR, "No loaded module currently provides MixMonitor starting functionality.\n");
+ return -1;
+ }
+
+ return mixmonitor_methods.start(chan, filename, options);
+}
+
+int ast_stop_mixmonitor(struct ast_channel *chan, const char *mixmon_id)
+{
+ SCOPED_RDLOCK(lock, &mixmonitor_lock);
+
+ if (!mixmonitor_methods.stop) {
+ ast_log(LOG_ERROR, "No loaded module currently provides MixMonitor stopping functionality.\n");
+ return -1;
+ }
+
+ return mixmonitor_methods.stop(chan, mixmon_id);
+}