[asterisk-commits] rmudgett: branch rmudgett/bridge_phase r387858 - in /team/rmudgett/bridge_pha...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 7 15:47:55 CDT 2013
Author: rmudgett
Date: Tue May 7 15:47:53 2013
New Revision: 387858
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387858
Log:
Move channels/chan_local.c to main/core_local.c and make it not dynamically loadable.
Added:
team/rmudgett/bridge_phase/main/core_local.c
- copied, changed from r387850, team/rmudgett/bridge_phase/channels/chan_local.c
Removed:
team/rmudgett/bridge_phase/channels/chan_local.c
Modified:
team/rmudgett/bridge_phase/apps/app_dial.c
team/rmudgett/bridge_phase/apps/app_followme.c
team/rmudgett/bridge_phase/apps/app_queue.c
team/rmudgett/bridge_phase/bridges/bridge_builtin_features.c
team/rmudgett/bridge_phase/channels/chan_agent.c
team/rmudgett/bridge_phase/channels/chan_sip.c
team/rmudgett/bridge_phase/include/asterisk/_private.h
team/rmudgett/bridge_phase/include/asterisk/ccss.h
team/rmudgett/bridge_phase/main/asterisk.c
team/rmudgett/bridge_phase/main/channel.c
team/rmudgett/bridge_phase/main/pbx.c
Modified: team/rmudgett/bridge_phase/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/apps/app_dial.c?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/apps/app_dial.c (original)
+++ team/rmudgett/bridge_phase/apps/app_dial.c Tue May 7 15:47:53 2013
@@ -26,7 +26,6 @@
*/
/*** MODULEINFO
- <depend>chan_local</depend>
<support_level>core</support_level>
***/
Modified: team/rmudgett/bridge_phase/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/apps/app_followme.c?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/apps/app_followme.c (original)
+++ team/rmudgett/bridge_phase/apps/app_followme.c Tue May 7 15:47:53 2013
@@ -36,7 +36,6 @@
*/
/*** MODULEINFO
- <depend>chan_local</depend>
<support_level>core</support_level>
***/
Modified: team/rmudgett/bridge_phase/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/apps/app_queue.c?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/apps/app_queue.c (original)
+++ team/rmudgett/bridge_phase/apps/app_queue.c Tue May 7 15:47:53 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/rmudgett/bridge_phase/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/bridges/bridge_builtin_features.c?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/bridges/bridge_builtin_features.c (original)
+++ team/rmudgett/bridge_phase/bridges/bridge_builtin_features.c Tue May 7 15:47:53 2013
@@ -109,7 +109,7 @@
*/
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/rmudgett/bridge_phase/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/channels/chan_agent.c?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/channels/chan_agent.c (original)
+++ team/rmudgett/bridge_phase/channels/chan_agent.c Tue May 7 15:47:53 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/rmudgett/bridge_phase/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/channels/chan_sip.c?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/channels/chan_sip.c (original)
+++ team/rmudgett/bridge_phase/channels/chan_sip.c Tue May 7 15:47:53 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>
***/
@@ -35026,5 +35025,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/rmudgett/bridge_phase/include/asterisk/_private.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/include/asterisk/_private.h?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/_private.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/_private.h Tue May 7 15:47:53 2013
@@ -61,6 +61,15 @@
int ast_bridging_init(void);
/*!
+ * \brief Initialize the local proxy channel and unreal derivative framework system.
+ * \since 12.0.0
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int ast_unreal_init(void);
+
+/*!
* \brief Reload asterisk modules.
* \param name the name of the module to reload
*
Modified: team/rmudgett/bridge_phase/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/include/asterisk/ccss.h?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/ccss.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/ccss.h Tue May 7 15:47:53 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/rmudgett/bridge_phase/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/asterisk.c?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/main/asterisk.c (original)
+++ team/rmudgett/bridge_phase/main/asterisk.c Tue May 7 15:47:53 2013
@@ -4339,6 +4339,11 @@
exit(1);
}
+ if (ast_unreal_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/rmudgett/bridge_phase/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/channel.c?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/main/channel.c (original)
+++ team/rmudgett/bridge_phase/main/channel.c Tue May 7 15:47:53 2013
@@ -6857,7 +6857,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
Copied: team/rmudgett/bridge_phase/main/core_local.c (from r387850, team/rmudgett/bridge_phase/channels/chan_local.c)
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/core_local.c?view=diff&rev=387858&p1=team/rmudgett/bridge_phase/channels/chan_local.c&r1=387850&p2=team/rmudgett/bridge_phase/main/core_local.c&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/channels/chan_local.c (original)
+++ team/rmudgett/bridge_phase/main/core_local.c Tue May 7 15:47:53 2013
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2005, 2013, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -19,10 +19,9 @@
/*! \file
*
* \author Mark Spencer <markster at digium.com>
- *
- * \brief Local Proxy Channel
- *
- * \ingroup channel_drivers
+ * \author Richard Mudgett <rmudgett at digium.com>
+ *
+ * \brief Local proxy channel and other unreal channel derivatives framework.
*/
/*** MODULEINFO
@@ -56,6 +55,7 @@
#include "asterisk/astobj2.h"
#include "asterisk/bridging.h"
#include "asterisk/core_local.h"
+#include "asterisk/_private.h"
/*** DOCUMENTATION
<manager name="LocalOptimizeAway" language="en_US">
@@ -1527,19 +1527,48 @@
return (obj == arg) ? CMP_MATCH : 0;
}
-/* BUGBUG need to move this file to main/core_local.c and make it not dynamically loadable. */
-/*! \brief Load module into PBX, register channel */
-static int load_module(void)
+/*!
+ * \internal
+ * \brief Shutdown the local proxy channel and unreal derivative framework system.
+ * \since 12.0.0
+ *
+ * \return Nothing
+ */
+static void unreal_shutdown(void)
+{
+ struct ast_local_pvt *p;
+ struct ao2_iterator it;
+
+ /* First, take us out of the channel loop */
+ ast_cli_unregister_multiple(cli_local, ARRAY_LEN(cli_local));
+ ast_manager_unregister("LocalOptimizeAway");
+ ast_channel_unregister(&local_tech);
+
+ it = ao2_iterator_init(locals, 0);
+ while ((p = ao2_iterator_next(&it))) {
+ if (p->base.owner) {
+ ast_softhangup(p->base.owner, AST_SOFTHANGUP_APPUNLOAD);
+ }
+ ao2_ref(p, -1);
+ }
+ ao2_iterator_destroy(&it);
+ ao2_ref(locals, -1);
+ locals = NULL;
+
+ ast_format_cap_destroy(local_tech.capabilities);
+}
+
+int ast_unreal_init(void)
{
if (!(local_tech.capabilities = ast_format_cap_alloc())) {
- return AST_MODULE_LOAD_FAILURE;
+ return -1;
}
ast_format_cap_add_all(local_tech.capabilities);
locals = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, locals_cmp_cb);
if (!locals) {
ast_format_cap_destroy(local_tech.capabilities);
- return AST_MODULE_LOAD_FAILURE;
+ return -1;
}
/* Make sure we can register our channel type */
@@ -1547,42 +1576,11 @@
ast_log(LOG_ERROR, "Unable to register channel class 'Local'\n");
ao2_ref(locals, -1);
ast_format_cap_destroy(local_tech.capabilities);
- return AST_MODULE_LOAD_FAILURE;
+ return -1;
}
ast_cli_register_multiple(cli_local, ARRAY_LEN(cli_local));
ast_manager_register_xml("LocalOptimizeAway", EVENT_FLAG_SYSTEM|EVENT_FLAG_CALL, manager_optimize_away);
- return AST_MODULE_LOAD_SUCCESS;
-}
-
-/*! \brief Unload the local proxy channel from Asterisk */
-static int unload_module(void)
-{
- struct ast_local_pvt *p;
- struct ao2_iterator it;
-
- /* First, take us out of the channel loop */
- ast_cli_unregister_multiple(cli_local, ARRAY_LEN(cli_local));
- ast_manager_unregister("LocalOptimizeAway");
- ast_channel_unregister(&local_tech);
-
- it = ao2_iterator_init(locals, 0);
- while ((p = ao2_iterator_next(&it))) {
- if (p->base.owner) {
- ast_softhangup(p->base.owner, AST_SOFTHANGUP_APPUNLOAD);
- }
- ao2_ref(p, -1);
- }
- ao2_iterator_destroy(&it);
- ao2_ref(locals, -1);
- locals = NULL;
-
- ast_format_cap_destroy(local_tech.capabilities);
+ ast_register_atexit(unreal_shutdown);
return 0;
}
-
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Local Proxy Channel (Note: used internally by other modules)",
- .load = load_module,
- .unload = unload_module,
- .load_pri = AST_MODPRI_CHANNEL_DRIVER,
- );
Modified: team/rmudgett/bridge_phase/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/pbx.c?view=diff&rev=387858&r1=387857&r2=387858
==============================================================================
--- team/rmudgett/bridge_phase/main/pbx.c (original)
+++ team/rmudgett/bridge_phase/main/pbx.c Tue May 7 15:47:53 2013
@@ -9441,8 +9441,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