[asterisk-commits] rmudgett: branch rmudgett/native_dahdi r394171 - in /team/rmudgett/native_dah...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 11 16:25:27 CDT 2013


Author: rmudgett
Date: Thu Jul 11 16:25:25 2013
New Revision: 394171

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394171
Log:
Stub out the DAHDI native bridge technology.

Modified:
    team/rmudgett/native_dahdi/channels/chan_dahdi.c
    team/rmudgett/native_dahdi/channels/dahdi/bridge_native_dahdi.c
    team/rmudgett/native_dahdi/channels/dahdi/bridge_native_dahdi.h

Modified: team/rmudgett/native_dahdi/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/native_dahdi/channels/chan_dahdi.c?view=diff&rev=394171&r1=394170&r2=394171
==============================================================================
--- team/rmudgett/native_dahdi/channels/chan_dahdi.c (original)
+++ team/rmudgett/native_dahdi/channels/chan_dahdi.c Thu Jul 11 16:25:25 2013
@@ -127,6 +127,7 @@
 #include "asterisk/bridging.h"
 #include "asterisk/stasis_channels.h"
 #include "chan_dahdi.h"
+#include "dahdi/bridge_native_dahdi.h"
 
 /*** DOCUMENTATION
 	<application name="DAHDISendKeypadFacility" language="en_US">
@@ -16564,6 +16565,8 @@
 	}
 #endif	/* defined(HAVE_SS7) */
 	ast_cond_destroy(&ss_thread_complete);
+
+	native_bridge_unload();
 
 	dahdi_tech.capabilities = ast_format_cap_destroy(dahdi_tech.capabilities);
 	STASIS_MESSAGE_TYPE_CLEANUP(dahdichannel_type);
@@ -18578,6 +18581,10 @@
 	ast_format_cap_add(dahdi_tech.capabilities, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0));
 	ast_format_cap_add(dahdi_tech.capabilities, ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0));
 
+	if (native_bridge_load(ast_module_info->self, &dahdi_tech)) {
+		return AST_MODULE_LOAD_FAILURE;
+	}
+
 #ifdef HAVE_PRI
 	memset(pris, 0, sizeof(pris));
 	for (y = 0; y < NUM_SPANS; y++) {
@@ -18798,5 +18805,5 @@
 	.unload = unload_module,
 	.reload = reload,
 	.load_pri = AST_MODPRI_CHANNEL_DRIVER,
-		.nonoptreq = "res_smdi",
+	.nonoptreq = "res_smdi",
 	);

Modified: team/rmudgett/native_dahdi/channels/dahdi/bridge_native_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/native_dahdi/channels/dahdi/bridge_native_dahdi.c?view=diff&rev=394171&r1=394170&r2=394171
==============================================================================
--- team/rmudgett/native_dahdi/channels/dahdi/bridge_native_dahdi.c (original)
+++ team/rmudgett/native_dahdi/channels/dahdi/bridge_native_dahdi.c Thu Jul 11 16:25:25 2013
@@ -43,7 +43,118 @@
 #include "../chan_dahdi.h"
 #include "asterisk/astobj.h"
 #include "bridge_native_dahdi.h"
+#include "asterisk/bridging.h"
+#include "asterisk/bridging_technology.h"
+#include "asterisk/frame.h"
 
 /* ------------------------------------------------------------------- */
 
+static const struct ast_channel_tech *dahdi_tech;
 
+static int native_bridge_create(struct ast_bridge *bridge)
+{
+	/*! \todo BUGBUG native_bridge_create() not written */
+	return -1;
+}
+
+static int native_bridge_start(struct ast_bridge *bridge)
+{
+	/*! \todo BUGBUG native_bridge_start() not written */
+	return -1;
+}
+
+static void native_bridge_stop(struct ast_bridge *bridge)
+{
+	/*! \todo BUGBUG native_bridge_stop() not written */
+}
+
+static void native_bridge_destroy(struct ast_bridge *bridge)
+{
+	/*! \todo BUGBUG native_bridge_destroy() not written */
+}
+
+static int native_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+	/*! \todo BUGBUG native_bridge_join() not written */
+	return -1;
+}
+
+static void native_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+	/*! \todo BUGBUG native_bridge_leave() not written */
+}
+
+static void native_bridge_suspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+	/*! \todo BUGBUG native_bridge_suspend() not written */
+}
+
+static void native_bridge_unsuspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+	/*! \todo BUGBUG native_bridge_unsuspend() not written */
+}
+
+static int native_bridge_compatible(struct ast_bridge *bridge)
+{
+	/*! \todo BUGBUG native_bridge_compatible() not written */
+	return -1;
+}
+
+static int native_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
+{
+	return ast_bridge_queue_everyone_else(bridge, bridge_channel, frame);
+}
+
+static struct ast_bridge_technology native_bridge = {
+	.name = "dahdi_native",
+	.capabilities = AST_BRIDGE_CAPABILITY_NATIVE,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_NATIVE,
+	.create = native_bridge_create,
+	.start = native_bridge_start,
+	.stop = native_bridge_stop,
+	.destroy = native_bridge_destroy,
+	.join = native_bridge_join,
+	.leave = native_bridge_leave,
+	.suspend = native_bridge_suspend,
+	.unsuspend = native_bridge_unsuspend,
+	.compatible = native_bridge_compatible,
+	.write = native_bridge_write,
+};
+
+/*!
+ * \internal
+ * \brief Destroy the DAHDI native bridge support.
+ * \since 12.0.0
+ *
+ * \return Nothing
+ */
+void native_bridge_unload(void)
+{
+	ast_format_cap_destroy(native_bridge.format_capabilities);
+	ast_bridge_technology_unregister(&native_bridge);
+}
+
+/*!
+ * \internal
+ * \brief Initialize the DAHDI native bridge support.
+ * \since 12.0.0
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int native_bridge_load(struct ast_module *mod, const struct ast_channel_tech *tech)
+{
+	struct ast_format format;
+
+	dahdi_tech = tech;
+
+	native_bridge.format_capabilities = ast_format_cap_alloc();
+	if (!native_bridge.format_capabilities) {
+		return -1;
+	}
+	ast_format_cap_add(native_bridge.format_capabilities, ast_format_set(&format, AST_FORMAT_SLINEAR, 0));
+	ast_format_cap_add(native_bridge.format_capabilities, ast_format_set(&format, AST_FORMAT_ULAW, 0));
+	ast_format_cap_add(native_bridge.format_capabilities, ast_format_set(&format, AST_FORMAT_ALAW, 0));
+
+	return __ast_bridge_technology_register(&native_bridge, mod);
+}

Modified: team/rmudgett/native_dahdi/channels/dahdi/bridge_native_dahdi.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/native_dahdi/channels/dahdi/bridge_native_dahdi.h?view=diff&rev=394171&r1=394170&r2=394171
==============================================================================
--- team/rmudgett/native_dahdi/channels/dahdi/bridge_native_dahdi.h (original)
+++ team/rmudgett/native_dahdi/channels/dahdi/bridge_native_dahdi.h Thu Jul 11 16:25:25 2013
@@ -35,7 +35,8 @@
 
 /* ------------------------------------------------------------------- */
 
-
+void native_bridge_unload(void);
+int native_bridge_load(struct ast_module *mod, const struct ast_channel_tech *tech);
 
 /* ------------------------------------------------------------------- */
 




More information about the asterisk-commits mailing list