[asterisk-commits] kmoore: branch kmoore/stasis-bridging-channel_events r388274 - in /team/kmoor...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 10 07:53:58 CDT 2013


Author: kmoore
Date: Fri May 10 07:53:49 2013
New Revision: 388274

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388274
Log:
Multiple revisions 388052,388080,388109,388115,388177,388217,388233,388237,388255

........
  r388052 | root | 2013-05-08 16:17:40 -0500 (Wed, 08 May 2013) | 33 lines
  
  Multiple revisions 388045-388046
  
  ........
    r388045 | dlee | 2013-05-08 15:25:28 -0500 (Wed, 08 May 2013) | 11 lines
    
    Removed #if checks for crazy old versions of OS X.
    
    The <arpa/nameser_compat.h> was introduced way back in OS X Panther, which
    itself was end-of-lifed back in 2007. We can assume that any OS X machine
    we build on will need that header file :-)
    
    Why bother removing it? The flag we're checking (__APPLE_CC__) is actually
    Apple's build number. Self-compiled versions of GCC (such as installing the
    latest version of GCC from homebrew) sets the value to 0, making it useless
    for this sort of compile flaggery.
  ........
    r388046 | dlee | 2013-05-08 16:01:33 -0500 (Wed, 08 May 2013) | 12 lines
    
    Add development flag to disable the inline API.
    
    A GCC bug[1] can, in some cases, pop up an unsuppressible pedwarn when
    using a static inline standard library function from a non-static
    inline function.
    
    This normally doesn't show up, but can occur if you're running an
    upgrade version of GCC (such as GCC 4.8 on OS X, which normally runs
    GCC 4.2).
    
     [1]: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47816
  ........
  
  Merged revisions 388045-388046 from file:///srv/subversion/repos/asterisk/trunk
........
  r388080 | root | 2013-05-08 17:17:52 -0500 (Wed, 08 May 2013) | 5 lines
  
  Fixed MODFLAG for res_stasis_websocket
  ........
  
  Merged revisions 388075 from file:///srv/subversion/repos/asterisk/trunk
........
  r388109 | rmudgett | 2013-05-08 22:33:50 -0500 (Wed, 08 May 2013) | 2 lines
  
  Rework smart bridge technology selection and bridge preference priority.
........
  r388115 | root | 2013-05-08 23:17:38 -0500 (Wed, 08 May 2013) | 69 lines
  
  Multiple revisions 388110,388113
  
  ........
    r388110 | elguero | 2013-05-08 22:35:25 -0500 (Wed, 08 May 2013) | 26 lines
    
    Fix Segfault In app_queue When "persistentmembers" Is Enabled And Using Realtime
    
    When the "ignorebusy" setting was deprecated, we added some code to allow us to
    be compatible with older setups that are still using the "ignorebusy" setting
    instead of "ringinuse".  We set a char *variable with the column name to use,
    which helps the realtime functions to use the correct column in their SQL
    queries.  When "persistentmembers" is enabled, we are not setting this variable
    before the realtime functions were called to load members.  This results in the
    variable being NULL and therefore causing a segfault when loading members during
    the module's process of loading.
    
    The solution was to move the code that sets that variable to be before these
    realtime functions are called during the loading of the module.
    
    (closes issue ASTERISK-21738)
    Reported by: JoshE
    Tested by: JoshE
    Patches:
        asterisk-21738-rt-ringinuse-field-not-set.diff
                                         uploaded by Michael L. Young (license 5026)
    
    Review: https://reviewboard.asterisk.org/r/2499/
    ........
    
    Merged revisions 388108 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
    r388113 | elguero | 2013-05-08 23:11:59 -0500 (Wed, 08 May 2013) | 33 lines
    
    Fix The Payload Being Set On CN Packets And Do Not Set Marker Bit
    
    When we send out a CN packet (for instance, in the case of using rtpkeepalives),
    we are not setting the payload code properly.  Also, we are setting the marker
    bit when we shouldn't be according to RFC 3389, section 4.
    
    AST_RTP_CN is not defined by AST_FORMAT codes.  Therefore, we should be using
    ast_rtp_codecs_payload_code() rather than ast_rtp_codecs_payload_lookup().
    
    11 and trunk already use the appropriate function.
    
    * In 1.8, use ast_rtp_codecs_payload_code()
    
    * Remove the setting of the marker bit
    
    * Fix the debug message by incrementing the seqno after the debug message is set
      in order to display the correct seqno that was sent out
    
    (closes issue ASTERISK-21246)
    Reported by: Peter Katzmann
    Tested by: Peter Katzmann, Michael L. Young
    Patches:
        asterisk-21246-rtp-cng-payload-error_1.8_v2.diff
                                         uploaded by Michael L. Young (license 5026)
    
    Review: https://reviewboard.asterisk.org/r/2500/
    ........
    
    Merged revisions 388111 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 388112 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388110,388113 from file:///srv/subversion/repos/asterisk/trunk
