Asterisk - The Open Source Telephony Project GIT-master-a358458
bridge_basic.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2013 Digium, Inc.
5 *
6 * Richard Mudgett <rmudgett@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*!
20 * \file
21 * \brief Basic bridge subclass API.
22 *
23 * \author Richard Mudgett <rmudgett@digium.com>
24 *
25 * See Also:
26 * \arg \ref AstCREDITS
27 */
28
29#ifndef _ASTERISK_BRIDGING_BASIC_H
30#define _ASTERISK_BRIDGING_BASIC_H
31
32#if defined(__cplusplus) || defined(c_plusplus)
33extern "C" {
34#endif
35
36#define AST_TRANSFERER_ROLE_NAME "transferer"
37/* ------------------------------------------------------------------- */
38
39/*!
40 * \brief Sets the features a channel will use upon being bridged.
41 * \since 12.0.0
42 *
43 * \param chan Which channel to set features for
44 * \param features Which feature codes to set for the channel
45 *
46 * \retval 0 on success
47 * \retval -1 on failure
48 */
49int ast_bridge_features_ds_set_string(struct ast_channel *chan, const char *features);
50
51/*!
52 * \brief writes a channel's DTMF features to a buffer string
53 * \since 12.0.0
54 *
55 * \param chan channel whose feature flags should be checked
56 * \param buffer pointer string buffer where the output should be stored
57 * \param buf_size size of the provided buffer (ideally enough for all features, 6+)
58 *
59 * \retval 0 on successful write
60 * \retval -1 on failure
61 */
62int ast_bridge_features_ds_get_string(struct ast_channel *chan, char *buffer, size_t buf_size);
63
64/*!
65 * \brief Get DTMF feature flags from the channel.
66 * \since 12.0.0
67 *
68 * \param chan Channel to get DTMF features datastore.
69 *
70 * \note The channel should be locked before calling this function.
71 * \note The channel must remain locked until the flags returned have been consumed.
72 *
73 * \return flags on success.
74 * \retval NULL if the datastore does not exist.
75 */
77
78/*!
79 * \brief Set basic bridge DTMF feature flags datastore on the channel.
80 * \since 12.0.0
81 *
82 * \param chan Channel to set DTMF features datastore.
83 * \param flags Builtin DTMF feature flags. (ast_bridge_config flags)
84 *
85 * \note The channel must be locked before calling this function.
86 *
87 * \retval 0 on success.
88 * \retval -1 on error.
89 */
90int ast_bridge_features_ds_set(struct ast_channel *chan, struct ast_flags *flags);
91
92/*!
93 * \brief Append basic bridge DTMF feature flags on the channel.
94 * \since 12.0.0
95 *
96 * \param chan Channel to append DTMF features datastore.
97 * \param flags Builtin DTMF feature flags. (ast_bridge_config flags)
98 *
99 * \note The channel must be locked before calling this function.
100 * \note This function differs from ast_bridge_features_ds_set only in that it won't
101 * remove features already set on the channel.
102 *
103 * \retval 0 on success.
104 * \retval -1 on error.
105 */
107
108/*! \brief Bridge basic class virtual method table. */
110
111/*!
112 * \brief Create a new basic class bridge
113 *
114 * \return a pointer to a new bridge on success
115 * \retval NULL on failure
116 *
117 * Example usage:
118 *
119 * \code
120 * struct ast_bridge *bridge;
121 * bridge = ast_bridge_basic_new();
122 * \endcode
123 *
124 * This creates a basic two party bridge with any configured
125 * DTMF features enabled that will be destroyed once one of the
126 * channels hangs up.
127 */
128struct ast_bridge *ast_bridge_basic_new(void);
129
130/*!
131 * \brief Set feature flags on a basic bridge
132 *
133 * Using this function instead of setting flags directly will
134 * ensure that after operations such as an attended transfer,
135 * the bridge will maintain the flags that were set on it.
136 *
137 * \param bridge
138 * \param flags These are added to the flags already set.
139 */
140void ast_bridge_basic_set_flags(struct ast_bridge *bridge, unsigned int flags);
141
142/*! Initialize the basic bridge class for use by the system. */
143void ast_bridging_init_basic(void);
144
145/* ------------------------------------------------------------------- */
146
147#if defined(__cplusplus) || defined(c_plusplus)
148}
149#endif
150
151#endif /* _ASTERISK_BRIDGING_BASIC_H */
struct ast_bridge_methods ast_bridge_basic_v_table
Bridge basic class virtual method table.
int ast_bridge_features_ds_get_string(struct ast_channel *chan, char *buffer, size_t buf_size)
writes a channel's DTMF features to a buffer string
Definition: bridge_basic.c:208
void ast_bridge_basic_set_flags(struct ast_bridge *bridge, unsigned int flags)
Set feature flags on a basic bridge.
void ast_bridging_init_basic(void)
struct ast_bridge * ast_bridge_basic_new(void)
Create a new basic class bridge.
int ast_bridge_features_ds_set_string(struct ast_channel *chan, const char *features)
Sets the features a channel will use upon being bridged.
Definition: bridge_basic.c:189
struct ast_flags * ast_bridge_features_ds_get(struct ast_channel *chan)
Get DTMF feature flags from the channel.
Definition: bridge_basic.c:268
int ast_bridge_features_ds_set(struct ast_channel *chan, struct ast_flags *flags)
Set basic bridge DTMF feature flags datastore on the channel.
Definition: bridge_basic.c:258
int ast_bridge_features_ds_append(struct ast_channel *chan, struct ast_flags *flags)
Append basic bridge DTMF feature flags on the channel.
Definition: bridge_basic.c:263
Bridge virtual methods table definition.
Definition: bridge.h:257
Structure that contains information about a bridge.
Definition: bridge.h:349
Main Channel structure associated with a channel.
Structure used to handle boolean flags.
Definition: utils.h:199
unsigned int flags
Definition: utils.h:200