[asterisk-commits] qwell: branch qwell/system_registry r393465 - in /team/qwell/system_registry:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 2 13:34:00 CDT 2013


Author: qwell
Date: Tue Jul  2 13:33:47 2013
New Revision: 393465

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393465
Log:
Multiple revisions 393309,393326,393332,393361,393364,393383,393396,393410,393429,393442,393449,393463

........
  r393309 | jrose | 2013-07-01 11:01:24 -0500 (Mon, 01 Jul 2013) | 11 lines
  
  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/
........
  r393326 | qwell | 2013-07-01 13:19:15 -0500 (Mon, 01 Jul 2013) | 9 lines
  
  ARI: Implement channel dial.
  
  This creates a new outbound channel, and bridges it to a channel already in
  the Stasis application.
  
  (closes issue ASTERISK-21620)
  
  Review: https://reviewboard.asterisk.org/r/2634/
........
  r393332 | qwell | 2013-07-01 13:56:21 -0500 (Mon, 01 Jul 2013) | 8 lines
  
  ARI: Implement channel hold/unhold.
  
  This puts the channel on hold (rather than queueing a frame from the channel).
  
  (closes issue ASTERISK-21619)
  
  Review: https://reviewboard.asterisk.org/r/2647/
........
  r393361 | mjordan | 2013-07-01 16:24:20 -0500 (Mon, 01 Jul 2013) | 17 lines
  
  Prevent crash during synchronous AMI origination by ref bumping returned channel
  
  The originate APIs allow callers to provide a pointer to a channel that will
  point to the originated channel if the function call succeeds. This is used by AMI
  to provide channel information when the originate is performed synchronously.
  Unfortunately, if the originate fails in certain ways, the outbound channel is
  already disposed of during the dialing itself. This results in the channel being
  improperly dereferenced by the internal originate function in pbx.c.
  
  This patch ref bumps the channel to prevent this from occurring. Callers must now
  unlock and unref the channel (which is more in line with general channel management
  guidelines anyway).
  
  This only affects manager, as it is the only consumer of this API function that
  actually passes in a channel pointer.
  
  Review: https://reviewboard.asterisk.org/r/2617/
........
  r393364 | kharwell | 2013-07-01 16:28:32 -0500 (Mon, 01 Jul 2013) | 11 lines
  
  New SIP Channel Driver - Add CLI/AMI initiated NOTIFY requests
  
  Added the ability to send unsolicited NOTIFY requests to a particular endpoint
  with a configured payload.  Added both CLI and AMI support.  For a given
  endpoint, this module will iterate over all its contacts sending the appropriate
  NOTIFY request to each.
  
  (closes issue ASTERISK-21436)
  Reported by: Matt Jordan
  Review: https://reviewboard.asterisk.org/r/2623/
........
  r393383 | tzafrir | 2013-07-02 03:23:16 -0500 (Tue, 02 Jul 2013) | 7 lines
  
  ast_tls_cert: don't recreate generated files
  
  Don't regenrate cat.cfg, ca.crt and ca.key if they were already created
  on a previous run.
  
  (closes issue ASTERISK-21932)
........
  r393396 | igorg | 2013-07-02 05:16:27 -0500 (Tue, 02 Jul 2013) | 8 lines
  
  
  Fix issue with inability to cancell call transfer made by on-sceen menus.
  
  Reported by: Igor Olhovskiy
  ........
  
  Merged revisions 393395 from http://svn.asterisk.org/svn/asterisk/branches/11
........
  r393410 | kmoore | 2013-07-02 09:01:53 -0500 (Tue, 02 Jul 2013) | 10 lines
  
  Add CEL unit tests and do some cleanup
  
  This adds several unit tests for CEL functionality and provides the
  requisite framework for creating additional unit tests.
  
  This also cleans up some reference leaks that were occurring in
  Stasis-Core message callback code.
  
  Review: https://reviewboard.asterisk.org/r/2646/
........
  r393429 | kmoore | 2013-07-02 11:11:32 -0500 (Tue, 02 Jul 2013) | 1 line
  
  Fix transfer AMI event parameter naming
........
  r393442 | kharwell | 2013-07-02 12:06:06 -0500 (Tue, 02 Jul 2013) | 13 lines
  
  New SIP Channel driver: Always Auth Reject
  
  If no matching endpoint is found for the incoming request Asterisk will respond
  with a 401 Unauthorized (rejecting the request), but will first challenge if
  no authorization creditials are given.
  
  Changes also included moving ACL options into a new global 'security'
  configuration section in res_sip.conf.
  
  (closes issue ASTERISK-21433)
  Reported by: Matt Jordan
  Review: https://reviewboard.asterisk.org/r/2554/
........
  r393449 | kharwell | 2013-07-02 12:20:20 -0500 (Tue, 02 Jul 2013) | 12 lines
  
  Stasis - Refactor AOC Events
  
  Refactored the AMI events in AOC onto Stasis-Core.  The ast_aoc_manager_event
  function now publishes a channel snapshot, along with a JSON blob describing
  the advice of charge.  A "to_ami" handler has also been added that converts
  the channel snapshot and AOC event data back into the appropriate data structure
  for use with AMI.
  
  (closes issue ASTERISK-21472)
  Reported by: Matt Jordan
  Review: https://reviewboard.asterisk.org/r/2643/