........
  r388177 | root | 2013-05-09 10:17:21 -0500 (Thu, 09 May 2013) | 5 lines
  
  Don't expect to pack three tuples when you only have two
  ........
  
  Merged revisions 388175 from file:///srv/subversion/repos/asterisk/trunk
........
  r388217 | rmudgett | 2013-05-09 15:19:05 -0500 (Thu, 09 May 2013) | 1 line
  
  Remove an old BUGBUG.
........
  r388233 | jrose | 2013-05-09 17:21:09 -0500 (Thu, 09 May 2013) | 25 lines
  
  res_parking: Rebuilding parking from the ground up for the new bridging model
  
  Parking has been rebuilt from scratch in order to support the new bridging
  architecture.
  
  Parking configuration works somewhat differently now and extensions aren't
  necessarily automatically generated (it's optional and hasn't been implemented),
  but the intention with the final result is that if you were using parking before
  without too much additional dialplan manipulation, that should all just work
  once your parking lots are migrated to the new configuration file.
  
  Currently supported:
  parking from the PBX with the Park application (all arguments are supported)
  parking within a call using the one touch parking feature
  parking within a call using DTMF blind transfers (attended transfers work,
      but it's basically just like they called the application itself).
  Picking up parked calls using the PBX
  Multiple parking lots
  All options available to parking lots are currently configurable. Some aren't
      currently doing anything, namely parkext and hints.
  
  (closes issue ASTERISK-21272)
  Reported by: Matt Jordan
  Review: https://reviewboard.asterisk.org/r/2447/
........
  r388237 | rmudgett | 2013-05-09 19:06:55 -0500 (Thu, 09 May 2013) | 1 line
  
  Add BUGBUG note.
........
  r388255 | root | 2013-05-10 07:17:54 -0500 (Fri, 10 May 2013) | 8 lines
  
  Fix copy/paste error in one-touch-recording implementation.
  ........
  
  Merged revisions 388253 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388254 from file:///srv/subversion/repos/asterisk/trunk
........

Merged revisions 388052,388080,388109,388115,388177,388217,388233,388237,388255 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction

Added:
    team/kmoore/stasis-bridging-channel_events/configs/res_parking.conf.sample
      - copied unchanged from r388255, team/group/bridge_construction/configs/res_parking.conf.sample
    team/kmoore/stasis-bridging-channel_events/include/asterisk/parking.h
      - copied unchanged from r388255, team/group/bridge_construction/include/asterisk/parking.h
    team/kmoore/stasis-bridging-channel_events/main/parking.c
      - copied unchanged from r388255, team/group/bridge_construction/main/parking.c
    team/kmoore/stasis-bridging-channel_events/res/parking/
      - copied from r388255, team/group/bridge_construction/res/parking/
    team/kmoore/stasis-bridging-channel_events/res/res_parking.c
      - copied unchanged from r388255, team/group/bridge_construction/res/res_parking.c
Modified:
    team/kmoore/stasis-bridging-channel_events/   (props changed)
    team/kmoore/stasis-bridging-channel_events/CHANGES
    team/kmoore/stasis-bridging-channel_events/apps/app_queue.c
    team/kmoore/stasis-bridging-channel_events/apps/app_userevent.c
    team/kmoore/stasis-bridging-channel_events/bridges/bridge_builtin_features.c
    team/kmoore/stasis-bridging-channel_events/bridges/bridge_holding.c
    team/kmoore/stasis-bridging-channel_events/bridges/bridge_simple.c
    team/kmoore/stasis-bridging-channel_events/bridges/bridge_softmix.c
    team/kmoore/stasis-bridging-channel_events/build_tools/cflags.xml
    team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c
    team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging.h
    team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging_technology.h
    team/kmoore/stasis-bridging-channel_events/include/asterisk/config_options.h
    team/kmoore/stasis-bridging-channel_events/include/asterisk/inline_api.h
    team/kmoore/stasis-bridging-channel_events/main/bridging.c
    team/kmoore/stasis-bridging-channel_events/main/bridging_basic.c
    team/kmoore/stasis-bridging-channel_events/main/bridging_roles.c
    team/kmoore/stasis-bridging-channel_events/main/config_options.c
    team/kmoore/stasis-bridging-channel_events/main/enum.c
    team/kmoore/stasis-bridging-channel_events/main/features.c
    team/kmoore/stasis-bridging-channel_events/main/srv.c
    team/kmoore/stasis-bridging-channel_events/res/Makefile
    team/kmoore/stasis-bridging-channel_events/res/res_rtp_asterisk.c
    team/kmoore/stasis-bridging-channel_events/res/res_stasis_websocket.c

Propchange: team/kmoore/stasis-bridging-channel_events/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/kmoore/stasis-bridging-channel_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 10 07:53:49 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-388036
+/team/group/bridge_construction:1-388273

Modified: team/kmoore/stasis-bridging-channel_events/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/CHANGES?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/CHANGES (original)
+++ team/kmoore/stasis-bridging-channel_events/CHANGES Fri May 10 07:53:49 2013
@@ -50,6 +50,19 @@
  * The AMI event 'UserEvent' from app_userevent now contains the channel state
    fields. The channel state fields will come before the body fields.
 
+ * The AMI events 'ParkedCall', 'ParkedCallTimeOut', 'ParkedCallGiveUp', and
+   'UnParkedCall' have changed significantly in the new res_parking module.
+   First, channel snapshot data is included for both the parker and the parkee
+   in lieu of the "From" and "Channel" fields. They follow standard channel
+   snapshot format but each field is suffixed with 'Parker' or 'Parkee'
+   depending on which side it applies to. The 'Exten' field is replaced with
+   'ParkingSpace' since the registration of extensions as for parking spaces
+   is no longer mandatory.
+
+ * The AMI event 'Parkinglot' (response to 'Parkinglots' command) in a similar
+   fashion has changed the field names 'StartExten' and 'StopExten' to
+   'StartSpace' and 'StopSpace' respectively.
+
  * The deprecated use of | (pipe) as a separator in the channelvars setting in
    manager.conf has been removed.
 
@@ -95,8 +108,8 @@
 
  * Add support for automixmonitor to the BRIDGE_FEATURES channel variable.
 
- * PARKINGSLOT and PARKEDLOT channel variables will now be set for a parked
-   channel even when comebactoorigin=yes
+ * Parking has been pulled from core and placed into a separate module called
+   res_parking. See Parking changes below for more details.
 
  * You can now have the settings for a channel updated using the FEATURE()
    and FEATUREMAP() functions inherited to child channels by setting
@@ -124,6 +137,43 @@
   of audio samples in a voice frame will experience significant quality problems
   if a denoiser is attached to the channel; this option gives them the ability
   to remove the denoiser without having to unload func_speex.
+
+Parking
+-------------------
+ * Parking is now implemented as a module instead of as core functionality.
+   The preferred way to configure parking is now through res_parking.conf while
+   configuration through features.conf is not currently supported.
+
+ * Parked calls are now placed in bridges. This is a largely architectural change,
+   but it could have some implications in allowing for new parked call retrieval
+   methods and the contents of parking lots will be visible though certain bridge
+   commands.
+
+ * The order of arguments for the new parking application are different from the
+   old one to be more intuitive. Timeout and return context/exten/priority are now
+   implemented as options. parking_lot_name is now the first parameter. See the
+   application documentation for Park for more in-depth information.
+
+ * Extensions are no longer automatically created in the dialplan to park calls,
+   pickup parked calls, etc by default.
+
+ * adsipark is no longer supported under the new parking model
+
+ * The PARKINGSLOT channel variable has been deprecated in favor of PARKING_SPACE
+   to match the naming scheme of the new system.
+
+ * PARKING_SPACE and PARKEDLOT channel variables will now be set for a parked
+   channel even when comebactoorigin=yes
+
+ * New CLI command 'parking show' allows you to inspect the currently in use
+   parking lots. 'parking show <parkinglot>' will also show the parked calls
+   in that specific parking lot.
+
+ * The CLI command 'parkedcalls' is now deprecated in favor of
+   'parking show <parkinglot>'.
+
+ * The AMI command 'ParkedCalls' will now accept a 'ParkingLot' argument which
+   can be used to get a list of parked calls only for a specific parking lot.
 
 Queue
 -------------------

Modified: team/kmoore/stasis-bridging-channel_events/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/apps/app_queue.c?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/apps/app_queue.c (original)
+++ team/kmoore/stasis-bridging-channel_events/apps/app_queue.c Fri May 10 07:53:49 2013
@@ -9915,6 +9915,31 @@
 	if (reload_handler(0, &mask, NULL))
 		return AST_MODULE_LOAD_DECLINE;
 
+	ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, SENTINEL);
+
+	/*
+	 * This section is used to determine which name for 'ringinuse' to use in realtime members
+	 * Necessary for supporting older setups.
+	 */
+	member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name LIKE", "%", SENTINEL);
+	if (!member_config) {
+		realtime_ringinuse_field = "ringinuse";
+	} else {
+		const char *config_val;
+		if ((config_val = ast_variable_retrieve(member_config, NULL, "ringinuse"))) {
+			ast_log(LOG_NOTICE, "ringinuse field entries found in queue_members table. Using 'ringinuse'\n");
+			realtime_ringinuse_field = "ringinuse";
+		} else if ((config_val = ast_variable_retrieve(member_config, NULL, "ignorebusy"))) {
+			ast_log(LOG_NOTICE, "ignorebusy field found in queue_members table with no ringinuse field. Using 'ignorebusy'\n");
+			realtime_ringinuse_field = "ignorebusy";
+		} else {
+			ast_log(LOG_NOTICE, "No entries were found for ringinuse/ignorebusy in queue_members table. Using 'ringinuse'\n");
+			realtime_ringinuse_field = "ringinuse";
+		}
+	}
+
+	ast_config_destroy(member_config);
+
 	if (queue_persistent_members)
 		reload_queue_members();
 
