[asterisk-commits] rmudgett: branch group/bridge_construction r388342 - in /team/group/bridge_co...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 10 11:39:55 CDT 2013


Author: rmudgett
Date: Fri May 10 11:39:49 2013
New Revision: 388342

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388342
Log:
Create unreal channel framework for derivative channels like local channels.

Part of the bridging work being done needs the ability to manipulate local
channels in new ways:

1) When one-touch parking a multi-party bridge, a local channel needs to
be created between the bridge being parked and the park holding bridge.
In this case, the local;2 channel needs to be pushed into the parking
bridge since there isn't a dialplan location to execute.

2) When attended transferring a multi-party bridge to an application like
voicemail using channel driver protocol transfers.  A local channel needs
to be created between the transferred bridge and the application.  In this
case, the local;2 channel needs to masquerade into the channel running
voicemail.

3) The ConfBridge announcer channels need to replace the chan_bridge
channels with an unreal channel framework channel for implementation
reasons.  (The chan_bridge driver will be deleted as a result.)

4) The chan_agent channel driver will use the unreal channel framework to
create Agent channels.

The chan_local.c file is refactored into core_local.c and core_unreal.c
and moves local channel support into the system core.

The new API calls for custom local channel manipulation are:

ast_local_get_peer() - Get the other local channel in the pair.  Useful
for getting the local;2 channel after an ast_request().

ast_local_setup_bridge() - After performing an ast_request(), using this
call will make the subsequent ast_call() push the local;2 channel into the
specified bridge.

ast_local_setup_masquerade() - After performing an ast_request(), using
this call will make the subsequent ast_call() masquerade the local;2
channel into the specified channel.

Changes/fixes in local/unreal channel behavior:

* Made unreal COLP indicate handling always set the caller information on
the other unreal channel in the pair.  Previously this happened only in
the local;2 to local;1 direction.

* Fixed using the wrong callerid when checking if the exten exists in
local_call().

* Renamed LOCAL_MOH_PASSTHRU to AST_UNREAL_MOH_INTERCEPT and invert the
use of the flag to match the new name.  This makes the unreal channels
default to not keeping state information in case they optimize.  Local
channels still behave the same for the /m option.

(closes issue ASTERISK-21713)
Reported by: Matt Jordan
Tested by: rmudgett

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

Added:
    team/group/bridge_construction/include/asterisk/core_local.h
      - copied unchanged from r388336, team/rmudgett/bridge_phase/include/asterisk/core_local.h
    team/group/bridge_construction/include/asterisk/core_unreal.h
      - copied unchanged from r388336, team/rmudgett/bridge_phase/include/asterisk/core_unreal.h
    team/group/bridge_construction/main/core_local.c
      - copied unchanged from r388336, team/rmudgett/bridge_phase/main/core_local.c
    team/group/bridge_construction/main/core_unreal.c
      - copied unchanged from r388336, team/rmudgett/bridge_phase/main/core_unreal.c
Removed:
    team/group/bridge_construction/channels/chan_local.c
Modified:
    team/group/bridge_construction/CHANGES
    team/group/bridge_construction/apps/app_dial.c
    team/group/bridge_construction/apps/app_followme.c
    team/group/bridge_construction/apps/app_queue.c
    team/group/bridge_construction/bridges/bridge_builtin_features.c
    team/group/bridge_construction/channels/chan_agent.c
    team/group/bridge_construction/channels/chan_sip.c
    team/group/bridge_construction/include/asterisk/_private.h
    team/group/bridge_construction/include/asterisk/bridging.h
    team/group/bridge_construction/include/asterisk/ccss.h
    team/group/bridge_construction/main/asterisk.c
    team/group/bridge_construction/main/bridging.c
    team/group/bridge_construction/main/channel.c
    team/group/bridge_construction/main/pbx.c