........
  r393463 | mmichelson | 2013-07-02 13:28:16 -0500 (Tue, 02 Jul 2013) | 6 lines
  
  Remove unused blind transfer publication structure.
  
  I ended up using a bridge blob, so this structure was
  unused. Keeping it in the header would just cause confusion.
........

Merged revisions 393309,393326,393332,393361,393364,393383,393396,393410,393429,393442,393449,393463 from http://svn.asterisk.org/svn/asterisk/trunk

Added:
    team/qwell/system_registry/include/asterisk/mixmonitor.h
      - copied unchanged from r393463, trunk/include/asterisk/mixmonitor.h
    team/qwell/system_registry/main/mixmonitor.c
      - copied unchanged from r393463, trunk/main/mixmonitor.c
    team/qwell/system_registry/res/res_sip/config_security.c
      - copied unchanged from r393463, trunk/res/res_sip/config_security.c
    team/qwell/system_registry/res/res_sip_notify.c
      - copied unchanged from r393463, trunk/res/res_sip_notify.c
    team/qwell/system_registry/tests/test_cel.c
      - copied unchanged from r393463, trunk/tests/test_cel.c
Modified:
    team/qwell/system_registry/   (props changed)
    team/qwell/system_registry/CHANGES
    team/qwell/system_registry/apps/app_mixmonitor.c
    team/qwell/system_registry/bridges/bridge_builtin_features.c
    team/qwell/system_registry/channels/chan_unistim.c
    team/qwell/system_registry/configs/features.conf.sample
    team/qwell/system_registry/contrib/scripts/ast_tls_cert
    team/qwell/system_registry/include/asterisk/cel.h
    team/qwell/system_registry/include/asterisk/channel.h
    team/qwell/system_registry/include/asterisk/features_config.h
    team/qwell/system_registry/include/asterisk/pbx.h
    team/qwell/system_registry/include/asterisk/res_sip.h
    team/qwell/system_registry/include/asterisk/stasis_app.h
    team/qwell/system_registry/include/asterisk/stasis_bridging.h
    team/qwell/system_registry/main/aoc.c
    team/qwell/system_registry/main/cel.c
    team/qwell/system_registry/main/features_config.c
    team/qwell/system_registry/main/manager.c
    team/qwell/system_registry/main/pbx.c
    team/qwell/system_registry/main/stasis_bridging.c
    team/qwell/system_registry/res/res_sip.c
    team/qwell/system_registry/res/res_sip.exports.in
    team/qwell/system_registry/res/res_sip/config_auth.c
    team/qwell/system_registry/res/res_sip/include/res_sip_private.h
    team/qwell/system_registry/res/res_sip/sip_configuration.c
    team/qwell/system_registry/res/res_sip/sip_distributor.c
    team/qwell/system_registry/res/res_sip/sip_options.c
    team/qwell/system_registry/res/res_sip_acl.c
    team/qwell/system_registry/res/res_sip_authenticator_digest.c
    team/qwell/system_registry/res/res_sip_outbound_authenticator_digest.c
    team/qwell/system_registry/res/res_stasis_http_channels.c
    team/qwell/system_registry/res/stasis/control.c
    team/qwell/system_registry/res/stasis_http/resource_channels.c
    team/qwell/system_registry/res/stasis_http/resource_channels.h
    team/qwell/system_registry/rest-api/api-docs/channels.json

Propchange: team/qwell/system_registry/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/qwell/system_registry/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/qwell/system_registry/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jul  2 13:33:47 2013
@@ -1,1 +1,1 @@
-/trunk:1-393305
+/trunk:1-393464

Modified: team/qwell/system_registry/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/CHANGES?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/CHANGES (original)
+++ team/qwell/system_registry/CHANGES Tue Jul  2 13:33:47 2013
@@ -283,7 +283,7 @@
    will now apply the feature to the calling party while use of a lowercase
    letter will apply that feature to the called party.
 
- * Add support for automixmonitor to the BRIDGE_FEATURES channel variable.
+ * Add support for automixmon to the BRIDGE_FEATURES channel variable.
 
  * Parking has been pulled from core and placed into a separate module called
    res_parking. See Parking changes below for more details.
@@ -291,6 +291,14 @@
  * You can now have the settings for a channel updated using the FEATURE()
    and FEATUREMAP() functions inherited to child channels by setting
    FEATURE(inherit)=yes.
+
+ * automixmon now supports additional channel variables from automon including:
+   TOUCH_MIXMONITOR_PREFIX, TOUCH_MIXMONITOR_MESSAGE_START,
+   and TOUCH_MIXMONITOR_MESSAGE_STOP
+
+ * A new general features.conf option 'recordingfailsound' has been added which
+   allowssetting a failure sound for a user tries to invoke a recording feature
+   such as automon or automixmon and it fails.
 
 Logging
 -------------------