@@ -9954,31 +9979,6 @@
 
 	ast_extension_state_add(NULL, NULL, extension_state_cb, NULL);
 
-	ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, SENTINEL);
-
-	/*
-	 * This section is used to determine which name for 'ringinuse' to use in realtime members
-	 * Necessary for supporting older setups.
-	 */
-	member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name LIKE", "%", SENTINEL);
-	if (!member_config) {
-		realtime_ringinuse_field = "ringinuse";
-	} else {
-		const char *config_val;
-		if ((config_val = ast_variable_retrieve(member_config, NULL, "ringinuse"))) {
-			ast_log(LOG_NOTICE, "ringinuse field entries found in queue_members table. Using 'ringinuse'\n");
-			realtime_ringinuse_field = "ringinuse";
-		} else if ((config_val = ast_variable_retrieve(member_config, NULL, "ignorebusy"))) {
-			ast_log(LOG_NOTICE, "ignorebusy field found in queue_members table with no ringinuse field. Using 'ignorebusy'\n");
-			realtime_ringinuse_field = "ignorebusy";
-		} else {
-			ast_log(LOG_NOTICE, "No entries were found for ringinuse/ignorebusy in queue_members table. Using 'ringinuse'\n");
-			realtime_ringinuse_field = "ringinuse";
-		}
-	}
-
-	ast_config_destroy(member_config);
-
 	return res ? AST_MODULE_LOAD_DECLINE : 0;
 }
 