Modified: team/group/bridge_construction/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/CHANGES?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/CHANGES (original)
+++ team/group/bridge_construction/CHANGES Fri May 10 11:39:49 2013
@@ -83,6 +83,8 @@
 chan_local
 ------------------
  * The /b option is removed.
+
+ * chan_local moved into the system core and is no longer a loadable module.
 
 chan_mobile
 ------------------

Modified: team/group/bridge_construction/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/apps/app_dial.c?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/apps/app_dial.c (original)
+++ team/group/bridge_construction/apps/app_dial.c Fri May 10 11:39:49 2013
@@ -26,7 +26,6 @@
  */
 
 /*** MODULEINFO
-	<depend>chan_local</depend>
 	<support_level>core</support_level>
  ***/
 

Modified: team/group/bridge_construction/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/apps/app_followme.c?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/apps/app_followme.c (original)
+++ team/group/bridge_construction/apps/app_followme.c Fri May 10 11:39:49 2013
@@ -36,7 +36,6 @@
  */
 
 /*** MODULEINFO
-	<depend>chan_local</depend>
 	<support_level>core</support_level>
  ***/
 

Modified: team/group/bridge_construction/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/apps/app_queue.c?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/apps/app_queue.c (original)
+++ team/group/bridge_construction/apps/app_queue.c Fri May 10 11:39:49 2013
@@ -5275,7 +5275,7 @@
 	}
 
 	/* if the calling channel has AST_CAUSE_ANSWERED_ELSEWHERE set, make sure this is inherited.
-		(this is mainly to support chan_local)
+		(this is mainly to support unreal/local channels)
 	*/
 	if (ast_channel_hangupcause(qe->chan) == AST_CAUSE_ANSWERED_ELSEWHERE) {
 		qe->cancel_answered_elsewhere = 1;

Modified: team/group/bridge_construction/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/bridges/bridge_builtin_features.c?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/bridges/bridge_builtin_features.c (original)
+++ team/group/bridge_construction/bridges/bridge_builtin_features.c Fri May 10 11:39:49 2013
@@ -105,7 +105,7 @@
 	/* Fill the variable with the extension and context we want to call */
 	snprintf(destination, sizeof(destination), "%s@%s", exten, context);
 
-	/* Now we request that chan_local prepare to call the destination */
+	/* Now we request a local channel to prepare to call the destination */
 	chan = ast_request("Local", ast_channel_nativeformats(caller), caller, destination,
 		&cause);
 	if (!chan) {

Modified: team/group/bridge_construction/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/channels/chan_agent.c?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/channels/chan_agent.c (original)
+++ team/group/bridge_construction/channels/chan_agent.c Fri May 10 11:39:49 2013
@@ -31,7 +31,6 @@
  * \ingroup channel_drivers
  */
 /*** MODULEINFO
-        <depend>chan_local</depend>
         <depend>res_monitor</depend>
 	<support_level>core</support_level>
  ***/
@@ -2589,5 +2588,5 @@
 		.unload = unload_module,
 		.reload = reload,
 		.load_pri = AST_MODPRI_CHANNEL_DRIVER,
-		.nonoptreq = "res_monitor,chan_local",
+		.nonoptreq = "res_monitor",
 	       );

Modified: team/group/bridge_construction/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/channels/chan_sip.c?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/channels/chan_sip.c (original)
+++ team/group/bridge_construction/channels/chan_sip.c Fri May 10 11:39:49 2013
@@ -176,7 +176,6 @@
 /*** MODULEINFO
 	<use type="module">res_crypto</use>
 	<use type="module">res_http_websocket</use>
-	<depend>chan_local</depend>
 	<support_level>core</support_level>
  ***/
 
@@ -34738,5 +34737,5 @@
 		.unload = unload_module,
 		.reload = reload,
 		.load_pri = AST_MODPRI_CHANNEL_DRIVER,
-		.nonoptreq = "res_crypto,chan_local,res_http_websocket",
+		.nonoptreq = "res_crypto,res_http_websocket",
 	       );