Modified: team/qwell/system_registry/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/apps/app_mixmonitor.c?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/apps/app_mixmonitor.c (original)
+++ team/qwell/system_registry/apps/app_mixmonitor.c Tue Jul  2 13:33:47 2013
@@ -56,6 +56,7 @@
 #include "asterisk/mod_format.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/test.h"
+#include "asterisk/mixmonitor.h"
 
 /*** DOCUMENTATION
 	<application name="MixMonitor" language="en_US">
@@ -1246,6 +1247,31 @@
 	return AMI_SUCCESS;
 }
 
+static int start_mixmonitor_callback(struct ast_channel *chan, const char *filename, const char *options)
+{
+	char *opts[OPT_ARG_ARRAY_SIZE] = { NULL, };
+	struct ast_flags flags = { 0 };
+	char args[PATH_MAX] = "";
+	int res;
+
+	if (!ast_strlen_zero(options)) {
+		ast_app_parse_options(mixmonitor_opts, &flags, opts, ast_strdupa(options));
+	}
+
+	snprintf(args, sizeof(args), "%s,%s", filename, options);
+
+	ast_channel_lock(chan);
+	res = mixmonitor_exec(chan, args);
+	ast_channel_unlock(chan);
+
+	return res;
+}
+
+static int stop_mixmonitor_callback(struct ast_channel *chan, const char *mixmonitor_id)
+{
+	return stop_mixmonitor_full(chan, mixmonitor_id);
+}
+
 static int manager_mixmonitor(struct mansession *s, const struct message *m)
 {
 	struct ast_channel *c = NULL;
@@ -1356,6 +1382,21 @@
 	AST_CLI_DEFINE(handle_cli_mixmonitor, "Execute a MixMonitor command")
 };
 
+static int set_mixmonitor_methods(void)
+{
+	struct ast_mixmonitor_methods mixmonitor_methods = {
+		.start = start_mixmonitor_callback,
+		.stop = stop_mixmonitor_callback,
+	};
+
+	return ast_set_mixmonitor_methods(&mixmonitor_methods);
+}
+
+static int clear_mixmonitor_methods(void)
+{
+	return ast_clear_mixmonitor_methods();
+}
+
 static int unload_module(void)
 {
 	int res;
@@ -1366,6 +1407,7 @@
 	res |= ast_manager_unregister("MixMonitorMute");
 	res |= ast_manager_unregister("MixMonitor");
 	res |= ast_manager_unregister("StopMixMonitor");
+	res |= clear_mixmonitor_methods();
 
 	return res;
 }
@@ -1380,6 +1422,7 @@
 	res |= ast_manager_register_xml("MixMonitorMute", 0, manager_mute_mixmonitor);
 	res |= ast_manager_register_xml("MixMonitor", 0, manager_mixmonitor);
 	res |= ast_manager_register_xml("StopMixMonitor", 0, manager_stop_mixmonitor);
+	res |= set_mixmonitor_methods();
 
 	return res;
 }

Modified: team/qwell/system_registry/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/bridges/bridge_builtin_features.c?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/bridges/bridge_builtin_features.c (original)
+++ team/qwell/system_registry/bridges/bridge_builtin_features.c Tue Jul  2 13:33:47 2013
@@ -50,6 +50,9 @@
 #include "asterisk/pbx.h"
 #include "asterisk/parking.h"
 #include "asterisk/features_config.h"
+#include "asterisk/monitor.h"
+#include "asterisk/mixmonitor.h"
+#include "asterisk/audiohook.h"
 
 /*!
  * \brief Helper function that presents dialtone and grabs extension
@@ -463,6 +466,304 @@
 	return 0;
 }
 
+static void stop_automonitor(struct ast_bridge_channel *bridge_channel, struct ast_channel *peer_chan, struct ast_features_general_config *features_cfg)
+{
+	const char *stop_message;
+
+	ast_channel_lock(bridge_channel->chan);
+	stop_message = pbx_builtin_getvar_helper(bridge_channel->chan, "TOUCH_MONITOR_MESSAGE_STOP");
+	stop_message = ast_strdupa(S_OR(stop_message, ""));
+	ast_channel_unlock(bridge_channel->chan);
+
+	ast_verb(3, "AutoMonitor used to stop recording call.\n");
+
+	ast_channel_lock(peer_chan);
+	if (ast_channel_monitor(peer_chan)) {
+		if (ast_channel_monitor(peer_chan)->stop(peer_chan, 1)) {
+			ast_verb(3, "Cannot stop AutoMonitor for %s\n", ast_channel_name(bridge_channel->chan));
+			if (features_cfg && !(ast_strlen_zero(features_cfg->recordingfailsound))) {
+				ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->recordingfailsound, NULL);
+			}
+			ast_channel_unlock(peer_chan);
+			return;
+		}
+	} else {
+		/* Something else removed the Monitor before we got to it. */
+		ast_channel_unlock(peer_chan);
+		return;
+	}
+
+	ast_channel_unlock(peer_chan);
+
+	if (features_cfg && !(ast_strlen_zero(features_cfg->courtesytone))) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->courtesytone, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, features_cfg->courtesytone, NULL);
+	}
+
+	if (!ast_strlen_zero(stop_message)) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, stop_message, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, stop_message, NULL);
+	}
+}
+
+enum set_touch_variables_res {
+	SET_TOUCH_SUCCESS = 0,
+	SET_TOUCH_UNSET,
+	SET_TOUCH_ALLOC_FAILURE,
+};
+
+static int set_touch_variables(struct ast_channel *chan, int is_mixmonitor, char **touch_format, char **touch_monitor, char **touch_monitor_prefix)
+{
+	enum set_touch_variables_res res = SET_TOUCH_UNSET;
+	const char *c_touch_format, *c_touch_monitor, *c_touch_monitor_prefix;
+
+	SCOPED_CHANNELLOCK(lock, chan);
+
+	c_touch_format = pbx_builtin_getvar_helper(chan, is_mixmonitor ? "TOUCH_MIXMONITOR_FORMAT" : "TOUCH_MONITOR_FORMAT");
+
+	if (!ast_strlen_zero(c_touch_format)) {
+		if (!(*touch_format = ast_strdup(c_touch_format))) {
+			return SET_TOUCH_ALLOC_FAILURE;
+		}
+		res = SET_TOUCH_SUCCESS;
+	}
+
+	c_touch_monitor = pbx_builtin_getvar_helper(chan, is_mixmonitor ? "TOUCH_MIXMONITOR" : "TOUCH_MONITOR");
+
+	if (!ast_strlen_zero(c_touch_monitor)) {
+		if (!(*touch_monitor = ast_strdup(c_touch_monitor))) {
+			return SET_TOUCH_ALLOC_FAILURE;
+		}
+		res = SET_TOUCH_SUCCESS;
+	}
+
+	c_touch_monitor_prefix = pbx_builtin_getvar_helper(chan, is_mixmonitor ? "TOUCH_MIXMONITOR_PREFIX" : "TOUCH_MONITOR_PREFIX");
+
+	if (!ast_strlen_zero(c_touch_monitor_prefix)) {
+		if (!(*touch_monitor_prefix = ast_strdup(c_touch_monitor_prefix))) {
+			return SET_TOUCH_ALLOC_FAILURE;
+		}
+		res = SET_TOUCH_SUCCESS;
+	}
+
+	return res;
+}
+
+static int feature_automonitor(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
+{
+	char *caller_chan_id = NULL, *peer_chan_id = NULL, *touch_filename = NULL;
+	size_t len;
+	const char *automon_message;
+	int x;
+	enum set_touch_variables_res set_touch_res;
+
+	RAII_VAR(char *, touch_format, NULL, ast_free);
+	RAII_VAR(char *, touch_monitor, NULL, ast_free);
+	RAII_VAR(char *, touch_monitor_prefix, NULL, ast_free);
+
+	RAII_VAR(struct ast_channel *, peer_chan, NULL, ast_channel_cleanup);
+	RAII_VAR(struct ast_features_general_config *, features_cfg, NULL, ao2_cleanup);
+
+	features_cfg = ast_get_chan_features_general_config(bridge_channel->chan);
+	peer_chan = ast_bridge_peer(bridge, bridge_channel->chan);
+
+	if (!peer_chan) {
+		ast_verb(3, "Cannot start AutoMonitor for %s - can not determine peer in bridge.\n", ast_channel_name(bridge_channel->chan));
+		if (features_cfg && !(ast_strlen_zero(features_cfg->recordingfailsound))) {
+			ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->recordingfailsound, NULL);
+		}
+		return 0;
+	}
+
+	if (ast_channel_monitor(peer_chan)) {
+		stop_automonitor(bridge_channel, peer_chan, features_cfg);
+		return 0;
+	}
+
+	if ((set_touch_res = set_touch_variables(bridge_channel->chan, 0, &touch_format, &touch_monitor, &touch_monitor_prefix))) {
+		if (set_touch_res == SET_TOUCH_ALLOC_FAILURE) {
+			return 0;
+		}
+		if (set_touch_variables(peer_chan, 0, &touch_format, &touch_monitor, &touch_monitor_prefix) == SET_TOUCH_ALLOC_FAILURE) {
+			return 0;
+		}
+	}
+
+	if (!ast_strlen_zero(touch_monitor)) {
+		len = strlen(touch_monitor) + 50;
+		touch_filename = ast_alloca(len);
+		snprintf(touch_filename, len, "%s-%ld-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), touch_monitor);
+	} else {
+		caller_chan_id = ast_strdupa(S_COR(ast_channel_caller(bridge_channel->chan)->id.number.valid,
+			ast_channel_caller(bridge_channel->chan)->id.number.str, ast_channel_name(bridge_channel->chan)));
+		peer_chan_id = ast_strdupa(S_COR(ast_channel_caller(peer_chan)->id.number.valid,
+			ast_channel_caller(peer_chan)->id.number.str, ast_channel_name(peer_chan)));
+		len = strlen(caller_chan_id) + strlen(peer_chan_id) + 50;
+		touch_filename = ast_alloca(len);
+		snprintf(touch_filename, len, "%s-%ld-%s-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), caller_chan_id, peer_chan_id);
+	}
+
+	for ( x = 0; x < strlen(touch_filename); x++) {
+		if (touch_filename[x] == '/') {
+			touch_filename[x] = '-';
+		}
+	}
+
+	ast_verb(3, "AutoMonitor used to record call. Filename: %s\n", touch_filename);
+
+	if (ast_monitor_start(peer_chan, touch_format, touch_filename, 1, X_REC_IN | X_REC_OUT)) {
+		ast_verb(3, "automon feature was tried by '%s' but monitor failed to start.\n", ast_channel_name(bridge_channel->chan));
+		return 0;
+	}
+
+	ast_channel_lock(bridge_channel->chan);
+	if ((automon_message = pbx_builtin_getvar_helper(bridge_channel->chan, "TOUCH_MONITOR_MESSAGE_START"))) {
+		automon_message = ast_strdupa(automon_message);
+	}
+	ast_channel_unlock(bridge_channel->chan);
+
+	if ((features_cfg = ast_get_chan_features_general_config(bridge_channel->chan)) && !(ast_strlen_zero(features_cfg->courtesytone))) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->courtesytone, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, features_cfg->courtesytone, NULL);
+	}
+
+	if (!ast_strlen_zero(automon_message)) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, automon_message, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, automon_message, NULL);
+	}
+
+	pbx_builtin_setvar_helper(peer_chan, "TOUCH_MONITOR_OUTPUT", touch_filename);
+
+	return 0;
+}
+
+static void stop_automixmonitor(struct ast_bridge_channel *bridge_channel, struct ast_channel *peer_chan, struct ast_features_general_config *features_cfg)
+{
+	const char *stop_message;
+
+	ast_channel_lock(bridge_channel->chan);
+	stop_message = pbx_builtin_getvar_helper(bridge_channel->chan, "TOUCH_MIXMONITOR_MESSAGE_STOP");
+	stop_message = ast_strdupa(S_OR(stop_message, ""));
+	ast_channel_unlock(bridge_channel->chan);
+
+	ast_verb(3, "AutoMixMonitor used to stop recording call.\n");
+
+	if (ast_stop_mixmonitor(peer_chan, NULL)) {
+		ast_verb(3, "Failed to stop Mixmonitor for %s.\n", ast_channel_name(bridge_channel->chan));
+		if (features_cfg && !(ast_strlen_zero(features_cfg->recordingfailsound))) {
+			ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->recordingfailsound, NULL);
+		}
+		return;
+	}
+
+	if (features_cfg && !(ast_strlen_zero(features_cfg->courtesytone))) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->courtesytone, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, features_cfg->courtesytone, NULL);
+	}
+
+	if (!ast_strlen_zero(stop_message)) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, stop_message, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, stop_message, NULL);
+	}
+
+}
+
+static int feature_automixmonitor(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
+{
+	char *caller_chan_id = NULL, *peer_chan_id = NULL, *touch_filename = NULL;
+	size_t len;
+	const char *automon_message;
+	static char *mixmonitor_spy_type = "MixMonitor";
+	int count, x;
+	enum set_touch_variables_res set_touch_res;
+
+	RAII_VAR(char *, touch_format, NULL, ast_free);
+	RAII_VAR(char *, touch_monitor, NULL, ast_free);
+	RAII_VAR(char *, touch_monitor_prefix, NULL, ast_free);
+
+	RAII_VAR(struct ast_channel *, peer_chan, NULL, ast_channel_cleanup);
+	RAII_VAR(struct ast_features_general_config *, features_cfg, NULL, ao2_cleanup);
+
+	features_cfg = ast_get_chan_features_general_config(bridge_channel->chan);
+
+	peer_chan = ast_bridge_peer(bridge, bridge_channel->chan);
+
+	if (!peer_chan) {
+		ast_verb(3, "Cannot start AutoMixMonitor for %s - can not determine peer in bridge.\n", ast_channel_name(bridge_channel->chan));
+		if (features_cfg && !(ast_strlen_zero(features_cfg->recordingfailsound))) {
+			ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->recordingfailsound, NULL);
+		}
+		return 0;
+	}
+
+	count = ast_channel_audiohook_count_by_source(peer_chan, mixmonitor_spy_type, AST_AUDIOHOOK_TYPE_SPY);
+	if (count > 0) {
+		stop_automixmonitor(bridge_channel, peer_chan, features_cfg);
+		return 0;
+	}
+
+	if ((set_touch_res = set_touch_variables(bridge_channel->chan, 1, &touch_format, &touch_monitor, &touch_monitor_prefix))) {
+		if (set_touch_res == SET_TOUCH_ALLOC_FAILURE) {
+			return 0;
+		}
+		if (set_touch_variables(peer_chan, 1, &touch_format, &touch_monitor, &touch_monitor_prefix) == SET_TOUCH_ALLOC_FAILURE) {
+			return 0;
+		}
+	}
+
+	if (!ast_strlen_zero(touch_monitor)) {
+		len = strlen(touch_monitor) + 50;
+		touch_filename = ast_alloca(len);
+		snprintf(touch_filename, len, "%s-%ld-%s.%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), touch_monitor, S_OR(touch_format, "wav"));
+	} else {
+		caller_chan_id = ast_strdupa(S_COR(ast_channel_caller(bridge_channel->chan)->id.number.valid,
+			ast_channel_caller(bridge_channel->chan)->id.number.str, ast_channel_name(bridge_channel->chan)));
+		peer_chan_id = ast_strdupa(S_COR(ast_channel_caller(peer_chan)->id.number.valid,
+			ast_channel_caller(peer_chan)->id.number.str, ast_channel_name(peer_chan)));
+		len = strlen(caller_chan_id) + strlen(peer_chan_id) + 50;
+		touch_filename = ast_alloca(len);
+		snprintf(touch_filename, len, "%s-%ld-%s-%s.%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), caller_chan_id, peer_chan_id, S_OR(touch_format, "wav"));
+	}
+
+	for ( x = 0; x < strlen(touch_filename); x++) {
+		if (touch_filename[x] == '/') {
+			touch_filename[x] = '-';
+		}
+	}
+
+	ast_verb(3, "AutoMixMonitor used to record call. Filename: %s\n", touch_filename);
+
+	if (ast_start_mixmonitor(peer_chan, touch_filename, "b")) {
+		ast_verb(3, "automixmon feature was tried by '%s' but mixmonitor failed to start.\n", ast_channel_name(bridge_channel->chan));
+
+		if (features_cfg && !ast_strlen_zero(features_cfg->recordingfailsound)) {
+			ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->recordingfailsound, NULL);
+		}
+
+		return 0;
+	}
+
+	ast_channel_lock(bridge_channel->chan);
+	if ((automon_message = pbx_builtin_getvar_helper(bridge_channel->chan, "TOUCH_MIXMONITOR_MESSAGE_START"))) {
+		automon_message = ast_strdupa(automon_message);
+	}
+	ast_channel_unlock(bridge_channel->chan);
+
+	if ((features_cfg = ast_get_chan_features_general_config(bridge_channel->chan)) && !(ast_strlen_zero(features_cfg->courtesytone))) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, features_cfg->courtesytone, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, features_cfg->courtesytone, NULL);
+	}
+
+	if (!ast_strlen_zero(automon_message)) {
+		ast_bridge_channel_queue_playfile(bridge_channel, NULL, automon_message, NULL);
+		ast_bridge_channel_write_playfile(bridge_channel, NULL, automon_message, NULL);
+	}
+
+	pbx_builtin_setvar_helper(peer_chan, "TOUCH_MIXMONITOR_OUTPUT", touch_filename);
+
+	return 0;
+}
+
 /*! \brief Internal built in feature for hangup */
 static int feature_hangup(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
 {
@@ -485,6 +786,8 @@
 	ast_bridge_features_register(AST_BRIDGE_BUILTIN_BLINDTRANSFER, feature_blind_transfer, NULL);
 	ast_bridge_features_register(AST_BRIDGE_BUILTIN_ATTENDEDTRANSFER, feature_attended_transfer, NULL);
 	ast_bridge_features_register(AST_BRIDGE_BUILTIN_HANGUP, feature_hangup, NULL);
+	ast_bridge_features_register(AST_BRIDGE_BUILTIN_AUTOMON, feature_automonitor, NULL);
+	ast_bridge_features_register(AST_BRIDGE_BUILTIN_AUTOMIXMON, feature_automixmonitor, NULL);
 
 	/* Bump up our reference count so we can't be unloaded */
 	ast_module_ref(ast_module_info->self);

Modified: team/qwell/system_registry/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/channels/chan_unistim.c?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/channels/chan_unistim.c (original)
+++ team/qwell/system_registry/channels/chan_unistim.c Tue Jul  2 13:33:47 2013
@@ -3292,12 +3292,11 @@
 		}
 		break;
 	case KEY_FUNC2:
+		if (ast_channel_state(sub->owner) == AST_STATE_RING) {
+			transfer_cancel_step2(pte);
+		}
 		if (ast_channel_state(sub->owner) == AST_STATE_UP) {
-			if (get_sub(pte->device, SUB_THREEWAY)) {
-				transfer_cancel_step2(pte);
-			} else {
-				transfer_call_step1(pte);
-			}
+			transfer_call_step1(pte);
 		}
 		break;
 	case KEY_HANGUP:
@@ -4815,7 +4814,6 @@
 				continue;
 			}
 			if (d->ssub[i] != NULL) { /* Found other subchannel active other then hangup'ed one */
-				ast_log(LOG_WARNING, "There is not only one call here %p %p %i\n",d->ssub[i], sub, i);
 				end_call = 0;
 			}
 		}