Modified: team/kmoore/stasis-bridging-channel_events/apps/app_userevent.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/apps/app_userevent.c?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/apps/app_userevent.c (original)
+++ team/kmoore/stasis-bridging-channel_events/apps/app_userevent.c Fri May 10 07:53:49 2013
@@ -90,7 +90,6 @@
 	blob = ast_json_pack("{s: s, s: s}",
 			     "type", "userevent",
 			     "eventname", args.eventname);
-
 	if (!blob) {
 		return -1;
 	}

Modified: team/kmoore/stasis-bridging-channel_events/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/bridges/bridge_builtin_features.c?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/bridges/bridge_builtin_features.c (original)
+++ team/kmoore/stasis-bridging-channel_events/bridges/bridge_builtin_features.c Fri May 10 07:53:49 2013
@@ -48,6 +48,7 @@
 #include "asterisk/app.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/pbx.h"
+#include "asterisk/parking.h"
 
 /*!
  * \brief Helper function that presents dialtone and grabs extension
@@ -102,11 +103,6 @@
 	int cause;
 
 	/* Fill the variable with the extension and context we want to call */
-/* BUGBUG if local channel optimization is using masquerades then this needs /n so the destination keeps its DTMF features.
- * Or use /n to keep the peer channel stable until after the atxfer completes and remove the /n from the channel.
- *
- * Local channel optimization currently is disabled because I don't set the chan->bridge pointers.
- */
 	snprintf(destination, sizeof(destination), "%s@%s", exten, context);
 
 	/* Now we request that chan_local prepare to call the destination */
@@ -170,6 +166,7 @@
 	struct ast_channel *chan = NULL;
 	struct ast_bridge_features_blind_transfer *blind_transfer = hook_pvt;
 	const char *context;
+	struct ast_exten *park_exten;
 
 /* BUGBUG the peer needs to be put on hold for the transfer. */
 	ast_channel_lock(bridge_channel->chan);
@@ -179,6 +176,16 @@
 
 	/* Grab the extension to transfer to */
 	if (grab_transfer(bridge_channel->chan, exten, sizeof(exten), context)) {
+		return 0;
+	}
+
+	/* Parking blind transfer override - phase this out for something more general purpose in the future. */
+	park_exten = ast_get_parking_exten(exten, bridge_channel->chan, context);
+	if (park_exten) {
+		/* We are transfering the transferee to a parking lot. */
+		if (ast_park_blind_xfer(bridge, bridge_channel, park_exten)) {
+			ast_log(LOG_ERROR, "%s attempted to transfer to park application and failed.\n", ast_channel_name(bridge_channel->chan));
+		};
 		return 0;
 	}
 
@@ -308,8 +315,7 @@
 	}
 
 	/* Create a bridge to use to talk to the person we are calling */