Modified: team/group/bridge_construction/include/asterisk/_private.h
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/include/asterisk/_private.h?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/include/asterisk/_private.h (original)
+++ team/group/bridge_construction/include/asterisk/_private.h Fri May 10 11:39:49 2013
@@ -61,6 +61,15 @@
 int ast_bridging_init(void);
 
 /*!
+ * \brief Initialize the local proxy channel.
+ * \since 12.0.0
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int ast_local_init(void);
+
+/*!
  * \brief Reload asterisk modules.
  * \param name the name of the module to reload
  *

Modified: team/group/bridge_construction/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/include/asterisk/bridging.h?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/include/asterisk/bridging.h (original)
+++ team/group/bridge_construction/include/asterisk/bridging.h Fri May 10 11:39:49 2013
@@ -851,18 +851,18 @@
 int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan);
 
 /*!
- * \brief Check and optimize out the local channels between bridges.
- * \since 12.0.0
- *
- * \param chan Local channel writing a frame into the channel driver.
- * \param peer Other local channel in the pair.
+ * \brief Check and optimize out the unreal channels between bridges.
+ * \since 12.0.0
+ *
+ * \param chan Unreal channel writing a frame into the channel driver.
+ * \param peer Other unreal channel in the pair.
  *
  * \note It is assumed that chan is already locked.
  *
- * \retval 0 if local channels were not optimized out.
- * \retval non-zero if local channels were optimized out.
- */
-int ast_bridge_local_optimized_out(struct ast_channel *chan, struct ast_channel *peer);
+ * \retval 0 if unreal channels were not optimized out.
+ * \retval non-zero if unreal channels were optimized out.
+ */
+int ast_bridge_unreal_optimized_out(struct ast_channel *chan, struct ast_channel *peer);
 
 /*!
  * \brief Try locking the bridge_channel.

Modified: team/group/bridge_construction/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/include/asterisk/ccss.h?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/include/asterisk/ccss.h (original)
+++ team/group/bridge_construction/include/asterisk/ccss.h Fri May 10 11:39:49 2013
@@ -1485,10 +1485,12 @@
  * \verbatim extension at context \endverbatim as a starting point
  *
  * \details
- * The CC_INTERFACES channel variable will have the interfaces that should be
- * called back for a specific PBX instance. This version of the function is used
- * mainly by chan_local, wherein we need to set CC_INTERFACES based on an extension
- * and context that appear in the middle of the tree of dialed interfaces
+ * The CC_INTERFACES channel variable will have the interfaces
+ * that should be called back for a specific PBX instance.  This
+ * version of the function is used mainly by local channels,
+ * wherein we need to set CC_INTERFACES based on an extension
+ * and context that appear in the middle of the tree of dialed
+ * interfaces.
  *
  * \note
  * This function will lock the channel as well as the list of monitors stored

Modified: team/group/bridge_construction/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/main/asterisk.c?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/main/asterisk.c (original)
+++ team/group/bridge_construction/main/asterisk.c Fri May 10 11:39:49 2013
@@ -4345,6 +4345,11 @@
 		exit(1);
 	}
 
+	if (ast_local_init()) {
+		printf("%s", term_quit());
+		exit(1);
+	}
+
 	if ((moduleresult = load_modules(0))) {		/* Load modules */
 		printf("%s", term_quit());
 		exit(moduleresult == -2 ? 2 : 1);