Modified: team/qwell/system_registry/configs/features.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/configs/features.conf.sample?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/configs/features.conf.sample (original)
+++ team/qwell/system_registry/configs/features.conf.sample Tue Jul  2 13:33:47 2013
@@ -105,6 +105,8 @@
 ;pickupfailsound = beeperr      ; to indicate that the pickup failed (default: no sound)
 ;featuredigittimeout = 1000     ; Max time (ms) between digits for
                                 ; feature activation  (default is 1000 ms)
+;recordingfailsound = beeperr   ; indicates that a one-touch monitor or one-touch mixmonitor feature failed
+								; to be applied to the call. (default: no sound)
 ;atxfernoanswertimeout = 15     ; Timeout for answer on attended transfer default is 15 seconds.
 ;atxferdropcall = no            ; If someone does an attended transfer, then hangs up before the transferred
                                 ; caller is connected, then by default, the system will try to call back the

Modified: team/qwell/system_registry/contrib/scripts/ast_tls_cert
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/contrib/scripts/ast_tls_cert?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/contrib/scripts/ast_tls_cert (original)
+++ team/qwell/system_registry/contrib/scripts/ast_tls_cert Tue Jul  2 13:33:47 2013
@@ -204,8 +204,12 @@
 	CAKEY=${OUTPUT_DIR}/ca.key
 	CACERT=${OUTPUT_DIR}/ca.crt
 	CACFG=${OUTPUT_DIR}/ca.cfg