-	attended_bridge = ast_bridge_base_new(
-		AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_1TO1MIX,
+	attended_bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_1TO1MIX,
 		AST_BRIDGE_FLAG_DISSOLVE_HANGUP);
 	if (!attended_bridge) {
 		ast_bridge_features_cleanup(&caller_features);

Modified: team/kmoore/stasis-bridging-channel_events/bridges/bridge_holding.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/bridges/bridge_holding.c?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/bridges/bridge_holding.c (original)
+++ team/kmoore/stasis-bridging-channel_events/bridges/bridge_holding.c Fri May 10 07:53:49 2013
@@ -283,7 +283,7 @@
 static struct ast_bridge_technology holding_bridge = {
 	.name = "holding_bridge",
 	.capabilities = AST_BRIDGE_CAPABILITY_HOLDING,
-	.preference = AST_BRIDGE_PREFERENCE_MEDIUM,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_HOLDING,
 	.write = holding_bridge_write,
 	.join = holding_bridge_join,
 	.leave = holding_bridge_leave,

Modified: team/kmoore/stasis-bridging-channel_events/bridges/bridge_simple.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/bridges/bridge_simple.c?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/bridges/bridge_simple.c (original)
+++ team/kmoore/stasis-bridging-channel_events/bridges/bridge_simple.c Fri May 10 07:53:49 2013
@@ -85,7 +85,7 @@
 static struct ast_bridge_technology simple_bridge = {
 	.name = "simple_bridge",
 	.capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX,
-	.preference = AST_BRIDGE_PREFERENCE_MEDIUM,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_1TO1MIX,
 	.join = simple_bridge_join,
 	.write = simple_bridge_write,
 };

Modified: team/kmoore/stasis-bridging-channel_events/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/bridges/bridge_softmix.c?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/bridges/bridge_softmix.c (original)
+++ team/kmoore/stasis-bridging-channel_events/bridges/bridge_softmix.c Fri May 10 07:53:49 2013
@@ -1091,7 +1091,7 @@
 static struct ast_bridge_technology softmix_bridge = {
 	.name = "softmix",
 	.capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX,
-	.preference = AST_BRIDGE_PREFERENCE_LOW,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_MULTIMIX,
 	.create = softmix_bridge_create,
 	.destroy = softmix_bridge_destroy,
 	.join = softmix_bridge_join,

Modified: team/kmoore/stasis-bridging-channel_events/build_tools/cflags.xml
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/build_tools/cflags.xml?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/build_tools/cflags.xml (original)
+++ team/kmoore/stasis-bridging-channel_events/build_tools/cflags.xml Fri May 10 07:53:49 2013
@@ -22,6 +22,12 @@
 			<support_level>extended</support_level>
 		</member>
 		<member name="LOW_MEMORY" displayname="Optimize for Low Memory Usage">
+			<support_level>extended</support_level>
+		</member>
+		<member name="DISABLE_INLINE" displayname="Disable the inline API">
+			<!-- Added to work around GCC bug
+			     See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47816
+			  -->
 			<support_level>extended</support_level>
 		</member>
 		<member name="BETTER_BACKTRACES" displayname="Use libbfd (GPL) to generate better inline backtraces">

Modified: team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c (original)
+++ team/kmoore/stasis-bridging-channel_events/channels/chan_sip.c Fri May 10 07:53:49 2013
@@ -21729,7 +21729,7 @@
 					feat = ast_find_call_feature(p->relatedpeer->record_on_feature);
 				}
 			} else if (!strcasecmp(c, "off")) {
-				if (ast_strlen_zero(p->relatedpeer->record_on_feature)) {
+				if (ast_strlen_zero(p->relatedpeer->record_off_feature)) {
 					suppress_warning = 1;
 				} else {
 					feat = ast_find_call_feature(p->relatedpeer->record_off_feature);

Modified: team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging.h?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging.h (original)
+++ team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging.h Fri May 10 07:53:49 2013
@@ -76,15 +76,15 @@
 
 /*! \brief Capabilities for a bridge technology */
 enum ast_bridge_capability {
-	/*! Bridge technology can service calls on hold */
+	/*! Bridge technology can service calls on hold. */
 	AST_BRIDGE_CAPABILITY_HOLDING = (1 << 0),
-	/*! Bridge waits for channel to answer.  Passes early media. */
+	/*! Bridge waits for channel to answer.  Passes early media. (XXX Not supported yet) */
 	AST_BRIDGE_CAPABILITY_EARLY = (1 << 1),
-	/*! Bridge should natively bridge two channels if possible */
+	/*! Bridge is capable of natively bridging two channels. (Smart bridge only) */
 	AST_BRIDGE_CAPABILITY_NATIVE = (1 << 2),
-	/*! Bridge is only capable of mixing 2 channels */
+	/*! Bridge is capable of mixing at most two channels. (Smart bridgeable) */
 	AST_BRIDGE_CAPABILITY_1TO1MIX = (1 << 3),
-	/*! Bridge is capable of mixing 2 or more channels */
+	/*! Bridge is capable of mixing an arbitrary number of channels. (Smart bridgeable) */
 	AST_BRIDGE_CAPABILITY_MULTIMIX = (1 << 4),
 };
 
@@ -219,6 +219,8 @@
 	AST_BRIDGE_ACTION_TALKING_STOP,
 	/*! Bridge channel is to play the indicated sound file. */
 	AST_BRIDGE_ACTION_PLAY_FILE,
+	/*! Bridge channel is to get parked. */
+	AST_BRIDGE_ACTION_PARK,
 	/*! Bridge channel is to run the indicated application. */
 	AST_BRIDGE_ACTION_RUN_APP,
 
@@ -404,6 +406,8 @@
 	struct ast_bridge_video_mode video_mode;
 	/*! Bridge flags to tweak behavior */
 	struct ast_flags feature_flags;
+	/*! Allowed bridge technology capabilities when AST_BRIDGE_FLAG_SMART enabled. */
+	uint32_t allowed_capabilities;
 	/*! Number of channels participating in the bridge */
 	unsigned int num_channels;
 	/*! Number of active channels in the bridge. */
@@ -572,25 +576,6 @@
 	} while (0)
 
 /*!
- * \brief See if it is possible to create a bridge
- *
- * \param capabilities The capabilities that the bridge will use
- *
- * \retval 1 if possible
- * \retval 0 if not possible
- *
- * Example usage:
- *
- * \code
- * int possible = ast_bridge_check(AST_BRIDGE_CAPABILITY_1TO1MIX);
- * \endcode
- *
- * This sees if it is possible to create a bridge capable of bridging two channels
- * together.
- */
-int ast_bridge_check(uint32_t capabilities);
-
-/*!
  * \brief Destroy a bridge
  *
  * \param bridge Bridge to destroy
@@ -1146,6 +1131,22 @@
 void ast_bridge_channel_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class);
 
 /*!
+ * \brief Have a bridge channel park a channel in the bridge
+ * \since 12.0.0
+ *
+ * \param bridge_channel Bridge channel performing the parking
+ * \param parkee_uuid Unique id of the channel we want to park
+ * \param parker_uuid Unique id of the channel parking the call
+ * \param app_data string indicating data used for park application (NULL allowed)
+ *
+ * \note This is intended to be called by bridge hooks.
+ *
+ * \return Nothing
+ */
+void ast_bridge_channel_write_park(struct ast_bridge_channel *bridge_channel, const char *parkee_uuid,
+	const char *parker_uuid, const char *app_data);
+
+/*!
  * \brief Write a bridge action play file frame into the bridge.
  * \since 12.0.0
  *

Modified: team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging_technology.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging_technology.h?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging_technology.h (original)
+++ team/kmoore/stasis-bridging-channel_events/include/asterisk/bridging_technology.h Fri May 10 07:53:49 2013
@@ -28,14 +28,17 @@
 extern "C" {
 #endif
 
-/*! \brief Preference for choosing the bridge technology */
+/*!
+ * \brief Base preference values for choosing a bridge technology.
+ *
+ * \note Higher is more preference.
+ */
 enum ast_bridge_preference {
-	/*! Bridge technology should have high precedence over other bridge technologies */
-	AST_BRIDGE_PREFERENCE_HIGH = 0,
-	/*! Bridge technology is decent, not the best but should still be considered over low */
-	AST_BRIDGE_PREFERENCE_MEDIUM,
-	/*! Bridge technology is low, it should not be considered unless it is absolutely needed */
-	AST_BRIDGE_PREFERENCE_LOW,
+	AST_BRIDGE_PREFERENCE_BASE_HOLDING  = 50,
+	AST_BRIDGE_PREFERENCE_BASE_EARLY    = 100,
+	AST_BRIDGE_PREFERENCE_BASE_NATIVE   = 90,
+	AST_BRIDGE_PREFERENCE_BASE_1TO1MIX  = 50,
+	AST_BRIDGE_PREFERENCE_BASE_MULTIMIX = 10,
 };
 
 /*!

Modified: team/kmoore/stasis-bridging-channel_events/include/asterisk/config_options.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/include/asterisk/config_options.h?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/include/asterisk/config_options.h (original)
+++ team/kmoore/stasis-bridging-channel_events/include/asterisk/config_options.h Fri May 10 07:53:49 2013
@@ -574,6 +574,16 @@
  * \retval -1 Failure
  */
 int aco_option_register_deprecated(struct aco_info *info, const char *name, struct aco_type **types, const char *aliased_to);
+
+/*!
+ * \brief Read the flags of a config option - useful when using a custom callback for a config option
+ * \since 12
+ *
+ * \param option Pointer to the aco_option struct
+ *
+ * \retval value of the flags on the config option
+ */
+unsigned int aco_option_get_flags(const struct aco_option *option);
 
 /*! \note  Everything below this point is to handle converting varargs
  * containing field names, to varargs containing a count of args, followed

Modified: team/kmoore/stasis-bridging-channel_events/include/asterisk/inline_api.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/include/asterisk/inline_api.h?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/include/asterisk/inline_api.h (original)
+++ team/kmoore/stasis-bridging-channel_events/include/asterisk/inline_api.h Fri May 10 07:53:49 2013
@@ -43,7 +43,7 @@
   including the header file
  */
 
-#if !defined(LOW_MEMORY)
+#if !defined(LOW_MEMORY) && !defined(DISABLE_INLINE)
 
 #if !defined(AST_API_MODULE)
 #define AST_INLINE_API(hdr, body) hdr; extern inline hdr body

Modified: team/kmoore/stasis-bridging-channel_events/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridging-channel_events/main/bridging.c?view=diff&rev=388274&r1=388273&r2=388274
==============================================================================
--- team/kmoore/stasis-bridging-channel_events/main/bridging.c (original)
+++ team/kmoore/stasis-bridging-channel_events/main/bridging.c Fri May 10 07:53:49 2013
@@ -58,6 +58,7 @@
 #include "asterisk/musiconhold.h"
 #include "asterisk/features.h"
 #include "asterisk/cli.h"
+#include "asterisk/parking.h"
 
 /*! All bridges container. */
 static struct ao2_container *bridges;
@@ -523,6 +524,8 @@
 	AST_LIST_REMOVE(&bridge->channels, bridge_channel, entry);
 	bridge->v_table->pull(bridge, bridge_channel);
 
+	ast_bridge_channel_clear_roles(bridge_channel);
+
 	bridge_dissolve_check(bridge_channel);
 
 	bridge->reconfigured = 1;
@@ -564,7 +567,8 @@
 	if (bridge->dissolved
 		|| bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_WAIT
 		|| (swap && swap->state != AST_BRIDGE_CHANNEL_STATE_WAIT)
-		|| bridge->v_table->push(bridge, bridge_channel, swap)) {
+		|| bridge->v_table->push(bridge, bridge_channel, swap)
+		|| ast_bridge_channel_establish_roles(bridge_channel)) {
 		ast_debug(1, "Bridge %s: pushing %p(%s) into bridge failed\n",
 			bridge->uniqueid, bridge_channel, ast_channel_name(bridge_channel->chan));
 		return -1;
@@ -901,6 +905,50 @@
 {
 	payload_helper_playfile(ast_bridge_channel_queue_action_data,
 		bridge_channel, custom_play, playfile, moh_class);
+}
+
+struct bridge_park {
+	int parker_uuid_offset;
+	int app_data_offset;
+	/* buffer used for holding those strings */
+	char parkee_uuid[0];
+};
+
+static void bridge_channel_park(struct ast_bridge_channel *bridge_channel, struct bridge_park *payload)
+{
+	ast_bridge_channel_park(bridge_channel, payload->parkee_uuid,
+		&payload->parkee_uuid[payload->parker_uuid_offset],
+		payload->app_data_offset ? &payload->parkee_uuid[payload->app_data_offset] : NULL);
+}
+
+static void payload_helper_park(ast_bridge_channel_post_action_data post_it,
+	struct ast_bridge_channel *bridge_channel,
+	const char *parkee_uuid,
+	const char *parker_uuid,
+	const char *app_data)
+{
+	struct bridge_park *payload;
+	size_t len_parkee_uuid = strlen(parkee_uuid) + 1;
+	size_t len_parker_uuid = strlen(parker_uuid) + 1;
+	size_t len_app_data = !app_data ? 0 : strlen(app_data) + 1;
+	size_t len_payload = sizeof(*payload) + len_parker_uuid + len_parkee_uuid + len_app_data;
+
+	payload = alloca(len_payload);
+	payload->app_data_offset = len_app_data ? len_parkee_uuid + len_parker_uuid : 0;
+	payload->parker_uuid_offset = len_parkee_uuid;
+	strcpy(payload->parkee_uuid, parkee_uuid);
+	strcpy(&payload->parkee_uuid[payload->parker_uuid_offset], parker_uuid);
+	if (app_data) {
+		strcpy(&payload->parkee_uuid[payload->app_data_offset], app_data);
+	}
+
+	post_it(bridge_channel, AST_BRIDGE_ACTION_PARK, payload, len_payload);
+}
+
+void ast_bridge_channel_write_park(struct ast_bridge_channel *bridge_channel, const char *parkee_uuid, const char *parker_uuid, const char *app_data)
+{
+	payload_helper_park(ast_bridge_channel_write_action_data,
+		bridge_channel, parkee_uuid, parker_uuid, app_data);
 }
 
 /*!
@@ -1014,8 +1062,8 @@
 	}
 }
 
-/*! \brief Helper function used to find the "best" bridge technology given a specified capabilities */
-static struct ast_bridge_technology *find_best_technology(uint32_t capabilities)
+/*! \brief Helper function used to find the "best" bridge technology given specified capabilities */
+static struct ast_bridge_technology *find_best_technology(uint32_t capabilities, struct ast_bridge *bridge)
 {
 	struct ast_bridge_technology *current;
 	struct ast_bridge_technology *best = NULL;
@@ -1028,13 +1076,18 @@
 			continue;
 		}
 		if (!(current->capabilities & capabilities)) {
-			ast_debug(1, "Bridge technology %s does not have the capabilities we need.\n",
+			ast_debug(1, "Bridge technology %s does not have any capabilities we want.\n",
 				current->name);
 			continue;
 		}
-		if (best && best->preference < current->preference) {
-			ast_debug(1, "Bridge technology %s has preference %d while %s has preference %d. Skipping.\n",
-				current->name, current->preference, best->name, best->preference);
+		if (best && current->preference <= best->preference) {
+			ast_debug(1, "Bridge technology %s has less preference than %s (%d <= %d). Skipping.\n",
+				current->name, best->name, current->preference, best->preference);
+			continue;
+		}
+		if (current->compatible && !current->compatible(bridge)) {
+			ast_debug(1, "Bridge technology %s is not compatible with properties of existing bridge.\n",
+				current->name);
 			continue;
 		}
 		best = current;
@@ -1239,25 +1292,13 @@
 
 	ast_uuid_generate_str(self->uniqueid, sizeof(self->uniqueid));
 	ast_set_flag(&self->feature_flags, flags);
-
-	/* If we need to be a smart bridge see if we can move between 1to1 and multimix bridges */
-	if (flags & AST_BRIDGE_FLAG_SMART) {
-		if (!ast_bridge_check((capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX)
-			? AST_BRIDGE_CAPABILITY_MULTIMIX : AST_BRIDGE_CAPABILITY_1TO1MIX)) {
-			ao2_ref(self, -1);
-			return NULL;
-		}
-	}
-
-	/*
-	 * If capabilities were provided use our helper function to find
-	 * the "best" bridge technology, otherwise we can just look for
-	 * the most basic capability needed, single 1to1 mixing.
-	 */
-	self->technology = capabilities
-		? find_best_technology(capabilities)
-		: find_best_technology(AST_BRIDGE_CAPABILITY_1TO1MIX);
+	self->allowed_capabilities = capabilities;
+
+	/* Use our helper function to find the "best" bridge technology. */
+	self->technology = find_best_technology(capabilities, self);
 	if (!self->technology) {
+		ast_debug(1, "Bridge %s: Could not create.  No technology available to support it.\n",
+			self->uniqueid);
 		ao2_ref(self, -1);
 		return NULL;
 	}
@@ -1399,19 +1440,6 @@
 	return bridge;
 }
 
-int ast_bridge_check(uint32_t capabilities)
-{
-	struct ast_bridge_technology *bridge_technology;
-
-	if (!(bridge_technology = find_best_technology(capabilities))) {
-		return 0;
-	}
-
-	ast_module_unref(bridge_technology->mod);
-
-	return 1;
-}
-
 int ast_bridge_destroy(struct ast_bridge *bridge)
 {
 	ast_debug(1, "Bridge %s: telling all channels to leave the party\n", bridge->uniqueid);
@@ -1504,7 +1532,7 @@
  */
 static int smart_bridge_operation(struct ast_bridge *bridge)
 {
-	uint32_t new_capabilities = 0;
+	uint32_t new_capabilities;
 	struct ast_bridge_technology *new_technology;
 	struct ast_bridge_technology *old_technology = bridge->technology;
 	struct ast_bridge_channel *bridge_channel;
@@ -1520,44 +1548,48 @@
 		return 0;
 	}
 
-/* BUGBUG the bridge tech compatible callback should be asking if the specified bridge is compatible with the tech. */
-	/*
-	 * Based on current capabilities determine whether we want to
-	 * change bridge technologies.
-	 */
-	if (bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX) {
-		if (bridge->num_channels <= 2) {
-			ast_debug(1, "Bridge %s channel count (%u) is within limits for %s technology, not performing smart bridge operation.\n",
-				bridge->uniqueid, bridge->num_channels, bridge->technology->name);
-			return 0;
-		}
+	/* Determine new bridge technology capabilities needed. */
+	if (2 < bridge->num_channels) {
 		new_capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX;
-	} else if (bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) {
-		if (2 < bridge->num_channels) {
-			ast_debug(1, "Bridge %s channel count (%u) is within limits for %s technology, not performing smart bridge operation.\n",
-				bridge->uniqueid, bridge->num_channels, bridge->technology->name);
-			return 0;
-		}
-		new_capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX;
-	}
-
-	if (!new_capabilities) {
-		ast_debug(1, "Bridge %s has no new capabilities, not performing smart bridge operation.\n",
-			bridge->uniqueid);
-		return 0;
-	}
-

[... 1189 lines stripped ...]



More information about the asterisk-commits mailing list