2013-07-24 15:38:18 +00:00
|
|
|
/*
|
|
|
|
|
* Asterisk -- An open source telephony toolkit.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2013 Digium, Inc.
|
|
|
|
|
*
|
|
|
|
|
* Joshua Colp <jcolp@digium.com>
|
|
|
|
|
* Richard Mudgett <rmudgett@digium.com>
|
|
|
|
|
* Matt Jordan <mjordan@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
|
2013-07-25 02:20:23 +00:00
|
|
|
* \page AstBridgeChannel Bridging Channel API
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
2013-07-24 19:24:09 +00:00
|
|
|
* An API that act on a channel in a bridge. Note that while the
|
|
|
|
|
* \ref ast_bridge_channel is owned by a channel, it should only be used
|
|
|
|
|
* by members of the bridging system. The only places where this API should
|
|
|
|
|
* be used is:
|
2013-07-25 02:20:23 +00:00
|
|
|
* \arg \ref AstBridging API itself
|
|
|
|
|
* \arg Bridge mixing technologies
|
|
|
|
|
* \arg Bridge sub-classes
|
2013-07-24 19:24:09 +00:00
|
|
|
*
|
|
|
|
|
* In general, anywhere else it is unsafe to use this API. Care should be
|
|
|
|
|
* taken when using this API to ensure that the locking order remains
|
|
|
|
|
* correct. The locking order must be:
|
2013-07-25 02:20:23 +00:00
|
|
|
* \arg The \ref \c ast_bridge
|
|
|
|
|
* \arg The \ref \c ast_bridge_channel
|
|
|
|
|
* \arg The \ref \c ast_channel
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
|
|
|
|
* \author Joshua Colp <jcolp@digium.com>
|
|
|
|
|
* \author Richard Mudgett <rmudgett@digium.com>
|
|
|
|
|
* \author Matt Jordan <mjordan@digium.com>
|
|
|
|
|
*
|
|
|
|
|
* See Also:
|
2013-07-25 02:20:23 +00:00
|
|
|
* \arg \ref AstBridging
|
2013-07-24 15:38:18 +00:00
|
|
|
* \arg \ref AstCREDITS
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _ASTERISK_BRIDGING_CHANNEL_H
|
|
|
|
|
#define _ASTERISK_BRIDGING_CHANNEL_H
|
|
|
|
|
|
|
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-11-06 19:12:18 +00:00
|
|
|
#include "asterisk/bridge_features.h"
|
2013-07-25 04:06:32 +00:00
|
|
|
#include "asterisk/bridge_technology.h"
|
2013-07-24 15:38:18 +00:00
|
|
|
|
|
|
|
|
/*! \brief State information about a bridged channel */
|
2013-07-25 02:20:23 +00:00
|
|
|
enum bridge_channel_state {
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! Waiting for a signal (Channel in the bridge) */
|
2013-07-25 02:20:23 +00:00
|
|
|
BRIDGE_CHANNEL_STATE_WAIT = 0,
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! Bridged channel was forced out and should be hung up (Bridge may dissolve.) */
|
2013-07-25 02:20:23 +00:00
|
|
|
BRIDGE_CHANNEL_STATE_END,
|
2013-07-24 19:24:09 +00:00
|
|
|
/*! Bridged channel was forced out. Don't dissolve the bridge regardless */
|
2013-07-25 02:20:23 +00:00
|
|
|
BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE,
|
2013-07-24 15:38:18 +00:00
|
|
|
};
|
|
|
|
|
|
2013-07-25 02:20:23 +00:00
|
|
|
enum bridge_channel_thread_state {
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! Bridge channel thread is idle/waiting. */
|
2013-07-25 02:20:23 +00:00
|
|
|
BRIDGE_CHANNEL_THREAD_IDLE,
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! Bridge channel thread is writing a normal/simple frame. */
|
2013-07-25 02:20:23 +00:00
|
|
|
BRIDGE_CHANNEL_THREAD_SIMPLE,
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! Bridge channel thread is processing a frame. */
|
2013-07-25 02:20:23 +00:00
|
|
|
BRIDGE_CHANNEL_THREAD_FRAME,
|
2013-07-24 15:38:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ast_bridge;
|
|
|
|
|
struct ast_bridge_tech_optimizations;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Structure that contains information regarding a channel in a bridge
|
|
|
|
|
*/
|
|
|
|
|
struct ast_bridge_channel {
|
2013-08-15 18:20:52 +00:00
|
|
|
/* XXX ASTERISK-21271 cond is only here because of external party suspend/unsuspend support. */
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! Condition, used if we want to wake up a thread waiting on the bridged channel */
|
|
|
|
|
ast_cond_t cond;
|
|
|
|
|
/*! Current bridged channel state */
|
2013-07-25 02:20:23 +00:00
|
|
|
enum bridge_channel_state state;
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! Asterisk channel participating in the bridge */
|
|
|
|
|
struct ast_channel *chan;
|
|
|
|
|
/*! Asterisk channel we are swapping with (if swapping) */
|
|
|
|
|
struct ast_channel *swap;
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Bridge this channel is participating in
|
|
|
|
|
*
|
|
|
|
|
* \note The bridge pointer cannot change while the bridge or
|
|
|
|
|
* bridge_channel is locked.
|
|
|
|
|
*/
|
|
|
|
|
struct ast_bridge *bridge;
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Bridge class private channel data.
|
|
|
|
|
*
|
|
|
|
|
* \note This information is added when the channel is pushed
|
|
|
|
|
* into the bridge and removed when it is pulled from the
|
|
|
|
|
* bridge.
|
|
|
|
|
*/
|
|
|
|
|
void *bridge_pvt;
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Private information unique to the bridge technology.
|
|
|
|
|
*
|
|
|
|
|
* \note This information is added when the channel joins the
|
|
|
|
|
* bridge's technology and removed when it leaves the bridge's
|
|
|
|
|
* technology.
|
|
|
|
|
*/
|
|
|
|
|
void *tech_pvt;
|
|
|
|
|
/*! Thread handling the bridged channel (Needed by ast_bridge_depart) */
|
|
|
|
|
pthread_t thread;
|
|
|
|
|
/* v-- These flags change while the bridge is locked or before the channel is in the bridge. */
|
|
|
|
|
/*! TRUE if the channel is in a bridge. */
|
|
|
|
|
unsigned int in_bridge:1;
|
|
|
|
|
/*! TRUE if the channel just joined the bridge. */
|
|
|
|
|
unsigned int just_joined:1;
|
|
|
|
|
/*! TRUE if the channel is suspended from the bridge. */
|
|
|
|
|
unsigned int suspended:1;
|
2013-09-13 22:19:23 +00:00
|
|
|
/*! TRUE if the COLP update on initial join is inhibited. */
|
|
|
|
|
unsigned int inhibit_colp:1;
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! TRUE if the channel must wait for an ast_bridge_depart to reclaim the channel. */
|
|
|
|
|
unsigned int depart_wait:1;
|
|
|
|
|
/* ^-- These flags change while the bridge is locked or before the channel is in the bridge. */
|
|
|
|
|
/*! Features structure for features that are specific to this channel */
|
|
|
|
|
struct ast_bridge_features *features;
|
|
|
|
|
/*! Technology optimization parameters used by bridging technologies capable of
|
|
|
|
|
* optimizing based upon talk detection. */
|
|
|
|
|
struct ast_bridge_tech_optimizations tech_args;
|
|
|
|
|
/*! Copy of read format used by chan before join */
|
media formats: re-architect handling of media for performance improvements
In the old times media formats were represented using a bit field. This was
fast but had a few limitations.
1. Asterisk was limited in how many formats it could handle.
2. Formats, being a bit field, could not include any attribute information.
A format was strictly its type, e.g., "this is ulaw".
This was changed in Asterisk 10 (see
https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal for
notes on that work) which led to the creation of the ast_format structure.
This structure allowed Asterisk to handle attributes and bundle information
with a format.
Additionally, ast_format_cap was created to act as a container for multiple
formats that, together, formed the capability of some entity. Another
mechanism was added to allow logic to be registered which performed format
attribute negotiation. Everywhere throughout the codebase Asterisk was
changed to use this strategy.
Unfortunately, in software, there is no free lunch. These new capabilities
came at a cost.
Performance analysis and profiling showed that we spend an inordinate
amount of time comparing, copying, and generally manipulating formats and
their related structures. Basic prototyping has shown that a reasonably
large performance improvement could be made in this area. This patch is the
result of that project, which overhauled the media format architecture
and its usage in Asterisk to improve performance.
Generally, the new philosophy for handling formats is as follows:
* The ast_format structure is reference counted. This removed a large amount
of the memory allocations and copying that was done in prior versions.
* In order to prevent race conditions while keeping things performant, the
ast_format structure is immutable by convention and lock-free. Violate this
tenet at your peril!
* Because formats are reference counted, codecs are also reference counted.
The Asterisk core generally provides built-in codecs and caches the
ast_format structures created to represent them. Generally, to prevent
inordinate amounts of module reference bumping, codecs and formats can be
added at run-time but cannot be removed.
* All compatibility with the bit field representation of codecs/formats has
been moved to a compatibility API. The primary user of this representation
is chan_iax2, which must continue to maintain its bit-field usage of formats
for interoperability concerns.
* When a format is negotiated with attributes, or when a format cannot be
represented by one of the cached formats, a new format object is created or
cloned from an existing format. That format may have the same codec
underlying it, but is a different format than a version of the format with
different attributes or without attributes.
* While formats are reference counted objects, the reference count maintained
on the format should be manipulated with care. Formats are generally cached
and will persist for the lifetime of Asterisk and do not explicitly need
to have their lifetime modified. An exception to this is when the user of a
format does not know where the format came from *and* the user may outlive
the provider of the format. This occurs, for example, when a format is read
from a channel: the channel may have a format with attributes (hence,
non-cached) and the user of the format may last longer than the channel (if
the reference to the channel is released prior to the format's reference).
For more information on this work, see the API design notes:
https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite
Finally, this work was the culmination of a large number of developer's
efforts. Extra thanks goes to Corey Farrell, who took on a large amount of the
work in the Asterisk core, chan_sip, and was an invaluable resource in peer
reviews throughout this project.
There were a substantial number of patches contributed during this work; the
following issues/patch names simply reflect some of the work (and will cause
the release scripts to give attribution to the individuals who work on them).
Reviews:
https://reviewboard.asterisk.org/r/3814
https://reviewboard.asterisk.org/r/3808
https://reviewboard.asterisk.org/r/3805
https://reviewboard.asterisk.org/r/3803
https://reviewboard.asterisk.org/r/3801
https://reviewboard.asterisk.org/r/3798
https://reviewboard.asterisk.org/r/3800
https://reviewboard.asterisk.org/r/3794
https://reviewboard.asterisk.org/r/3793
https://reviewboard.asterisk.org/r/3792
https://reviewboard.asterisk.org/r/3791
https://reviewboard.asterisk.org/r/3790
https://reviewboard.asterisk.org/r/3789
https://reviewboard.asterisk.org/r/3788
https://reviewboard.asterisk.org/r/3787
https://reviewboard.asterisk.org/r/3786
https://reviewboard.asterisk.org/r/3784
https://reviewboard.asterisk.org/r/3783
https://reviewboard.asterisk.org/r/3778
https://reviewboard.asterisk.org/r/3774
https://reviewboard.asterisk.org/r/3775
https://reviewboard.asterisk.org/r/3772
https://reviewboard.asterisk.org/r/3761
https://reviewboard.asterisk.org/r/3754
https://reviewboard.asterisk.org/r/3753
https://reviewboard.asterisk.org/r/3751
https://reviewboard.asterisk.org/r/3750
https://reviewboard.asterisk.org/r/3748
https://reviewboard.asterisk.org/r/3747
https://reviewboard.asterisk.org/r/3746
https://reviewboard.asterisk.org/r/3742
https://reviewboard.asterisk.org/r/3740
https://reviewboard.asterisk.org/r/3739
https://reviewboard.asterisk.org/r/3738
https://reviewboard.asterisk.org/r/3737
https://reviewboard.asterisk.org/r/3736
https://reviewboard.asterisk.org/r/3734
https://reviewboard.asterisk.org/r/3722
https://reviewboard.asterisk.org/r/3713
https://reviewboard.asterisk.org/r/3703
https://reviewboard.asterisk.org/r/3689
https://reviewboard.asterisk.org/r/3687
https://reviewboard.asterisk.org/r/3674
https://reviewboard.asterisk.org/r/3671
https://reviewboard.asterisk.org/r/3667
https://reviewboard.asterisk.org/r/3665
https://reviewboard.asterisk.org/r/3625
https://reviewboard.asterisk.org/r/3602
https://reviewboard.asterisk.org/r/3519
https://reviewboard.asterisk.org/r/3518
https://reviewboard.asterisk.org/r/3516
https://reviewboard.asterisk.org/r/3515
https://reviewboard.asterisk.org/r/3512
https://reviewboard.asterisk.org/r/3506
https://reviewboard.asterisk.org/r/3413
https://reviewboard.asterisk.org/r/3410
https://reviewboard.asterisk.org/r/3387
https://reviewboard.asterisk.org/r/3388
https://reviewboard.asterisk.org/r/3389
https://reviewboard.asterisk.org/r/3390
https://reviewboard.asterisk.org/r/3321
https://reviewboard.asterisk.org/r/3320
https://reviewboard.asterisk.org/r/3319
https://reviewboard.asterisk.org/r/3318
https://reviewboard.asterisk.org/r/3266
https://reviewboard.asterisk.org/r/3265
https://reviewboard.asterisk.org/r/3234
https://reviewboard.asterisk.org/r/3178
ASTERISK-23114 #close
Reported by: mjordan
media_formats_translation_core.diff uploaded by kharwell (License 6464)
rb3506.diff uploaded by mjordan (License 6283)
media_format_app_file.diff uploaded by kharwell (License 6464)
misc-2.diff uploaded by file (License 5000)
chan_mild-3.diff uploaded by file (License 5000)
chan_obscure.diff uploaded by file (License 5000)
jingle.diff uploaded by file (License 5000)
funcs.diff uploaded by file (License 5000)
formats.diff uploaded by file (License 5000)
core.diff uploaded by file (License 5000)
bridges.diff uploaded by file (License 5000)
mf-codecs-2.diff uploaded by file (License 5000)
mf-app_fax.diff uploaded by file (License 5000)
mf-apps-3.diff uploaded by file (License 5000)
media-formats-3.diff uploaded by file (License 5000)
ASTERISK-23715
rb3713.patch uploaded by coreyfarrell (License 5909)
rb3689.patch uploaded by mjordan (License 6283)
ASTERISK-23957
rb3722.patch uploaded by mjordan (License 6283)
mf-attributes-3.diff uploaded by file (License 5000)
ASTERISK-23958
Tested by: jrose
rb3822.patch uploaded by coreyfarrell (License 5909)
rb3800.patch uploaded by jrose (License 6182)
chan_sip.diff uploaded by mjordan (License 6283)
rb3747.patch uploaded by jrose (License 6182)
ASTERISK-23959 #close
Tested by: sgriepentrog, mjordan, coreyfarrell
sip_cleanup.diff uploaded by opticron (License 6273)
chan_sip_caps.diff uploaded by mjordan (License 6283)
rb3751.patch uploaded by coreyfarrell (License 5909)
chan_sip-3.diff uploaded by file (License 5000)
ASTERISK-23960 #close
Tested by: opticron
direct_media.diff uploaded by opticron (License 6273)
pjsip-direct-media.diff uploaded by file (License 5000)
format_cap_remove.diff uploaded by opticron (License 6273)
media_format_fixes.diff uploaded by opticron (License 6273)
chan_pjsip-2.diff uploaded by file (License 5000)
ASTERISK-23966 #close
Tested by: rmudgett
rb3803.patch uploaded by rmudgetti (License 5621)
chan_dahdi.diff uploaded by file (License 5000)
ASTERISK-24064 #close
Tested by: coreyfarrell, mjordan, opticron, file, rmudgett, sgriepentrog, jrose
rb3814.patch uploaded by rmudgett (License 5621)
moh_cleanup.diff uploaded by opticron (License 6273)
bridge_leak.diff uploaded by opticron (License 6273)
translate.diff uploaded by file (License 5000)
rb3795.patch uploaded by rmudgett (License 5621)
tls_fix.diff uploaded by mjordan (License 6283)
fax-mf-fix-2.diff uploaded by file (License 5000)
rtp_transfer_stuff uploaded by mjordan (License 6283)
rb3787.patch uploaded by rmudgett (License 5621)
media-formats-explicit-translate-format-3.diff uploaded by file (License 5000)
format_cache_case_fix.diff uploaded by opticron (License 6273)
rb3774.patch uploaded by rmudgett (License 5621)
rb3775.patch uploaded by rmudgett (License 5621)
rtp_engine_fix.diff uploaded by opticron (License 6273)
rtp_crash_fix.diff uploaded by opticron (License 6273)
rb3753.patch uploaded by mjordan (License 6283)
rb3750.patch uploaded by mjordan (License 6283)
rb3748.patch uploaded by rmudgett (License 5621)
media_format_fixes.diff uploaded by opticron (License 6273)
rb3740.patch uploaded by mjordan (License 6283)
rb3739.patch uploaded by mjordan (License 6283)
rb3734.patch uploaded by mjordan (License 6283)
rb3689.patch uploaded by mjordan (License 6283)
rb3674.patch uploaded by coreyfarrell (License 5909)
rb3671.patch uploaded by coreyfarrell (License 5909)
rb3667.patch uploaded by coreyfarrell (License 5909)
rb3665.patch uploaded by mjordan (License 6283)
rb3625.patch uploaded by coreyfarrell (License 5909)
rb3602.patch uploaded by coreyfarrell (License 5909)
format_compatibility-2.diff uploaded by file (License 5000)
core.diff uploaded by file (License 5000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-20 22:06:33 +00:00
|
|
|
struct ast_format *read_format;
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! Copy of write format used by chan before join */
|
media formats: re-architect handling of media for performance improvements
In the old times media formats were represented using a bit field. This was
fast but had a few limitations.
1. Asterisk was limited in how many formats it could handle.
2. Formats, being a bit field, could not include any attribute information.
A format was strictly its type, e.g., "this is ulaw".
This was changed in Asterisk 10 (see
https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal for
notes on that work) which led to the creation of the ast_format structure.
This structure allowed Asterisk to handle attributes and bundle information
with a format.
Additionally, ast_format_cap was created to act as a container for multiple
formats that, together, formed the capability of some entity. Another
mechanism was added to allow logic to be registered which performed format
attribute negotiation. Everywhere throughout the codebase Asterisk was
changed to use this strategy.
Unfortunately, in software, there is no free lunch. These new capabilities
came at a cost.
Performance analysis and profiling showed that we spend an inordinate
amount of time comparing, copying, and generally manipulating formats and
their related structures. Basic prototyping has shown that a reasonably
large performance improvement could be made in this area. This patch is the
result of that project, which overhauled the media format architecture
and its usage in Asterisk to improve performance.
Generally, the new philosophy for handling formats is as follows:
* The ast_format structure is reference counted. This removed a large amount
of the memory allocations and copying that was done in prior versions.
* In order to prevent race conditions while keeping things performant, the
ast_format structure is immutable by convention and lock-free. Violate this
tenet at your peril!
* Because formats are reference counted, codecs are also reference counted.
The Asterisk core generally provides built-in codecs and caches the
ast_format structures created to represent them. Generally, to prevent
inordinate amounts of module reference bumping, codecs and formats can be
added at run-time but cannot be removed.
* All compatibility with the bit field representation of codecs/formats has
been moved to a compatibility API. The primary user of this representation
is chan_iax2, which must continue to maintain its bit-field usage of formats
for interoperability concerns.
* When a format is negotiated with attributes, or when a format cannot be
represented by one of the cached formats, a new format object is created or
cloned from an existing format. That format may have the same codec
underlying it, but is a different format than a version of the format with
different attributes or without attributes.
* While formats are reference counted objects, the reference count maintained
on the format should be manipulated with care. Formats are generally cached
and will persist for the lifetime of Asterisk and do not explicitly need
to have their lifetime modified. An exception to this is when the user of a
format does not know where the format came from *and* the user may outlive
the provider of the format. This occurs, for example, when a format is read
from a channel: the channel may have a format with attributes (hence,
non-cached) and the user of the format may last longer than the channel (if
the reference to the channel is released prior to the format's reference).
For more information on this work, see the API design notes:
https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite
Finally, this work was the culmination of a large number of developer's
efforts. Extra thanks goes to Corey Farrell, who took on a large amount of the
work in the Asterisk core, chan_sip, and was an invaluable resource in peer
reviews throughout this project.
There were a substantial number of patches contributed during this work; the
following issues/patch names simply reflect some of the work (and will cause
the release scripts to give attribution to the individuals who work on them).
Reviews:
https://reviewboard.asterisk.org/r/3814
https://reviewboard.asterisk.org/r/3808
https://reviewboard.asterisk.org/r/3805
https://reviewboard.asterisk.org/r/3803
https://reviewboard.asterisk.org/r/3801
https://reviewboard.asterisk.org/r/3798
https://reviewboard.asterisk.org/r/3800
https://reviewboard.asterisk.org/r/3794
https://reviewboard.asterisk.org/r/3793
https://reviewboard.asterisk.org/r/3792
https://reviewboard.asterisk.org/r/3791
https://reviewboard.asterisk.org/r/3790
https://reviewboard.asterisk.org/r/3789
https://reviewboard.asterisk.org/r/3788
https://reviewboard.asterisk.org/r/3787
https://reviewboard.asterisk.org/r/3786
https://reviewboard.asterisk.org/r/3784
https://reviewboard.asterisk.org/r/3783
https://reviewboard.asterisk.org/r/3778
https://reviewboard.asterisk.org/r/3774
https://reviewboard.asterisk.org/r/3775
https://reviewboard.asterisk.org/r/3772
https://reviewboard.asterisk.org/r/3761
https://reviewboard.asterisk.org/r/3754
https://reviewboard.asterisk.org/r/3753
https://reviewboard.asterisk.org/r/3751
https://reviewboard.asterisk.org/r/3750
https://reviewboard.asterisk.org/r/3748
https://reviewboard.asterisk.org/r/3747
https://reviewboard.asterisk.org/r/3746
https://reviewboard.asterisk.org/r/3742
https://reviewboard.asterisk.org/r/3740
https://reviewboard.asterisk.org/r/3739
https://reviewboard.asterisk.org/r/3738
https://reviewboard.asterisk.org/r/3737
https://reviewboard.asterisk.org/r/3736
https://reviewboard.asterisk.org/r/3734
https://reviewboard.asterisk.org/r/3722
https://reviewboard.asterisk.org/r/3713
https://reviewboard.asterisk.org/r/3703
https://reviewboard.asterisk.org/r/3689
https://reviewboard.asterisk.org/r/3687
https://reviewboard.asterisk.org/r/3674
https://reviewboard.asterisk.org/r/3671
https://reviewboard.asterisk.org/r/3667
https://reviewboard.asterisk.org/r/3665
https://reviewboard.asterisk.org/r/3625
https://reviewboard.asterisk.org/r/3602
https://reviewboard.asterisk.org/r/3519
https://reviewboard.asterisk.org/r/3518
https://reviewboard.asterisk.org/r/3516
https://reviewboard.asterisk.org/r/3515
https://reviewboard.asterisk.org/r/3512
https://reviewboard.asterisk.org/r/3506
https://reviewboard.asterisk.org/r/3413
https://reviewboard.asterisk.org/r/3410
https://reviewboard.asterisk.org/r/3387
https://reviewboard.asterisk.org/r/3388
https://reviewboard.asterisk.org/r/3389
https://reviewboard.asterisk.org/r/3390
https://reviewboard.asterisk.org/r/3321
https://reviewboard.asterisk.org/r/3320
https://reviewboard.asterisk.org/r/3319
https://reviewboard.asterisk.org/r/3318
https://reviewboard.asterisk.org/r/3266
https://reviewboard.asterisk.org/r/3265
https://reviewboard.asterisk.org/r/3234
https://reviewboard.asterisk.org/r/3178
ASTERISK-23114 #close
Reported by: mjordan
media_formats_translation_core.diff uploaded by kharwell (License 6464)
rb3506.diff uploaded by mjordan (License 6283)
media_format_app_file.diff uploaded by kharwell (License 6464)
misc-2.diff uploaded by file (License 5000)
chan_mild-3.diff uploaded by file (License 5000)
chan_obscure.diff uploaded by file (License 5000)
jingle.diff uploaded by file (License 5000)
funcs.diff uploaded by file (License 5000)
formats.diff uploaded by file (License 5000)
core.diff uploaded by file (License 5000)
bridges.diff uploaded by file (License 5000)
mf-codecs-2.diff uploaded by file (License 5000)
mf-app_fax.diff uploaded by file (License 5000)
mf-apps-3.diff uploaded by file (License 5000)
media-formats-3.diff uploaded by file (License 5000)
ASTERISK-23715
rb3713.patch uploaded by coreyfarrell (License 5909)
rb3689.patch uploaded by mjordan (License 6283)
ASTERISK-23957
rb3722.patch uploaded by mjordan (License 6283)
mf-attributes-3.diff uploaded by file (License 5000)
ASTERISK-23958
Tested by: jrose
rb3822.patch uploaded by coreyfarrell (License 5909)
rb3800.patch uploaded by jrose (License 6182)
chan_sip.diff uploaded by mjordan (License 6283)
rb3747.patch uploaded by jrose (License 6182)
ASTERISK-23959 #close
Tested by: sgriepentrog, mjordan, coreyfarrell
sip_cleanup.diff uploaded by opticron (License 6273)
chan_sip_caps.diff uploaded by mjordan (License 6283)
rb3751.patch uploaded by coreyfarrell (License 5909)
chan_sip-3.diff uploaded by file (License 5000)
ASTERISK-23960 #close
Tested by: opticron
direct_media.diff uploaded by opticron (License 6273)
pjsip-direct-media.diff uploaded by file (License 5000)
format_cap_remove.diff uploaded by opticron (License 6273)
media_format_fixes.diff uploaded by opticron (License 6273)
chan_pjsip-2.diff uploaded by file (License 5000)
ASTERISK-23966 #close
Tested by: rmudgett
rb3803.patch uploaded by rmudgetti (License 5621)
chan_dahdi.diff uploaded by file (License 5000)
ASTERISK-24064 #close
Tested by: coreyfarrell, mjordan, opticron, file, rmudgett, sgriepentrog, jrose
rb3814.patch uploaded by rmudgett (License 5621)
moh_cleanup.diff uploaded by opticron (License 6273)
bridge_leak.diff uploaded by opticron (License 6273)
translate.diff uploaded by file (License 5000)
rb3795.patch uploaded by rmudgett (License 5621)
tls_fix.diff uploaded by mjordan (License 6283)
fax-mf-fix-2.diff uploaded by file (License 5000)
rtp_transfer_stuff uploaded by mjordan (License 6283)
rb3787.patch uploaded by rmudgett (License 5621)
media-formats-explicit-translate-format-3.diff uploaded by file (License 5000)
format_cache_case_fix.diff uploaded by opticron (License 6273)
rb3774.patch uploaded by rmudgett (License 5621)
rb3775.patch uploaded by rmudgett (License 5621)
rtp_engine_fix.diff uploaded by opticron (License 6273)
rtp_crash_fix.diff uploaded by opticron (License 6273)
rb3753.patch uploaded by mjordan (License 6283)
rb3750.patch uploaded by mjordan (License 6283)
rb3748.patch uploaded by rmudgett (License 5621)
media_format_fixes.diff uploaded by opticron (License 6273)
rb3740.patch uploaded by mjordan (License 6283)
rb3739.patch uploaded by mjordan (License 6283)
rb3734.patch uploaded by mjordan (License 6283)
rb3689.patch uploaded by mjordan (License 6283)
rb3674.patch uploaded by coreyfarrell (License 5909)
rb3671.patch uploaded by coreyfarrell (License 5909)
rb3667.patch uploaded by coreyfarrell (License 5909)
rb3665.patch uploaded by mjordan (License 6283)
rb3625.patch uploaded by coreyfarrell (License 5909)
rb3602.patch uploaded by coreyfarrell (License 5909)
format_compatibility-2.diff uploaded by file (License 5000)
core.diff uploaded by file (License 5000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-20 22:06:33 +00:00
|
|
|
struct ast_format *write_format;
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! Call ID associated with bridge channel */
|
2015-03-13 01:12:35 +00:00
|
|
|
ast_callid callid;
|
2013-07-24 15:38:18 +00:00
|
|
|
/*! A clone of the roles living on chan when the bridge channel joins the bridge. This may require some opacification */
|
|
|
|
|
struct bridge_roles_datastore *bridge_roles;
|
|
|
|
|
/*! Linked list information */
|
|
|
|
|
AST_LIST_ENTRY(ast_bridge_channel) entry;
|
|
|
|
|
/*! Queue of outgoing frames to the channel. */
|
|
|
|
|
AST_LIST_HEAD_NOLOCK(, ast_frame) wr_queue;
|
|
|
|
|
/*! Pipe to alert thread when frames are put into the wr_queue. */
|
|
|
|
|
int alert_pipe[2];
|
|
|
|
|
/*!
|
|
|
|
|
* \brief The bridge channel thread activity.
|
|
|
|
|
*
|
|
|
|
|
* \details Used by local channel optimization to determine if
|
|
|
|
|
* the thread is in an acceptable state to optimize.
|
|
|
|
|
*
|
|
|
|
|
* \note Needs to be atomically settable.
|
|
|
|
|
*/
|
2013-07-25 02:20:23 +00:00
|
|
|
enum bridge_channel_thread_state activity;
|
2013-08-23 18:33:36 +00:00
|
|
|
/*! Owed events to the bridge. */
|
|
|
|
|
struct {
|
|
|
|
|
/*! Time started sending the current digit. (Invalid if owed.dtmf_digit is zero.) */
|
|
|
|
|
struct timeval dtmf_tv;
|
|
|
|
|
/*! Digit currently sending into the bridge. (zero if not sending) */
|
|
|
|
|
char dtmf_digit;
|
2016-02-22 13:54:47 -06:00
|
|
|
/*! Non-zero if a T.38 session terminate is owed to the bridge. */
|
|
|
|
|
char t38_terminate;
|
2013-08-23 18:33:36 +00:00
|
|
|
} owed;
|
2014-11-06 19:12:18 +00:00
|
|
|
/*! DTMF hook sequence state */
|
|
|
|
|
struct {
|
|
|
|
|
/*! Time at which the DTMF hooks should stop waiting for more digits to come. */
|
|
|
|
|
struct timeval interdigit_timeout;
|
|
|
|
|
/*! Collected DTMF digits for DTMF hooks. */
|
|
|
|
|
char collected[MAXIMUM_DTMF_FEATURE_STRING];
|
|
|
|
|
} dtmf_hook_state;
|
2016-08-12 18:23:18 +02:00
|
|
|
union {
|
|
|
|
|
uint32_t raw;
|
|
|
|
|
struct {
|
|
|
|
|
/*! TRUE if binaural is suspended. */
|
|
|
|
|
unsigned int binaural_suspended:1;
|
|
|
|
|
/*! TRUE if a change of binaural positions has to be performed. */
|
|
|
|
|
unsigned int binaural_pos_change:1;
|
|
|
|
|
/*! Padding */
|
|
|
|
|
unsigned int padding:30;
|
|
|
|
|
};
|
|
|
|
|
};
|
2017-04-25 11:49:16 -05:00
|
|
|
struct {
|
|
|
|
|
/*! An index mapping of where a channel's media needs to be routed */
|
|
|
|
|
struct ast_vector_int to_bridge;
|
|
|
|
|
/*! An index mapping of where a bridge's media needs to be routed */
|
|
|
|
|
struct ast_vector_int to_channel;
|
|
|
|
|
} stream_map;
|
2013-07-24 15:38:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Try locking the bridge_channel.
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel What to try locking
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval non-zero on error.
|
|
|
|
|
*/
|
|
|
|
|
#define ast_bridge_channel_trylock(bridge_channel) _ast_bridge_channel_trylock(bridge_channel, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge_channel)
|
|
|
|
|
static inline int _ast_bridge_channel_trylock(struct ast_bridge_channel *bridge_channel, const char *file, const char *function, int line, const char *var)
|
|
|
|
|
{
|
|
|
|
|
return __ao2_trylock(bridge_channel, AO2_LOCK_REQ_MUTEX, file, function, line, var);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Lock the bridge_channel.
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel What to lock
|
|
|
|
|
*
|
|
|
|
|
* \return Nothing
|
|
|
|
|
*/
|
|
|
|
|
#define ast_bridge_channel_lock(bridge_channel) _ast_bridge_channel_lock(bridge_channel, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge_channel)
|
|
|
|
|
static inline void _ast_bridge_channel_lock(struct ast_bridge_channel *bridge_channel, const char *file, const char *function, int line, const char *var)
|
|
|
|
|
{
|
|
|
|
|
__ao2_lock(bridge_channel, AO2_LOCK_REQ_MUTEX, file, function, line, var);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Unlock the bridge_channel.
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel What to unlock
|
|
|
|
|
*
|
|
|
|
|
* \return Nothing
|
|
|
|
|
*/
|
|
|
|
|
#define ast_bridge_channel_unlock(bridge_channel) _ast_bridge_channel_unlock(bridge_channel, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge_channel)
|
|
|
|
|
static inline void _ast_bridge_channel_unlock(struct ast_bridge_channel *bridge_channel, const char *file, const char *function, int line, const char *var)
|
|
|
|
|
{
|
|
|
|
|
__ao2_unlock(bridge_channel, file, function, line, var);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Lock the bridge associated with the bridge channel.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Channel that wants to lock the bridge.
|
|
|
|
|
*
|
|
|
|
|
* \details
|
|
|
|
|
* This is an upstream lock operation. The defined locking
|
|
|
|
|
* order is bridge then bridge_channel.
|
|
|
|
|
*
|
|
|
|
|
* \note On entry, neither the bridge nor bridge_channel is locked.
|
|
|
|
|
*
|
|
|
|
|
* \note The bridge_channel->bridge pointer changes because of a
|
|
|
|
|
* bridge-merge/channel-move operation between bridges.
|
|
|
|
|
*
|
|
|
|
|
* \return Nothing
|
|
|
|
|
*/
|
|
|
|
|
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel);
|
|
|
|
|
|
2013-07-25 02:20:23 +00:00
|
|
|
/*!
|
|
|
|
|
* \brief Lets the bridging indicate when a bridge channel has stopped or started talking.
|
|
|
|
|
*
|
|
|
|
|
* \note All DSP functionality on the bridge has been pushed down to the lowest possible
|
|
|
|
|
* layer, which in this case is the specific bridging technology being used. Since it
|
|
|
|
|
* is necessary for the knowledge of which channels are talking to make its way up to the
|
|
|
|
|
* application, this function has been created to allow the bridging technology to communicate
|
|
|
|
|
* that information with the bridging core.
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel The bridge channel that has either started or stopped talking.
|
|
|
|
|
* \param started_talking set to 1 when this indicates the channel has started talking set to 0
|
|
|
|
|
* when this indicates the channel has stopped talking.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_notify_talking(struct ast_bridge_channel *bridge_channel, int started_talking);
|
|
|
|
|
|
2013-07-24 15:38:18 +00:00
|
|
|
/*!
|
2013-07-24 19:24:09 +00:00
|
|
|
* \brief Set bridge channel state to leave bridge (if not leaving already).
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
2013-07-24 19:24:09 +00:00
|
|
|
* \param bridge_channel Channel to change the state on
|
|
|
|
|
* \param new_state The new state to place the channel into
|
2013-08-22 21:09:52 +00:00
|
|
|
* \param cause Cause of channel leaving bridge.
|
|
|
|
|
* If cause <= 0 then use cause on channel if cause still <= 0 use AST_CAUSE_NORMAL_CLEARING.
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
2013-07-24 19:24:09 +00:00
|
|
|
* Example usage:
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
2013-07-24 19:24:09 +00:00
|
|
|
* \code
|
2013-08-22 21:09:52 +00:00
|
|
|
* ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END, AST_CAUSE_NORMAL_CLEARING);
|
2013-07-24 19:24:09 +00:00
|
|
|
* \endcode
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
2013-07-24 19:24:09 +00:00
|
|
|
* This places the channel pointed to by bridge_channel into the
|
2013-07-25 02:20:23 +00:00
|
|
|
* state BRIDGE_CHANNEL_STATE_END if it was
|
|
|
|
|
* BRIDGE_CHANNEL_STATE_WAIT before.
|
2013-07-24 15:38:18 +00:00
|
|
|
*/
|
2013-08-22 21:09:52 +00:00
|
|
|
void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause);
|
2013-07-24 15:38:18 +00:00
|
|
|
|
|
|
|
|
/*!
|
2013-07-24 19:24:09 +00:00
|
|
|
* \brief Set bridge channel state to leave bridge (if not leaving already).
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
2013-07-24 19:24:09 +00:00
|
|
|
* \param bridge_channel Channel to change the state on
|
|
|
|
|
* \param new_state The new state to place the channel into
|
2013-08-22 21:09:52 +00:00
|
|
|
* \param cause Cause of channel leaving bridge.
|
|
|
|
|
* If cause <= 0 then use cause on channel if cause still <= 0 use AST_CAUSE_NORMAL_CLEARING.
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
2013-07-24 19:24:09 +00:00
|
|
|
* Example usage:
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
2013-07-24 19:24:09 +00:00
|
|
|
* \code
|
2013-08-22 21:09:52 +00:00
|
|
|
* ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END, AST_CAUSE_NORMAL_CLEARING);
|
2013-07-24 19:24:09 +00:00
|
|
|
* \endcode
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
2013-07-24 19:24:09 +00:00
|
|
|
* This places the channel pointed to by bridge_channel into the
|
2013-07-25 02:20:23 +00:00
|
|
|
* state BRIDGE_CHANNEL_STATE_END if it was
|
|
|
|
|
* BRIDGE_CHANNEL_STATE_WAIT before.
|
|
|
|
|
*/
|
2013-08-22 21:09:52 +00:00
|
|
|
void ast_bridge_channel_leave_bridge_nolock(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause);
|
2013-07-25 02:20:23 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Get the peer bridge channel of a two party bridge.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel What to get the peer of.
|
|
|
|
|
*
|
|
|
|
|
* \note On entry, bridge_channel->bridge is already locked.
|
|
|
|
|
*
|
|
|
|
|
* \note This is an internal bridge function.
|
|
|
|
|
*
|
|
|
|
|
* \retval peer on success.
|
|
|
|
|
* \retval NULL no peer channel.
|
|
|
|
|
*/
|
|
|
|
|
struct ast_bridge_channel *ast_bridge_channel_peer(struct ast_bridge_channel *bridge_channel);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Restore the formats of a bridge channel's channel to how they were before bridge_channel_internal_join
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Channel to restore
|
|
|
|
|
*/
|
|
|
|
|
void ast_bridge_channel_restore_formats(struct ast_bridge_channel *bridge_channel);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Adjust the bridge_channel's bridge merge inhibit request count.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel What to operate on.
|
|
|
|
|
* \param request Inhibit request increment.
|
|
|
|
|
* (Positive to add requests. Negative to remove requests.)
|
|
|
|
|
*
|
|
|
|
|
* \note This API call is meant for internal bridging operations.
|
|
|
|
|
*
|
|
|
|
|
* \retval bridge adjusted merge inhibit with reference count.
|
|
|
|
|
*/
|
|
|
|
|
struct ast_bridge *ast_bridge_channel_merge_inhibit(struct ast_bridge_channel *bridge_channel, int request);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \internal
|
|
|
|
|
* \brief Update the linkedids for all channels in a bridge
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel The channel joining the bridge
|
|
|
|
|
* \param swap The channel being swapped out of the bridge. May be NULL.
|
|
|
|
|
*
|
2014-07-09 16:34:51 +00:00
|
|
|
* \note The bridge must be locked prior to calling this function.
|
|
|
|
|
* \note This should be called during a \ref bridge_channel_internal_push
|
|
|
|
|
* operation, typically by a sub-class of a bridge.
|
2013-07-25 02:20:23 +00:00
|
|
|
*/
|
|
|
|
|
void ast_bridge_channel_update_linkedids(struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \internal
|
2014-07-09 16:34:51 +00:00
|
|
|
* \brief Update the accountcodes for channels joining/leaving a bridge
|
2013-07-25 02:20:23 +00:00
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* This function updates the accountcode and peeraccount on channels in two-party
|
|
|
|
|
* bridges. In multi-party bridges, peeraccount is not set - it doesn't make much sense -
|
|
|
|
|
* however accountcode propagation will still occur if the channel joining has an
|
|
|
|
|
* accountcode.
|
|
|
|
|
*
|
2014-07-09 16:34:51 +00:00
|
|
|
* \param joining The channel joining the bridge. May be NULL.
|
|
|
|
|
* \param leaving The channel leaving or being swapped out of the bridge. May be NULL.
|
|
|
|
|
*
|
|
|
|
|
* \note The joining and leaving parameters cannot both be NULL.
|
2013-07-25 02:20:23 +00:00
|
|
|
*
|
2014-07-09 16:34:51 +00:00
|
|
|
* \note The bridge must be locked prior to calling this function.
|
|
|
|
|
* \note This should be called during a \ref bridge_channel_internal_push
|
|
|
|
|
* or \ref bridge_channel_internal_pull operation, typically by a
|
|
|
|
|
* sub-class of a bridge.
|
2013-07-24 15:38:18 +00:00
|
|
|
*/
|
2014-07-09 16:34:51 +00:00
|
|
|
void ast_bridge_channel_update_accountcodes(struct ast_bridge_channel *joining, struct ast_bridge_channel *leaving);
|
2013-07-24 15:38:18 +00:00
|
|
|
|
|
|
|
|
/*!
|
2013-07-24 19:24:09 +00:00
|
|
|
* \brief Write a frame to the specified bridge_channel.
|
2013-07-24 15:38:18 +00:00
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
2013-07-24 19:24:09 +00:00
|
|
|
* \param bridge_channel Channel to queue the frame.
|
|
|
|
|
* \param fr Frame to write.
|
2013-07-24 15:38:18 +00:00
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
2013-07-24 19:24:09 +00:00
|
|
|
int ast_bridge_channel_queue_frame(struct ast_bridge_channel *bridge_channel, struct ast_frame *fr);
|
2013-07-24 15:38:18 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Queue a control frame onto the bridge channel with data.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel to queue the frame onto.
|
|
|
|
|
* \param control Type of control frame.
|
|
|
|
|
* \param data Frame payload data to pass.
|
|
|
|
|
* \param datalen Frame payload data length to pass.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_queue_control_data(struct ast_bridge_channel *bridge_channel, enum ast_control_frame_type control, const void *data, size_t datalen);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Write a control frame into the bridge with data.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel is putting the frame into the bridge.
|
|
|
|
|
* \param control Type of control frame.
|
|
|
|
|
* \param data Frame payload data to pass.
|
|
|
|
|
* \param datalen Frame payload data length to pass.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_write_control_data(struct ast_bridge_channel *bridge_channel, enum ast_control_frame_type control, const void *data, size_t datalen);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Write a hold frame into the bridge.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel is putting the hold into the bridge.
|
|
|
|
|
* \param moh_class The suggested music class for the other end to use.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_write_hold(struct ast_bridge_channel *bridge_channel, const char *moh_class);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Write an unhold frame into the bridge.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel is putting the hold into the bridge.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_write_unhold(struct ast_bridge_channel *bridge_channel);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Run an application on the bridge channel.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel to run the application on.
|
|
|
|
|
* \param app_name Dialplan application name.
|
|
|
|
|
* \param app_args Arguments for the application. (NULL tolerant)
|
|
|
|
|
* \param moh_class MOH class to request bridge peers to hear while application is running.
|
|
|
|
|
* NULL if no MOH.
|
|
|
|
|
* Empty if default MOH class.
|
|
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks.
|
|
|
|
|
*
|
|
|
|
|
* \return Nothing
|
|
|
|
|
*/
|
|
|
|
|
void ast_bridge_channel_run_app(struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Write a bridge action run application frame into the bridge.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel is putting the frame into the bridge
|
|
|
|
|
* \param app_name Dialplan application name.
|
|
|
|
|
* \param app_args Arguments for the application. (NULL or empty for no arguments)
|
|
|
|
|
* \param moh_class MOH class to request bridge peers to hear while application is running.
|
|
|
|
|
* NULL if no MOH.
|
|
|
|
|
* Empty if default MOH class.
|
|
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_write_app(struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Queue a bridge action run application frame onto the bridge channel.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel to put the frame onto
|
|
|
|
|
* \param app_name Dialplan application name.
|
|
|
|
|
* \param app_args Arguments for the application. (NULL or empty for no arguments)
|
|
|
|
|
* \param moh_class MOH class to request bridge peers to hear while application is running.
|
|
|
|
|
* NULL if no MOH.
|
|
|
|
|
* Empty if default MOH class.
|
|
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_queue_app(struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Custom interpretation of the playfile name.
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel to play the file on
|
|
|
|
|
* \param playfile Sound filename to play.
|
|
|
|
|
*
|
|
|
|
|
* \return Nothing
|
|
|
|
|
*/
|
|
|
|
|
typedef void (*ast_bridge_custom_play_fn)(struct ast_bridge_channel *bridge_channel, const char *playfile);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Play a file on the bridge channel.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel to play the file on
|
|
|
|
|
* \param custom_play Call this function to play the playfile. (NULL if normal sound file to play)
|
|
|
|
|
* \param playfile Sound filename to play.
|
|
|
|
|
* \param moh_class MOH class to request bridge peers to hear while file is played.
|
|
|
|
|
* NULL if no MOH.
|
|
|
|
|
* Empty if default MOH class.
|
|
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks.
|
|
|
|
|
*
|
|
|
|
|
* \return Nothing
|
|
|
|
|
*/
|
|
|
|
|
void ast_bridge_channel_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Write a bridge action play file frame into the bridge.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel is putting the frame into the bridge
|
|
|
|
|
* \param custom_play Call this function to play the playfile. (NULL if normal sound file to play)
|
|
|
|
|
* \param playfile Sound filename to play.
|
|
|
|
|
* \param moh_class MOH class to request bridge peers to hear while file is played.
|
|
|
|
|
* NULL if no MOH.
|
|
|
|
|
* Empty if default MOH class.
|
|
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_write_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Queue a bridge action play file frame onto the bridge channel.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel to put the frame onto.
|
|
|
|
|
* \param custom_play Call this function to play the playfile. (NULL if normal sound file to play)
|
|
|
|
|
* \param playfile Sound filename to play.
|
|
|
|
|
* \param moh_class MOH class to request bridge peers to hear while file is played.
|
|
|
|
|
* NULL if no MOH.
|
|
|
|
|
* Empty if default MOH class.
|
|
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_queue_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class);
|
|
|
|
|
|
2014-03-17 17:22:12 +00:00
|
|
|
/*!
|
|
|
|
|
* \brief Synchronously queue a bridge action play file frame onto the bridge channel.
|
|
|
|
|
* \since 12.2.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel to put the frame onto.
|
|
|
|
|
* \param custom_play Call this function to play the playfile. (NULL if normal sound file to play)
|
|
|
|
|
* \param playfile Sound filename to play.
|
|
|
|
|
* \param moh_class MOH class to request bridge peers to hear while file is played.
|
|
|
|
|
* NULL if no MOH.
|
|
|
|
|
* Empty if default MOH class.
|
|
|
|
|
*
|
|
|
|
|
* This function will block until the queued frame has been destroyed. This will happen
|
|
|
|
|
* either if an error occurs or if the queued playback finishes.
|
|
|
|
|
*
|
|
|
|
|
* \note No locks may be held when calling this function.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 The playback was successfully queued.
|
|
|
|
|
* \retval -1 The playback could not be queued.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_queue_playfile_sync(struct ast_bridge_channel *bridge_channel,
|
|
|
|
|
ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class);
|
|
|
|
|
|
2013-07-24 15:38:18 +00:00
|
|
|
/*!
|
|
|
|
|
* \brief Custom callback run on a bridge channel.
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel to operate on.
|
|
|
|
|
* \param payload Data to pass to the callback. (NULL if none).
|
|
|
|
|
* \param payload_size Size of the payload if payload is non-NULL. A number otherwise.
|
|
|
|
|
*
|
|
|
|
|
* \note The payload MUST NOT have any resources that need to be freed.
|
|
|
|
|
*
|
|
|
|
|
* \return Nothing
|
|
|
|
|
*/
|
|
|
|
|
typedef void (*ast_bridge_custom_callback_fn)(struct ast_bridge_channel *bridge_channel, const void *payload, size_t payload_size);
|
|
|
|
|
|
2013-08-21 15:51:19 +00:00
|
|
|
enum ast_bridge_channel_custom_callback_option {
|
|
|
|
|
/*! The callback temporarily affects media. (Like a custom playfile.) */
|
|
|
|
|
AST_BRIDGE_CHANNEL_CB_OPTION_MEDIA = (1 << 0),
|
|
|
|
|
};
|
|
|
|
|
|
2013-07-24 15:38:18 +00:00
|
|
|
/*!
|
|
|
|
|
* \brief Write a bridge action custom callback frame into the bridge.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel is putting the frame into the bridge
|
2013-08-21 15:51:19 +00:00
|
|
|
* \param flags Custom callback option flags.
|
2013-07-24 15:38:18 +00:00
|
|
|
* \param callback Custom callback run on a bridge channel.
|
|
|
|
|
* \param payload Data to pass to the callback. (NULL if none).
|
|
|
|
|
* \param payload_size Size of the payload if payload is non-NULL. A number otherwise.
|
|
|
|
|
*
|
|
|
|
|
* \note The payload MUST NOT have any resources that need to be freed.
|
|
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
2013-08-21 15:51:19 +00:00
|
|
|
int ast_bridge_channel_write_callback(struct ast_bridge_channel *bridge_channel,
|
|
|
|
|
enum ast_bridge_channel_custom_callback_option flags,
|
|
|
|
|
ast_bridge_custom_callback_fn callback, const void *payload, size_t payload_size);
|
2013-07-24 15:38:18 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Queue a bridge action custom callback frame onto the bridge channel.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel to put the frame onto.
|
2013-08-21 15:51:19 +00:00
|
|
|
* \param flags Custom callback option flags.
|
2013-07-24 15:38:18 +00:00
|
|
|
* \param callback Custom callback run on a bridge channel.
|
|
|
|
|
* \param payload Data to pass to the callback. (NULL if none).
|
|
|
|
|
* \param payload_size Size of the payload if payload is non-NULL. A number otherwise.
|
|
|
|
|
*
|
|
|
|
|
* \note The payload MUST NOT have any resources that need to be freed.
|
|
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
2013-08-21 15:51:19 +00:00
|
|
|
int ast_bridge_channel_queue_callback(struct ast_bridge_channel *bridge_channel,
|
|
|
|
|
enum ast_bridge_channel_custom_callback_option flags,
|
|
|
|
|
ast_bridge_custom_callback_fn callback, const void *payload, size_t payload_size);
|
2013-07-24 15:38:18 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Have a bridge channel park a channel in the bridge
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Bridge channel performing the parking
|
|
|
|
|
* \param parkee_uuid Unique id of the channel we want to park
|
|
|
|
|
* \param parker_uuid Unique id of the channel parking the call
|
|
|
|
|
* \param app_data string indicating data used for park application (NULL allowed)
|
|
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 on success.
|
|
|
|
|
* \retval -1 on error.
|
|
|
|
|
*/
|
|
|
|
|
int ast_bridge_channel_write_park(struct ast_bridge_channel *bridge_channel, const char *parkee_uuid,
|
|
|
|
|
const char *parker_uuid, const char *app_data);
|
|
|
|
|
|
2013-08-16 20:48:13 +00:00
|
|
|
/*!
|
|
|
|
|
* \brief Kick the channel out of the bridge.
|
|
|
|
|
* \since 12.0.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Which channel is being kicked or hungup.
|
2013-08-22 21:09:52 +00:00
|
|
|
* \param cause Cause of channel being kicked.
|
|
|
|
|
* If cause <= 0 then use cause on channel if cause still <= 0 use AST_CAUSE_NORMAL_CLEARING.
|
2013-08-16 20:48:13 +00:00
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks and the
|
|
|
|
|
* bridge channel thread.
|
|
|
|
|
*
|
|
|
|
|
* \return Nothing
|
|
|
|
|
*/
|
2013-08-22 21:09:52 +00:00
|
|
|
void ast_bridge_channel_kick(struct ast_bridge_channel *bridge_channel, int cause);
|
2013-08-16 20:48:13 +00:00
|
|
|
|
2015-03-26 17:13:26 +00:00
|
|
|
/*!
|
|
|
|
|
* \brief Add a DTMF digit to the collected digits.
|
|
|
|
|
* \since 13.3.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Channel that received a DTMF digit.
|
|
|
|
|
* \param digit DTMF digit to add to collected digits
|
|
|
|
|
*
|
|
|
|
|
* \note Neither the bridge nor the bridge_channel locks should be held
|
|
|
|
|
* when entering this function.
|
|
|
|
|
*
|
|
|
|
|
* \note This is can only be called from within DTMF bridge hooks.
|
|
|
|
|
*/
|
|
|
|
|
void ast_bridge_channel_feature_digit_add(struct ast_bridge_channel *bridge_channel, int digit);
|
|
|
|
|
|
2014-11-06 19:12:18 +00:00
|
|
|
/*!
|
|
|
|
|
* \brief Add a DTMF digit to the collected digits to match against DTMF features.
|
|
|
|
|
* \since 12.8.0
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Channel that received a DTMF digit.
|
|
|
|
|
* \param digit DTMF digit to add to collected digits or 0 for timeout event.
|
2015-03-26 17:13:26 +00:00
|
|
|
* \param clear_digits clear the digits array prior to calling hooks
|
2014-11-06 19:12:18 +00:00
|
|
|
*
|
|
|
|
|
* \note Neither the bridge nor the bridge_channel locks should be held
|
|
|
|
|
* when entering this function.
|
|
|
|
|
*
|
|
|
|
|
* \note This is intended to be called by bridge hooks and the
|
|
|
|
|
* bridge channel thread.
|
|
|
|
|
*
|
2015-03-26 17:13:26 +00:00
|
|
|
* \note This is intended to be called by non-DTMF bridge hooks and the bridge
|
|
|
|
|
* channel thread. Calling from a DTMF bridge hook can potentially cause
|
|
|
|
|
* unbounded recursion.
|
|
|
|
|
*
|
2014-11-06 19:12:18 +00:00
|
|
|
* \return Nothing
|
|
|
|
|
*/
|
|
|
|
|
void ast_bridge_channel_feature_digit(struct ast_bridge_channel *bridge_channel, int digit);
|
|
|
|
|
|
2017-04-25 11:49:16 -05:00
|
|
|
/*!
|
|
|
|
|
* \brief Maps a channel's stream topology to and from the bridge
|
|
|
|
|
* \since 15.0.0
|
|
|
|
|
*
|
|
|
|
|
* When a channel joins a bridge or its associated stream topology is updated, each stream
|
|
|
|
|
* in the topology needs to be mapped according to its media type to the bridge. Calling
|
|
|
|
|
* this method creates a mapping of each stream on the channel indexed to the bridge's
|
|
|
|
|
* supported media types and vice versa (i.e. bridge's media types indexed to channel
|
|
|
|
|
* streams).
|
|
|
|
|
*
|
|
|
|
|
* The first channel to join the bridge creates the initial order for the bridge's media
|
|
|
|
|
* types (e.g. a one to one mapping is made). Subsequently added channels are mapped to
|
|
|
|
|
* that order adding more media types if/when the newly added channel has more streams
|
|
|
|
|
* and/or media types specified by the bridge.
|
|
|
|
|
*
|
|
|
|
|
* \param bridge_channel Channel to map
|
|
|
|
|
*
|
|
|
|
|
* \return Nothing
|
|
|
|
|
*/
|
|
|
|
|
void ast_bridge_channel_stream_map(struct ast_bridge_channel *bridge_channel);
|
|
|
|
|
|
2013-07-24 15:38:18 +00:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-07-24 16:01:20 +00:00
|
|
|
#endif /* _ASTERISK_BRIDGING_CHANNEL_H */
|