-	create_config ca "${CACFG}" "${DEFAULT_CA_CN}" "${DEFAULT_CA_ORG}"
-	create_ca
+	if [ ! -r "$CAKEY" ] &&  [ ! -r "$CACFG" ]; then
+		create_config ca "${CACFG}" "${DEFAULT_CA_CN}" "${DEFAULT_CA_ORG}"
+	fi
+	if  [ ! -r "$CACERT" ]; then
+		create_ca
+	fi
 else
 	if [ -z ${CAKEY} ]
 	then

Modified: team/qwell/system_registry/include/asterisk/cel.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/include/asterisk/cel.h?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/include/asterisk/cel.h (original)
+++ team/qwell/system_registry/include/asterisk/cel.h Tue Jul  2 13:33:47 2013
@@ -263,6 +263,68 @@
  */
 struct stasis_topic *ast_cel_topic(void);
 
+/*! \brief A structure to hold CEL global configuration options */
+struct ast_cel_general_config {
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(date_format); /*!< The desired date format for logging */
+	);
+	int enable;			/*!< Whether CEL is enabled */
+	int64_t events;			/*!< The events to be logged */
+	/*! The apps for which to log app start and end events. This is
+	 * ast_str_container_alloc()ed and filled with ao2-allocated
+	 * char* which are all-lowercase application names. */
+	struct ao2_container *apps;
+};
+
+/*!
+ * \brief Allocate a CEL configuration object
+ *
+ * \retval NULL on error
+ * \retval The new CEL configuration object
+ */
+void *ast_cel_general_config_alloc(void);
+
+/*!
+ * \since 12
+ * \brief Obtain the current CEL configuration
+ *
+ * The configuration is a ref counted object. The caller of this function must
+ * decrement the ref count when finished with the configuration.
+ *
+ * \retval NULL on error
+ * \retval The current CEL configuration
+ */
+struct ast_cel_general_config *ast_cel_get_config(void);
+
+/*!
+ * \since 12
+ * \brief Set the current CEL configuration
+ *
+ * \param config The new CEL configuration
+ */
+void ast_cel_set_config(struct ast_cel_general_config *config);
+
+struct ast_channel_snapshot;
+/*!
+ * \brief Allocate and populate a CEL event structure
+ *
+ * \param snapshot An ast_channel_snapshot of the primary channel associated
+ *        with this channel event.
+ * \param event_type The type of call event being reported.
+ * \param userdefevname Custom name for the call event. (optional)
+ * \param extra An opaque field that will go into the "CEL_EXTRA" information
+ *        element of the call event. (optional)
+ * \param peer_name The peer name to be placed into the event. (optional)
+ *
+ * \since 12
+ *
+ * \retval The created ast_event structure
+ * \retval NULL on failure
+ */
+struct ast_event *ast_cel_create_event(struct ast_channel_snapshot *snapshot,
+		enum ast_cel_event_type event_type, const char *userdefevname,
+		const char *extra, const char *peer_name);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/qwell/system_registry/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/include/asterisk/channel.h?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/include/asterisk/channel.h (original)
+++ team/qwell/system_registry/include/asterisk/channel.h Tue Jul  2 13:33:47 2013
@@ -2595,6 +2595,17 @@
  * \since 1.8
  */
 #define ast_channel_unref(c) ({ ao2_ref(c, -1); (struct ast_channel *) (NULL); })
