[asterisk-commits] file: branch file/bridging r172705 - /team/file/bridging/include/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jan 31 09:25:34 CST 2009


Author: file
Date: Sat Jan 31 09:25:34 2009
New Revision: 172705

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=172705
Log:
Move bridging features into a separate header file.

Added:
    team/file/bridging/include/asterisk/bridging_features.h   (with props)
Modified:
    team/file/bridging/include/asterisk/bridging.h

Modified: team/file/bridging/include/asterisk/bridging.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/include/asterisk/bridging.h?view=diff&rev=172705&r1=172704&r2=172705
==============================================================================
--- team/file/bridging/include/asterisk/bridging.h (original)
+++ team/file/bridging/include/asterisk/bridging.h Sat Jan 31 09:25:34 2009
@@ -62,6 +62,8 @@
 extern "C" {
 #endif
 
+#include "asterisk/bridging_features.h"
+	
 /*! \brief Capabilities for a bridge technology */
 enum ast_bridge_capability {
 	/*! Bridge is only capable of mixing 2 channels */
@@ -96,14 +98,6 @@
 	AST_BRIDGE_CHANNEL_STATE_DTMF,
 };
 
-/*! \brief Flags used for bridge features */
-enum ast_bridge_feature_flags {
-	/*! Upon hangup the bridge should be discontinued */
-	AST_BRIDGE_FLAG_DISSOLVE = (1 << 0),
-	/*! Move between bridging technologies as needed. */
-	AST_BRIDGE_FLAG_SMART = (1 << 1),	
-};
-
 /*! \brief Return values for bridge technology write function */
 enum ast_bridge_write_result {
 	/*! Bridge technology wrote out frame fine */
@@ -114,67 +108,8 @@
 	AST_BRIDGE_WRITE_UNSUPPORTED,
 };
 
-/*! \brief Built in features */
-enum ast_bridge_builtin_feature {
-	/*! DTMF Based Blind Transfer */
-	AST_BRIDGE_BUILTIN_BLINDTRANSFER = 0,
-	/*! DTMF Based Attended Transfer */
-	AST_BRIDGE_BUILTIN_ATTENDEDTRANSFER,
-	/*! DTMF Based Hangup Feature */
-	AST_BRIDGE_BUILTIN_HANGUP,
-	/*! End terminator for list of built in features. Must remain last. */
-	AST_BRIDGE_BUILTIN_END,
-};
-
 struct ast_bridge_technology;	
 struct ast_bridge;
-struct ast_bridge_channel;
-struct ast_bridge_features;
-
-/*!
- * \brief Features hook callback type
- *
- * \param bridge
- * \param bridge_channel
- * \param hook_pvt
- *
- * \retval 0 success
- * \retval -1 failure
- */
-typedef int (*ast_bridge_features_hook_callback)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt);
-
-/*!
- * \brief Maximum length of a DTMF feature string
- */
-#define MAXIMUM_DTMF_FEATURE_STRING 8
-	
-/*!
- * \brief Structure that is the essence of a features hook
- */
-struct ast_bridge_features_hook {
-	/*! DTMF String that is examined during a feature hook lookup */
-	char dtmf[MAXIMUM_DTMF_FEATURE_STRING];
-	/*! Callback that is called when DTMF string is matched */
-	ast_bridge_features_hook_callback callback;
-	/*! Unique data that was passed into us */
-	void *hook_pvt;
-	/*! Linked list information */
-	AST_LIST_ENTRY(ast_bridge_features_hook) entry;
-};
-
-/*!
- * \brief Structure that contains features information
- */
-struct ast_bridge_features {
-	/*! Attached DTMF based feature hooks */
-	AST_LIST_HEAD_NOLOCK(, ast_bridge_features_hook) hooks;
-	/*! Feature flags that are enabled */
-	struct ast_flags feature_flags;
-	/*! Bit to indicate that this structure is useful and should be considered when looking for features */
-	unsigned int usable:1;
-	/*! Bit to indicate whether the channel/bridge is muted or not */
-	unsigned int mute:1;
-};
 
 /*!
  * \brief Structure that contains information regarding a channel in a bridge
@@ -466,141 +401,6 @@
  */
 void ast_bridge_change_state(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_state new_state);
 