Modified: team/group/bridge_construction/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/main/bridging.c?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/main/bridging.c (original)
+++ team/group/bridge_construction/main/bridging.c Fri May 10 11:39:49 2013
@@ -3574,10 +3574,10 @@
 
 /*!
  * \internal
- * \brief Lock the local channel stack for chan and prequalify it.
+ * \brief Lock the unreal channel stack for chan and prequalify it.
  * \since 12.0.0
  *
- * \param chan Local channel writing a frame into the channel driver.
+ * \param chan Unreal channel writing a frame into the channel driver.
  *
  * \note It is assumed that chan is already locked.
  *
@@ -3617,10 +3617,10 @@
 
 /*!
  * \internal
- * \brief Lock the local channel stack for peer and prequalify it.
+ * \brief Lock the unreal channel stack for peer and prequalify it.
  * \since 12.0.0
  *
- * \param peer Other local channel in the pair.
+ * \param peer Other unreal channel in the pair.
  *
  * \retval bridge on success with bridge, bridge_channel, and peer locked.
  * \retval NULL if cannot do optimization now.
@@ -3665,7 +3665,7 @@
 
 /*!
  * \internal
- * \brief Check and attempt to swap optimize out the local channels.
+ * \brief Check and attempt to swap optimize out the unreal channels.
  * \since 12.0.0
  *
  * \param chan_bridge
@@ -3673,9 +3673,9 @@
  * \param peer_bridge
  * \param peer_bridge_channel
  *
- * \retval 1 if local channels failed to optimize out.
- * \retval 0 if local channels were not optimized out.
- * \retval -1 if local channels were optimized out.
+ * \retval 1 if unreal channels failed to optimize out.
+ * \retval 0 if unreal channels were not optimized out.
+ * \retval -1 if unreal channels were optimized out.
  */
 static int check_swap_optimize_out(struct ast_bridge *chan_bridge,
 	struct ast_bridge_channel *chan_bridge_channel, struct ast_bridge *peer_bridge,
@@ -3746,7 +3746,7 @@
 
 /*!
  * \internal
- * \brief Check and attempt to merge optimize out the local channels.
+ * \brief Check and attempt to merge optimize out the unreal channels.
  * \since 12.0.0
  *
  * \param chan_bridge
@@ -3754,8 +3754,8 @@
  * \param peer_bridge
  * \param peer_bridge_channel
  *
- * \retval 0 if local channels were not optimized out.
- * \retval -1 if local channels were optimized out.
+ * \retval 0 if unreal channels were not optimized out.
+ * \retval -1 if unreal channels were optimized out.
  */
 static int check_merge_optimize_out(struct ast_bridge *chan_bridge,
 	struct ast_bridge_channel *chan_bridge_channel, struct ast_bridge *peer_bridge,
@@ -3797,7 +3797,7 @@
 	return res;
 }
 
-int ast_bridge_local_optimized_out(struct ast_channel *chan, struct ast_channel *peer)
+int ast_bridge_unreal_optimized_out(struct ast_channel *chan, struct ast_channel *peer)
 {
 	struct ast_bridge *chan_bridge;
 	struct ast_bridge *peer_bridge;

Modified: team/group/bridge_construction/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/main/channel.c?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/main/channel.c (original)
+++ team/group/bridge_construction/main/channel.c Fri May 10 11:39:49 2013
@@ -6852,7 +6852,7 @@
 	 * and new masquerade attempts, the channels container must be
 	 * locked for the entire masquerade.  The original and clonechan
 	 * need to be unlocked earlier to avoid potential deadlocks with
-	 * the chan_local deadlock avoidance method.
+	 * the unreal/local channel deadlock avoidance method.
 	 *
 	 * The container lock blocks competing masquerade attempts from
 	 * starting as well as being necessary for proper locking order

Modified: team/group/bridge_construction/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/main/pbx.c?view=diff&rev=388342&r1=388341&r2=388342
==============================================================================
--- team/group/bridge_construction/main/pbx.c (original)
+++ team/group/bridge_construction/main/pbx.c Fri May 10 11:39:49 2013
@@ -9444,8 +9444,7 @@
 
 	/* Masquerade into tmp channel */
 	if (ast_channel_masquerade(tmpchan, chan)) {
-		/* Failed to set up the masquerade.  It's probably chan_local
-		 * in the middle of optimizing itself out.  Sad. :( */
+		/* Failed to set up the masquerade. */
 		ast_hangup(tmpchan);
 		tmpchan = NULL;
 		res = -1;




More information about the asterisk-commits mailing list