+
+/*!
+ * \brief Cleanup a channel reference
+ *
+ * \param c the channel (NULL tolerant)
+ *
+ * \retval NULL always
+ *
+ * \since 12.0.0
+ */
+#define ast_channel_cleanup(c) ({ ao2_cleanup(c); (struct ast_channel *) (NULL); })
 
 /*! Channel Iterating @{ */
 

Modified: team/qwell/system_registry/include/asterisk/features_config.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/include/asterisk/features_config.h?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/include/asterisk/features_config.h (original)
+++ team/qwell/system_registry/include/asterisk/features_config.h Tue Jul  2 13:33:47 2013
@@ -30,6 +30,8 @@
 	AST_DECLARE_STRING_FIELDS(
 		/*! Sound played when automon or automixmon features are used */
 		AST_STRING_FIELD(courtesytone);
+		/*! Sound played when automon or automixmon features fail when used */
+		AST_STRING_FIELD(recordingfailsound);
 	);
 	/*! Milliseconds allowed between digit presses when entering feature code */
 	unsigned int featuredigittimeout;

Modified: team/qwell/system_registry/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/include/asterisk/pbx.h?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/include/asterisk/pbx.h (original)
+++ team/qwell/system_registry/include/asterisk/pbx.h Tue Jul  2 13:33:47 2013
@@ -1083,13 +1083,59 @@
  */
 int ast_async_goto_by_name(const char *chan, const char *context, const char *exten, int priority);
 