-/*! \brief Attach a custom hook to a bridge features structure
- *
- * \param features Bridge features structure
- * \param dtmf DTMF string to be activated upon
- * \param callback Function to execute upon activation
- * \param hook_pvt Unique data
- *
- * \retval 0 on success
- * \retval -1 on failure
- *
- * Example usage:
- *
- * \code
- * struct ast_bridge_features features;
- * ast_bridge_features_init(&features);
- * ast_bridge_features_hook(&features, "#", pound_callback, NULL);
- * \endcode
- *
- * This makes the bridging core call pound_callback if a channel that has this
- * feature structure inputs the DTMF string '#'. A pointer to useful data may be
- * provided to the hook_pvt parameter.
- *
- * \note It is important that the callback set the bridge channel state back to
- *       AST_BRIDGE_CHANNEL_STATE_WAIT or the bridge thread will not service the channel.
- */
-int ast_bridge_features_hook(struct ast_bridge_features *features, const char *dtmf, ast_bridge_features_hook_callback callback, void *hook_pvt);
-
-/*! \brief Enable a built in feature on a bridge features structure
- *
- * \param features Bridge features structure
- * \param feature Feature to enable
- * \param dtmf Optionally the DTMF stream to trigger the feature, if not specified it will be the default
- *
- * \retval 0 on success
- * \retval -1 on failure
- *
- * Example usage:
- *
- * \code
- * struct ast_bridge_features features;
- * ast_bridge_features_init(&features);
- * ast_bridge_features_enable(&features, AST_BRIDGE_BUILTIN_ATTENDEDTRANSFER, NULL);
- * \endcode
- *
- * This enables the attended transfer DTMF option using the default DTMF string. An alternate
- * string may be provided using the dtmf parameter. Internally this is simply setting up a hook
- * to a built in feature callback function.
- */
-int ast_bridge_features_enable(struct ast_bridge_features *features, enum ast_bridge_builtin_feature feature, const char *dtmf);
-
-/*! \brief Set a flag on a bridge features structure
- *
- * \param features Bridge features structure
- * \param flag Flag to enable
- *
- * \retval 0 on success
- * \retval -1 on failure
- *
- * Example usage:
- *
- * \code
- * struct ast_bridge_features features;
- * ast_bridge_features_init(&features);
- * ast_bridge_features_set_flag(&features, AST_BRIDGE_FLAG_DISSOLVE);
- * \endcode
- *
- * This sets the AST_BRIDGE_FLAG_DISSOLVE feature to be enabled on the features structure
- * 'features'.
- */
-int ast_bridge_features_set_flag(struct ast_bridge_features *features, enum ast_bridge_feature_flags flag);
-
-/*! \brief Initialize bridge features structure
- *
- * \param features Bridge featues structure
- *
- * \retval 0 on success
- * \retval -1 on failure
- *
- * Example usage:
- *
- * \code
- * struct ast_bridge_features features;
- * ast_bridge_features_init(&features);
- * \endcode
- *
- * This initializes the feature structure 'features' to have nothing enabled.
- *
- * \note This MUST be called before enabling features or flags. Failure to do so
- *       may result in a crash.
- */
-int ast_bridge_features_init(struct ast_bridge_features *features);
-
-/*! \brief Clean up the contents of a bridge features structure
- *
- * \param features Bridge features structure
- *
- * \retval 0 on success
- * \retval -1 on failure
- *
- * Example usage:
- *
- * \code
- * struct ast_bridge_features features;
- * ast_bridge_features_init(&features);
- * ast_bridge_features_cleanup(&features);
- * \endcode
- *
- * This cleans up the feature structure 'features'.
- *
- * \note This MUST be called after the features structure is done being used
- *       or a memory leak may occur.
- */
-int ast_bridge_features_cleanup(struct ast_bridge_features *features);
-
-/*! \brief Play a DTMF stream into a bridge, optionally not to a given channel
- *
- * \param bridge Bridge to play stream into
- * \param dtmf DTMF to play
- * \param chan Channel to optionally not play to
- *
- * \retval 0 on success
- * \retval -1 on failure
- *
- * Example usage:
- *
- * \code
- * ast_bridge_dtmf_stream(bridge, "0123456789", NULL);
- * \endcode
- *
- * This sends the DTMF digits '0123456789' to all channels in the bridge pointed to
- * by the bridge pointer. Optionally a channel may be excluded by passing it's channel pointer
- * using the chan parameter.
- */
-int ast_bridge_dtmf_stream(struct ast_bridge *bridge, const char *dtmf, struct ast_channel *chan);
-
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Added: team/file/bridging/include/asterisk/bridging_features.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/include/asterisk/bridging_features.h?view=auto&rev=172705
==============================================================================
--- team/file/bridging/include/asterisk/bridging_features.h (added)
+++ team/file/bridging/include/asterisk/bridging_features.h Sat Jan 31 09:25:34 2009
@@ -1,0 +1,238 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 1999 - 2008, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ * \brief Channel Bridging API
+ * \author Joshua Colp <jcolp at digium.com>
+ */
+
+#ifndef _ASTERISK_BRIDGING_FEATURES_H
+#define _ASTERISK_BRIDGING_FEATURES_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/*! \brief Flags used for bridge features */
+enum ast_bridge_feature_flags {
+	/*! Upon hangup the bridge should be discontinued */
+	AST_BRIDGE_FLAG_DISSOLVE = (1 << 0),
+	/*! Move between bridging technologies as needed. */
+	AST_BRIDGE_FLAG_SMART = (1 << 1),	
+};
+
+/*! \brief Built in features */
+enum ast_bridge_builtin_feature {
+	/*! DTMF Based Blind Transfer */
+	AST_BRIDGE_BUILTIN_BLINDTRANSFER = 0,
+	/*! DTMF Based Attended Transfer */
+	AST_BRIDGE_BUILTIN_ATTENDEDTRANSFER,
+	/*! DTMF Based Hangup Feature */
+	AST_BRIDGE_BUILTIN_HANGUP,
+	/*! End terminator for list of built in features. Must remain last. */
+	AST_BRIDGE_BUILTIN_END,
+};
+
+struct ast_bridge;
+struct ast_bridge_channel;
+
+/*!
+ * \brief Features hook callback type
+ *
+ * \param bridge
+ * \param bridge_channel
+ * \param hook_pvt
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
+typedef int (*ast_bridge_features_hook_callback)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt);
+
+/*!
+ * \brief Maximum length of a DTMF feature string
+ */
+#define MAXIMUM_DTMF_FEATURE_STRING 8
+	
+/*!
+ * \brief Structure that is the essence of a features hook
+ */
+struct ast_bridge_features_hook {
+	/*! DTMF String that is examined during a feature hook lookup */
+	char dtmf[MAXIMUM_DTMF_FEATURE_STRING];
+	/*! Callback that is called when DTMF string is matched */
+	ast_bridge_features_hook_callback callback;
+	/*! Unique data that was passed into us */
+	void *hook_pvt;
+	/*! Linked list information */
+	AST_LIST_ENTRY(ast_bridge_features_hook) entry;
+};
+
+/*!
+ * \brief Structure that contains features information
+ */
+struct ast_bridge_features {
+	/*! Attached DTMF based feature hooks */
+	AST_LIST_HEAD_NOLOCK(, ast_bridge_features_hook) hooks;
+	/*! Feature flags that are enabled */
+	struct ast_flags feature_flags;
+	/*! Bit to indicate that this structure is useful and should be considered when looking for features */
+	unsigned int usable:1;
+	/*! Bit to indicate whether the channel/bridge is muted or not */
+	unsigned int mute:1;
+};
+
+/*! \brief Attach a custom hook to a bridge features structure
+ *
+ * \param features Bridge features structure
+ * \param dtmf DTMF string to be activated upon
+ * \param callback Function to execute upon activation
+ * \param hook_pvt Unique data
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * struct ast_bridge_features features;
+ * ast_bridge_features_init(&features);
+ * ast_bridge_features_hook(&features, "#", pound_callback, NULL);
+ * \endcode
+ *
+ * This makes the bridging core call pound_callback if a channel that has this
+ * feature structure inputs the DTMF string '#'. A pointer to useful data may be
+ * provided to the hook_pvt parameter.
+ *
+ * \note It is important that the callback set the bridge channel state back to
+ *       AST_BRIDGE_CHANNEL_STATE_WAIT or the bridge thread will not service the channel.
+ */
+int ast_bridge_features_hook(struct ast_bridge_features *features, const char *dtmf, ast_bridge_features_hook_callback callback, void *hook_pvt);
+
+/*! \brief Enable a built in feature on a bridge features structure
+ *
+ * \param features Bridge features structure
+ * \param feature Feature to enable
+ * \param dtmf Optionally the DTMF stream to trigger the feature, if not specified it will be the default
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * struct ast_bridge_features features;
+ * ast_bridge_features_init(&features);
+ * ast_bridge_features_enable(&features, AST_BRIDGE_BUILTIN_ATTENDEDTRANSFER, NULL);
+ * \endcode
+ *
+ * This enables the attended transfer DTMF option using the default DTMF string. An alternate
+ * string may be provided using the dtmf parameter. Internally this is simply setting up a hook
+ * to a built in feature callback function.
+ */
+int ast_bridge_features_enable(struct ast_bridge_features *features, enum ast_bridge_builtin_feature feature, const char *dtmf);
+
+/*! \brief Set a flag on a bridge features structure
+ *
+ * \param features Bridge features structure
+ * \param flag Flag to enable
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * struct ast_bridge_features features;
+ * ast_bridge_features_init(&features);
+ * ast_bridge_features_set_flag(&features, AST_BRIDGE_FLAG_DISSOLVE);
+ * \endcode
+ *
+ * This sets the AST_BRIDGE_FLAG_DISSOLVE feature to be enabled on the features structure
+ * 'features'.
+ */
+int ast_bridge_features_set_flag(struct ast_bridge_features *features, enum ast_bridge_feature_flags flag);
+
+/*! \brief Initialize bridge features structure
+ *
+ * \param features Bridge featues structure
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * struct ast_bridge_features features;
+ * ast_bridge_features_init(&features);
+ * \endcode
+ *
+ * This initializes the feature structure 'features' to have nothing enabled.
+ *
+ * \note This MUST be called before enabling features or flags. Failure to do so
+ *       may result in a crash.
+ */
+int ast_bridge_features_init(struct ast_bridge_features *features);
+
+/*! \brief Clean up the contents of a bridge features structure
+ *
+ * \param features Bridge features structure
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * struct ast_bridge_features features;
+ * ast_bridge_features_init(&features);
+ * ast_bridge_features_cleanup(&features);
+ * \endcode
+ *
+ * This cleans up the feature structure 'features'.
+ *
+ * \note This MUST be called after the features structure is done being used
+ *       or a memory leak may occur.
+ */
+int ast_bridge_features_cleanup(struct ast_bridge_features *features);
+
+/*! \brief Play a DTMF stream into a bridge, optionally not to a given channel
+ *
+ * \param bridge Bridge to play stream into
+ * \param dtmf DTMF to play
+ * \param chan Channel to optionally not play to
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * ast_bridge_dtmf_stream(bridge, "0123456789", NULL);
+ * \endcode
+ *
+ * This sends the DTMF digits '0123456789' to all channels in the bridge pointed to
+ * by the bridge pointer. Optionally a channel may be excluded by passing it's channel pointer
+ * using the chan parameter.
+ */
+int ast_bridge_dtmf_stream(struct ast_bridge *bridge, const char *dtmf, struct ast_channel *chan);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* _ASTERISK_BRIDGING_FEATURES_H */

Propchange: team/file/bridging/include/asterisk/bridging_features.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/file/bridging/include/asterisk/bridging_features.h
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: team/file/bridging/include/asterisk/bridging_features.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list