-/*! Synchronously or asynchronously make an outbound call and send it to a
-   particular extension */
-int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, int early_media);
-
-/*! Synchronously or asynchronously make an outbound call and send it to a
-   particular application with given extension */
-int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
+/*! \brief Synchronously or asynchronously make an outbound call and send it to a
+ * particular extension
+ *
+ * \param type The channel technology to create
+ * \param cap The format capabilities for the channel
+ * \param addr Address data to pass to the channel technology driver
+ * \param timeout How long we should attempt to dial the outbound channel
+ * \param context The destination context for the outbound channel
+ * \param exten The destination extension for the outbound channel
+ * \param priority The destination priority for the outbound channel
+ * \param reason Optional. If provided, the hangup cause code of the outbound channel if
+ *  it failed
+ * \param sync If non-zero, block until the outbound channel answers
+ * \param cid_num The caller ID number to set on the outbound channel
+ * \param cid_name The caller ID name to set on the outbound channel
+ * \param vars Variables to set on the outbound channel
+ * \param account The accountcode for the outbound channel
+ * \param locked_channel Optional. The outbound channel that was created. This is returned
+ *  both locked and reference bumped. If a caller provides a channel parameter, it must
+ *  unlock the channel and decrement the reference count.
+ * \param early_media If non-zero, allow early-media on the originated channel
+ */
+int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, const char *addr,
+    int timeout, const char *context, const char *exten, int priority, int *reason,
+    int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars,
+    const char *account, struct ast_channel **locked_channel, int early_media);
+
+/*! \brief Synchronously or asynchronously make an outbound call and execute an
+ *  application on the channel.
+ *
+ * Note that when the application stops executing, the channel is hungup.
+ *
+ * \param type The channel technology to create
+ * \param cap The format capabilities for the channel
+ * \param addr Address data to pass to the channel technology driver
+ * \param timeout How long we should attempt to dial the outbound channel
+ * \param app The name of the application to execute
+ * \param appdata Data to pass to the application
+ * \param reason Optional. If provided, the hangup cause code of the outbound channel if
+ *  it failed
+ * \param sync If non-zero, block until the outbound channel answers
+ * \param cid_num The caller ID number to set on the outbound channel
+ * \param cid_name The caller ID name to set on the outbound channel
+ * \param vars Variables to set on the outbound channel
+ * \param account The accountcode for the outbound channel
+ * \param locked_channel Optional. The outbound channel that was created. This is returned
+ *  both locked and reference bumped. If a caller provides a channel parameter, it must
+ *  unlock the channel and decrement the reference count.
+ */
+int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, const char *addr,
+    int timeout, const char *app, const char *appdata, int *reason, int sync,
+    const char *cid_num, const char *cid_name, struct ast_variable *vars,
+    const char *account, struct ast_channel **locked_channel);
 
 /*!
  * \brief Evaluate a condition

Modified: team/qwell/system_registry/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/system_registry/include/asterisk/res_sip.h?view=diff&rev=393465&r1=393464&r2=393465
==============================================================================
--- team/qwell/system_registry/include/asterisk/res_sip.h (original)
+++ team/qwell/system_registry/include/asterisk/res_sip.h Tue Jul  2 13:33:47 2013
@@ -237,6 +237,8 @@
 	AST_SIP_AUTH_TYPE_USER_PASS,
 	/*! Credentials stored as an MD5 sum */
 	AST_SIP_AUTH_TYPE_MD5,
+	/*! Credentials not stored this is a fake auth */
+	AST_SIP_AUTH_TYPE_ARTIFICIAL
 };
 
 #define SIP_SORCERY_AUTH_TYPE "auth"
@@ -481,6 +483,17 @@
     struct ast_sip_endpoint *(*identify_endpoint)(pjsip_rx_data *rdata);
 };
 
+#define SIP_SORCERY_SECURITY_TYPE "security"
+
+/*!
+ * \brief SIP security details and configuration.
+ */
+struct ast_sip_security {
+	SORCERY_OBJECT(details);
+	struct ast_acl_list *acl;
+	struct ast_acl_list *contact_acl;
+};
+
 /*!
  * \brief Register a SIP service in Asterisk.
  *
@@ -778,6 +791,16 @@
 int ast_sip_initialize_sorcery_auth(struct ast_sorcery *sorcery);
 
 /*!
+ * \brief Initialize security support on a sorcery instance
+ *
+ * \param sorcery The sorcery instance
+ *
+ * \retval -1 failure
+ * \retval 0 success
+ */
+int ast_sip_initialize_sorcery_security(struct ast_sorcery *sorcery);
+
+/*!

[... 2084 lines stripped ...]



More information about the asterisk-commits mailing list