2009-03-05 18:18:27 +00:00
|
|
|
/*
|
|
|
|
* Asterisk -- An open source telephony toolkit.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007-2008, Digium, Inc.
|
|
|
|
*
|
|
|
|
* Joshua Colp <jcolp@digium.com>
|
2011-04-21 18:11:40 +00:00
|
|
|
* David Vossel <dvossel@digium.com>
|
2009-03-05 18:18:27 +00:00
|
|
|
*
|
|
|
|
* 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 Conference Bridge application
|
|
|
|
*
|
|
|
|
* \author\verbatim Joshua Colp <jcolp@digium.com> \endverbatim
|
2011-04-21 18:11:40 +00:00
|
|
|
* \author\verbatim David Vossel <dvossel@digium.com> \endverbatim
|
2009-03-05 18:18:27 +00:00
|
|
|
*
|
|
|
|
* This is a conference bridge application utilizing the bridging core.
|
|
|
|
* \ingroup applications
|
|
|
|
*/
|
|
|
|
|
2012-10-14 21:45:16 +00:00
|
|
|
/*! \li \ref app_confbridge.c uses the configuration file \ref confbridge.conf
|
2012-10-01 23:22:50 +00:00
|
|
|
* \addtogroup configuration_file Configuration Files
|
|
|
|
*/
|
|
|
|
|
2013-07-25 04:06:32 +00:00
|
|
|
/*!
|
2012-10-01 23:22:50 +00:00
|
|
|
* \page confbridge.conf confbridge.conf
|
|
|
|
* \verbinclude confbridge.conf.sample
|
|
|
|
*/
|
|
|
|
|
2011-07-14 20:28:54 +00:00
|
|
|
/*** MODULEINFO
|
|
|
|
<support_level>core</support_level>
|
|
|
|
***/
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
#include "asterisk.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
2011-02-01 16:05:23 +00:00
|
|
|
#include "asterisk/cli.h"
|
2009-03-05 18:18:27 +00:00
|
|
|
#include "asterisk/file.h"
|
|
|
|
#include "asterisk/channel.h"
|
|
|
|
#include "asterisk/pbx.h"
|
2011-04-21 18:11:40 +00:00
|
|
|
#include "asterisk/pbx.h"
|
2009-03-05 18:18:27 +00:00
|
|
|
#include "asterisk/module.h"
|
|
|
|
#include "asterisk/lock.h"
|
2013-07-25 04:06:32 +00:00
|
|
|
#include "asterisk/bridge.h"
|
2009-03-05 18:18:27 +00:00
|
|
|
#include "asterisk/musiconhold.h"
|
|
|
|
#include "asterisk/say.h"
|
|
|
|
#include "asterisk/audiohook.h"
|
|
|
|
#include "asterisk/astobj2.h"
|
2011-04-21 18:11:40 +00:00
|
|
|
#include "confbridge/include/confbridge.h"
|
|
|
|
#include "asterisk/paths.h"
|
|
|
|
#include "asterisk/manager.h"
|
2011-12-22 20:44:53 +00:00
|
|
|
#include "asterisk/test.h"
|
2013-05-21 18:00:22 +00:00
|
|
|
#include "asterisk/stasis.h"
|
2013-07-25 04:06:32 +00:00
|
|
|
#include "asterisk/stasis_bridges.h"
|
2013-05-21 18:00:22 +00:00
|
|
|
#include "asterisk/json.h"
|
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
|
|
|
#include "asterisk/format_cache.h"
|
2016-08-10 20:14:09 +00:00
|
|
|
#include "asterisk/taskprocessor.h"
|
2009-03-05 18:18:27 +00:00
|
|
|
|
|
|
|
/*** DOCUMENTATION
|
2012-12-04 22:34:05 +00:00
|
|
|
<application name="ConfBridge" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Conference bridge application.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<parameter name="conference" required="true">
|
|
|
|
<para>Name of the conference bridge. You are not limited to just
|
|
|
|
numbers.</para>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="bridge_profile">
|
|
|
|
<para>The bridge profile name from confbridge.conf. When left blank,
|
|
|
|
a dynamically built bridge profile created by the CONFBRIDGE dialplan
|
|
|
|
function is searched for on the channel and used. If no dynamic
|
|
|
|
profile is present, the 'default_bridge' profile found in
|
|
|
|
confbridge.conf is used. </para>
|
|
|
|
<para>It is important to note that while user profiles may be unique
|
|
|
|
for each participant, mixing bridge profiles on a single conference
|
|
|
|
is _NOT_ recommended and will produce undefined results.</para>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="user_profile">
|
|
|
|
<para>The user profile name from confbridge.conf. When left blank,
|
|
|
|
a dynamically built user profile created by the CONFBRIDGE dialplan
|
|
|
|
function is searched for on the channel and used. If no dynamic
|
|
|
|
profile is present, the 'default_user' profile found in
|
|
|
|
confbridge.conf is used.</para>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="menu">
|
|
|
|
<para>The name of the DTMF menu in confbridge.conf to be applied to
|
2013-11-01 22:48:14 +00:00
|
|
|
this channel. When left blank, a dynamically built menu profile
|
|
|
|
created by the CONFBRIDGE dialplan function is searched for on
|
|
|
|
the channel and used. If no dynamic profile is present, the
|
|
|
|
'default_menu' profile found in confbridge.conf is used.</para>
|
2012-12-04 22:34:05 +00:00
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
<para>Enters the user into a specified conference bridge. The user can
|
|
|
|
exit the conference by hangup or DTMF menu option.</para>
|
2013-12-09 17:29:48 +00:00
|
|
|
<para>This application sets the following channel variable upon completion:</para>
|
|
|
|
<variablelist>
|
|
|
|
<variable name="CONFBRIDGE_RESULT">
|
|
|
|
<value name="FAILED">The channel encountered an error and could not enter the conference.</value>
|
|
|
|
<value name="HANGUP">The channel exited the conference by hanging up.</value>
|
|
|
|
<value name="KICKED">The channel was kicked from the conference.</value>
|
|
|
|
<value name="ENDMARKED">The channel left the conference as a result of the last marked user leaving.</value>
|
|
|
|
<value name="DTMF">The channel pressed a DTMF sequence to exit the conference.</value>
|
2015-11-13 20:03:35 +00:00
|
|
|
<value name="TIMEOUT">The channel reached its configured timeout.</value>
|
2013-12-09 17:29:48 +00:00
|
|
|
</variable>
|
|
|
|
</variablelist>
|
2012-12-04 22:34:05 +00:00
|
|
|
</description>
|
|
|
|
<see-also>
|
|
|
|
<ref type="application">ConfBridge</ref>
|
|
|
|
<ref type="function">CONFBRIDGE</ref>
|
|
|
|
<ref type="function">CONFBRIDGE_INFO</ref>
|
|
|
|
</see-also>
|
|
|
|
</application>
|
2011-04-21 18:11:40 +00:00
|
|
|
<function name="CONFBRIDGE" language="en_US">
|
|
|
|
<synopsis>
|
2016-01-26 23:59:28 +00:00
|
|
|
Set a custom dynamic bridge, user, or menu profile on a channel for the
|
|
|
|
ConfBridge application using the same options available in confbridge.conf.
|
2011-04-21 18:11:40 +00:00
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<parameter name="type" required="true">
|
2016-01-26 23:59:28 +00:00
|
|
|
<para>To what type of conference profile the option applies.</para>
|
|
|
|
<enumlist>
|
|
|
|
<enum name="bridge"></enum>
|
|
|
|
<enum name="menu"></enum>
|
|
|
|
<enum name="user"></enum>
|
|
|
|
</enumlist>
|
2011-04-21 18:11:40 +00:00
|
|
|
</parameter>
|
2012-12-04 22:34:05 +00:00
|
|
|
<parameter name="option" required="true">
|
2016-01-26 23:59:28 +00:00
|
|
|
<para>Option refers to a <filename>confbridge.conf</filename> option
|
|
|
|
that is being set dynamically on this channel, or <literal>clear</literal>
|
|
|
|
to remove already applied profile options from the channel.</para>
|
2011-04-21 18:11:40 +00:00
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
<description>
|
2016-01-26 23:59:28 +00:00
|
|
|
<para>A custom profile uses the default profile type settings defined in
|
|
|
|
<filename>confbridge.conf</filename> as defaults if the profile template
|
|
|
|
is not explicitly specified first.</para>
|
|
|
|
<para>For <literal>bridge</literal> profiles the default template is <literal>default_bridge</literal>.</para>
|
|
|
|
<para>For <literal>menu</literal> profiles the default template is <literal>default_menu</literal>.</para>
|
|
|
|
<para>For <literal>user</literal> profiles the default template is <literal>default_user</literal>.</para>
|
2011-04-21 18:11:40 +00:00
|
|
|
<para>---- Example 1 ----</para>
|
2016-01-26 23:59:28 +00:00
|
|
|
<para>In this example the custom user profile set on the channel will
|
|
|
|
automatically be used by the ConfBridge application.</para>
|
|
|
|
<para>exten => 1,1,Answer()</para>
|
|
|
|
<para>; In this example the effect of the following line is</para>
|
|
|
|
<para>; implied:</para>
|
|
|
|
<para>; same => n,Set(CONFBRIDGE(user,template)=default_user)</para>
|
|
|
|
<para>same => n,Set(CONFBRIDGE(user,announce_join_leave)=yes)</para>
|
|
|
|
<para>same => n,Set(CONFBRIDGE(user,startmuted)=yes)</para>
|
|
|
|
<para>same => n,ConfBridge(1) </para>
|
2011-04-21 18:11:40 +00:00
|
|
|
<para>---- Example 2 ----</para>
|
2016-01-26 23:59:28 +00:00
|
|
|
<para>This example shows how to use a predefined user profile in
|
|
|
|
<filename>confbridge.conf</filename> as a template for a dynamic profile.
|
|
|
|
Here we make an admin/marked user out of the <literal>my_user</literal>
|
|
|
|
profile that you define in <filename>confbridge.conf</filename>.</para>
|
|
|
|
<para>exten => 1,1,Answer()</para>
|
|
|
|
<para>same => n,Set(CONFBRIDGE(user,template)=my_user)</para>
|
|
|
|
<para>same => n,Set(CONFBRIDGE(user,admin)=yes)</para>
|
|
|
|
<para>same => n,Set(CONFBRIDGE(user,marked)=yes)</para>
|
|
|
|
<para>same => n,ConfBridge(1)</para>
|
2011-04-21 18:11:40 +00:00
|
|
|
</description>
|
|
|
|
</function>
|
2011-06-15 13:45:41 +00:00
|
|
|
<function name="CONFBRIDGE_INFO" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Get information about a ConfBridge conference.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<parameter name="type" required="true">
|
2016-01-26 23:59:28 +00:00
|
|
|
<para>What conference information is requested.</para>
|
|
|
|
<enumlist>
|
|
|
|
<enum name="admins">
|
|
|
|
<para>Get the number of admin users in the conference.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="locked">
|
|
|
|
<para>Determine if the conference is locked. (0 or 1)</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="marked">
|
|
|
|
<para>Get the number of marked users in the conference.</para>
|
|
|
|
</enum>
|
2016-01-25 22:05:09 +00:00
|
|
|
<enum name="muted">
|
|
|
|
<para>Determine if the conference is muted. (0 or 1)</para>
|
|
|
|
</enum>
|
2016-01-26 23:59:28 +00:00
|
|
|
<enum name="parties">
|
|
|
|
<para>Get the number of users in the conference.</para>
|
|
|
|
</enum>
|
|
|
|
</enumlist>
|
2011-06-15 13:45:41 +00:00
|
|
|
</parameter>
|
|
|
|
<parameter name="conf" required="true">
|
2016-01-26 23:59:28 +00:00
|
|
|
<para>The name of the conference being referenced.</para>
|
2011-06-15 13:45:41 +00:00
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
<description>
|
2016-01-26 23:59:28 +00:00
|
|
|
<para>This function returns a non-negative integer for valid conference
|
|
|
|
names and an empty string for invalid conference names.</para>
|
2011-06-15 13:45:41 +00:00
|
|
|
</description>
|
|
|
|
</function>
|
2011-04-21 18:11:40 +00:00
|
|
|
<manager name="ConfbridgeList" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
List participants in a conference.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
2013-01-24 04:02:47 +00:00
|
|
|
<parameter name="Conference" required="true">
|
2011-04-21 18:11:40 +00:00
|
|
|
<para>Conference number.</para>
|
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
<para>Lists all users in a particular ConfBridge conference.
|
|
|
|
ConfbridgeList will follow as separate events, followed by a final event called
|
|
|
|
ConfbridgeListComplete.</para>
|
|
|
|
</description>
|
|
|
|
</manager>
|
|
|
|
<manager name="ConfbridgeListRooms" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
List active conferences.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
<para>Lists data about all active conferences.
|
|
|
|
ConfbridgeListRooms will follow as separate events, followed by a final event called
|
|
|
|
ConfbridgeListRoomsComplete.</para>
|
|
|
|
</description>
|
|
|
|
</manager>
|
|
|
|
<manager name="ConfbridgeMute" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Mute a Confbridge user.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
|
|
|
<parameter name="Conference" required="true" />
|
2014-01-22 19:36:23 +00:00
|
|
|
<parameter name="Channel" required="true">
|
|
|
|
<para>If this parameter is not a complete channel name, the first channel with this prefix will be used.</para>
|
2014-08-26 23:30:00 +00:00
|
|
|
<para>If this parameter is "all", all channels will be muted.</para>
|
|
|
|
<para>If this parameter is "participants", all non-admin channels will be muted.</para>
|
2014-01-22 19:36:23 +00:00
|
|
|
</parameter>
|
2011-04-21 18:11:40 +00:00
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
</description>
|
|
|
|
</manager>
|
|
|
|
<manager name="ConfbridgeUnmute" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Unmute a Confbridge user.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
|
|
|
<parameter name="Conference" required="true" />
|
2014-01-22 19:36:23 +00:00
|
|
|
<parameter name="Channel" required="true">
|
|
|
|
<para>If this parameter is not a complete channel name, the first channel with this prefix will be used.</para>
|
2014-08-26 23:30:00 +00:00
|
|
|
<para>If this parameter is "all", all channels will be unmuted.</para>
|
|
|
|
<para>If this parameter is "participants", all non-admin channels will be unmuted.</para>
|
2014-01-22 19:36:23 +00:00
|
|
|
</parameter>
|
2011-04-21 18:11:40 +00:00
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
</description>
|
|
|
|
</manager>
|
|
|
|
<manager name="ConfbridgeKick" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Kick a Confbridge user.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
|
|
|
<parameter name="Conference" required="true" />
|
2014-04-21 14:58:12 +00:00
|
|
|
<parameter name="Channel" required="true" >
|
|
|
|
<para>If this parameter is "all", all channels will be kicked from the conference.</para>
|
2014-08-26 23:30:00 +00:00
|
|
|
<para>If this parameter is "participants", all non-admin channels will be kicked from the conference.</para>
|
2014-04-21 14:58:12 +00:00
|
|
|
</parameter>
|
2011-04-21 18:11:40 +00:00
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
</description>
|
|
|
|
</manager>
|
|
|
|
<manager name="ConfbridgeLock" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Lock a Confbridge conference.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
|
|
|
<parameter name="Conference" required="true" />
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
</description>
|
|
|
|
</manager>
|
|
|
|
<manager name="ConfbridgeUnlock" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Unlock a Confbridge conference.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
|
|
|
<parameter name="Conference" required="true" />
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
</description>
|
|
|
|
</manager>
|
|
|
|
<manager name="ConfbridgeStartRecord" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Start recording a Confbridge conference.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
|
|
|
<parameter name="Conference" required="true" />
|
|
|
|
<parameter name="RecordFile" required="false" />
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
<para>Start recording a conference. If recording is already present an error will be returned. If RecordFile is not provided, the default record file specified in the conference's bridge profile will be used, if that is not present either a file will automatically be generated in the monitor directory.</para>
|
|
|
|
</description>
|
|
|
|
</manager>
|
|
|
|
<manager name="ConfbridgeStopRecord" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Stop recording a Confbridge conference.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
|
|
|
<parameter name="Conference" required="true" />
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
</description>
|
|
|
|
</manager>
|
2011-06-30 20:33:15 +00:00
|
|
|
<manager name="ConfbridgeSetSingleVideoSrc" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Set a conference user as the single video source distributed to all other participants.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
|
|
|
<parameter name="Conference" required="true" />
|
2014-01-22 19:36:23 +00:00
|
|
|
<parameter name="Channel" required="true">
|
|
|
|
<para>If this parameter is not a complete channel name, the first channel with this prefix will be used.</para>
|
|
|
|
</parameter>
|
2011-06-30 20:33:15 +00:00
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
</description>
|
|
|
|
</manager>
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
***/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \par Playing back a file to a channel in a conference
|
|
|
|
* You might notice in this application that while playing a sound file
|
|
|
|
* to a channel the actual conference bridge lock is not held. This is done so
|
|
|
|
* that other channels are not blocked from interacting with the conference bridge.
|
|
|
|
* Unfortunately because of this it is possible for things to change after the sound file
|
|
|
|
* is done being played. Data must therefore be checked after reacquiring the conference
|
|
|
|
* bridge lock if it is important.
|
|
|
|
*/
|
|
|
|
|
2009-06-07 14:55:51 +00:00
|
|
|
static const char app[] = "ConfBridge";
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
/*! Number of buckets our conference bridges container can have */
|
2009-03-05 18:18:27 +00:00
|
|
|
#define CONFERENCE_BRIDGE_BUCKETS 53
|
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
/*! Initial recording filename space. */
|
|
|
|
#define RECORD_FILENAME_INITIAL_SPACE 128
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/*! \brief Container to hold all conference bridges in progress */
|
2013-05-21 18:00:22 +00:00
|
|
|
struct ao2_container *conference_bridges;
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static void leave_conference(struct confbridge_user *user);
|
|
|
|
static int play_sound_number(struct confbridge_conference *conference, int say_number);
|
|
|
|
static int execute_menu_entry(struct confbridge_conference *conference,
|
|
|
|
struct confbridge_user *user,
|
2011-04-21 18:11:40 +00:00
|
|
|
struct ast_bridge_channel *bridge_channel,
|
|
|
|
struct conf_menu_entry *menu_entry,
|
|
|
|
struct conf_menu *menu);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
|
|
|
/*! \brief Hashing function used for conference bridges container */
|
|
|
|
static int conference_bridge_hash_cb(const void *obj, const int flags)
|
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
const struct confbridge_conference *conference = obj;
|
2013-04-23 20:18:44 +00:00
|
|
|
const char *name = obj;
|
|
|
|
int hash;
|
|
|
|
|
|
|
|
switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
|
|
|
|
default:
|
|
|
|
case OBJ_POINTER:
|
|
|
|
name = conference->name;
|
|
|
|
/* Fall through */
|
|
|
|
case OBJ_KEY:
|
|
|
|
hash = ast_str_case_hash(name);
|
|
|
|
break;
|
|
|
|
case OBJ_PARTIAL_KEY:
|
|
|
|
/* Should never happen in hash callback. */
|
|
|
|
ast_assert(0);
|
|
|
|
hash = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return hash;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Comparison function used for conference bridges container */
|
|
|
|
static int conference_bridge_cmp_cb(void *obj, void *arg, int flags)
|
|
|
|
{
|
2013-04-23 20:18:44 +00:00
|
|
|
const struct confbridge_conference *left = obj;
|
|
|
|
const struct confbridge_conference *right = arg;
|
|
|
|
const char *right_name = arg;
|
|
|
|
int cmp;
|
|
|
|
|
|
|
|
switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
|
|
|
|
default:
|
|
|
|
case OBJ_POINTER:
|
|
|
|
right_name = right->name;
|
|
|
|
/* Fall through */
|
|
|
|
case OBJ_KEY:
|
|
|
|
cmp = strcasecmp(left->name, right_name);
|
|
|
|
break;
|
|
|
|
case OBJ_PARTIAL_KEY:
|
|
|
|
cmp = strncasecmp(left->name, right_name, strlen(right_name));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return cmp ? 0 : CMP_MATCH;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
const char *conf_get_sound(enum conf_sounds sound, struct bridge_profile_sounds *custom_sounds)
|
|
|
|
{
|
|
|
|
switch (sound) {
|
|
|
|
case CONF_SOUND_HAS_JOINED:
|
|
|
|
return S_OR(custom_sounds->hasjoin, "conf-hasjoin");
|
|
|
|
case CONF_SOUND_HAS_LEFT:
|
|
|
|
return S_OR(custom_sounds->hasleft, "conf-hasleft");
|
|
|
|
case CONF_SOUND_KICKED:
|
|
|
|
return S_OR(custom_sounds->kicked, "conf-kicked");
|
|
|
|
case CONF_SOUND_MUTED:
|
|
|
|
return S_OR(custom_sounds->muted, "conf-muted");
|
|
|
|
case CONF_SOUND_UNMUTED:
|
|
|
|
return S_OR(custom_sounds->unmuted, "conf-unmuted");
|
2016-08-12 16:23:40 +00:00
|
|
|
case CONF_SOUND_BINAURAL_ON:
|
|
|
|
return S_OR(custom_sounds->binauralon, "confbridge-binaural-on");
|
|
|
|
case CONF_SOUND_BINAURAL_OFF:
|
|
|
|
return S_OR(custom_sounds->binauraloff, "confbridge-binaural-off");
|
2011-04-21 18:11:40 +00:00
|
|
|
case CONF_SOUND_ONLY_ONE:
|
|
|
|
return S_OR(custom_sounds->onlyone, "conf-onlyone");
|
|
|
|
case CONF_SOUND_THERE_ARE:
|
|
|
|
return S_OR(custom_sounds->thereare, "conf-thereare");
|
|
|
|
case CONF_SOUND_OTHER_IN_PARTY:
|
|
|
|
return S_OR(custom_sounds->otherinparty, "conf-otherinparty");
|
|
|
|
case CONF_SOUND_PLACE_IN_CONF:
|
|
|
|
return S_OR(custom_sounds->placeintoconf, "conf-placeintoconf");
|
|
|
|
case CONF_SOUND_WAIT_FOR_LEADER:
|
|
|
|
return S_OR(custom_sounds->waitforleader, "conf-waitforleader");
|
|
|
|
case CONF_SOUND_LEADER_HAS_LEFT:
|
|
|
|
return S_OR(custom_sounds->leaderhasleft, "conf-leaderhasleft");
|
|
|
|
case CONF_SOUND_GET_PIN:
|
|
|
|
return S_OR(custom_sounds->getpin, "conf-getpin");
|
|
|
|
case CONF_SOUND_INVALID_PIN:
|
|
|
|
return S_OR(custom_sounds->invalidpin, "conf-invalidpin");
|
|
|
|
case CONF_SOUND_ONLY_PERSON:
|
|
|
|
return S_OR(custom_sounds->onlyperson, "conf-onlyperson");
|
|
|
|
case CONF_SOUND_LOCKED:
|
|
|
|
return S_OR(custom_sounds->locked, "conf-locked");
|
|
|
|
case CONF_SOUND_LOCKED_NOW:
|
|
|
|
return S_OR(custom_sounds->lockednow, "conf-lockednow");
|
|
|
|
case CONF_SOUND_UNLOCKED_NOW:
|
|
|
|
return S_OR(custom_sounds->unlockednow, "conf-unlockednow");
|
|
|
|
case CONF_SOUND_ERROR_MENU:
|
|
|
|
return S_OR(custom_sounds->errormenu, "conf-errormenu");
|
|
|
|
case CONF_SOUND_JOIN:
|
2011-04-27 17:51:53 +00:00
|
|
|
return S_OR(custom_sounds->join, "confbridge-join");
|
2011-04-21 18:11:40 +00:00
|
|
|
case CONF_SOUND_LEAVE:
|
2011-04-27 17:51:53 +00:00
|
|
|
return S_OR(custom_sounds->leave, "confbridge-leave");
|
2011-11-17 18:09:13 +00:00
|
|
|
case CONF_SOUND_PARTICIPANTS_MUTED:
|
|
|
|
return S_OR(custom_sounds->participantsmuted, "conf-now-muted");
|
|
|
|
case CONF_SOUND_PARTICIPANTS_UNMUTED:
|
|
|
|
return S_OR(custom_sounds->participantsunmuted, "conf-now-unmuted");
|
2014-02-10 16:01:37 +00:00
|
|
|
case CONF_SOUND_BEGIN:
|
|
|
|
return S_OR(custom_sounds->begin, "confbridge-conf-begin");
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2014-08-27 17:30:51 +00:00
|
|
|
static void send_conf_stasis(struct confbridge_conference *conference, struct ast_channel *chan,
|
|
|
|
struct stasis_message_type *type, struct ast_json *extras, int channel_topic)
|
2013-05-21 18:00:22 +00:00
|
|
|
{
|
|
|
|
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
|
|
|
|
RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
|
|
|
|
|
2013-05-31 12:41:10 +00:00
|
|
|
json_object = ast_json_pack("{s: s}",
|
2013-05-21 18:00:22 +00:00
|
|
|
"conference", conference->name);
|
|
|
|
if (!json_object) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (extras) {
|
|
|
|
ast_json_object_update(json_object, extras);
|
|
|
|
}
|
|
|
|
|
2014-04-11 12:43:34 +00:00
|
|
|
ast_bridge_lock(conference->bridge);
|
2013-05-31 12:41:10 +00:00
|
|
|
msg = ast_bridge_blob_create(type,
|
|
|
|
conference->bridge,
|
|
|
|
chan,
|
|
|
|
json_object);
|
2014-04-11 12:43:34 +00:00
|
|
|
ast_bridge_unlock(conference->bridge);
|
2013-05-21 18:00:22 +00:00
|
|
|
if (!msg) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (channel_topic) {
|
|
|
|
stasis_publish(ast_channel_topic(chan), msg);
|
|
|
|
} else {
|
|
|
|
stasis_publish(ast_bridge_topic(conference->bridge), msg);
|
|
|
|
}
|
2013-02-12 03:31:46 +00:00
|
|
|
}
|
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
static void send_conf_start_event(struct confbridge_conference *conference)
|
|
|
|
{
|
2013-05-31 12:41:10 +00:00
|
|
|
send_conf_stasis(conference, NULL, confbridge_start_type(), NULL, 0);
|
2013-02-12 03:31:46 +00:00
|
|
|
}
|
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
static void send_conf_end_event(struct confbridge_conference *conference)
|
|
|
|
{
|
2013-05-31 12:41:10 +00:00
|
|
|
send_conf_stasis(conference, NULL, confbridge_end_type(), NULL, 0);
|
2013-02-12 03:31:46 +00:00
|
|
|
}
|
|
|
|
|
2014-08-27 17:30:51 +00:00
|
|
|
static void send_join_event(struct confbridge_user *user, struct confbridge_conference *conference)
|
2013-05-21 18:00:22 +00:00
|
|
|
{
|
2014-08-27 17:30:51 +00:00
|
|
|
struct ast_json *json_object;
|
|
|
|
|
|
|
|
json_object = ast_json_pack("{s: b}",
|
|
|
|
"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
|
|
|
|
);
|
|
|
|
if (!json_object) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
send_conf_stasis(conference, user->chan, confbridge_join_type(), json_object, 0);
|
|
|
|
ast_json_unref(json_object);
|
2013-02-12 03:31:46 +00:00
|
|
|
}
|
|
|
|
|
2014-08-27 17:30:51 +00:00
|
|
|
static void send_leave_event(struct confbridge_user *user, struct confbridge_conference *conference)
|
2013-05-21 18:00:22 +00:00
|
|
|
{
|
2014-08-27 17:30:51 +00:00
|
|
|
struct ast_json *json_object;
|
|
|
|
|
|
|
|
json_object = ast_json_pack("{s: b}",
|
|
|
|
"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
|
|
|
|
);
|
|
|
|
if (!json_object) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
send_conf_stasis(conference, user->chan, confbridge_leave_type(), json_object, 0);
|
|
|
|
ast_json_unref(json_object);
|
2013-05-21 18:00:22 +00:00
|
|
|
}
|
2013-02-12 03:31:46 +00:00
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
static void send_start_record_event(struct confbridge_conference *conference)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2013-05-31 12:41:10 +00:00
|
|
|
send_conf_stasis(conference, NULL, confbridge_start_record_type(), NULL, 0);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2013-05-21 18:00:22 +00:00
|
|
|
|
|
|
|
static void send_stop_record_event(struct confbridge_conference *conference)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2013-05-31 12:41:10 +00:00
|
|
|
send_conf_stasis(conference, NULL, confbridge_stop_record_type(), NULL, 0);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2013-05-21 18:00:22 +00:00
|
|
|
|
2014-08-27 17:30:51 +00:00
|
|
|
static void send_mute_event(struct confbridge_user *user, struct confbridge_conference *conference)
|
2013-05-21 18:00:22 +00:00
|
|
|
{
|
2014-08-27 17:30:51 +00:00
|
|
|
struct ast_json *json_object;
|
|
|
|
|
|
|
|
json_object = ast_json_pack("{s: b}",
|
|
|
|
"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
|
|
|
|
);
|
|
|
|
if (!json_object) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
send_conf_stasis(conference, user->chan, confbridge_mute_type(), json_object, 1);
|
|
|
|
ast_json_unref(json_object);
|
2013-05-21 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
2014-08-27 17:30:51 +00:00
|
|
|
static void send_unmute_event(struct confbridge_user *user, struct confbridge_conference *conference)
|
2013-05-21 18:00:22 +00:00
|
|
|
{
|
2014-08-27 17:30:51 +00:00
|
|
|
struct ast_json *json_object;
|
|
|
|
|
|
|
|
json_object = ast_json_pack("{s: b}",
|
|
|
|
"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
|
|
|
|
);
|
|
|
|
if (!json_object) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
send_conf_stasis(conference, user->chan, confbridge_unmute_type(), json_object, 1);
|
|
|
|
ast_json_unref(json_object);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static void set_rec_filename(struct confbridge_conference *conference, struct ast_str **filename, int is_new)
|
2013-02-18 22:23:52 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
char *rec_file = conference->b_profile.rec_file;
|
2013-02-18 22:23:52 +00:00
|
|
|
char *ext;
|
2015-01-23 19:51:42 +00:00
|
|
|
time_t now;
|
2013-02-18 22:23:52 +00:00
|
|
|
|
2015-01-23 19:51:42 +00:00
|
|
|
if (ast_str_strlen(*filename)
|
|
|
|
&& ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND)
|
|
|
|
&& !is_new) {
|
|
|
|
return;
|
2013-02-18 22:23:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
time(&now);
|
|
|
|
|
|
|
|
ast_str_reset(*filename);
|
|
|
|
if (ast_strlen_zero(rec_file)) {
|
2015-01-23 19:51:42 +00:00
|
|
|
ast_str_set(filename, 0, "confbridge-%s-%u.wav", conference->name,
|
|
|
|
(unsigned int) now);
|
2014-12-22 02:35:05 +00:00
|
|
|
} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_TIMESTAMP)) {
|
2013-02-18 22:23:52 +00:00
|
|
|
/* insert time before file extension */
|
|
|
|
ext = strrchr(rec_file, '.');
|
|
|
|
if (ext) {
|
|
|
|
ast_str_set_substr(filename, 0, rec_file, ext - rec_file);
|
2015-01-23 19:51:42 +00:00
|
|
|
ast_str_append(filename, 0, "-%u%s", (unsigned int) now, ext);
|
2013-02-18 22:23:52 +00:00
|
|
|
} else {
|
2015-01-23 19:51:42 +00:00
|
|
|
ast_str_set(filename, 0, "%s-%u", rec_file, (unsigned int) now);
|
2013-02-18 22:23:52 +00:00
|
|
|
}
|
2014-12-22 02:35:05 +00:00
|
|
|
} else {
|
|
|
|
ast_str_set(filename, 0, "%s", rec_file);
|
2013-02-18 22:23:52 +00:00
|
|
|
}
|
2014-12-22 02:35:05 +00:00
|
|
|
ast_str_append(filename, 0, ",%s%s,%s",
|
|
|
|
ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_APPEND) ? "a" : "",
|
|
|
|
conference->b_profile.rec_options,
|
|
|
|
conference->b_profile.rec_command);
|
2013-02-18 22:23:52 +00:00
|
|
|
}
|
|
|
|
|
2013-03-04 20:18:36 +00:00
|
|
|
static int is_new_rec_file(const char *rec_file, struct ast_str **orig_rec_file)
|
|
|
|
{
|
|
|
|
if (!ast_strlen_zero(rec_file)) {
|
|
|
|
if (!*orig_rec_file) {
|
2015-01-27 17:48:18 +00:00
|
|
|
*orig_rec_file = ast_str_create(RECORD_FILENAME_INITIAL_SPACE);
|
2013-03-04 20:18:36 +00:00
|
|
|
}
|
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
if (*orig_rec_file
|
|
|
|
&& strcmp(ast_str_buffer(*orig_rec_file), rec_file)) {
|
2013-03-04 20:18:36 +00:00
|
|
|
ast_str_set(orig_rec_file, 0, "%s", rec_file);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Returns whether or not conference is being recorded.
|
|
|
|
*
|
2013-03-09 00:21:46 +00:00
|
|
|
* \param conference The bridge to check for recording
|
2015-01-27 17:48:18 +00:00
|
|
|
*
|
|
|
|
* \note Must be called with the conference locked
|
|
|
|
*
|
2011-04-21 18:11:40 +00:00
|
|
|
* \retval 1, conference is recording.
|
|
|
|
* \retval 0, conference is NOT recording.
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static int conf_is_recording(struct confbridge_conference *conference)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2015-01-27 17:48:18 +00:00
|
|
|
return conference->record_chan != NULL;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
/*!
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
* \internal
|
2015-01-27 17:48:18 +00:00
|
|
|
* \brief Stop recording a conference bridge
|
|
|
|
*
|
2013-03-09 00:21:46 +00:00
|
|
|
* \param conference The conference bridge on which to stop the recording
|
2015-01-27 17:48:18 +00:00
|
|
|
*
|
|
|
|
* \note Must be called with the conference locked
|
|
|
|
*
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
* \retval -1 Failure
|
|
|
|
* \retval 0 Success
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static int conf_stop_record(struct confbridge_conference *conference)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
|
|
|
struct ast_channel *chan;
|
2015-01-27 17:48:18 +00:00
|
|
|
struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_HANGUP };
|
|
|
|
|
|
|
|
if (!conf_is_recording(conference)) {
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
return -1;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2015-01-27 17:48:18 +00:00
|
|
|
|
|
|
|
/* Remove the recording channel from the conference bridge. */
|
|
|
|
chan = conference->record_chan;
|
|
|
|
conference->record_chan = NULL;
|
|
|
|
ast_queue_frame(chan, &f);
|
|
|
|
ast_channel_unref(chan);
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_test_suite_event_notify("CONF_STOP_RECORD", "Message: stopped conference recording channel\r\nConference: %s", conference->b_profile.name);
|
2013-05-21 18:00:22 +00:00
|
|
|
send_stop_record_event(conference);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
|
|
|
return 0;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
2015-01-27 17:48:18 +00:00
|
|
|
* \brief Start recording the conference
|
2011-04-21 18:11:40 +00:00
|
|
|
*
|
2013-03-09 00:21:46 +00:00
|
|
|
* \param conference The conference bridge to start recording
|
2015-01-27 17:48:18 +00:00
|
|
|
*
|
|
|
|
* \note Must be called with the conference locked
|
|
|
|
*
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
* \retval 0 success
|
2015-01-27 17:48:18 +00:00
|
|
|
* \retval non-zero failure
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static int conf_start_record(struct confbridge_conference *conference)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2015-01-27 17:48:18 +00:00
|
|
|
struct ast_app *mixmonapp;
|
|
|
|
struct ast_channel *chan;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
struct ast_format_cap *cap;
|
2015-01-27 17:48:18 +00:00
|
|
|
struct ast_bridge_features *features;
|
|
|
|
|
|
|
|
if (conf_is_recording(conference)) {
|
|
|
|
return -1;
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
mixmonapp = pbx_findapp("MixMonitor");
|
|
|
|
if (!mixmonapp) {
|
|
|
|
ast_log(LOG_WARNING, "Cannot record ConfBridge, MixMonitor app is not installed\n");
|
2011-04-21 18:11:40 +00:00
|
|
|
return -1;
|
|
|
|
}
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
features = ast_bridge_features_new();
|
|
|
|
if (!features) {
|
2011-04-21 18:11:40 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2015-01-27 17:48:18 +00:00
|
|
|
ast_set_flag(&features->feature_flags, AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
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
|
|
|
cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
|
2013-05-21 18:00:22 +00:00
|
|
|
if (!cap) {
|
2015-01-27 17:48:18 +00:00
|
|
|
ast_bridge_features_destroy(features);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
return -1;
|
|
|
|
}
|
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
|
|
|
ast_format_cap_append(cap, ast_format_slin, 0);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
/* Create the recording channel. */
|
|
|
|
chan = ast_request("CBRec", cap, NULL, NULL, conference->name, NULL);
|
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
|
|
|
ao2_ref(cap, -1);
|
2015-01-27 17:48:18 +00:00
|
|
|
if (!chan) {
|
|
|
|
ast_bridge_features_destroy(features);
|
2011-04-21 18:11:40 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
/* Start recording. */
|
|
|
|
set_rec_filename(conference, &conference->record_filename,
|
|
|
|
is_new_rec_file(conference->b_profile.rec_file, &conference->orig_rec_file));
|
|
|
|
ast_answer(chan);
|
|
|
|
pbx_exec(chan, mixmonapp, ast_str_buffer(conference->record_filename));
|
|
|
|
|
|
|
|
/* Put the channel into the conference bridge. */
|
|
|
|
ast_channel_ref(chan);
|
|
|
|
conference->record_chan = chan;
|
|
|
|
if (ast_bridge_impart(conference->bridge, chan, NULL, features,
|
|
|
|
AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
|
|
|
|
ast_hangup(chan);
|
|
|
|
ast_channel_unref(chan);
|
|
|
|
conference->record_chan = NULL;
|
2011-04-21 18:11:40 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
ast_test_suite_event_notify("CONF_START_RECORD", "Message: started conference recording channel\r\nConference: %s", conference->b_profile.name);
|
|
|
|
send_start_record_event(conference);
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-03-26 17:13:26 +00:00
|
|
|
/* \brief Playback the given filename and monitor for any dtmf interrupts.
|
|
|
|
*
|
|
|
|
* This function is used to playback sound files on a given channel and optionally
|
|
|
|
* allow dtmf interrupts to occur.
|
|
|
|
*
|
|
|
|
* If the optional bridge_channel parameter is given then sound file playback
|
|
|
|
* is played on that channel and dtmf interruptions are allowed. However, if
|
|
|
|
* bridge_channel is not set then the channel parameter is expected to be set
|
|
|
|
* instead and non interruptible playback is played on that channel.
|
|
|
|
*
|
|
|
|
* \param bridge_channel Bridge channel to play file on
|
|
|
|
* \param channel Optional channel to play file on if bridge_channel not given
|
|
|
|
* \param filename The file name to playback
|
|
|
|
*
|
|
|
|
* \retval -1 failure during playback, 0 on file was fully played, 1 on dtmf interrupt.
|
|
|
|
*/
|
|
|
|
static int play_file(struct ast_bridge_channel *bridge_channel, struct ast_channel *channel,
|
|
|
|
const char *filename)
|
|
|
|
{
|
|
|
|
struct ast_channel *chan;
|
|
|
|
const char *stop_digits;
|
|
|
|
int digit;
|
|
|
|
|
|
|
|
if (bridge_channel) {
|
|
|
|
chan = bridge_channel->chan;
|
|
|
|
stop_digits = AST_DIGIT_ANY;
|
|
|
|
} else {
|
|
|
|
chan = channel;
|
|
|
|
stop_digits = AST_DIGIT_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
digit = ast_stream_and_wait(chan, filename, stop_digits);
|
|
|
|
if (digit < 0) {
|
|
|
|
ast_log(LOG_WARNING, "Failed to playback file '%s' to channel\n", filename);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (digit > 0) {
|
|
|
|
ast_stopstream(bridge_channel->chan);
|
|
|
|
ast_bridge_channel_feature_digit_add(bridge_channel, digit);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-22 00:36:52 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Complain if the given sound file does not exist.
|
|
|
|
*
|
|
|
|
* \param filename Sound file to check if exists.
|
|
|
|
*
|
|
|
|
* \retval non-zero if the file exists.
|
|
|
|
*/
|
|
|
|
static int sound_file_exists(const char *filename)
|
|
|
|
{
|
|
|
|
if (ast_fileexists(filename, NULL, NULL)) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
ast_log(LOG_WARNING, "File %s does not exist in any format\n", filename);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/*!
|
|
|
|
* \brief Announce number of users in the conference bridge to the caller
|
|
|
|
*
|
2013-03-09 00:21:46 +00:00
|
|
|
* \param conference Conference bridge to peek at
|
|
|
|
* \param user Optional Caller
|
2015-03-26 17:13:26 +00:00
|
|
|
* \param bridge_channel The bridged channel involved
|
2009-03-05 18:18:27 +00:00
|
|
|
*
|
2011-04-21 18:11:40 +00:00
|
|
|
* \note if caller is NULL, the announcment will be sent to all participants in the conference.
|
2011-06-21 16:06:46 +00:00
|
|
|
* \return Returns 0 on success, -1 if the user hung up
|
2009-03-05 18:18:27 +00:00
|
|
|
*/
|
2015-03-26 17:13:26 +00:00
|
|
|
static int announce_user_count(struct confbridge_conference *conference, struct confbridge_user *user,
|
|
|
|
struct ast_bridge_channel *bridge_channel)
|
2009-03-05 18:18:27 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
const char *other_in_party = conf_get_sound(CONF_SOUND_OTHER_IN_PARTY, conference->b_profile.sounds);
|
|
|
|
const char *only_one = conf_get_sound(CONF_SOUND_ONLY_ONE, conference->b_profile.sounds);
|
|
|
|
const char *there_are = conf_get_sound(CONF_SOUND_THERE_ARE, conference->b_profile.sounds);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (conference->activeusers <= 1) {
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
/* Awww we are the only person in the conference bridge OR we only have waitmarked users */
|
2011-06-21 16:06:46 +00:00
|
|
|
return 0;
|
2013-03-09 00:21:46 +00:00
|
|
|
} else if (conference->activeusers == 2) {
|
|
|
|
if (user) {
|
2011-04-21 18:11:40 +00:00
|
|
|
/* Eep, there is one other person */
|
2015-03-26 17:13:26 +00:00
|
|
|
if (play_file(bridge_channel, user->chan, only_one) < 0) {
|
2011-06-21 16:06:46 +00:00
|
|
|
return -1;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
} else {
|
2013-03-09 00:21:46 +00:00
|
|
|
play_sound_file(conference, only_one);
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Alas multiple others in here */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (user) {
|
|
|
|
if (ast_stream_and_wait(user->chan,
|
2011-04-21 18:11:40 +00:00
|
|
|
there_are,
|
|
|
|
"")) {
|
2011-06-21 16:06:46 +00:00
|
|
|
return -1;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_say_number(user->chan, conference->activeusers - 1, "", ast_channel_language(user->chan), NULL)) {
|
2011-06-21 16:06:46 +00:00
|
|
|
return -1;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2015-03-26 17:13:26 +00:00
|
|
|
if (play_file(bridge_channel, user->chan, other_in_party) < 0) {
|
2011-06-21 16:06:46 +00:00
|
|
|
return -1;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2013-01-22 00:36:52 +00:00
|
|
|
} else if (sound_file_exists(there_are) && sound_file_exists(other_in_party)) {
|
2013-03-09 00:21:46 +00:00
|
|
|
play_sound_file(conference, there_are);
|
|
|
|
play_sound_number(conference, conference->activeusers - 1);
|
|
|
|
play_sound_file(conference, other_in_party);
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
}
|
2011-06-21 16:06:46 +00:00
|
|
|
return 0;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Play back an audio file to a channel
|
|
|
|
*
|
2013-03-09 00:21:46 +00:00
|
|
|
* \param user User to play audio prompt to
|
2013-02-05 19:11:33 +00:00
|
|
|
* \param filename Prompt to play
|
2009-03-05 18:18:27 +00:00
|
|
|
*
|
2011-06-21 16:06:46 +00:00
|
|
|
* \return Returns 0 on success, -1 if the user hung up
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
* \note Generally this should be called when the conference is unlocked to avoid blocking
|
|
|
|
* the entire conference while the sound is played. But don't unlock the conference bridge
|
|
|
|
* in the middle of a state transition.
|
2009-03-05 18:18:27 +00:00
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static int play_prompt_to_user(struct confbridge_user *user, const char *filename)
|
2009-03-05 18:18:27 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
return ast_stream_and_wait(user->chan, filename, "");
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static void handle_video_on_join(struct confbridge_conference *conference, struct ast_channel *chan, int marked)
|
2011-06-30 20:33:15 +00:00
|
|
|
{
|
2011-07-07 17:24:57 +00:00
|
|
|
/* Right now, only marked users are automatically set as the single src of video.*/
|
|
|
|
if (!marked) {
|
2011-06-30 20:33:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED)) {
|
2011-06-30 20:33:15 +00:00
|
|
|
int set = 1;
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_user *user = NULL;
|
|
|
|
|
|
|
|
ao2_lock(conference);
|
2011-06-30 20:33:15 +00:00
|
|
|
/* see if anyone is already the video src */
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
|
|
|
if (user->chan == chan) {
|
2011-06-30 20:33:15 +00:00
|
|
|
continue;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_bridge_is_video_src(conference->bridge, user->chan)) {
|
2011-06-30 20:33:15 +00:00
|
|
|
set = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
2011-06-30 20:33:15 +00:00
|
|
|
if (set) {
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_set_single_src_video_mode(conference->bridge, chan);
|
2011-06-30 20:33:15 +00:00
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_LAST_MARKED)) {
|
2011-06-30 20:33:15 +00:00
|
|
|
/* we joined and are video capable, we override anyone else that may have already been the video feed */
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_set_single_src_video_mode(conference->bridge, chan);
|
2011-06-30 20:33:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static void handle_video_on_exit(struct confbridge_conference *conference, struct ast_channel *chan)
|
2011-06-30 20:33:15 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_user *user = NULL;
|
2011-06-30 20:33:15 +00:00
|
|
|
|
|
|
|
/* if this isn't a video source, nothing to update */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!ast_bridge_is_video_src(conference->bridge, chan)) {
|
2011-06-30 20:33:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_remove_video_src(conference->bridge, chan);
|
2011-07-07 17:24:57 +00:00
|
|
|
|
|
|
|
/* If in follow talker mode, make sure to restore this mode on the
|
|
|
|
* bridge when a source is removed. It is possible this channel was
|
|
|
|
* only set temporarily as a video source by an AMI or DTMF action. */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER)) {
|
|
|
|
ast_bridge_set_talker_src_video_mode(conference->bridge);
|
2011-07-07 17:24:57 +00:00
|
|
|
}
|
2011-06-30 20:33:15 +00:00
|
|
|
|
|
|
|
/* if the video_mode isn't set to automatically pick the video source, do nothing on exit. */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED) &&
|
|
|
|
!ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_LAST_MARKED)) {
|
2011-06-30 20:33:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-07-07 17:24:57 +00:00
|
|
|
/* Make the next available marked user the video src. */
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
|
|
|
if (user->chan == chan) {
|
2011-06-30 20:33:15 +00:00
|
|
|
continue;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)) {
|
|
|
|
ast_bridge_set_single_src_video_mode(conference->bridge, user->chan);
|
2011-06-30 20:33:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
2011-06-30 20:33:15 +00:00
|
|
|
}
|
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
struct hangup_data
|
|
|
|
{
|
|
|
|
struct confbridge_conference *conference;
|
|
|
|
ast_mutex_t lock;
|
|
|
|
ast_cond_t cond;
|
|
|
|
int hungup;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Hang up the announcer channel
|
|
|
|
*
|
|
|
|
* This hangs up the announcer channel in the conference. This
|
|
|
|
* runs in the playback queue taskprocessor since we do not want
|
|
|
|
* to hang up the channel while it's trying to play an announcement.
|
|
|
|
*
|
|
|
|
* This task is performed synchronously, so there is no need to
|
|
|
|
* perform any cleanup on the passed-in data.
|
|
|
|
*
|
|
|
|
* \param data A hangup_data structure
|
|
|
|
* \return 0
|
|
|
|
*/
|
|
|
|
static int hangup_playback(void *data)
|
|
|
|
{
|
|
|
|
struct hangup_data *hangup = data;
|
|
|
|
|
|
|
|
ast_autoservice_stop(hangup->conference->playback_chan);
|
|
|
|
|
|
|
|
ast_hangup(hangup->conference->playback_chan);
|
|
|
|
hangup->conference->playback_chan = NULL;
|
|
|
|
|
|
|
|
ast_mutex_lock(&hangup->lock);
|
|
|
|
hangup->hungup = 1;
|
|
|
|
ast_cond_signal(&hangup->cond);
|
|
|
|
ast_mutex_unlock(&hangup->lock);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void hangup_data_init(struct hangup_data *hangup, struct confbridge_conference *conference)
|
|
|
|
{
|
|
|
|
ast_mutex_init(&hangup->lock);
|
|
|
|
ast_cond_init(&hangup->cond, NULL);
|
|
|
|
|
|
|
|
hangup->conference = conference;
|
|
|
|
hangup->hungup = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void hangup_data_destroy(struct hangup_data *hangup)
|
|
|
|
{
|
|
|
|
ast_mutex_destroy(&hangup->lock);
|
|
|
|
ast_cond_destroy(&hangup->cond);
|
|
|
|
}
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/*!
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
* \brief Destroy a conference bridge
|
2009-03-05 18:18:27 +00:00
|
|
|
*
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
* \param obj The conference bridge object
|
2009-03-05 18:18:27 +00:00
|
|
|
*
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
* \return Returns nothing
|
2009-03-05 18:18:27 +00:00
|
|
|
*/
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
static void destroy_conference_bridge(void *obj)
|
2009-03-05 18:18:27 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_conference *conference = obj;
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_debug(1, "Destroying conference bridge '%s'\n", conference->name);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (conference->playback_chan) {
|
2016-08-10 20:14:09 +00:00
|
|
|
if (conference->playback_queue) {
|
|
|
|
struct hangup_data hangup;
|
|
|
|
hangup_data_init(&hangup, conference);
|
|
|
|
ast_taskprocessor_push(conference->playback_queue, hangup_playback, &hangup);
|
|
|
|
|
|
|
|
ast_mutex_lock(&hangup.lock);
|
|
|
|
while (!hangup.hungup) {
|
|
|
|
ast_cond_wait(&hangup.cond, &hangup.lock);
|
|
|
|
}
|
|
|
|
ast_mutex_unlock(&hangup.lock);
|
|
|
|
hangup_data_destroy(&hangup);
|
|
|
|
} else {
|
|
|
|
/* Playback queue is not yet allocated. Just hang up the channel straight */
|
|
|
|
ast_hangup(conference->playback_chan);
|
|
|
|
conference->playback_chan = NULL;
|
|
|
|
}
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
/* Destroying a conference bridge is simple, all we have to do is destroy the bridging object */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (conference->bridge) {
|
2013-08-22 21:09:52 +00:00
|
|
|
ast_bridge_destroy(conference->bridge, 0);
|
2013-03-09 00:21:46 +00:00
|
|
|
conference->bridge = NULL;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
2012-12-07 00:00:39 +00:00
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
ast_channel_cleanup(conference->record_chan);
|
|
|
|
ast_free(conference->orig_rec_file);
|
|
|
|
ast_free(conference->record_filename);
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
conf_bridge_profile_destroy(&conference->b_profile);
|
2016-08-10 20:14:09 +00:00
|
|
|
ast_taskprocessor_unreference(conference->playback_queue);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Call the proper join event handler for the user for the conference bridge's current state
|
|
|
|
* \internal
|
2013-03-09 00:21:46 +00:00
|
|
|
* \param user The conference bridge user that is joining
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
* \retval 0 success
|
|
|
|
* \retval -1 failure
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static int handle_conf_user_join(struct confbridge_user *user)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
|
|
|
conference_event_fn handler;
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)) {
|
|
|
|
handler = user->conference->state->join_marked;
|
|
|
|
} else if (ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED)) {
|
|
|
|
handler = user->conference->state->join_waitmarked;
|
2009-03-05 18:18:27 +00:00
|
|
|
} else {
|
2013-03-09 00:21:46 +00:00
|
|
|
handler = user->conference->state->join_unmarked;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ast_assert(handler != NULL);
|
|
|
|
|
|
|
|
if (!handler) {
|
2013-03-09 00:21:46 +00:00
|
|
|
conf_invalid_event_fn(user);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
return -1;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
handler(user);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2011-06-21 16:06:46 +00:00
|
|
|
return 0;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
/*! \brief Call the proper leave event handler for the user for the conference bridge's current state
|
|
|
|
* \internal
|
2013-03-09 00:21:46 +00:00
|
|
|
* \param user The conference bridge user that is leaving
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
* \retval 0 success
|
|
|
|
* \retval -1 failure
|
2009-03-05 18:18:27 +00:00
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static int handle_conf_user_leave(struct confbridge_user *user)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
|
|
|
conference_event_fn handler;
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)) {
|
|
|
|
handler = user->conference->state->leave_marked;
|
|
|
|
} else if (ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED)) {
|
|
|
|
handler = user->conference->state->leave_waitmarked;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
} else {
|
2013-03-09 00:21:46 +00:00
|
|
|
handler = user->conference->state->leave_unmarked;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
ast_assert(handler != NULL);
|
|
|
|
|
|
|
|
if (!handler) {
|
|
|
|
/* This should never happen. If it does, though, it is bad. The user will not have been removed
|
|
|
|
* from the appropriate list, so counts will be off and stuff. The conference won't be torn down, etc.
|
|
|
|
* Shouldn't happen, though. */
|
2013-03-09 00:21:46 +00:00
|
|
|
conf_invalid_event_fn(user);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
return -1;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
handler(user);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-11-02 03:24:47 +00:00
|
|
|
void conf_update_user_mute(struct confbridge_user *user)
|
|
|
|
{
|
|
|
|
int mute_user;
|
|
|
|
int mute_system;
|
|
|
|
int mute_effective;
|
|
|
|
|
|
|
|
/* User level mute request. */
|
|
|
|
mute_user = user->muted;
|
|
|
|
|
|
|
|
/* System level mute request. */
|
|
|
|
mute_system = user->playing_moh
|
|
|
|
/*
|
|
|
|
* Do not allow waitmarked users to talk to anyone unless there
|
|
|
|
* is a marked user present.
|
|
|
|
*/
|
|
|
|
|| (!user->conference->markedusers
|
|
|
|
&& ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED));
|
|
|
|
|
|
|
|
mute_effective = mute_user || mute_system;
|
|
|
|
|
|
|
|
ast_debug(1, "User %s is %s: user:%d system:%d.\n",
|
|
|
|
ast_channel_name(user->chan), mute_effective ? "muted" : "unmuted",
|
|
|
|
mute_user, mute_system);
|
|
|
|
user->features.mute = mute_effective;
|
2014-03-20 23:02:45 +00:00
|
|
|
ast_test_suite_event_notify("CONF_MUTE_UPDATE",
|
|
|
|
"Mode: %s\r\n"
|
|
|
|
"Conference: %s\r\n"
|
|
|
|
"Channel: %s",
|
|
|
|
mute_effective ? "muted" : "unmuted",
|
2016-01-25 23:36:50 +00:00
|
|
|
user->conference->b_profile.name,
|
2014-03-20 23:02:45 +00:00
|
|
|
ast_channel_name(user->chan));
|
2013-11-02 03:24:47 +00:00
|
|
|
}
|
|
|
|
|
2016-01-25 23:34:20 +00:00
|
|
|
/*
|
|
|
|
* \internal
|
|
|
|
* \brief Mute/unmute a single user.
|
|
|
|
*/
|
|
|
|
static void generic_mute_unmute_user(struct confbridge_conference *conference, struct confbridge_user *user, int mute)
|
|
|
|
{
|
|
|
|
/* Set user level mute request. */
|
|
|
|
user->muted = mute ? 1 : 0;
|
|
|
|
|
|
|
|
conf_update_user_mute(user);
|
|
|
|
ast_test_suite_event_notify("CONF_MUTE",
|
|
|
|
"Message: participant %s %s\r\n"
|
|
|
|
"Conference: %s\r\n"
|
|
|
|
"Channel: %s",
|
|
|
|
ast_channel_name(user->chan),
|
|
|
|
mute ? "muted" : "unmuted",
|
|
|
|
conference->b_profile.name,
|
|
|
|
ast_channel_name(user->chan));
|
|
|
|
if (mute) {
|
|
|
|
send_mute_event(user, conference);
|
|
|
|
} else {
|
|
|
|
send_unmute_event(user, conference);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_moh_stop(struct confbridge_user *user)
|
2012-12-13 21:28:15 +00:00
|
|
|
{
|
|
|
|
user->playing_moh = 0;
|
|
|
|
if (!user->suspended_moh) {
|
|
|
|
int in_bridge;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Locking the ast_bridge here is the only way to hold off the
|
|
|
|
* call to ast_bridge_join() in confbridge_exec() from
|
|
|
|
* interfering with the bridge and MOH operations here.
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_lock(user->conference->bridge);
|
2012-12-13 21:28:15 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Temporarily suspend the user from the bridge so we have
|
|
|
|
* control to stop MOH if needed.
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
in_bridge = !ast_bridge_suspend(user->conference->bridge, user->chan);
|
2012-12-13 21:28:15 +00:00
|
|
|
ast_moh_stop(user->chan);
|
|
|
|
if (in_bridge) {
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_unsuspend(user->conference->bridge, user->chan);
|
2012-12-13 21:28:15 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_unlock(user->conference->bridge);
|
2012-12-13 21:28:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_moh_start(struct confbridge_user *user)
|
2012-12-13 21:28:15 +00:00
|
|
|
{
|
|
|
|
user->playing_moh = 1;
|
|
|
|
if (!user->suspended_moh) {
|
|
|
|
int in_bridge;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Locking the ast_bridge here is the only way to hold off the
|
|
|
|
* call to ast_bridge_join() in confbridge_exec() from
|
|
|
|
* interfering with the bridge and MOH operations here.
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_lock(user->conference->bridge);
|
2012-12-13 21:28:15 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Temporarily suspend the user from the bridge so we have
|
|
|
|
* control to start MOH if needed.
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
in_bridge = !ast_bridge_suspend(user->conference->bridge, user->chan);
|
2012-12-13 21:28:15 +00:00
|
|
|
ast_moh_start(user->chan, user->u_profile.moh_class, NULL);
|
|
|
|
if (in_bridge) {
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_unsuspend(user->conference->bridge, user->chan);
|
2012-12-13 21:28:15 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_unlock(user->conference->bridge);
|
2012-12-13 21:28:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Unsuspend MOH for the conference user.
|
|
|
|
*
|
|
|
|
* \param user Conference user to unsuspend MOH on.
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static void conf_moh_unsuspend(struct confbridge_user *user)
|
2012-12-13 21:28:15 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(user->conference);
|
2012-12-13 21:28:15 +00:00
|
|
|
if (--user->suspended_moh == 0 && user->playing_moh) {
|
|
|
|
ast_moh_start(user->chan, user->u_profile.moh_class, NULL);
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(user->conference);
|
2012-12-13 21:28:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Suspend MOH for the conference user.
|
|
|
|
*
|
|
|
|
* \param user Conference user to suspend MOH on.
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static void conf_moh_suspend(struct confbridge_user *user)
|
2012-12-13 21:28:15 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(user->conference);
|
2012-12-13 21:28:15 +00:00
|
|
|
if (user->suspended_moh++ == 0 && user->playing_moh) {
|
|
|
|
ast_moh_stop(user->chan);
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(user->conference);
|
2012-12-13 21:28:15 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
int conf_handle_inactive_waitmarked(struct confbridge_user *user)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
|
|
|
/* If we have not been quieted play back that they are waiting for the leader */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!ast_test_flag(&user->u_profile, USER_OPT_QUIET) && play_prompt_to_user(user,
|
2016-01-25 23:36:50 +00:00
|
|
|
conf_get_sound(CONF_SOUND_WAIT_FOR_LEADER, user->conference->b_profile.sounds))) {
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
/* user hungup while the sound was playing */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
int conf_handle_only_unmarked(struct confbridge_user *user)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
|
|
|
/* If audio prompts have not been quieted or this prompt quieted play it on out */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!ast_test_flag(&user->u_profile, USER_OPT_QUIET | USER_OPT_NOONLYPERSON)) {
|
|
|
|
if (play_prompt_to_user(user,
|
2016-01-25 23:36:50 +00:00
|
|
|
conf_get_sound(CONF_SOUND_ONLY_PERSON, user->conference->b_profile.sounds))) {
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
/* user hungup while the sound was playing */
|
2011-06-21 16:06:46 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2011-06-21 16:06:46 +00:00
|
|
|
return 0;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
int conf_add_post_join_action(struct confbridge_user *user, int (*func)(struct confbridge_user *user))
|
2009-03-05 18:18:27 +00:00
|
|
|
{
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
struct post_join_action *action;
|
|
|
|
if (!(action = ast_calloc(1, sizeof(*action)))) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
action->func = func;
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_INSERT_TAIL(&user->post_join_list, action, list);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_handle_first_join(struct confbridge_conference *conference)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, "confbridge:%s", conference->name);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_handle_second_active(struct confbridge_conference *conference)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
|
|
|
/* If we are the second participant we may need to stop music on hold on the first */
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_user *first_user = AST_LIST_FIRST(&conference->active_list);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&first_user->u_profile, USER_OPT_MUSICONHOLD)) {
|
|
|
|
conf_moh_stop(first_user);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
2013-11-02 03:24:47 +00:00
|
|
|
conf_update_user_mute(first_user);
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_ended(struct confbridge_conference *conference)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
2016-05-04 07:40:55 +00:00
|
|
|
struct pbx_find_info q = { .stacklen = 0 };
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
/* Called with a reference to conference */
|
|
|
|
ao2_unlink(conference_bridges, conference);
|
2013-05-21 18:00:22 +00:00
|
|
|
send_conf_end_event(conference);
|
2016-05-04 07:40:55 +00:00
|
|
|
if (!ast_strlen_zero(conference->b_profile.regcontext) &&
|
|
|
|
pbx_find_extension(NULL, NULL, &q, conference->b_profile.regcontext,
|
|
|
|
conference->name, 1, NULL, "", E_MATCH)) {
|
|
|
|
ast_context_remove_extension(conference->b_profile.regcontext,
|
|
|
|
conference->name, 1, NULL);
|
|
|
|
}
|
2015-01-27 17:48:18 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
conf_stop_record(conference);
|
|
|
|
ao2_unlock(conference);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
2011-06-21 16:06:46 +00:00
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Allocate playback channel for a conference.
|
|
|
|
* \pre expects conference to be locked before calling this function
|
|
|
|
*/
|
|
|
|
static int alloc_playback_chan(struct confbridge_conference *conference)
|
|
|
|
{
|
|
|
|
struct ast_format_cap *cap;
|
|
|
|
char taskprocessor_name[AST_TASKPROCESSOR_MAX_NAME + 1];
|
|
|
|
|
|
|
|
cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
|
|
|
|
if (!cap) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
ast_format_cap_append(cap, ast_format_slin, 0);
|
|
|
|
conference->playback_chan = ast_request("CBAnn", cap, NULL, NULL,
|
|
|
|
conference->name, NULL);
|
|
|
|
ao2_ref(cap, -1);
|
|
|
|
if (!conference->playback_chan) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* To make sure playback_chan has the same language as the bridge */
|
|
|
|
ast_channel_lock(conference->playback_chan);
|
|
|
|
ast_channel_language_set(conference->playback_chan, conference->b_profile.language);
|
|
|
|
ast_channel_unlock(conference->playback_chan);
|
|
|
|
|
|
|
|
ast_debug(1, "Created announcer channel '%s' to conference bridge '%s'\n",
|
|
|
|
ast_channel_name(conference->playback_chan), conference->name);
|
|
|
|
|
|
|
|
ast_taskprocessor_build_name(taskprocessor_name, sizeof(taskprocessor_name),
|
|
|
|
"Confbridge/%s", conference->name);
|
|
|
|
conference->playback_queue = ast_taskprocessor_get(taskprocessor_name, TPS_REF_DEFAULT);
|
|
|
|
if (!conference->playback_queue) {
|
|
|
|
ast_hangup(conference->playback_chan);
|
|
|
|
conference->playback_chan = NULL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Push the announcer channel into the bridge
|
|
|
|
*
|
|
|
|
* This runs in the playback queue taskprocessor.
|
|
|
|
*
|
|
|
|
* \param data A confbridge_conference
|
|
|
|
* \retval 0 Success
|
|
|
|
* \retval -1 Failed to push the channel to the bridge
|
|
|
|
*/
|
|
|
|
static int push_announcer(void *data)
|
|
|
|
{
|
|
|
|
struct confbridge_conference *conference = data;
|
|
|
|
|
|
|
|
if (conf_announce_channel_push(conference->playback_chan)) {
|
|
|
|
ast_hangup(conference->playback_chan);
|
|
|
|
conference->playback_chan = NULL;
|
|
|
|
ao2_cleanup(conference);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_autoservice_start(conference->playback_chan);
|
|
|
|
ao2_cleanup(conference);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/*!
|
|
|
|
* \brief Join a conference bridge
|
|
|
|
*
|
2013-03-09 00:21:46 +00:00
|
|
|
* \param conference_name The conference name
|
|
|
|
* \param user Conference bridge user structure
|
2009-03-05 18:18:27 +00:00
|
|
|
*
|
|
|
|
* \return A pointer to the conference bridge struct, or NULL if the conference room wasn't found.
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static struct confbridge_conference *join_conference_bridge(const char *conference_name, struct confbridge_user *user)
|
2009-03-05 18:18:27 +00:00
|
|
|
{
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_conference *conference;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
struct post_join_action *action;
|
2011-04-21 18:11:40 +00:00
|
|
|
int max_members_reached = 0;
|
2009-03-05 18:18:27 +00:00
|
|
|
|
|
|
|
/* We explictly lock the conference bridges container ourselves so that other callers can not create duplicate conferences at the same */
|
|
|
|
ao2_lock(conference_bridges);
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_debug(1, "Trying to find conference bridge '%s'\n", conference_name);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
|
|
|
/* Attempt to find an existing conference bridge */
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (conference && conference->b_profile.max_members) {
|
|
|
|
max_members_reached = conference->b_profile.max_members > conference->activeusers ? 0 : 1;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/* When finding a conference bridge that already exists make sure that it is not locked, and if so that we are not an admin */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (conference && (max_members_reached || conference->locked) && !ast_test_flag(&user->u_profile, USER_OPT_ADMIN)) {
|
2009-03-05 18:18:27 +00:00
|
|
|
ao2_unlock(conference_bridges);
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_debug(1, "Conference '%s' is locked and caller is not an admin\n", conference_name);
|
|
|
|
ast_stream_and_wait(user->chan,
|
2016-01-25 23:36:50 +00:00
|
|
|
conf_get_sound(CONF_SOUND_LOCKED, conference->b_profile.sounds),
|
|
|
|
"");
|
|
|
|
ao2_ref(conference, -1);
|
2009-03-05 18:18:27 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If no conference bridge was found see if we can create one */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2009-03-05 18:18:27 +00:00
|
|
|
/* Try to allocate memory for a new conference bridge, if we fail... this won't end well. */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!(conference = ao2_alloc(sizeof(*conference), destroy_conference_bridge))) {
|
2009-03-05 18:18:27 +00:00
|
|
|
ao2_unlock(conference_bridges);
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_log(LOG_ERROR, "Conference '%s' could not be created.\n", conference_name);
|
2009-03-05 18:18:27 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
/* Setup for the record channel */
|
|
|
|
conference->record_filename = ast_str_create(RECORD_FILENAME_INITIAL_SPACE);
|
|
|
|
if (!conference->record_filename) {
|
|
|
|
ao2_ref(conference, -1);
|
|
|
|
ao2_unlock(conference_bridges);
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-12-07 00:00:39 +00:00
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/* Setup conference bridge parameters */
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_copy_string(conference->name, conference_name, sizeof(conference->name));
|
|
|
|
conf_bridge_profile_copy(&conference->b_profile, &user->b_profile);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
|
|
|
/* Create an actual bridge that will do the audio mixing */
|
2013-05-21 18:00:22 +00:00
|
|
|
conference->bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_MULTIMIX,
|
2013-12-17 23:25:49 +00:00
|
|
|
AST_BRIDGE_FLAG_MASQUERADE_ONLY | AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY,
|
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it. Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation. This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first. In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.
Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.
(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........
Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
|
|
|
app, conference_name, NULL);
|
2013-05-21 18:00:22 +00:00
|
|
|
if (!conference->bridge) {
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_ref(conference, -1);
|
2009-03-05 18:18:27 +00:00
|
|
|
ao2_unlock(conference_bridges);
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_log(LOG_ERROR, "Conference '%s' mixing bridge could not be created.\n", conference_name);
|
2009-03-05 18:18:27 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* Set the internal sample rate on the bridge from the bridge profile */
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_set_internal_sample_rate(conference->bridge, conference->b_profile.internal_sample_rate);
|
2011-04-21 18:11:40 +00:00
|
|
|
/* Set the internal mixing interval on the bridge from the bridge profile */
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_set_mixing_interval(conference->bridge, conference->b_profile.mix_interval);
|
2016-08-12 16:23:18 +00:00
|
|
|
ast_bridge_set_binaural_active(conference->bridge, ast_test_flag(&conference->b_profile, BRIDGE_OPT_BINAURAL_ACTIVE));
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER)) {
|
|
|
|
ast_bridge_set_talker_src_video_mode(conference->bridge);
|
2011-06-30 20:33:15 +00:00
|
|
|
}
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/* Link it into the conference bridges container */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!ao2_link(conference_bridges, conference)) {
|
|
|
|
ao2_ref(conference, -1);
|
2012-12-07 00:00:39 +00:00
|
|
|
ao2_unlock(conference_bridges);
|
|
|
|
ast_log(LOG_ERROR,
|
2013-03-09 00:21:46 +00:00
|
|
|
"Conference '%s' could not be added to the conferences list.\n", conference_name);
|
2012-12-07 00:00:39 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
/* Set the initial state to EMPTY */
|
2013-03-09 00:21:46 +00:00
|
|
|
conference->state = CONF_STATE_EMPTY;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
if (alloc_playback_chan(conference)) {
|
|
|
|
ao2_unlink(conference_bridges, conference);
|
|
|
|
ao2_ref(conference, -1);
|
|
|
|
ao2_unlock(conference_bridges);
|
|
|
|
ast_log(LOG_ERROR, "Could not allocate announcer channel for conference '%s'\n", conference_name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ast_taskprocessor_push(conference->playback_queue, push_announcer, ao2_bump(conference))) {
|
|
|
|
ao2_unlink(conference_bridges, conference);
|
|
|
|
ao2_ref(conference, -1);
|
|
|
|
ao2_unlock(conference_bridges);
|
|
|
|
ast_log(LOG_ERROR, "Could not add announcer channel for conference '%s' bridge\n", conference_name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_CONFERENCE)) {
|
|
|
|
ao2_lock(conference);
|
2015-01-27 17:48:18 +00:00
|
|
|
conf_start_record(conference);
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
send_conf_start_event(conference);
|
2016-05-04 07:40:55 +00:00
|
|
|
|
|
|
|
if (!ast_strlen_zero(conference->b_profile.regcontext)) {
|
|
|
|
if (!ast_exists_extension(NULL, conference->b_profile.regcontext, conference->name, 1, NULL)) {
|
|
|
|
ast_add_extension(conference->b_profile.regcontext, 1, conference->name, 1, NULL, NULL, "Noop", NULL, NULL, "ConfBridge");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_debug(1, "Created conference '%s' and linked to container.\n", conference_name);
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ao2_unlock(conference_bridges);
|
|
|
|
|
|
|
|
/* Setup conference bridge user parameters */
|
2013-03-09 00:21:46 +00:00
|
|
|
user->conference = conference;
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2016-01-25 21:48:04 +00:00
|
|
|
/* Determine if the new user should join the conference muted. */
|
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_STARTMUTED)
|
|
|
|
|| (!ast_test_flag(&user->u_profile, USER_OPT_ADMIN) && conference->muted)) {
|
|
|
|
/* Set user level mute request. */
|
|
|
|
user->muted = 1;
|
|
|
|
}
|
|
|
|
|
2012-12-13 21:28:15 +00:00
|
|
|
/*
|
|
|
|
* Suspend any MOH until the user actually joins the bridge of
|
|
|
|
* the conference. This way any pre-join file playback does not
|
|
|
|
* need to worry about MOH.
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
user->suspended_moh = 1;
|
2012-12-13 21:28:15 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (handle_conf_user_join(user)) {
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
/* Invalid event, nothing was done, so we don't want to process a leave. */
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
|
|
|
ao2_ref(conference, -1);
|
2016-01-25 23:36:50 +00:00
|
|
|
user->conference = NULL;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
return NULL;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_check_hangup(user->chan)) {
|
|
|
|
ao2_unlock(conference);
|
|
|
|
leave_conference(user);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
return NULL;
|
2010-03-29 14:07:44 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2013-02-05 19:11:33 +00:00
|
|
|
/* If an announcement is to be played play it */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!ast_strlen_zero(user->u_profile.announcement)) {
|
|
|
|
if (play_prompt_to_user(user,
|
|
|
|
user->u_profile.announcement)) {
|
|
|
|
leave_conference(user);
|
2013-02-05 19:11:33 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
/* Announce number of users if need be */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_ANNOUNCEUSERCOUNT)) {
|
2015-03-26 17:13:26 +00:00
|
|
|
if (announce_user_count(conference, user, NULL)) {
|
2013-03-09 00:21:46 +00:00
|
|
|
leave_conference(user);
|
2012-03-10 20:06:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_ANNOUNCEUSERCOUNTALL) &&
|
|
|
|
(conference->activeusers > user->u_profile.announce_user_count_all_after)) {
|
2013-01-22 00:36:52 +00:00
|
|
|
int user_count_res;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We have to autoservice the new user because he has not quite
|
|
|
|
* joined the conference yet.
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_autoservice_start(user->chan);
|
2015-03-26 17:13:26 +00:00
|
|
|
user_count_res = announce_user_count(conference, NULL, NULL);
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_autoservice_stop(user->chan);
|
2013-01-22 00:36:52 +00:00
|
|
|
if (user_count_res) {
|
2013-03-09 00:21:46 +00:00
|
|
|
leave_conference(user);
|
2011-06-21 16:06:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
/* Handle post-join actions */
|
2013-03-09 00:21:46 +00:00
|
|
|
while ((action = AST_LIST_REMOVE_HEAD(&user->post_join_list, list))) {
|
|
|
|
action->func(user);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
ast_free(action);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
return conference;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2012-12-07 00:00:39 +00:00
|
|
|
* \brief Leave a conference
|
2009-03-05 18:18:27 +00:00
|
|
|
*
|
2012-12-07 00:00:39 +00:00
|
|
|
* \param user The conference user
|
2009-03-05 18:18:27 +00:00
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static void leave_conference(struct confbridge_user *user)
|
2009-03-05 18:18:27 +00:00
|
|
|
{
|
2012-12-07 00:00:39 +00:00
|
|
|
struct post_join_action *action;
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(user->conference);
|
2012-12-07 00:00:39 +00:00
|
|
|
handle_conf_user_leave(user);
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(user->conference);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2012-12-07 00:00:39 +00:00
|
|
|
/* Discard any post-join actions */
|
|
|
|
while ((action = AST_LIST_REMOVE_HEAD(&user->post_join_list, list))) {
|
|
|
|
ast_free(action);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Done mucking with the conference, huzzah */
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_ref(user->conference, -1);
|
|
|
|
user->conference = NULL;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
static void playback_common(struct confbridge_conference *conference, const char *filename, int say_number)
|
|
|
|
{
|
|
|
|
/* Don't try to play if the playback channel has been hung up */
|
|
|
|
if (!conference->playback_chan) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_autoservice_stop(conference->playback_chan);
|
|
|
|
|
|
|
|
/* The channel is all under our control, in goes the prompt */
|
|
|
|
if (!ast_strlen_zero(filename)) {
|
|
|
|
ast_stream_and_wait(conference->playback_chan, filename, "");
|
|
|
|
} else if (say_number >= 0) {
|
|
|
|
ast_say_number(conference->playback_chan, say_number, "",
|
|
|
|
ast_channel_language(conference->playback_chan), NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_autoservice_start(conference->playback_chan);
|
|
|
|
}
|
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
struct playback_task_data {
|
|
|
|
struct confbridge_conference *conference;
|
|
|
|
const char *filename;
|
|
|
|
int say_number;
|
|
|
|
int playback_finished;
|
|
|
|
ast_mutex_t lock;
|
|
|
|
ast_cond_t cond;
|
|
|
|
};
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/*!
|
2016-08-10 20:14:09 +00:00
|
|
|
* \brief Play an announcement into a confbridge
|
|
|
|
*
|
|
|
|
* This runs in the playback queue taskprocessor. This ensures that
|
|
|
|
* all playbacks are handled in sequence and do not play over top one
|
|
|
|
* another.
|
|
|
|
*
|
|
|
|
* This task runs synchronously so there is no need for performing any
|
|
|
|
* sort of cleanup on the input parameter.
|
|
|
|
*
|
|
|
|
* \param data A playback_task_data
|
|
|
|
* \return 0
|
2009-03-05 18:18:27 +00:00
|
|
|
*/
|
2016-08-10 20:14:09 +00:00
|
|
|
static int playback_task(void *data)
|
2009-03-05 18:18:27 +00:00
|
|
|
{
|
2016-08-10 20:14:09 +00:00
|
|
|
struct playback_task_data *ptd = data;
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
playback_common(ptd->conference, ptd->filename, ptd->say_number);
|
2016-08-10 20:14:09 +00:00
|
|
|
|
|
|
|
ast_mutex_lock(&ptd->lock);
|
|
|
|
ptd->playback_finished = 1;
|
|
|
|
ast_cond_signal(&ptd->cond);
|
|
|
|
ast_mutex_unlock(&ptd->lock);
|
2013-10-08 20:18:37 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
static void playback_task_data_init(struct playback_task_data *ptd, struct confbridge_conference *conference,
|
|
|
|
const char *filename, int say_number)
|
|
|
|
{
|
|
|
|
ast_mutex_init(&ptd->lock);
|
|
|
|
ast_cond_init(&ptd->cond, NULL);
|
|
|
|
|
|
|
|
ptd->filename = filename;
|
|
|
|
ptd->say_number = say_number;
|
|
|
|
ptd->conference = conference;
|
|
|
|
ptd->playback_finished = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void playback_task_data_destroy(struct playback_task_data *ptd)
|
|
|
|
{
|
|
|
|
ast_mutex_destroy(&ptd->lock);
|
|
|
|
ast_cond_destroy(&ptd->cond);
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static int play_sound_helper(struct confbridge_conference *conference, const char *filename, int say_number)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2016-08-10 20:14:09 +00:00
|
|
|
struct playback_task_data ptd;
|
|
|
|
|
2012-02-13 16:42:42 +00:00
|
|
|
/* Do not waste resources trying to play files that do not exist */
|
2016-08-10 20:14:09 +00:00
|
|
|
if (ast_strlen_zero(filename)) {
|
|
|
|
if (say_number < 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} else if (!sound_file_exists(filename)) {
|
2012-02-13 16:42:42 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
playback_task_data_init(&ptd, conference, filename, say_number);
|
|
|
|
if (ast_taskprocessor_push(conference->playback_queue, playback_task, &ptd)) {
|
|
|
|
if (!ast_strlen_zero(filename)) {
|
|
|
|
ast_log(LOG_WARNING, "Unable to play file '%s' to conference %s\n",
|
|
|
|
filename, conference->name);
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_WARNING, "Unable to say number '%d' to conference %s\n",
|
|
|
|
say_number, conference->name);
|
|
|
|
}
|
|
|
|
playback_task_data_destroy(&ptd);
|
2013-05-21 18:00:22 +00:00
|
|
|
return -1;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
/* Wait for the playback to complete */
|
|
|
|
ast_mutex_lock(&ptd.lock);
|
|
|
|
while (!ptd.playback_finished) {
|
|
|
|
ast_cond_wait(&ptd.cond, &ptd.lock);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2016-08-10 20:14:09 +00:00
|
|
|
ast_mutex_unlock(&ptd.lock);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
playback_task_data_destroy(&ptd);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
int play_sound_file(struct confbridge_conference *conference, const char *filename)
|
2009-03-05 18:18:27 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
return play_sound_helper(conference, filename, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
struct async_playback_task_data {
|
|
|
|
struct confbridge_conference *conference;
|
|
|
|
int say_number;
|
|
|
|
struct ast_channel *initiator;
|
|
|
|
char filename[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct async_datastore_data {
|
|
|
|
ast_mutex_t lock;
|
|
|
|
ast_cond_t cond;
|
|
|
|
int wait;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void async_datastore_data_destroy(void *data)
|
|
|
|
{
|
|
|
|
struct async_datastore_data *add = data;
|
|
|
|
|
|
|
|
ast_mutex_destroy(&add->lock);
|
|
|
|
ast_cond_destroy(&add->cond);
|
|
|
|
|
|
|
|
ast_free(add);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Datastore used for timing of async announcement playback
|
|
|
|
*
|
|
|
|
* Announcements that are played to the entire conference can be played
|
|
|
|
* asynchronously (i.e. The channel that queues the playback does not wait
|
|
|
|
* for the playback to complete before continuing)
|
|
|
|
*
|
|
|
|
* The thing about async announcements is that the channel that queues the
|
|
|
|
* announcement is either not in the bridge or is in some other way "occupied"
|
|
|
|
* at the time the announcement is queued. Because of that, the initiator of
|
|
|
|
* the announcement may enter after the announcement has already started,
|
|
|
|
* resulting in the sound being "clipped".
|
|
|
|
*
|
|
|
|
* This datastore makes it so that the channel that queues the async announcement
|
|
|
|
* can say "I'm ready now". This way the announcement does not start until the
|
|
|
|
* initiator of the announcement is ready to hear the sound.
|
|
|
|
*/
|
|
|
|
static struct ast_datastore_info async_datastore_info = {
|
|
|
|
.type = "Confbridge async playback",
|
|
|
|
.destroy = async_datastore_data_destroy,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct async_datastore_data *async_datastore_data_alloc(void)
|
|
|
|
{
|
|
|
|
struct async_datastore_data *add;
|
|
|
|
|
|
|
|
add = ast_malloc(sizeof(*add));
|
|
|
|
if (!add) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_mutex_init(&add->lock);
|
|
|
|
ast_cond_init(&add->cond, NULL);
|
|
|
|
add->wait = 1;
|
|
|
|
|
|
|
|
return add;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Prepare the async playback datastore
|
|
|
|
*
|
|
|
|
* This is done prior to queuing an async announcement. If the
|
|
|
|
* datastore has not yet been created, it is allocated and initialized.
|
|
|
|
* If it already exists, we set it to be in "waiting" mode.
|
|
|
|
*
|
|
|
|
* \param initiator The channel that is queuing the async playback
|
|
|
|
* \retval 0 Success
|
|
|
|
* \retval -1 Failure :(
|
|
|
|
*/
|
|
|
|
static int setup_async_playback_datastore(struct ast_channel *initiator)
|
|
|
|
{
|
|
|
|
struct ast_datastore *async_datastore;
|
|
|
|
|
|
|
|
async_datastore = ast_channel_datastore_find(initiator, &async_datastore_info, NULL);
|
|
|
|
if (async_datastore) {
|
|
|
|
struct async_datastore_data *add;
|
|
|
|
|
|
|
|
add = async_datastore->data;
|
|
|
|
add->wait = 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
async_datastore = ast_datastore_alloc(&async_datastore_info, NULL);
|
|
|
|
if (!async_datastore) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
async_datastore->data = async_datastore_data_alloc();
|
|
|
|
if (!async_datastore->data) {
|
|
|
|
ast_datastore_free(async_datastore);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_channel_datastore_add(initiator, async_datastore);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct async_playback_task_data *async_playback_task_data_alloc(
|
|
|
|
struct confbridge_conference *conference, const char *filename, int say_number,
|
|
|
|
struct ast_channel *initiator)
|
|
|
|
{
|
|
|
|
struct async_playback_task_data *aptd;
|
|
|
|
|
|
|
|
aptd = ast_malloc(sizeof(*aptd) + strlen(filename) + 1);
|
|
|
|
if (!aptd) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Safe */
|
|
|
|
strcpy(aptd->filename, filename);
|
|
|
|
aptd->say_number = say_number;
|
|
|
|
|
|
|
|
/* You may think that we need to bump the conference refcount since we are pushing
|
|
|
|
* this task to the taskprocessor.
|
|
|
|
*
|
|
|
|
* In this case, that actually causes a problem. The destructor for the conference
|
|
|
|
* pushes a hangup task into the taskprocessor and waits for it to complete before
|
|
|
|
* continuing. If the destructor gets called from a taskprocessor task, we're
|
|
|
|
* deadlocked.
|
|
|
|
*
|
|
|
|
* So is there a risk of the conference being freed out from under us? No. Since
|
|
|
|
* the destructor pushes a task into the taskprocessor and waits for it to complete,
|
|
|
|
* the destructor cannot free the conference out from under us. No further tasks
|
|
|
|
* can be queued onto the taskprocessor after the hangup since no channels are referencing
|
|
|
|
* the conference at that point any more.
|
|
|
|
*/
|
|
|
|
aptd->conference = conference;
|
|
|
|
|
|
|
|
aptd->initiator = initiator;
|
|
|
|
if (initiator) {
|
|
|
|
ast_channel_ref(initiator);
|
|
|
|
ast_channel_lock(aptd->initiator);
|
|
|
|
/* We don't really care if this fails. If the datastore fails to get set up
|
|
|
|
* we'll still play the announcement. It's possible that the sound will be
|
|
|
|
* clipped for the initiator, but that's not the end of the world.
|
|
|
|
*/
|
|
|
|
setup_async_playback_datastore(aptd->initiator);
|
|
|
|
ast_channel_unlock(aptd->initiator);
|
|
|
|
}
|
|
|
|
|
|
|
|
return aptd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void async_playback_task_data_destroy(struct async_playback_task_data *aptd)
|
|
|
|
{
|
|
|
|
ast_channel_cleanup(aptd->initiator);
|
|
|
|
ast_free(aptd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Wait for the initiator of an async playback to be ready
|
|
|
|
*
|
|
|
|
* See the description on the async_datastore_info structure for more
|
|
|
|
* information about what this is about.
|
|
|
|
*
|
|
|
|
* \param initiator The channel that queued the async announcement
|
|
|
|
*/
|
|
|
|
static void wait_for_initiator(struct ast_channel *initiator)
|
|
|
|
{
|
|
|
|
struct ast_datastore *async_datastore;
|
|
|
|
struct async_datastore_data *add;
|
|
|
|
|
|
|
|
ast_channel_lock(initiator);
|
|
|
|
async_datastore = ast_channel_datastore_find(initiator, &async_datastore_info, NULL);
|
|
|
|
ast_channel_unlock(initiator);
|
|
|
|
|
|
|
|
if (!async_datastore) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
add = async_datastore->data;
|
|
|
|
|
|
|
|
ast_mutex_lock(&add->lock);
|
|
|
|
while (add->wait) {
|
|
|
|
ast_cond_wait(&add->cond, &add->lock);
|
|
|
|
}
|
|
|
|
ast_mutex_unlock(&add->lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Play an announcement into a confbridge asynchronously
|
|
|
|
*
|
|
|
|
* This runs in the playback queue taskprocessor. This ensures that
|
|
|
|
* all playbacks are handled in sequence and do not play over top one
|
|
|
|
* another.
|
|
|
|
*
|
|
|
|
* \param data An async_playback_task_data
|
|
|
|
* \return 0
|
|
|
|
*/
|
|
|
|
static int async_playback_task(void *data)
|
|
|
|
{
|
|
|
|
struct async_playback_task_data *aptd = data;
|
|
|
|
|
|
|
|
/* Wait for the initiator to get back in the bridge or be hung up */
|
|
|
|
if (aptd->initiator) {
|
|
|
|
wait_for_initiator(aptd->initiator);
|
|
|
|
}
|
|
|
|
|
|
|
|
playback_common(aptd->conference, aptd->filename, aptd->say_number);
|
|
|
|
|
|
|
|
async_playback_task_data_destroy(aptd);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int async_play_sound_helper(struct confbridge_conference *conference,
|
|
|
|
const char *filename, int say_number, struct ast_channel *initiator)
|
|
|
|
{
|
|
|
|
struct async_playback_task_data *aptd;
|
|
|
|
|
|
|
|
/* Do not waste resources trying to play files that do not exist */
|
|
|
|
if (ast_strlen_zero(filename)) {
|
|
|
|
if (say_number < 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} else if (!sound_file_exists(filename)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
aptd = async_playback_task_data_alloc(conference, filename, say_number, initiator);
|
|
|
|
if (!aptd) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ast_taskprocessor_push(conference->playback_queue, async_playback_task, aptd)) {
|
|
|
|
if (!ast_strlen_zero(filename)) {
|
|
|
|
ast_log(LOG_WARNING, "Unable to play file '%s' to conference '%s'\n",
|
|
|
|
filename, conference->name);
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_WARNING, "Unable to say number '%d' to conference '%s'\n",
|
|
|
|
say_number, conference->name);
|
|
|
|
}
|
|
|
|
async_playback_task_data_destroy(aptd);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int async_play_sound_file(struct confbridge_conference *conference,
|
|
|
|
const char *filename, struct ast_channel *initiator)
|
|
|
|
{
|
|
|
|
return async_play_sound_helper(conference, filename, -1, initiator);
|
|
|
|
}
|
|
|
|
|
|
|
|
void async_play_sound_ready(struct ast_channel *chan)
|
|
|
|
{
|
|
|
|
struct ast_datastore *async_datastore;
|
|
|
|
struct async_datastore_data *add;
|
|
|
|
|
|
|
|
ast_channel_lock(chan);
|
|
|
|
async_datastore = ast_channel_datastore_find(chan, &async_datastore_info, NULL);
|
|
|
|
ast_channel_unlock(chan);
|
|
|
|
if (!async_datastore) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
add = async_datastore->data;
|
|
|
|
|
|
|
|
ast_mutex_lock(&add->lock);
|
|
|
|
add->wait = 0;
|
|
|
|
ast_cond_signal(&add->cond);
|
|
|
|
ast_mutex_unlock(&add->lock);
|
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/*!
|
|
|
|
* \brief Play number into the conference bridge
|
|
|
|
*
|
2013-03-09 00:21:46 +00:00
|
|
|
* \param conference The conference bridge to say the number into
|
2012-09-21 17:14:59 +00:00
|
|
|
* \param say_number number to say
|
2011-04-21 18:11:40 +00:00
|
|
|
*
|
|
|
|
* \retval 0 success
|
|
|
|
* \retval -1 failure
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static int play_sound_number(struct confbridge_conference *conference, int say_number)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
return play_sound_helper(conference, NULL, say_number);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
2013-07-26 21:34:23 +00:00
|
|
|
static int conf_handle_talker_cb(struct ast_bridge_channel *bridge_channel, void *hook_pvt, int talking)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2014-08-27 17:30:51 +00:00
|
|
|
const struct confbridge_user *user = hook_pvt;
|
2014-05-07 20:59:13 +00:00
|
|
|
RAII_VAR(struct confbridge_conference *, conference, NULL, ao2_cleanup);
|
2013-05-21 18:00:22 +00:00
|
|
|
struct ast_json *talking_extras;
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2014-08-27 17:30:51 +00:00
|
|
|
conference = ao2_find(conference_bridges, user->conference->name, OBJ_KEY);
|
2013-05-21 18:00:22 +00:00
|
|
|
if (!conference) {
|
2013-07-24 21:13:00 +00:00
|
|
|
/* Remove the hook since the conference does not exist. */
|
|
|
|
return -1;
|
2013-05-21 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
2014-08-27 17:30:51 +00:00
|
|
|
talking_extras = ast_json_pack("{s: s, s: b}",
|
|
|
|
"talking_status", talking ? "on" : "off",
|
|
|
|
"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN));
|
2013-05-21 18:00:22 +00:00
|
|
|
if (!talking_extras) {
|
2013-07-24 21:13:00 +00:00
|
|
|
return 0;
|
2013-05-21 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 12:41:10 +00:00
|
|
|
send_conf_stasis(conference, bridge_channel->chan, confbridge_talking_type(), talking_extras, 0);
|
2013-05-21 18:00:22 +00:00
|
|
|
ast_json_unref(talking_extras);
|
2013-07-24 21:13:00 +00:00
|
|
|
return 0;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static int conf_get_pin(struct ast_channel *chan, struct confbridge_user *user)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
|
|
|
char pin_guess[MAX_PIN+1] = { 0, };
|
2013-03-09 00:21:46 +00:00
|
|
|
const char *pin = user->u_profile.pin;
|
2011-04-21 18:11:40 +00:00
|
|
|
char *tmp = pin_guess;
|
|
|
|
int i, res;
|
2016-01-25 23:36:50 +00:00
|
|
|
unsigned int len = MAX_PIN;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NOTE: We have not joined a conference yet so we have to use
|
|
|
|
* the bridge profile requested by the user.
|
|
|
|
*/
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
/* give them three tries to get the pin right */
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
if (ast_app_getdata(chan,
|
2013-03-09 00:21:46 +00:00
|
|
|
conf_get_sound(CONF_SOUND_GET_PIN, user->b_profile.sounds),
|
2011-04-21 18:11:40 +00:00
|
|
|
tmp, len, 0) >= 0) {
|
|
|
|
if (!strcasecmp(pin, pin_guess)) {
|
|
|
|
return 0;
|
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_streamfile(chan,
|
2013-03-09 00:21:46 +00:00
|
|
|
conf_get_sound(CONF_SOUND_INVALID_PIN, user->b_profile.sounds),
|
2012-01-24 20:12:09 +00:00
|
|
|
ast_channel_language(chan));
|
2011-04-21 18:11:40 +00:00
|
|
|
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
|
|
|
if (res > 0) {
|
|
|
|
/* Account for digit already read during ivalid pin playback
|
|
|
|
* resetting pin buf. */
|
|
|
|
pin_guess[0] = res;
|
|
|
|
pin_guess[1] = '\0';
|
|
|
|
tmp = pin_guess + 1;
|
|
|
|
len = MAX_PIN - 1;
|
2009-03-05 18:18:27 +00:00
|
|
|
} else {
|
2011-04-21 18:11:40 +00:00
|
|
|
/* reset pin buf as empty buffer. */
|
|
|
|
tmp = pin_guess;
|
|
|
|
len = MAX_PIN;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2015-11-13 20:03:35 +00:00
|
|
|
static int user_timeout(struct ast_bridge_channel *bridge_channel, void *ignore)
|
|
|
|
{
|
|
|
|
ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END, 0);
|
|
|
|
pbx_builtin_setvar_helper(bridge_channel->chan, "CONFBRIDGE_RESULT", "TIMEOUT");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static int conf_rec_name(struct confbridge_user *user, const char *conf_name)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
|
|
|
char destdir[PATH_MAX];
|
|
|
|
int res;
|
|
|
|
int duration = 20;
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
snprintf(destdir, sizeof(destdir), "%s/confbridge", ast_config_AST_SPOOL_DIR);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
if (ast_mkdir(destdir, 0777) != 0) {
|
|
|
|
ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", destdir, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
snprintf(user->name_rec_location, sizeof(user->name_rec_location),
|
|
|
|
"%s/confbridge-name-%s-%s", destdir,
|
2012-01-24 20:12:09 +00:00
|
|
|
conf_name, ast_channel_uniqueid(user->chan));
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-11-15 22:38:52 +00:00
|
|
|
if (!(ast_test_flag(&user->u_profile, USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW))) {
|
|
|
|
res = ast_play_and_record(user->chan,
|
|
|
|
"vm-rec-name",
|
|
|
|
user->name_rec_location,
|
|
|
|
10,
|
|
|
|
"sln",
|
|
|
|
&duration,
|
|
|
|
NULL,
|
|
|
|
ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE),
|
|
|
|
0,
|
|
|
|
NULL);
|
|
|
|
} else {
|
|
|
|
res = ast_record_review(user->chan,
|
|
|
|
"vm-rec-name",
|
|
|
|
user->name_rec_location,
|
|
|
|
10,
|
|
|
|
"sln",
|
|
|
|
&duration,
|
|
|
|
NULL);
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
if (res == -1) {
|
|
|
|
user->name_rec_location[0] = '\0';
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
static int join_callback(struct ast_bridge_channel *bridge_channel, void *ignore)
|
|
|
|
{
|
|
|
|
async_play_sound_ready(bridge_channel->chan);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/*! \brief The ConfBridge application */
|
2009-05-21 21:13:09 +00:00
|
|
|
static int confbridge_exec(struct ast_channel *chan, const char *data)
|
2009-03-05 18:18:27 +00:00
|
|
|
{
|
|
|
|
int res = 0, volume_adjustments[2];
|
2011-04-21 18:11:40 +00:00
|
|
|
int quiet = 0;
|
2009-03-05 18:18:27 +00:00
|
|
|
char *parse;
|
2013-11-01 22:48:14 +00:00
|
|
|
const char *b_profile_name = NULL;
|
|
|
|
const char *u_profile_name = NULL;
|
|
|
|
const char *menu_profile_name = NULL;
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_conference *conference = NULL;
|
|
|
|
struct confbridge_user user = {
|
2009-03-05 18:18:27 +00:00
|
|
|
.chan = chan,
|
2011-04-21 18:11:40 +00:00
|
|
|
.tech_args.talking_threshold = DEFAULT_TALKING_THRESHOLD,
|
|
|
|
.tech_args.silence_threshold = DEFAULT_SILENCE_THRESHOLD,
|
|
|
|
.tech_args.drop_silence = 0,
|
2009-03-05 18:18:27 +00:00
|
|
|
};
|
|
|
|
AST_DECLARE_APP_ARGS(args,
|
|
|
|
AST_APP_ARG(conf_name);
|
2011-04-21 18:11:40 +00:00
|
|
|
AST_APP_ARG(b_profile_name);
|
|
|
|
AST_APP_ARG(u_profile_name);
|
2013-11-01 22:48:14 +00:00
|
|
|
AST_APP_ARG(menu_profile_name);
|
2009-03-05 18:18:27 +00:00
|
|
|
);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2012-02-20 23:43:27 +00:00
|
|
|
if (ast_channel_state(chan) != AST_STATE_UP) {
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_answer(chan);
|
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
if (ast_bridge_features_init(&user.features)) {
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
|
2013-05-21 18:00:22 +00:00
|
|
|
res = -1;
|
|
|
|
goto confbridge_cleanup;
|
|
|
|
}
|
|
|
|
|
2014-06-04 07:27:21 +00:00
|
|
|
/* We need to make a copy of the input string if we are going to modify it! */
|
|
|
|
parse = ast_strdupa(data);
|
|
|
|
|
|
|
|
AST_STANDARD_APP_ARGS(args, parse);
|
|
|
|
|
|
|
|
if (ast_strlen_zero(args.conf_name)) {
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
|
2009-03-05 18:18:27 +00:00
|
|
|
ast_log(LOG_WARNING, "%s requires an argument (conference name[,options])\n", app);
|
2013-11-11 19:31:40 +00:00
|
|
|
res = -1;
|
2011-04-21 18:11:40 +00:00
|
|
|
goto confbridge_cleanup;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2014-06-04 07:27:21 +00:00
|
|
|
if (strlen(args.conf_name) >= MAX_CONF_NAME) {
|
|
|
|
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
|
|
|
|
ast_log(LOG_WARNING, "%s does not accept conference names longer than %d\n", app, MAX_CONF_NAME - 1);
|
|
|
|
res = -1;
|
|
|
|
goto confbridge_cleanup;
|
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* bridge profile name */
|
|
|
|
if (args.argc > 1 && !ast_strlen_zero(args.b_profile_name)) {
|
|
|
|
b_profile_name = args.b_profile_name;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conf_find_bridge_profile(chan, b_profile_name, &user.b_profile)) {
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
|
2013-11-01 22:48:14 +00:00
|
|
|
ast_log(LOG_WARNING, "Conference bridge profile %s does not exist\n", b_profile_name ?
|
|
|
|
b_profile_name : DEFAULT_BRIDGE_PROFILE);
|
2011-06-13 14:30:51 +00:00
|
|
|
res = -1;
|
|
|
|
goto confbridge_cleanup;
|
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* user profile name */
|
|
|
|
if (args.argc > 2 && !ast_strlen_zero(args.u_profile_name)) {
|
|
|
|
u_profile_name = args.u_profile_name;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conf_find_user_profile(chan, u_profile_name, &user.u_profile)) {
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
|
2013-11-01 22:48:14 +00:00
|
|
|
ast_log(LOG_WARNING, "Conference user profile %s does not exist\n", u_profile_name ?
|
|
|
|
u_profile_name : DEFAULT_USER_PROFILE);
|
2011-06-13 14:30:51 +00:00
|
|
|
res = -1;
|
|
|
|
goto confbridge_cleanup;
|
|
|
|
}
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
quiet = ast_test_flag(&user.u_profile, USER_OPT_QUIET);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* ask for a PIN immediately after finding user profile. This has to be
|
|
|
|
* prompted for requardless of quiet setting. */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!ast_strlen_zero(user.u_profile.pin)) {
|
|
|
|
if (conf_get_pin(chan, &user)) {
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
|
2011-04-21 18:11:40 +00:00
|
|
|
res = -1; /* invalid PIN */
|
|
|
|
goto confbridge_cleanup;
|
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* See if we need them to record a intro name */
|
2013-11-15 22:38:52 +00:00
|
|
|
if (!quiet &&
|
|
|
|
(ast_test_flag(&user.u_profile, USER_OPT_ANNOUNCE_JOIN_LEAVE) ||
|
|
|
|
(ast_test_flag(&user.u_profile, USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW)))) {
|
2013-03-09 00:21:46 +00:00
|
|
|
conf_rec_name(&user, args.conf_name);
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* menu name */
|
2013-11-01 22:48:14 +00:00
|
|
|
if (args.argc > 3 && !ast_strlen_zero(args.menu_profile_name)) {
|
|
|
|
menu_profile_name = args.menu_profile_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (conf_set_menu_to_user(chan, &user, menu_profile_name)) {
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
|
2013-11-01 22:48:14 +00:00
|
|
|
ast_log(LOG_WARNING, "Conference menu profile %s does not exist\n", menu_profile_name ?
|
|
|
|
menu_profile_name : DEFAULT_MENU_PROFILE);
|
|
|
|
res = -1;
|
|
|
|
goto confbridge_cleanup;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
/* Set if DTMF should pass through for this user or not */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user.u_profile, USER_OPT_DTMF_PASS)) {
|
|
|
|
user.features.dtmf_passthrough = 1;
|
2013-08-15 12:17:41 +00:00
|
|
|
} else {
|
|
|
|
user.features.dtmf_passthrough = 0;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* Set dsp threshold values if present */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (user.u_profile.talking_threshold) {
|
|
|
|
user.tech_args.talking_threshold = user.u_profile.talking_threshold;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (user.u_profile.silence_threshold) {
|
|
|
|
user.tech_args.silence_threshold = user.u_profile.silence_threshold;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* Set a talker indicate call back if talking detection is requested */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user.u_profile, USER_OPT_TALKER_DETECT)) {
|
2013-07-24 21:13:00 +00:00
|
|
|
if (ast_bridge_talk_detector_hook(&user.features, conf_handle_talker_cb,
|
2014-08-27 17:30:51 +00:00
|
|
|
&user, NULL, AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
|
2013-07-24 21:13:00 +00:00
|
|
|
res = -1;
|
|
|
|
goto confbridge_cleanup;
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* Look for a conference bridge matching the provided name */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!(conference = join_conference_bridge(args.conf_name, &user))) {
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
|
2013-11-11 19:31:40 +00:00
|
|
|
res = -1;
|
2011-04-21 18:11:40 +00:00
|
|
|
goto confbridge_cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Keep a copy of volume adjustments so we can restore them later if need be */
|
|
|
|
volume_adjustments[0] = ast_audiohook_volume_get(chan, AST_AUDIOHOOK_DIRECTION_READ);
|
|
|
|
volume_adjustments[1] = ast_audiohook_volume_get(chan, AST_AUDIOHOOK_DIRECTION_WRITE);
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user.u_profile, USER_OPT_DROP_SILENCE)) {
|
|
|
|
user.tech_args.drop_silence = 1;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user.u_profile, USER_OPT_JITTERBUFFER)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
char *func_jb;
|
|
|
|
if ((func_jb = ast_module_helper("", "func_jitterbuffer", 0, 0, 0, 0))) {
|
|
|
|
ast_free(func_jb);
|
|
|
|
ast_func_write(chan, "JITTERBUFFER(adaptive)", "default");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user.u_profile, USER_OPT_DENOISE)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
char *mod_speex;
|
|
|
|
/* Reduce background noise from each participant */
|
|
|
|
if ((mod_speex = ast_module_helper("", "codec_speex", 0, 0, 0, 0))) {
|
|
|
|
ast_free(mod_speex);
|
|
|
|
ast_func_write(chan, "DENOISE(rx)", "on");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if this user has a intro, play it before entering */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!ast_strlen_zero(user.name_rec_location)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_autoservice_start(chan);
|
2013-03-09 00:21:46 +00:00
|
|
|
play_sound_file(conference, user.name_rec_location);
|
|
|
|
play_sound_file(conference,
|
2016-01-25 23:36:50 +00:00
|
|
|
conf_get_sound(CONF_SOUND_HAS_JOINED, conference->b_profile.sounds));
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_autoservice_stop(chan);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Play the Join sound to both the conference and the user entering. */
|
|
|
|
if (!quiet) {
|
2016-01-25 23:36:50 +00:00
|
|
|
const char *join_sound = conf_get_sound(CONF_SOUND_JOIN, conference->b_profile.sounds);
|
2012-12-13 21:28:15 +00:00
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
if (strcmp(conference->b_profile.language, ast_channel_language(chan))) {
|
|
|
|
ast_stream_and_wait(chan, join_sound, "");
|
|
|
|
ast_autoservice_start(chan);
|
|
|
|
play_sound_file(conference, join_sound);
|
|
|
|
ast_autoservice_stop(chan);
|
|
|
|
} else {
|
|
|
|
async_play_sound_file(conference, join_sound, chan);
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
2015-11-13 20:03:35 +00:00
|
|
|
if (user.u_profile.timeout) {
|
|
|
|
ast_bridge_interval_hook(&user.features,
|
|
|
|
0,
|
|
|
|
user.u_profile.timeout * 1000,
|
|
|
|
user_timeout,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
AST_BRIDGE_HOOK_REMOVE_ON_PULL);
|
|
|
|
}
|
|
|
|
|
2011-07-07 17:24:57 +00:00
|
|
|
/* See if we need to automatically set this user as a video source or not */
|
2013-03-09 00:21:46 +00:00
|
|
|
handle_video_on_join(conference, user.chan, ast_test_flag(&user.u_profile, USER_OPT_MARKEDUSER));
|
2011-06-30 20:33:15 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
conf_moh_unsuspend(&user);
|
2012-12-13 21:28:15 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* Join our conference bridge for real */
|
2014-08-27 17:30:51 +00:00
|
|
|
send_join_event(&user, conference);
|
2016-08-10 20:14:09 +00:00
|
|
|
|
|
|
|
if (ast_bridge_join_hook(&user.features, join_callback, NULL, NULL, 0)) {
|
|
|
|
async_play_sound_ready(user.chan);
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_join(conference->bridge,
|
2011-04-21 18:11:40 +00:00
|
|
|
chan,
|
|
|
|
NULL,
|
2013-03-09 00:21:46 +00:00
|
|
|
&user.features,
|
2013-05-21 18:00:22 +00:00
|
|
|
&user.tech_args,
|
|
|
|
0);
|
2013-12-09 17:29:48 +00:00
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
/* This is a catch-all in case joining the bridge failed or for some reason
|
|
|
|
* an async announcement got queued up and hasn't been told to play yet
|
|
|
|
*/
|
|
|
|
async_play_sound_ready(chan);
|
|
|
|
|
2013-12-09 17:29:48 +00:00
|
|
|
if (!user.kicked && ast_check_hangup(chan)) {
|
|
|
|
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "HANGUP");
|
|
|
|
}
|
|
|
|
|
2014-08-27 17:30:51 +00:00
|
|
|
send_leave_event(&user, conference);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2011-07-12 14:40:16 +00:00
|
|
|
/* if we're shutting down, don't attempt to do further processing */
|
|
|
|
if (ast_shutting_down()) {
|
2015-02-11 17:39:13 +00:00
|
|
|
/*
|
|
|
|
* Not taking any new calls at this time. We cannot create
|
|
|
|
* the announcer channel if this is the first channel into
|
|
|
|
* the conference and we certainly cannot create any
|
|
|
|
* recording channel.
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
leave_conference(&user);
|
|
|
|
conference = NULL;
|
2011-07-12 14:40:16 +00:00
|
|
|
goto confbridge_cleanup;
|
|
|
|
}
|
|
|
|
|
2011-07-07 17:24:57 +00:00
|
|
|
/* If this user was a video source, we need to clean up and possibly pick a new source. */
|
2013-03-09 00:21:46 +00:00
|
|
|
handle_video_on_exit(conference, user.chan);
|
2011-06-30 20:33:15 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* if this user has a intro, play it when leaving */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!quiet && !ast_strlen_zero(user.name_rec_location)) {
|
2016-08-10 20:14:09 +00:00
|
|
|
async_play_sound_file(conference, user.name_rec_location, NULL);
|
|
|
|
async_play_sound_file(conference,
|
|
|
|
conf_get_sound(CONF_SOUND_HAS_LEFT, conference->b_profile.sounds), NULL);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* play the leave sound */
|
|
|
|
if (!quiet) {
|
2016-01-25 23:36:50 +00:00
|
|
|
const char *leave_sound = conf_get_sound(CONF_SOUND_LEAVE, conference->b_profile.sounds);
|
2016-08-10 20:14:09 +00:00
|
|
|
async_play_sound_file(conference, leave_sound, NULL);
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If the user was kicked from the conference play back the audio prompt for it */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!quiet && user.kicked) {
|
2011-04-21 18:11:40 +00:00
|
|
|
res = ast_stream_and_wait(chan,
|
2016-01-25 23:36:50 +00:00
|
|
|
conf_get_sound(CONF_SOUND_KICKED, conference->b_profile.sounds),
|
2011-04-21 18:11:40 +00:00
|
|
|
"");
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2016-01-25 23:36:50 +00:00
|
|
|
/* Easy as pie, depart this channel from the conference bridge */
|
|
|
|
leave_conference(&user);
|
|
|
|
conference = NULL;
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/* Restore volume adjustments to previous values in case they were changed */
|
|
|
|
if (volume_adjustments[0]) {
|
|
|
|
ast_audiohook_volume_set(chan, AST_AUDIOHOOK_DIRECTION_READ, volume_adjustments[0]);
|
|
|
|
}
|
|
|
|
if (volume_adjustments[1]) {
|
|
|
|
ast_audiohook_volume_set(chan, AST_AUDIOHOOK_DIRECTION_WRITE, volume_adjustments[1]);
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!ast_strlen_zero(user.name_rec_location)) {
|
|
|
|
ast_filedelete(user.name_rec_location, NULL);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
confbridge_cleanup:
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_features_cleanup(&user.features);
|
|
|
|
conf_bridge_profile_destroy(&user.b_profile);
|
2011-04-21 18:11:40 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static int action_toggle_mute(struct confbridge_conference *conference,
|
2015-03-26 17:13:26 +00:00
|
|
|
struct confbridge_user *user,
|
|
|
|
struct ast_bridge_channel *bridge_channel)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2013-11-02 03:24:47 +00:00
|
|
|
int mute;
|
|
|
|
|
|
|
|
/* Toggle user level mute request. */
|
|
|
|
mute = !user->muted;
|
2016-01-25 23:34:20 +00:00
|
|
|
generic_mute_unmute_user(conference, user, mute);
|
2013-11-02 03:24:47 +00:00
|
|
|
|
2016-01-25 23:36:50 +00:00
|
|
|
return play_file(bridge_channel, NULL,
|
|
|
|
conf_get_sound(mute ? CONF_SOUND_MUTED : CONF_SOUND_UNMUTED,
|
|
|
|
conference->b_profile.sounds)) < 0;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
2016-08-12 16:23:40 +00:00
|
|
|
static int action_toggle_binaural(struct confbridge_conference *conference,
|
|
|
|
struct confbridge_user *user,
|
|
|
|
struct ast_bridge_channel *bridge_channel)
|
|
|
|
{
|
|
|
|
unsigned int binaural;
|
|
|
|
ast_bridge_channel_lock_bridge(bridge_channel);
|
|
|
|
binaural = !bridge_channel->binaural_suspended;
|
|
|
|
bridge_channel->binaural_suspended = binaural;
|
|
|
|
ast_bridge_unlock(bridge_channel->bridge);
|
|
|
|
return play_file(bridge_channel, NULL, (binaural ?
|
|
|
|
conf_get_sound(CONF_SOUND_BINAURAL_OFF, user->b_profile.sounds) :
|
|
|
|
conf_get_sound(CONF_SOUND_BINAURAL_ON, user->b_profile.sounds))) < 0;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static int action_toggle_mute_participants(struct confbridge_conference *conference, struct confbridge_user *user)
|
2011-11-17 18:09:13 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_user *cur_user = NULL;
|
2011-11-17 18:09:13 +00:00
|
|
|
const char *sound_to_play;
|
2013-11-02 03:24:47 +00:00
|
|
|
int mute;
|
2011-11-17 18:09:13 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
2011-11-17 18:09:13 +00:00
|
|
|
|
2013-11-02 03:24:47 +00:00
|
|
|
/* Toggle bridge level mute request. */
|
|
|
|
mute = !conference->muted;
|
|
|
|
conference->muted = mute;
|
2011-11-17 18:09:13 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, cur_user, list) {
|
|
|
|
if (!ast_test_flag(&cur_user->u_profile, USER_OPT_ADMIN)) {
|
2013-11-02 03:24:47 +00:00
|
|
|
/* Set user level to bridge level mute request. */
|
|
|
|
cur_user->muted = mute;
|
|
|
|
conf_update_user_mute(cur_user);
|
2011-11-17 18:09:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
2011-11-17 18:09:13 +00:00
|
|
|
|
2016-01-25 23:36:50 +00:00
|
|
|
sound_to_play = conf_get_sound(
|
|
|
|
mute ? CONF_SOUND_PARTICIPANTS_MUTED : CONF_SOUND_PARTICIPANTS_UNMUTED,
|
|
|
|
conference->b_profile.sounds);
|
2013-11-02 03:24:47 +00:00
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
if (strcmp(conference->b_profile.language, ast_channel_language(user->chan))) {
|
|
|
|
/* The host needs to hear it seperately, as they don't get the audio from play_sound_helper */
|
|
|
|
ast_stream_and_wait(user->chan, sound_to_play, "");
|
2011-11-17 18:09:13 +00:00
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
/* Announce to the group that all participants are muted */
|
|
|
|
ast_autoservice_start(user->chan);
|
|
|
|
play_sound_file(conference, sound_to_play);
|
|
|
|
ast_autoservice_stop(user->chan);
|
|
|
|
} else {
|
|
|
|
/* Playing the sound asynchronously lets the sound be heard by everyone at once */
|
|
|
|
async_play_sound_file(conference, sound_to_play, user->chan);
|
|
|
|
}
|
2011-11-17 18:09:13 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
static int action_playback(struct ast_bridge_channel *bridge_channel, const char *playback_file)
|
|
|
|
{
|
|
|
|
char *file_copy = ast_strdupa(playback_file);
|
|
|
|
char *file = NULL;
|
|
|
|
|
|
|
|
while ((file = strsep(&file_copy, "&"))) {
|
|
|
|
if (ast_stream_and_wait(bridge_channel->chan, file, "")) {
|
|
|
|
ast_log(LOG_WARNING, "Failed to playback file %s to channel\n", file);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static int action_playback_and_continue(struct confbridge_conference *conference,
|
|
|
|
struct confbridge_user *user,
|
2011-04-21 18:11:40 +00:00
|
|
|
struct ast_bridge_channel *bridge_channel,
|
|
|
|
struct conf_menu *menu,
|
|
|
|
const char *playback_file,
|
|
|
|
const char *cur_dtmf,
|
|
|
|
int *stop_prompts)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int digit = 0;
|
|
|
|
char dtmf[MAXIMUM_DTMF_FEATURE_STRING];
|
|
|
|
struct conf_menu_entry new_menu_entry = { { 0, }, };
|
|
|
|
char *file_copy = ast_strdupa(playback_file);
|
|
|
|
char *file = NULL;
|
|
|
|
|
|
|
|
while ((file = strsep(&file_copy, "&"))) {
|
2012-01-24 20:12:09 +00:00
|
|
|
if (ast_streamfile(bridge_channel->chan, file, ast_channel_language(bridge_channel->chan))) {
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_log(LOG_WARNING, "Failed to playback file %s to channel\n", file);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now wait for more digits. */
|
|
|
|
if (!(digit = ast_waitstream(bridge_channel->chan, AST_DIGIT_ANY))) {
|
|
|
|
/* streaming finished and no DTMF was entered */
|
|
|
|
continue;
|
|
|
|
} else if (digit == -1) {
|
|
|
|
/* error */
|
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
break; /* dtmf was entered */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!digit) {
|
|
|
|
/* streaming finished on all files and no DTMF was entered */
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
ast_stopstream(bridge_channel->chan);
|
|
|
|
|
|
|
|
/* If we get here, then DTMF has been entered, This means no
|
|
|
|
* additional prompts should be played for this menu entry */
|
|
|
|
*stop_prompts = 1;
|
|
|
|
|
|
|
|
/* If a digit was pressed during the payback, update
|
|
|
|
* the dtmf string and look for a new menu entry in the
|
|
|
|
* menu structure */
|
|
|
|
ast_copy_string(dtmf, cur_dtmf, sizeof(dtmf));
|
|
|
|
for (i = 0; i < (MAXIMUM_DTMF_FEATURE_STRING - 1); i++) {
|
|
|
|
dtmf[i] = cur_dtmf[i];
|
|
|
|
if (!dtmf[i]) {
|
|
|
|
dtmf[i] = (char) digit;
|
|
|
|
dtmf[i + 1] = '\0';
|
|
|
|
i = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* If i is not -1 then the new dtmf digit was _NOT_ added to the string.
|
|
|
|
* If this is the case, no new DTMF sequence should be looked for. */
|
|
|
|
if (i != -1) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (conf_find_menu_entry_by_sequence(dtmf, menu, &new_menu_entry)) {
|
2013-03-09 00:21:46 +00:00
|
|
|
execute_menu_entry(conference,
|
|
|
|
user,
|
2011-04-21 18:11:40 +00:00
|
|
|
bridge_channel,
|
|
|
|
&new_menu_entry, menu);
|
|
|
|
conf_menu_entry_destroy(&new_menu_entry);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static int action_kick_last(struct confbridge_conference *conference,
|
2011-04-21 18:11:40 +00:00
|
|
|
struct ast_bridge_channel *bridge_channel,
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_user *user)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_user *last_user = NULL;
|
|
|
|
int isadmin = ast_test_flag(&user->u_profile, USER_OPT_ADMIN);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
if (!isadmin) {
|
2015-03-26 17:13:26 +00:00
|
|
|
play_file(bridge_channel, NULL,
|
2016-01-25 23:36:50 +00:00
|
|
|
conf_get_sound(CONF_SOUND_ERROR_MENU, conference->b_profile.sounds));
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_log(LOG_WARNING, "Only admin users can use the kick_last menu action. Channel %s of conf %s is not an admin.\n",
|
2012-01-09 22:15:50 +00:00
|
|
|
ast_channel_name(bridge_channel->chan),
|
2013-03-09 00:21:46 +00:00
|
|
|
conference->name);
|
2011-04-21 18:11:40 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
if (((last_user = AST_LIST_LAST(&conference->active_list)) == user)
|
|
|
|
|| (ast_test_flag(&last_user->u_profile, USER_OPT_ADMIN))) {
|
|
|
|
ao2_unlock(conference);
|
2015-03-26 17:13:26 +00:00
|
|
|
play_file(bridge_channel, NULL,
|
2016-01-25 23:36:50 +00:00
|
|
|
conf_get_sound(CONF_SOUND_ERROR_MENU, conference->b_profile.sounds));
|
app_confbridge: Fix crash caused when waitmarked/marked users leave together
When waitmarked users join a ConfBridge, the conference state is transitioned
from EMPTY -> INACTIVE. In this state, the users are maintined in a waiting
users list. When a marked user joins, the ConfBridge conference transitions
from INACTIVE -> MULTI_MARKED, and all users are put onto the active list of
users. This process works correctly.
When the marked user leaves, if they are the last marked user, the MULTI_MARKED
state does the following:
(1) It plays back a message to the bridge stating that the leader has left the
conference. This requires an unlocking of the bridge.
(2) It moves waitmarked users back to the waiting list
(3) It transitions to the appropriate state: in this case, INACTIVE
However, because it plays the prompt back to the bridge before moving the users
and before finishing the state transition, this creates a race condition: with
the bridge unlocked, waitmarked users who leave the conference (or are kicked
from it) can cause a state transition of the bridge to another state before
the conference is transitioned to the INACTIVE state. This causes the state
machine to get a bit wonky, often leading to a crash when the MULTI_MARKED state
attempts to conclude its processing.
This patch fixes this problem:
(1) It prevents kicked users from being kicked again. That's just a nicety.
(2) More importantly, it fixes the race condition by only playing the prompt
once the state has transitioned correctly to INACTIVE. If waitmarked users
sneak out during the prompt being played, no harm no foul.
Review: https://reviewboard.asterisk.org/r/3108/
Note that the patch committed here is essentially the same as uploaded by
Simon Moxon on ASTERISK-22740, with the addition of the double kick prevention.
(closes issue AST-1258)
Reported by: Steve Pitts
(closes issue ASTERISK-22740)
Reported by: Simon Moxon
patches:
ASTERISK-22740.diff uploaded by Simon Moxon (license 6546)
........
Merged revisions 405215 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 405216 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405217 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-09 15:50:23 +00:00
|
|
|
} else if (last_user && !last_user->kicked) {
|
2013-03-09 00:21:46 +00:00
|
|
|
last_user->kicked = 1;
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(last_user->chan, "CONFBRIDGE_RESULT", "KICKED");
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_bridge_remove(conference->bridge, last_user->chan);
|
|
|
|
ao2_unlock(conference);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_dialplan_exec(struct ast_bridge_channel *bridge_channel, struct conf_menu_action *menu_action)
|
|
|
|
{
|
|
|
|
struct ast_pbx_args args;
|
|
|
|
struct ast_pbx *pbx;
|
|
|
|
char *exten;
|
|
|
|
char *context;
|
|
|
|
int priority;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
memset(&args, 0, sizeof(args));
|
|
|
|
args.no_hangup_chan = 1;
|
|
|
|
|
|
|
|
ast_channel_lock(bridge_channel->chan);
|
|
|
|
|
|
|
|
/*save off*/
|
2012-02-13 17:27:06 +00:00
|
|
|
exten = ast_strdupa(ast_channel_exten(bridge_channel->chan));
|
|
|
|
context = ast_strdupa(ast_channel_context(bridge_channel->chan));
|
2012-02-20 23:43:27 +00:00
|
|
|
priority = ast_channel_priority(bridge_channel->chan);
|
|
|
|
pbx = ast_channel_pbx(bridge_channel->chan);
|
|
|
|
ast_channel_pbx_set(bridge_channel->chan, NULL);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
/*set new*/
|
2012-02-13 17:27:06 +00:00
|
|
|
ast_channel_exten_set(bridge_channel->chan, menu_action->data.dialplan_args.exten);
|
|
|
|
ast_channel_context_set(bridge_channel->chan, menu_action->data.dialplan_args.context);
|
2012-02-20 23:43:27 +00:00
|
|
|
ast_channel_priority_set(bridge_channel->chan, menu_action->data.dialplan_args.priority);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
ast_channel_unlock(bridge_channel->chan);
|
|
|
|
|
|
|
|
/*execute*/
|
|
|
|
res = ast_pbx_run_args(bridge_channel->chan, &args);
|
|
|
|
|
|
|
|
/*restore*/
|
|
|
|
ast_channel_lock(bridge_channel->chan);
|
|
|
|
|
2012-02-13 17:27:06 +00:00
|
|
|
ast_channel_exten_set(bridge_channel->chan, exten);
|
|
|
|
ast_channel_context_set(bridge_channel->chan, context);
|
2012-02-20 23:43:27 +00:00
|
|
|
ast_channel_priority_set(bridge_channel->chan, priority);
|
|
|
|
ast_channel_pbx_set(bridge_channel->chan, pbx);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
ast_channel_unlock(bridge_channel->chan);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static int execute_menu_entry(struct confbridge_conference *conference,
|
|
|
|
struct confbridge_user *user,
|
2011-04-21 18:11:40 +00:00
|
|
|
struct ast_bridge_channel *bridge_channel,
|
|
|
|
struct conf_menu_entry *menu_entry,
|
|
|
|
struct conf_menu *menu)
|
|
|
|
{
|
|
|
|
struct conf_menu_action *menu_action;
|
2013-03-09 00:21:46 +00:00
|
|
|
int isadmin = ast_test_flag(&user->u_profile, USER_OPT_ADMIN);
|
2011-04-21 18:11:40 +00:00
|
|
|
int stop_prompts = 0;
|
|
|
|
int res = 0;
|
|
|
|
|
|
|
|
AST_LIST_TRAVERSE(&menu_entry->actions, menu_action, action) {
|
|
|
|
switch (menu_action->id) {
|
|
|
|
case MENU_ACTION_TOGGLE_MUTE:
|
2015-03-26 17:13:26 +00:00
|
|
|
res |= action_toggle_mute(conference, user, bridge_channel);
|
2011-04-21 18:11:40 +00:00
|
|
|
break;
|
2016-08-12 16:23:40 +00:00
|
|
|
case MENU_ACTION_TOGGLE_BINAURAL:
|
|
|
|
action_toggle_binaural(conference, user, bridge_channel);
|
|
|
|
break;
|
2011-11-17 18:09:13 +00:00
|
|
|
case MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS:
|
|
|
|
if (!isadmin) {
|
|
|
|
break;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
action_toggle_mute_participants(conference, user);
|
2011-11-17 18:09:13 +00:00
|
|
|
break;
|
|
|
|
case MENU_ACTION_PARTICIPANT_COUNT:
|
2015-03-26 17:13:26 +00:00
|
|
|
announce_user_count(conference, user, bridge_channel);
|
2011-11-17 18:09:13 +00:00
|
|
|
break;
|
2011-04-21 18:11:40 +00:00
|
|
|
case MENU_ACTION_PLAYBACK:
|
|
|
|
if (!stop_prompts) {
|
|
|
|
res |= action_playback(bridge_channel, menu_action->data.playback_file);
|
2013-11-11 20:28:38 +00:00
|
|
|
ast_test_suite_event_notify("CONF_MENU_PLAYBACK",
|
|
|
|
"Message: %s\r\nChannel: %s",
|
|
|
|
menu_action->data.playback_file, ast_channel_name(bridge_channel->chan));
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MENU_ACTION_RESET_LISTENING:
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_audiohook_volume_set(user->chan, AST_AUDIOHOOK_DIRECTION_WRITE, 0);
|
2011-04-21 18:11:40 +00:00
|
|
|
break;
|
|
|
|
case MENU_ACTION_RESET_TALKING:
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_audiohook_volume_set(user->chan, AST_AUDIOHOOK_DIRECTION_READ, 0);
|
2011-04-21 18:11:40 +00:00
|
|
|
break;
|
|
|
|
case MENU_ACTION_INCREASE_LISTENING:
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_audiohook_volume_adjust(user->chan,
|
2011-04-21 18:11:40 +00:00
|
|
|
AST_AUDIOHOOK_DIRECTION_WRITE, 1);
|
|
|
|
break;
|
|
|
|
case MENU_ACTION_DECREASE_LISTENING:
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_audiohook_volume_adjust(user->chan,
|
2011-04-21 18:11:40 +00:00
|
|
|
AST_AUDIOHOOK_DIRECTION_WRITE, -1);
|
|
|
|
break;
|
|
|
|
case MENU_ACTION_INCREASE_TALKING:
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_audiohook_volume_adjust(user->chan,
|
2011-04-21 18:11:40 +00:00
|
|
|
AST_AUDIOHOOK_DIRECTION_READ, 1);
|
|
|
|
break;
|
|
|
|
case MENU_ACTION_DECREASE_TALKING:
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_audiohook_volume_adjust(user->chan,
|
2011-04-21 18:11:40 +00:00
|
|
|
AST_AUDIOHOOK_DIRECTION_READ, -1);
|
|
|
|
break;
|
|
|
|
case MENU_ACTION_PLAYBACK_AND_CONTINUE:
|
|
|
|
if (!(stop_prompts)) {
|
2013-03-09 00:21:46 +00:00
|
|
|
res |= action_playback_and_continue(conference,
|
|
|
|
user,
|
2011-04-21 18:11:40 +00:00
|
|
|
bridge_channel,
|
|
|
|
menu,
|
|
|
|
menu_action->data.playback_file,
|
|
|
|
menu_entry->dtmf,
|
|
|
|
&stop_prompts);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MENU_ACTION_DIALPLAN_EXEC:
|
|
|
|
res |= action_dialplan_exec(bridge_channel, menu_action);
|
|
|
|
break;
|
|
|
|
case MENU_ACTION_ADMIN_TOGGLE_LOCK:
|
|
|
|
if (!isadmin) {
|
|
|
|
break;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
conference->locked = (!conference->locked ? 1 : 0);
|
2015-03-26 17:13:26 +00:00
|
|
|
res |= play_file(bridge_channel, NULL,
|
2016-01-25 23:36:50 +00:00
|
|
|
conf_get_sound(
|
|
|
|
conference->locked ? CONF_SOUND_LOCKED_NOW : CONF_SOUND_UNLOCKED_NOW,
|
|
|
|
conference->b_profile.sounds)) < 0;
|
2011-04-21 18:11:40 +00:00
|
|
|
break;
|
|
|
|
case MENU_ACTION_ADMIN_KICK_LAST:
|
2013-03-09 00:21:46 +00:00
|
|
|
res |= action_kick_last(conference, bridge_channel, user);
|
2011-04-21 18:11:40 +00:00
|
|
|
break;
|
|
|
|
case MENU_ACTION_LEAVE:
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(bridge_channel->chan, "CONFBRIDGE_RESULT", "DTMF");
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
ast_bridge_remove(conference->bridge, bridge_channel->chan);
|
2013-11-11 20:28:38 +00:00
|
|
|
ast_test_suite_event_notify("CONF_MENU_LEAVE",
|
|
|
|
"Channel: %s",
|
|
|
|
ast_channel_name(bridge_channel->chan));
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
2011-04-21 18:11:40 +00:00
|
|
|
break;
|
|
|
|
case MENU_ACTION_NOOP:
|
|
|
|
break;
|
2011-06-30 20:33:15 +00:00
|
|
|
case MENU_ACTION_SET_SINGLE_VIDEO_SRC:
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
ast_bridge_set_single_src_video_mode(conference->bridge, bridge_channel->chan);
|
|
|
|
ao2_unlock(conference);
|
2011-06-30 20:33:15 +00:00
|
|
|
break;
|
2011-07-07 17:24:57 +00:00
|
|
|
case MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC:
|
2013-03-09 00:21:46 +00:00
|
|
|
handle_video_on_exit(conference, bridge_channel->chan);
|
2011-07-07 17:24:57 +00:00
|
|
|
break;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
}
|
2009-03-05 18:18:27 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
int conf_handle_dtmf(struct ast_bridge_channel *bridge_channel,
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_user *user,
|
2011-04-21 18:11:40 +00:00
|
|
|
struct conf_menu_entry *menu_entry,
|
|
|
|
struct conf_menu *menu)
|
|
|
|
{
|
|
|
|
/* See if music on hold is playing */
|
2013-03-09 00:21:46 +00:00
|
|
|
conf_moh_suspend(user);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
/* execute the list of actions associated with this menu entry */
|
2013-03-09 00:21:46 +00:00
|
|
|
execute_menu_entry(user->conference, user, bridge_channel, menu_entry, menu);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
/* See if music on hold needs to be started back up again */
|
2013-03-09 00:21:46 +00:00
|
|
|
conf_moh_unsuspend(user);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2016-08-10 20:14:09 +00:00
|
|
|
async_play_sound_ready(bridge_channel->chan);
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-08-26 23:30:00 +00:00
|
|
|
static int kick_conference_participant(struct confbridge_conference *conference,
|
|
|
|
const char *channel)
|
2013-02-26 15:52:02 +00:00
|
|
|
{
|
2013-07-16 22:33:27 +00:00
|
|
|
int res = -1;
|
2014-08-26 23:30:00 +00:00
|
|
|
int match;
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_user *user = NULL;
|
2014-08-26 23:30:00 +00:00
|
|
|
int all = !strcasecmp("all", channel);
|
|
|
|
int participants = !strcasecmp("participants", channel);
|
2013-02-26 15:52:02 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
SCOPED_AO2LOCK(bridge_lock, conference);
|
2014-05-07 20:59:13 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
2014-08-26 23:30:00 +00:00
|
|
|
if (user->kicked) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
match = !strcasecmp(channel, ast_channel_name(user->chan));
|
|
|
|
if (match || all
|
|
|
|
|| (participants && !ast_test_flag(&user->u_profile, USER_OPT_ADMIN))) {
|
2013-07-16 22:33:27 +00:00
|
|
|
user->kicked = 1;
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(user->chan, "CONFBRIDGE_RESULT", "KICKED");
|
2013-07-16 22:33:27 +00:00
|
|
|
ast_bridge_remove(conference->bridge, user->chan);
|
|
|
|
res = 0;
|
2014-08-26 23:30:00 +00:00
|
|
|
if (match) {
|
|
|
|
return res;
|
|
|
|
}
|
2013-02-26 15:52:02 +00:00
|
|
|
}
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
|
2014-08-26 23:30:00 +00:00
|
|
|
if (user->kicked) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
match = !strcasecmp(channel, ast_channel_name(user->chan));
|
|
|
|
if (match || all
|
|
|
|
|| (participants && !ast_test_flag(&user->u_profile, USER_OPT_ADMIN))) {
|
2013-07-16 22:33:27 +00:00
|
|
|
user->kicked = 1;
|
2013-12-09 17:29:48 +00:00
|
|
|
pbx_builtin_setvar_helper(user->chan, "CONFBRIDGE_RESULT", "KICKED");
|
2013-07-16 22:33:27 +00:00
|
|
|
ast_bridge_remove(conference->bridge, user->chan);
|
|
|
|
res = 0;
|
2014-08-26 23:30:00 +00:00
|
|
|
if (match) {
|
|
|
|
return res;
|
|
|
|
}
|
2013-02-26 15:52:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-16 22:33:27 +00:00
|
|
|
return res;
|
2013-02-26 15:52:02 +00:00
|
|
|
}
|
|
|
|
|
2011-02-01 16:05:23 +00:00
|
|
|
static char *complete_confbridge_name(const char *line, const char *word, int pos, int state)
|
|
|
|
{
|
|
|
|
int which = 0;
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_conference *conference;
|
2011-02-01 16:05:23 +00:00
|
|
|
char *res = NULL;
|
|
|
|
int wordlen = strlen(word);
|
2013-02-16 20:44:44 +00:00
|
|
|
struct ao2_iterator iter;
|
2011-02-01 16:05:23 +00:00
|
|
|
|
2013-02-16 20:44:44 +00:00
|
|
|
iter = ao2_iterator_init(conference_bridges, 0);
|
2013-03-09 00:21:46 +00:00
|
|
|
while ((conference = ao2_iterator_next(&iter))) {
|
|
|
|
if (!strncasecmp(conference->name, word, wordlen) && ++which > state) {
|
|
|
|
res = ast_strdup(conference->name);
|
|
|
|
ao2_ref(conference, -1);
|
2011-02-01 16:05:23 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_ref(conference, -1);
|
2011-02-01 16:05:23 +00:00
|
|
|
}
|
2013-02-16 20:44:44 +00:00
|
|
|
ao2_iterator_destroy(&iter);
|
2011-02-01 16:05:23 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
static char *complete_confbridge_participant(const char *conference_name, const char *line, const char *word, int pos, int state)
|
2013-02-26 15:52:02 +00:00
|
|
|
{
|
|
|
|
int which = 0;
|
2013-03-09 00:21:46 +00:00
|
|
|
RAII_VAR(struct confbridge_conference *, conference, NULL, ao2_cleanup);
|
|
|
|
struct confbridge_user *user;
|
2013-02-26 15:52:02 +00:00
|
|
|
char *res = NULL;
|
|
|
|
int wordlen = strlen(word);
|
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2013-02-26 15:52:02 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-08-26 23:30:00 +00:00
|
|
|
if (!strncasecmp("all", word, wordlen) && ++which > state) {
|
2014-04-21 14:47:37 +00:00
|
|
|
return ast_strdup("all");
|
|
|
|
}
|
2014-08-26 23:30:00 +00:00
|
|
|
|
|
|
|
if (!strncasecmp("participants", word, wordlen) && ++which > state) {
|
|
|
|
return ast_strdup("participants");
|
|
|
|
}
|
2014-04-21 14:47:37 +00:00
|
|
|
|
2013-02-26 15:52:02 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
SCOPED_AO2LOCK(bridge_lock, conference);
|
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
|
|
|
if (!strncasecmp(ast_channel_name(user->chan), word, wordlen) && ++which > state) {
|
|
|
|
res = ast_strdup(ast_channel_name(user->chan));
|
2013-02-26 15:52:02 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
|
|
|
|
if (!strncasecmp(ast_channel_name(user->chan), word, wordlen) && ++which > state) {
|
|
|
|
res = ast_strdup(ast_channel_name(user->chan));
|
2013-02-26 15:52:02 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-02-01 16:05:23 +00:00
|
|
|
static char *handle_cli_confbridge_kick(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
{
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_conference *conference;
|
2014-05-07 20:39:29 +00:00
|
|
|
int not_found;
|
2011-02-01 16:05:23 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "confbridge kick";
|
|
|
|
e->usage =
|
|
|
|
"Usage: confbridge kick <conference> <channel>\n"
|
2014-08-26 23:30:00 +00:00
|
|
|
" Kicks a channel out of the conference bridge.\n"
|
|
|
|
" (all to kick everyone, participants to kick non-admins).\n";
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
2011-02-01 16:05:23 +00:00
|
|
|
if (a->pos == 2) {
|
|
|
|
return complete_confbridge_name(a->line, a->word, a->pos, a->n);
|
|
|
|
}
|
|
|
|
if (a->pos == 3) {
|
2013-02-26 15:52:02 +00:00
|
|
|
return complete_confbridge_participant(a->argv[2], a->line, a->word, a->pos, a->n);
|
2011-02-01 16:05:23 +00:00
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2011-02-01 16:05:23 +00:00
|
|
|
|
|
|
|
if (a->argc != 4) {
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
}
|
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, a->argv[2], OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-02-01 16:05:23 +00:00
|
|
|
ast_cli(a->fd, "No conference bridge named '%s' found!\n", a->argv[2]);
|
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
2014-05-07 20:39:29 +00:00
|
|
|
not_found = kick_conference_participant(conference, a->argv[3]);
|
|
|
|
ao2_ref(conference, -1);
|
|
|
|
if (not_found) {
|
2014-08-26 23:30:00 +00:00
|
|
|
if (!strcasecmp("all", a->argv[3]) || !strcasecmp("participants", a->argv[3])) {
|
|
|
|
ast_cli(a->fd, "No participants found!\n");
|
|
|
|
} else {
|
|
|
|
ast_cli(a->fd, "No participant named '%s' found!\n", a->argv[3]);
|
|
|
|
}
|
2013-02-26 15:52:02 +00:00
|
|
|
return CLI_SUCCESS;
|
2011-02-01 16:05:23 +00:00
|
|
|
}
|
2014-08-26 23:30:00 +00:00
|
|
|
ast_cli(a->fd, "Kicked '%s' out of conference '%s'\n", a->argv[3], a->argv[2]);
|
2011-02-01 16:05:23 +00:00
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static void handle_cli_confbridge_list_item(struct ast_cli_args *a, struct confbridge_user *user, int waiting)
|
2013-01-18 21:52:18 +00:00
|
|
|
{
|
2013-11-02 03:24:47 +00:00
|
|
|
char flag_str[6 + 1];/* Max flags + terminator */
|
2013-02-18 19:12:11 +00:00
|
|
|
int pos = 0;
|
|
|
|
|
|
|
|
/* Build flags column string. */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_ADMIN)) {
|
2013-02-18 19:12:11 +00:00
|
|
|
flag_str[pos++] = 'A';
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)) {
|
2013-02-18 19:12:11 +00:00
|
|
|
flag_str[pos++] = 'M';
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED)) {
|
2013-02-18 19:12:11 +00:00
|
|
|
flag_str[pos++] = 'W';
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_ENDMARKED)) {
|
2013-02-18 19:12:11 +00:00
|
|
|
flag_str[pos++] = 'E';
|
|
|
|
}
|
2013-11-02 03:24:47 +00:00
|
|
|
if (user->muted) {
|
|
|
|
flag_str[pos++] = 'm';
|
|
|
|
}
|
2013-02-18 19:12:11 +00:00
|
|
|
if (waiting) {
|
|
|
|
flag_str[pos++] = 'w';
|
|
|
|
}
|
|
|
|
flag_str[pos] = '\0';
|
|
|
|
|
2013-11-02 03:24:47 +00:00
|
|
|
ast_cli(a->fd, "%-30s %-6s %-16s %-16s %-16s %s\n",
|
|
|
|
ast_channel_name(user->chan),
|
|
|
|
flag_str,
|
|
|
|
user->u_profile.name,
|
2016-01-25 23:36:50 +00:00
|
|
|
user->conference->b_profile.name,
|
2013-11-02 03:24:47 +00:00
|
|
|
user->menu_name,
|
|
|
|
S_COR(ast_channel_caller(user->chan)->id.number.valid,
|
|
|
|
ast_channel_caller(user->chan)->id.number.str, "<unknown>"));
|
2013-01-18 21:52:18 +00:00
|
|
|
}
|
|
|
|
|
2011-02-01 16:05:23 +00:00
|
|
|
static char *handle_cli_confbridge_list(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_conference *conference;
|
2011-02-01 16:05:23 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "confbridge list";
|
|
|
|
e->usage =
|
|
|
|
"Usage: confbridge list [<name>]\n"
|
2013-02-18 19:12:11 +00:00
|
|
|
" Lists all currently active conference bridges or a specific conference bridge.\n"
|
|
|
|
"\n"
|
|
|
|
" When a conference bridge name is provided, flags may be shown for users. Below\n"
|
2013-07-25 04:06:32 +00:00
|
|
|
" are the flags and what they represent.\n"
|
2013-02-18 19:12:11 +00:00
|
|
|
"\n"
|
|
|
|
" Flags:\n"
|
|
|
|
" A - The user is an admin\n"
|
|
|
|
" M - The user is a marked user\n"
|
|
|
|
" W - The user must wait for a marked user to join\n"
|
|
|
|
" E - The user will be kicked after the last marked user leaves the conference\n"
|
2013-11-02 03:24:47 +00:00
|
|
|
" m - The user is muted\n"
|
2013-02-18 19:12:11 +00:00
|
|
|
" w - The user is waiting for a marked user to join\n";
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
2011-02-01 16:05:23 +00:00
|
|
|
if (a->pos == 2) {
|
|
|
|
return complete_confbridge_name(a->line, a->word, a->pos, a->n);
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2011-02-01 16:05:23 +00:00
|
|
|
|
|
|
|
if (a->argc == 2) {
|
2013-02-16 20:44:44 +00:00
|
|
|
struct ao2_iterator iter;
|
|
|
|
|
2016-01-25 22:05:09 +00:00
|
|
|
ast_cli(a->fd, "Conference Bridge Name Users Marked Locked Muted\n");
|
|
|
|
ast_cli(a->fd, "================================ ====== ====== ====== =====\n");
|
2013-02-16 20:44:44 +00:00
|
|
|
iter = ao2_iterator_init(conference_bridges, 0);
|
2013-03-09 00:21:46 +00:00
|
|
|
while ((conference = ao2_iterator_next(&iter))) {
|
2016-01-25 22:05:09 +00:00
|
|
|
ast_cli(a->fd, "%-32s %6u %6u %-6s %s\n",
|
|
|
|
conference->name,
|
|
|
|
conference->activeusers + conference->waitingusers,
|
|
|
|
conference->markedusers,
|
|
|
|
AST_CLI_YESNO(conference->locked),
|
|
|
|
AST_CLI_YESNO(conference->muted));
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_ref(conference, -1);
|
2011-02-01 16:05:23 +00:00
|
|
|
}
|
2013-02-16 20:44:44 +00:00
|
|
|
ao2_iterator_destroy(&iter);
|
2011-02-01 16:05:23 +00:00
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a->argc == 3) {
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_user *user;
|
2013-02-16 20:44:44 +00:00
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, a->argv[2], OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-02-01 16:05:23 +00:00
|
|
|
ast_cli(a->fd, "No conference bridge named '%s' found!\n", a->argv[2]);
|
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
2013-11-02 03:24:47 +00:00
|
|
|
ast_cli(a->fd, "Channel Flags User Profile Bridge Profile Menu CallerID\n");
|
|
|
|
ast_cli(a->fd, "============================== ====== ================ ================ ================ ================\n");
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
|
|
|
handle_cli_confbridge_list_item(a, user, 0);
|
2013-01-18 21:52:18 +00:00
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
|
|
|
|
handle_cli_confbridge_list_item(a, user, 1);
|
2011-02-01 16:05:23 +00:00
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
|
|
|
ao2_ref(conference, -1);
|
2011-02-01 16:05:23 +00:00
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
/* \internal
|
|
|
|
* \brief finds a conference by name and locks/unlocks.
|
|
|
|
*
|
|
|
|
* \retval 0 success
|
|
|
|
* \retval -1 conference not found
|
|
|
|
*/
|
2013-03-09 00:21:46 +00:00
|
|
|
static int generic_lock_unlock_helper(int lock, const char *conference_name)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_conference *conference;
|
2011-04-21 18:11:40 +00:00
|
|
|
int res = 0;
|
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-04-21 18:11:40 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
conference->locked = lock;
|
|
|
|
ast_test_suite_event_notify("CONF_LOCK", "Message: conference %s\r\nConference: %s", conference->locked ? "locked" : "unlocked", conference->b_profile.name);
|
|
|
|
ao2_unlock(conference);
|
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* \internal
|
|
|
|
* \brief finds a conference user by channel name and mutes/unmutes them.
|
|
|
|
*
|
|
|
|
* \retval 0 success
|
|
|
|
* \retval -1 conference not found
|
|
|
|
* \retval -2 user not found
|
|
|
|
*/
|
2014-08-26 23:30:00 +00:00
|
|
|
static int generic_mute_unmute_helper(int mute, const char *conference_name,
|
|
|
|
const char *chan_name)
|
2011-04-21 18:11:40 +00:00
|
|
|
{
|
2014-08-26 23:30:00 +00:00
|
|
|
RAII_VAR(struct confbridge_conference *, conference, NULL, ao2_cleanup);
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_user *user;
|
2014-08-26 23:30:00 +00:00
|
|
|
int all = !strcasecmp("all", chan_name);
|
|
|
|
int participants = !strcasecmp("participants", chan_name);
|
|
|
|
int res = -2;
|
2013-04-23 20:18:44 +00:00
|
|
|
|
|
|
|
conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-04-21 18:11:40 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2014-08-26 23:30:00 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
SCOPED_AO2LOCK(bridge_lock, conference);
|
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
|
|
|
int match = !strncasecmp(chan_name, ast_channel_name(user->chan),
|
|
|
|
strlen(chan_name));
|
|
|
|
if (match || all
|
|
|
|
|| (participants && !ast_test_flag(&user->u_profile, USER_OPT_ADMIN))) {
|
|
|
|
generic_mute_unmute_user(conference, user, mute);
|
|
|
|
res = 0;
|
|
|
|
if (match) {
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2014-08-26 23:30:00 +00:00
|
|
|
|
2014-06-05 14:49:20 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
|
2014-08-26 23:30:00 +00:00
|
|
|
int match = !strncasecmp(chan_name, ast_channel_name(user->chan),
|
|
|
|
strlen(chan_name));
|
|
|
|
if (match || all
|
|
|
|
|| (participants && !ast_test_flag(&user->u_profile, USER_OPT_ADMIN))) {
|
|
|
|
generic_mute_unmute_user(conference, user, mute);
|
|
|
|
res = 0;
|
|
|
|
if (match) {
|
|
|
|
return res;
|
|
|
|
}
|
2014-06-05 14:49:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int cli_mute_unmute_helper(int mute, struct ast_cli_args *a)
|
|
|
|
{
|
|
|
|
int res = generic_mute_unmute_helper(mute, a->argv[2], a->argv[3]);
|
|
|
|
|
|
|
|
if (res == -1) {
|
|
|
|
ast_cli(a->fd, "No conference bridge named '%s' found!\n", a->argv[2]);
|
|
|
|
return -1;
|
|
|
|
} else if (res == -2) {
|
2014-08-26 23:30:00 +00:00
|
|
|
if (!strcasecmp("all", a->argv[3]) || !strcasecmp("participants", a->argv[3])) {
|
|
|
|
ast_cli(a->fd, "No participants found in conference %s\n", a->argv[2]);
|
|
|
|
} else {
|
|
|
|
ast_cli(a->fd, "No channel named '%s' found in conference %s\n", a->argv[3], a->argv[2]);
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
ast_cli(a->fd, "%s %s from confbridge %s\n", mute ? "Muting" : "Unmuting", a->argv[3], a->argv[2]);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *handle_cli_confbridge_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
{
|
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "confbridge mute";
|
|
|
|
e->usage =
|
2013-02-26 15:52:02 +00:00
|
|
|
"Usage: confbridge mute <conference> <channel>\n"
|
2014-01-22 19:36:23 +00:00
|
|
|
" Mute a channel in a conference.\n"
|
2014-08-26 23:30:00 +00:00
|
|
|
" (all to mute everyone, participants to mute non-admins)\n"
|
2014-01-22 19:36:23 +00:00
|
|
|
" If the specified channel is a prefix,\n"
|
|
|
|
" the action will be taken on the first\n"
|
|
|
|
" matching channel.\n";
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
|
|
|
if (a->pos == 2) {
|
|
|
|
return complete_confbridge_name(a->line, a->word, a->pos, a->n);
|
|
|
|
}
|
2013-02-26 15:52:02 +00:00
|
|
|
if (a->pos == 3) {
|
|
|
|
return complete_confbridge_participant(a->argv[2], a->line, a->word, a->pos, a->n);
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (a->argc != 4) {
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
cli_mute_unmute_helper(1, a);
|
|
|
|
|
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *handle_cli_confbridge_unmute(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
{
|
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "confbridge unmute";
|
|
|
|
e->usage =
|
2013-02-26 15:52:02 +00:00
|
|
|
"Usage: confbridge unmute <conference> <channel>\n"
|
2014-01-22 19:36:23 +00:00
|
|
|
" Unmute a channel in a conference.\n"
|
2014-08-26 23:30:00 +00:00
|
|
|
" (all to unmute everyone, participants to unmute non-admins)\n"
|
2014-01-22 19:36:23 +00:00
|
|
|
" If the specified channel is a prefix,\n"
|
|
|
|
" the action will be taken on the first\n"
|
|
|
|
" matching channel.\n";
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
|
|
|
if (a->pos == 2) {
|
|
|
|
return complete_confbridge_name(a->line, a->word, a->pos, a->n);
|
|
|
|
}
|
2013-02-26 15:52:02 +00:00
|
|
|
if (a->pos == 3) {
|
|
|
|
return complete_confbridge_participant(a->argv[2], a->line, a->word, a->pos, a->n);
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (a->argc != 4) {
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
cli_mute_unmute_helper(0, a);
|
|
|
|
|
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *handle_cli_confbridge_lock(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
{
|
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "confbridge lock";
|
|
|
|
e->usage =
|
2013-02-26 15:52:02 +00:00
|
|
|
"Usage: confbridge lock <conference>\n"
|
|
|
|
" Lock a conference. While locked, no new non-admins\n"
|
|
|
|
" may join the conference.\n";
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
|
|
|
if (a->pos == 2) {
|
|
|
|
return complete_confbridge_name(a->line, a->word, a->pos, a->n);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (a->argc != 3) {
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
}
|
|
|
|
if (generic_lock_unlock_helper(1, a->argv[2])) {
|
|
|
|
ast_cli(a->fd, "Conference %s is not found\n", a->argv[2]);
|
|
|
|
} else {
|
|
|
|
ast_cli(a->fd, "Conference %s is locked.\n", a->argv[2]);
|
|
|
|
}
|
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *handle_cli_confbridge_unlock(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
{
|
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "confbridge unlock";
|
|
|
|
e->usage =
|
2013-02-26 15:52:02 +00:00
|
|
|
"Usage: confbridge unlock <conference>\n"
|
|
|
|
" Unlock a previously locked conference.\n";
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
|
|
|
if (a->pos == 2) {
|
|
|
|
return complete_confbridge_name(a->line, a->word, a->pos, a->n);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (a->argc != 3) {
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
}
|
|
|
|
if (generic_lock_unlock_helper(0, a->argv[2])) {
|
|
|
|
ast_cli(a->fd, "Conference %s is not found\n", a->argv[2]);
|
|
|
|
} else {
|
|
|
|
ast_cli(a->fd, "Conference %s is unlocked.\n", a->argv[2]);
|
|
|
|
}
|
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *handle_cli_confbridge_start_record(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
{
|
|
|
|
const char *rec_file = NULL;
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_conference *conference;
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "confbridge record start";
|
|
|
|
e->usage =
|
|
|
|
"Usage: confbridge record start <conference> <file>\n"
|
|
|
|
" <file> is optional, Otherwise the bridge profile\n"
|
|
|
|
" record file will be used. If the bridge profile\n"
|
|
|
|
" has no record file specified, a file will automatically\n"
|
|
|
|
" be generated in the monitor directory\n";
|
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
|
|
|
if (a->pos == 3) {
|
|
|
|
return complete_confbridge_name(a->line, a->word, a->pos, a->n);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (a->argc < 4) {
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
}
|
|
|
|
if (a->argc == 5) {
|
|
|
|
rec_file = a->argv[4];
|
|
|
|
}
|
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, a->argv[3], OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_cli(a->fd, "Conference not found.\n");
|
|
|
|
return CLI_FAILURE;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
if (conf_is_recording(conference)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_cli(a->fd, "Conference is already being recorded.\n");
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
if (!ast_strlen_zero(rec_file)) {
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_copy_string(conference->b_profile.rec_file, rec_file, sizeof(conference->b_profile.rec_file));
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
if (conf_start_record(conference)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_cli(a->fd, "Could not start recording due to internal error.\n");
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
return CLI_FAILURE;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_cli(a->fd, "Recording started\n");
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *handle_cli_confbridge_stop_record(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
{
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_conference *conference;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
int ret;
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "confbridge record stop";
|
|
|
|
e->usage =
|
2013-02-26 15:52:02 +00:00
|
|
|
"Usage: confbridge record stop <conference>\n"
|
|
|
|
" Stop a previously started recording.\n";
|
2011-04-21 18:11:40 +00:00
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
|
|
|
if (a->pos == 3) {
|
|
|
|
return complete_confbridge_name(a->line, a->word, a->pos, a->n);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (a->argc != 4) {
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
}
|
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, a->argv[3], OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_cli(a->fd, "Conference not found.\n");
|
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
ret = conf_stop_record(conference);
|
|
|
|
ao2_unlock(conference);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
ast_cli(a->fd, "Recording %sstopped.\n", ret ? "could not be " : "");
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2011-02-01 16:05:23 +00:00
|
|
|
static struct ast_cli_entry cli_confbridge[] = {
|
|
|
|
AST_CLI_DEFINE(handle_cli_confbridge_list, "List conference bridges and participants."),
|
2011-04-21 18:11:40 +00:00
|
|
|
AST_CLI_DEFINE(handle_cli_confbridge_kick, "Kick participants out of conference bridges."),
|
2014-08-26 23:30:00 +00:00
|
|
|
AST_CLI_DEFINE(handle_cli_confbridge_mute, "Mute participants."),
|
|
|
|
AST_CLI_DEFINE(handle_cli_confbridge_unmute, "Unmute participants."),
|
2011-04-21 18:11:40 +00:00
|
|
|
AST_CLI_DEFINE(handle_cli_confbridge_lock, "Lock a conference."),
|
|
|
|
AST_CLI_DEFINE(handle_cli_confbridge_unlock, "Unlock a conference."),
|
|
|
|
AST_CLI_DEFINE(handle_cli_confbridge_start_record, "Start recording a conference"),
|
|
|
|
AST_CLI_DEFINE(handle_cli_confbridge_stop_record, "Stop recording a conference."),
|
|
|
|
};
|
|
|
|
static struct ast_custom_function confbridge_function = {
|
|
|
|
.name = "CONFBRIDGE",
|
|
|
|
.write = func_confbridge_helper,
|
2011-02-01 16:05:23 +00:00
|
|
|
};
|
|
|
|
|
2011-06-15 13:45:41 +00:00
|
|
|
static int func_confbridge_info(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len);
|
|
|
|
static struct ast_custom_function confbridge_info_function = {
|
|
|
|
.name = "CONFBRIDGE_INFO",
|
|
|
|
.read = func_confbridge_info,
|
|
|
|
};
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
static void action_confbridgelist_item(struct mansession *s, const char *id_text, struct confbridge_conference *conference, struct confbridge_user *user, int waiting)
|
2013-01-18 21:52:18 +00:00
|
|
|
{
|
|
|
|
astman_append(s,
|
|
|
|
"Event: ConfbridgeList\r\n"
|
|
|
|
"%s"
|
|
|
|
"Conference: %s\r\n"
|
|
|
|
"CallerIDNum: %s\r\n"
|
|
|
|
"CallerIDName: %s\r\n"
|
|
|
|
"Channel: %s\r\n"
|
|
|
|
"Admin: %s\r\n"
|
|
|
|
"MarkedUser: %s\r\n"
|
2013-02-18 19:12:11 +00:00
|
|
|
"WaitMarked: %s\r\n"
|
|
|
|
"EndMarked: %s\r\n"
|
|
|
|
"Waiting: %s\r\n"
|
2013-11-02 03:24:47 +00:00
|
|
|
"Muted: %s\r\n"
|
2014-08-30 17:33:08 +00:00
|
|
|
"AnsweredTime: %d\r\n"
|
2013-01-18 21:52:18 +00:00
|
|
|
"\r\n",
|
|
|
|
id_text,
|
2013-03-09 00:21:46 +00:00
|
|
|
conference->name,
|
|
|
|
S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, "<unknown>"),
|
|
|
|
S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, "<no name>"),
|
|
|
|
ast_channel_name(user->chan),
|
|
|
|
ast_test_flag(&user->u_profile, USER_OPT_ADMIN) ? "Yes" : "No",
|
|
|
|
ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER) ? "Yes" : "No",
|
|
|
|
ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED) ? "Yes" : "No",
|
|
|
|
ast_test_flag(&user->u_profile, USER_OPT_ENDMARKED) ? "Yes" : "No",
|
2013-11-02 03:24:47 +00:00
|
|
|
waiting ? "Yes" : "No",
|
2014-08-30 17:33:08 +00:00
|
|
|
user->muted ? "Yes" : "No",
|
|
|
|
ast_channel_get_up_time(user->chan));
|
2013-01-18 21:52:18 +00:00
|
|
|
}
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
static int action_confbridgelist(struct mansession *s, const struct message *m)
|
|
|
|
{
|
|
|
|
const char *actionid = astman_get_header(m, "ActionID");
|
2013-03-09 00:21:46 +00:00
|
|
|
const char *conference_name = astman_get_header(m, "Conference");
|
|
|
|
struct confbridge_user *user;
|
|
|
|
struct confbridge_conference *conference;
|
2013-02-18 19:12:11 +00:00
|
|
|
char id_text[80];
|
2011-04-21 18:11:40 +00:00
|
|
|
int total = 0;
|
|
|
|
|
2013-02-18 19:12:11 +00:00
|
|
|
id_text[0] = '\0';
|
2011-04-21 18:11:40 +00:00
|
|
|
if (!ast_strlen_zero(actionid)) {
|
|
|
|
snprintf(id_text, sizeof(id_text), "ActionID: %s\r\n", actionid);
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_strlen_zero(conference_name)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference name provided.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!ao2_container_count(conference_bridges)) {
|
|
|
|
astman_send_error(s, m, "No active conferences.");
|
|
|
|
return 0;
|
|
|
|
}
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference by that name found.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-01-12 18:09:27 +00:00
|
|
|
astman_send_listack(s, m, "Confbridge user list will follow", "start");
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
2011-04-21 18:11:40 +00:00
|
|
|
total++;
|
2013-03-09 00:21:46 +00:00
|
|
|
action_confbridgelist_item(s, id_text, conference, user, 0);
|
2013-01-18 21:52:18 +00:00
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
|
2013-01-18 21:52:18 +00:00
|
|
|
total++;
|
2013-03-09 00:21:46 +00:00
|
|
|
action_confbridgelist_item(s, id_text, conference, user, 1);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2015-01-09 18:16:54 +00:00
|
|
|
astman_send_list_complete_start(s, m, "ConfbridgeListComplete", total);
|
|
|
|
astman_send_list_complete_end(s);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_confbridgelistrooms(struct mansession *s, const struct message *m)
|
|
|
|
{
|
|
|
|
const char *actionid = astman_get_header(m, "ActionID");
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_conference *conference;
|
2013-02-16 20:44:44 +00:00
|
|
|
struct ao2_iterator iter;
|
2011-04-21 18:11:40 +00:00
|
|
|
char id_text[512] = "";
|
|
|
|
int totalitems = 0;
|
|
|
|
|
|
|
|
if (!ast_strlen_zero(actionid)) {
|
|
|
|
snprintf(id_text, sizeof(id_text), "ActionID: %s\r\n", actionid);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ao2_container_count(conference_bridges)) {
|
|
|
|
astman_send_error(s, m, "No active conferences.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-01-12 18:09:27 +00:00
|
|
|
astman_send_listack(s, m, "Confbridge conferences will follow", "start");
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
/* Traverse the conference list */
|
2013-02-16 20:44:44 +00:00
|
|
|
iter = ao2_iterator_init(conference_bridges, 0);
|
2013-03-09 00:21:46 +00:00
|
|
|
while ((conference = ao2_iterator_next(&iter))) {
|
2011-04-21 18:11:40 +00:00
|
|
|
totalitems++;
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_append(s,
|
|
|
|
"Event: ConfbridgeListRooms\r\n"
|
|
|
|
"%s"
|
|
|
|
"Conference: %s\r\n"
|
2014-05-09 22:49:26 +00:00
|
|
|
"Parties: %u\r\n"
|
|
|
|
"Marked: %u\r\n"
|
2011-04-21 18:11:40 +00:00
|
|
|
"Locked: %s\r\n"
|
2016-01-25 22:05:09 +00:00
|
|
|
"Muted: %s\r\n"
|
2011-04-21 18:11:40 +00:00
|
|
|
"\r\n",
|
|
|
|
id_text,
|
2013-03-09 00:21:46 +00:00
|
|
|
conference->name,
|
|
|
|
conference->activeusers + conference->waitingusers,
|
|
|
|
conference->markedusers,
|
2016-01-25 22:05:09 +00:00
|
|
|
AST_YESNO(conference->locked),
|
|
|
|
AST_YESNO(conference->muted));
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2013-02-16 20:44:44 +00:00
|
|
|
ao2_iterator_destroy(&iter);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
/* Send final confirmation */
|
2015-01-09 18:16:54 +00:00
|
|
|
astman_send_list_complete_start(s, m, "ConfbridgeListRoomsComplete", totalitems);
|
|
|
|
astman_send_list_complete_end(s);
|
2011-04-21 18:11:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_mute_unmute_helper(struct mansession *s, const struct message *m, int mute)
|
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
const char *conference_name = astman_get_header(m, "Conference");
|
|
|
|
const char *channel_name = astman_get_header(m, "Channel");
|
2011-04-21 18:11:40 +00:00
|
|
|
int res = 0;
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_strlen_zero(conference_name)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference name provided.");
|
|
|
|
return 0;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_strlen_zero(channel_name)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No channel name provided.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!ao2_container_count(conference_bridges)) {
|
|
|
|
astman_send_error(s, m, "No active conferences.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
res = generic_mute_unmute_helper(mute, conference_name, channel_name);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
if (res == -1) {
|
|
|
|
astman_send_error(s, m, "No Conference by that name found.");
|
|
|
|
return 0;
|
|
|
|
} else if (res == -2) {
|
|
|
|
astman_send_error(s, m, "No Channel by that name found in Conference.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
astman_send_ack(s, m, mute ? "User muted" : "User unmuted");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_confbridgeunmute(struct mansession *s, const struct message *m)
|
|
|
|
{
|
|
|
|
return action_mute_unmute_helper(s, m, 0);
|
|
|
|
}
|
|
|
|
static int action_confbridgemute(struct mansession *s, const struct message *m)
|
|
|
|
{
|
|
|
|
return action_mute_unmute_helper(s, m, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_lock_unlock_helper(struct mansession *s, const struct message *m, int lock)
|
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
const char *conference_name = astman_get_header(m, "Conference");
|
2011-04-21 18:11:40 +00:00
|
|
|
int res = 0;
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_strlen_zero(conference_name)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference name provided.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!ao2_container_count(conference_bridges)) {
|
|
|
|
astman_send_error(s, m, "No active conferences.");
|
|
|
|
return 0;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
if ((res = generic_lock_unlock_helper(lock, conference_name))) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference by that name found.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
astman_send_ack(s, m, lock ? "Conference locked" : "Conference unlocked");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static int action_confbridgeunlock(struct mansession *s, const struct message *m)
|
|
|
|
{
|
|
|
|
return action_lock_unlock_helper(s, m, 0);
|
|
|
|
}
|
|
|
|
static int action_confbridgelock(struct mansession *s, const struct message *m)
|
|
|
|
{
|
|
|
|
return action_lock_unlock_helper(s, m, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_confbridgekick(struct mansession *s, const struct message *m)
|
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
const char *conference_name = astman_get_header(m, "Conference");
|
2011-04-21 18:11:40 +00:00
|
|
|
const char *channel = astman_get_header(m, "Channel");
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_conference *conference;
|
2014-05-07 20:39:29 +00:00
|
|
|
int found;
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_strlen_zero(conference_name)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference name provided.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!ao2_container_count(conference_bridges)) {
|
|
|
|
astman_send_error(s, m, "No active conferences.");
|
|
|
|
return 0;
|
|
|
|
}
|
2013-02-26 15:52:02 +00:00
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference by that name found.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
found = !kick_conference_participant(conference, channel);
|
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
|
|
|
if (found) {
|
2014-04-21 14:58:12 +00:00
|
|
|
astman_send_ack(s, m, !strcmp("all", channel) ? "All participants kicked" : "User kicked");
|
2011-04-21 18:11:40 +00:00
|
|
|
} else {
|
|
|
|
astman_send_error(s, m, "No Channel by that name found in Conference.");
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int action_confbridgestartrecord(struct mansession *s, const struct message *m)
|
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
const char *conference_name = astman_get_header(m, "Conference");
|
2011-04-21 18:11:40 +00:00
|
|
|
const char *recordfile = astman_get_header(m, "RecordFile");
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_conference *conference;
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_strlen_zero(conference_name)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference name provided.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!ao2_container_count(conference_bridges)) {
|
|
|
|
astman_send_error(s, m, "No active conferences.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference by that name found.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
if (conf_is_recording(conference)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "Conference is already being recorded.");
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ast_strlen_zero(recordfile)) {
|
2013-03-09 00:21:46 +00:00
|
|
|
ast_copy_string(conference->b_profile.rec_file, recordfile, sizeof(conference->b_profile.rec_file));
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
|
|
|
|
2015-01-27 17:48:18 +00:00
|
|
|
if (conf_start_record(conference)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "Internal error starting conference recording.");
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_ack(s, m, "Conference Recording Started.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static int action_confbridgestoprecord(struct mansession *s, const struct message *m)
|
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
const char *conference_name = astman_get_header(m, "Conference");
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_conference *conference;
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_strlen_zero(conference_name)) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference name provided.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!ao2_container_count(conference_bridges)) {
|
|
|
|
astman_send_error(s, m, "No active conferences.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "No Conference by that name found.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
if (conf_stop_record(conference)) {
|
|
|
|
ao2_unlock(conference);
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_error(s, m, "Internal error while stopping recording.");
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_ref(conference, -1);
|
2011-04-21 18:11:40 +00:00
|
|
|
astman_send_ack(s, m, "Conference Recording Stopped.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-06-30 20:33:15 +00:00
|
|
|
static int action_confbridgesetsinglevideosrc(struct mansession *s, const struct message *m)
|
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
const char *conference_name = astman_get_header(m, "Conference");
|
2011-06-30 20:33:15 +00:00
|
|
|
const char *channel = astman_get_header(m, "Channel");
|
2013-04-23 20:18:44 +00:00
|
|
|
struct confbridge_user *user;
|
|
|
|
struct confbridge_conference *conference;
|
2011-06-30 20:33:15 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_strlen_zero(conference_name)) {
|
2011-06-30 20:33:15 +00:00
|
|
|
astman_send_error(s, m, "No Conference name provided.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (ast_strlen_zero(channel)) {
|
|
|
|
astman_send_error(s, m, "No channel name provided.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!ao2_container_count(conference_bridges)) {
|
|
|
|
astman_send_error(s, m, "No active conferences.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-06-30 20:33:15 +00:00
|
|
|
astman_send_error(s, m, "No Conference by that name found.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* find channel and set as video src. */
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
|
|
|
if (!strncmp(channel, ast_channel_name(user->chan), strlen(channel))) {
|
|
|
|
ast_bridge_set_single_src_video_mode(conference->bridge, user->chan);
|
2011-06-30 20:33:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
|
|
|
ao2_ref(conference, -1);
|
2011-06-30 20:33:15 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
/* do not access user after conference unlock. We are just
|
2011-06-30 20:33:15 +00:00
|
|
|
* using this check to see if it was found or not */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!user) {
|
2011-06-30 20:33:15 +00:00
|
|
|
astman_send_error(s, m, "No channel by that name found in conference.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
astman_send_ack(s, m, "Conference single video source set.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-06-15 13:45:41 +00:00
|
|
|
static int func_confbridge_info(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
|
|
|
|
{
|
2013-04-23 20:18:44 +00:00
|
|
|
char *parse;
|
|
|
|
struct confbridge_conference *conference;
|
|
|
|
struct confbridge_user *user;
|
2011-06-15 13:45:41 +00:00
|
|
|
int count = 0;
|
|
|
|
AST_DECLARE_APP_ARGS(args,
|
|
|
|
AST_APP_ARG(type);
|
|
|
|
AST_APP_ARG(confno);
|
|
|
|
);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2011-06-15 13:45:41 +00:00
|
|
|
/* parse all the required arguments and make sure they exist. */
|
|
|
|
if (ast_strlen_zero(data)) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
parse = ast_strdupa(data);
|
|
|
|
AST_STANDARD_APP_ARGS(args, parse);
|
|
|
|
if (ast_strlen_zero(args.confno) || ast_strlen_zero(args.type)) {
|
|
|
|
return -1;
|
|
|
|
}
|
2013-04-23 20:18:44 +00:00
|
|
|
conference = ao2_find(conference_bridges, args.confno, OBJ_KEY);
|
2013-03-09 00:21:46 +00:00
|
|
|
if (!conference) {
|
2011-08-19 20:00:19 +00:00
|
|
|
snprintf(buf, len, "0");
|
|
|
|
return 0;
|
2011-06-15 13:45:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* get the correct count for the type requested */
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_lock(conference);
|
2016-01-25 22:05:09 +00:00
|
|
|
if (!strcasecmp(args.type, "parties")) {
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
2011-06-15 13:45:41 +00:00
|
|
|
count++;
|
|
|
|
}
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
|
2013-02-26 15:52:02 +00:00
|
|
|
count++;
|
|
|
|
}
|
2016-01-25 22:05:09 +00:00
|
|
|
} else if (!strcasecmp(args.type, "admins")) {
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_ADMIN)) {
|
2011-06-15 13:45:41 +00:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
2016-01-25 22:05:09 +00:00
|
|
|
} else if (!strcasecmp(args.type, "marked")) {
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
|
|
|
|
if (ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)) {
|
2011-06-15 13:45:41 +00:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
2016-01-25 22:05:09 +00:00
|
|
|
} else if (!strcasecmp(args.type, "locked")) {
|
2013-03-09 00:21:46 +00:00
|
|
|
count = conference->locked;
|
2016-01-25 22:05:09 +00:00
|
|
|
} else if (!strcasecmp(args.type, "muted")) {
|
|
|
|
count = conference->muted;
|
2011-06-15 13:45:41 +00:00
|
|
|
} else {
|
2016-01-25 22:05:09 +00:00
|
|
|
ast_log(LOG_ERROR, "Invalid keyword '%s' passed to CONFBRIDGE_INFO.\n", args.type);
|
2011-06-15 13:45:41 +00:00
|
|
|
}
|
|
|
|
snprintf(buf, len, "%d", count);
|
2013-03-09 00:21:46 +00:00
|
|
|
ao2_unlock(conference);
|
|
|
|
ao2_ref(conference, -1);
|
2011-06-15 13:45:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_add_user_active(struct confbridge_conference *conference, struct confbridge_user *user)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_INSERT_TAIL(&conference->active_list, user, list);
|
|
|
|
conference->activeusers++;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_add_user_marked(struct confbridge_conference *conference, struct confbridge_user *user)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_INSERT_TAIL(&conference->active_list, user, list);
|
|
|
|
conference->activeusers++;
|
|
|
|
conference->markedusers++;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_add_user_waiting(struct confbridge_conference *conference, struct confbridge_user *user)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_INSERT_TAIL(&conference->waiting_list, user, list);
|
|
|
|
conference->waitingusers++;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_remove_user_active(struct confbridge_conference *conference, struct confbridge_user *user)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_REMOVE(&conference->active_list, user, list);
|
|
|
|
conference->activeusers--;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_remove_user_marked(struct confbridge_conference *conference, struct confbridge_user *user)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_REMOVE(&conference->active_list, user, list);
|
|
|
|
conference->activeusers--;
|
|
|
|
conference->markedusers--;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_mute_only_active(struct confbridge_conference *conference)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
struct confbridge_user *only_user = AST_LIST_FIRST(&conference->active_list);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
|
2013-11-02 03:24:47 +00:00
|
|
|
/* Turn on MOH if the single participant is set up for it */
|
2013-03-09 00:21:46 +00:00
|
|
|
if (ast_test_flag(&only_user->u_profile, USER_OPT_MUSICONHOLD)) {
|
|
|
|
conf_moh_start(only_user);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
2013-11-02 03:24:47 +00:00
|
|
|
conf_update_user_mute(only_user);
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
|
|
|
|
2013-03-09 00:21:46 +00:00
|
|
|
void conf_remove_user_waiting(struct confbridge_conference *conference, struct confbridge_user *user)
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
{
|
2013-03-09 00:21:46 +00:00
|
|
|
AST_LIST_REMOVE(&conference->waiting_list, user, list);
|
|
|
|
conference->waitingusers--;
|
Resolve issues in ConfBridge regarding marked, waitmarked, and unmarked users
Thank's to Neil Tallim (flan)'s tireless testing, issue reporting, and patches
it became clear that app_confbridge had some complex logic in how it handled
interactions between marked, waitmarked, and unmarked users. In particular,
there were some areas in which the interactions between the users resulted
in inconsistent behavior, and app_confbridge was missing logic in how to handle
some corner cases. Some areas included:
* Poor handling of mixing unmarked and waitmarked users
* Inconsistencies in how MOH and muting was applied to various users
* Handling of various announcements for different user profile options
flan's patches seem to fix the various issues, but highlighted how hard the
code could be to maintain. In an attempt to make things easier to maintain and
to more fully enumerate the various cases that exist, this patch breaks up the
logic into a state machine-like setup.
Please note that the various state transitioned are documented on the Asterisk
wiki:
https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes
Review: //https://reviewboard.asterisk.org/r/2072/
Note that for the following issues, mjordan uploaded the patch, although it
was written by twilson. Any contributor license discrepency is due to that.
(closes issue ASTERISK-19562)
Reported by: flan
Tested by: flan, mjordan, jrose
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-19726)
Reported by: flan
Tested by: flan
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
(closes issue ASTERISK-20181)
Reported by: Jonathan White
Tested by: Jonathan White
patches:
bugASTERISK-19562_ASTERISK-19726_ASTERISK-20181.patch uploaded by twilson (license 6283)
........
Merged revisions 374652 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 374657 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@374658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-08 18:48:34 +00:00
|
|
|
}
|
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Unregister a ConfBridge channel technology.
|
|
|
|
* \since 12.0.0
|
|
|
|
*
|
|
|
|
* \param tech What to unregister.
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
|
|
|
static void unregister_channel_tech(struct ast_channel_tech *tech)
|
|
|
|
{
|
|
|
|
ast_channel_unregister(tech);
|
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
|
|
|
ao2_cleanup(tech->capabilities);
|
2013-05-21 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Register a ConfBridge channel technology.
|
|
|
|
* \since 12.0.0
|
|
|
|
*
|
|
|
|
* \param tech What to register.
|
|
|
|
*
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
|
|
|
static int register_channel_tech(struct ast_channel_tech *tech)
|
|
|
|
{
|
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
|
|
|
tech->capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
|
2013-05-21 18:00:22 +00:00
|
|
|
if (!tech->capabilities) {
|
|
|
|
return -1;
|
|
|
|
}
|
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
|
|
|
ast_format_cap_append_by_type(tech->capabilities, AST_MEDIA_TYPE_UNKNOWN);
|
2013-05-21 18:00:22 +00:00
|
|
|
if (ast_channel_register(tech)) {
|
|
|
|
ast_log(LOG_ERROR, "Unable to register channel technology %s(%s).\n",
|
|
|
|
tech->type, tech->description);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/*! \brief Called when module is being unloaded */
|
|
|
|
static int unload_module(void)
|
|
|
|
{
|
2013-04-23 20:18:44 +00:00
|
|
|
ast_unregister_application(app);
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
ast_custom_function_unregister(&confbridge_function);
|
2011-06-15 13:45:41 +00:00
|
|
|
ast_custom_function_unregister(&confbridge_info_function);
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
ast_cli_unregister_multiple(cli_confbridge, ARRAY_LEN(cli_confbridge));
|
|
|
|
|
|
|
|
ast_manager_unregister("ConfbridgeList");
|
|
|
|
ast_manager_unregister("ConfbridgeListRooms");
|
|
|
|
ast_manager_unregister("ConfbridgeMute");
|
|
|
|
ast_manager_unregister("ConfbridgeUnmute");
|
|
|
|
ast_manager_unregister("ConfbridgeKick");
|
|
|
|
ast_manager_unregister("ConfbridgeUnlock");
|
|
|
|
ast_manager_unregister("ConfbridgeLock");
|
|
|
|
ast_manager_unregister("ConfbridgeStartRecord");
|
|
|
|
ast_manager_unregister("ConfbridgeStopRecord");
|
|
|
|
ast_manager_unregister("ConfbridgeSetSingleVideoSrc");
|
2011-02-01 16:05:23 +00:00
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
/* Unsubscribe from stasis confbridge message type and clean it up. */
|
|
|
|
manager_confbridge_shutdown();
|
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/* Get rid of the conference bridges container. Since we only allow dynamic ones none will be active. */
|
2013-04-23 20:18:44 +00:00
|
|
|
ao2_cleanup(conference_bridges);
|
|
|
|
conference_bridges = NULL;
|
2009-03-05 18:18:27 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
conf_destroy_config();
|
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
unregister_channel_tech(conf_announce_get_tech());
|
|
|
|
unregister_channel_tech(conf_record_get_tech());
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
return 0;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 23:22:50 +00:00
|
|
|
/*!
|
|
|
|
* \brief Load the module
|
|
|
|
*
|
|
|
|
* Module loading including tests for configuration or dependencies.
|
|
|
|
* This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE,
|
|
|
|
* or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails
|
2013-07-25 04:06:32 +00:00
|
|
|
* tests return AST_MODULE_LOAD_FAILURE. If the module can not load the
|
|
|
|
* configuration file or other non-critical problem return
|
2012-10-01 23:22:50 +00:00
|
|
|
* AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
|
|
|
|
*/
|
2009-03-05 18:18:27 +00:00
|
|
|
static int load_module(void)
|
|
|
|
{
|
2011-04-21 18:11:40 +00:00
|
|
|
int res = 0;
|
2012-07-30 20:27:39 +00:00
|
|
|
|
2013-06-13 19:04:41 +00:00
|
|
|
if (conf_load_config()) {
|
2012-09-04 15:35:02 +00:00
|
|
|
ast_log(LOG_ERROR, "Unable to load config. Not loading module.\n");
|
|
|
|
return AST_MODULE_LOAD_DECLINE;
|
|
|
|
}
|
2013-04-23 20:18:44 +00:00
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
if (register_channel_tech(conf_record_get_tech())
|
|
|
|
|| register_channel_tech(conf_announce_get_tech())) {
|
2013-04-23 20:18:44 +00:00
|
|
|
unload_module();
|
2011-04-21 18:11:40 +00:00
|
|
|
return AST_MODULE_LOAD_FAILURE;
|
|
|
|
}
|
2013-04-23 20:18:44 +00:00
|
|
|
|
2009-03-05 18:18:27 +00:00
|
|
|
/* Create a container to hold the conference bridges */
|
2013-04-23 20:18:44 +00:00
|
|
|
conference_bridges = ao2_container_alloc(CONFERENCE_BRIDGE_BUCKETS,
|
|
|
|
conference_bridge_hash_cb, conference_bridge_cmp_cb);
|
|
|
|
if (!conference_bridges) {
|
|
|
|
unload_module();
|
2011-04-21 18:11:40 +00:00
|
|
|
return AST_MODULE_LOAD_FAILURE;
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
/* Setup manager stasis subscriptions */
|
|
|
|
res |= manager_confbridge_init();
|
|
|
|
|
2013-04-23 20:18:44 +00:00
|
|
|
res |= ast_register_application_xml(app, confbridge_exec);
|
|
|
|
|
2014-11-20 15:57:23 +00:00
|
|
|
res |= ast_custom_function_register_escalating(&confbridge_function, AST_CFE_WRITE);
|
2013-04-23 20:18:44 +00:00
|
|
|
res |= ast_custom_function_register(&confbridge_info_function);
|
|
|
|
|
|
|
|
res |= ast_cli_register_multiple(cli_confbridge, ARRAY_LEN(cli_confbridge));
|
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
res |= ast_manager_register_xml("ConfbridgeList", EVENT_FLAG_REPORTING, action_confbridgelist);
|
|
|
|
res |= ast_manager_register_xml("ConfbridgeListRooms", EVENT_FLAG_REPORTING, action_confbridgelistrooms);
|
|
|
|
res |= ast_manager_register_xml("ConfbridgeMute", EVENT_FLAG_CALL, action_confbridgemute);
|
|
|
|
res |= ast_manager_register_xml("ConfbridgeUnmute", EVENT_FLAG_CALL, action_confbridgeunmute);
|
|
|
|
res |= ast_manager_register_xml("ConfbridgeKick", EVENT_FLAG_CALL, action_confbridgekick);
|
|
|
|
res |= ast_manager_register_xml("ConfbridgeUnlock", EVENT_FLAG_CALL, action_confbridgeunlock);
|
|
|
|
res |= ast_manager_register_xml("ConfbridgeLock", EVENT_FLAG_CALL, action_confbridgelock);
|
2014-11-20 15:57:23 +00:00
|
|
|
res |= ast_manager_register_xml("ConfbridgeStartRecord", EVENT_FLAG_SYSTEM, action_confbridgestartrecord);
|
|
|
|
res |= ast_manager_register_xml("ConfbridgeStopRecord", EVENT_FLAG_SYSTEM, action_confbridgestoprecord);
|
2011-06-30 20:33:15 +00:00
|
|
|
res |= ast_manager_register_xml("ConfbridgeSetSingleVideoSrc", EVENT_FLAG_CALL, action_confbridgesetsinglevideosrc);
|
2012-07-30 20:27:39 +00:00
|
|
|
if (res) {
|
2013-04-23 20:18:44 +00:00
|
|
|
unload_module();
|
2012-07-30 20:27:39 +00:00
|
|
|
return AST_MODULE_LOAD_FAILURE;
|
|
|
|
}
|
2011-04-21 18:11:40 +00:00
|
|
|
|
2012-07-30 20:27:39 +00:00
|
|
|
return AST_MODULE_LOAD_SUCCESS;
|
2011-04-21 18:11:40 +00:00
|
|
|
}
|
2011-02-01 16:05:23 +00:00
|
|
|
|
2011-04-21 18:11:40 +00:00
|
|
|
static int reload(void)
|
|
|
|
{
|
2013-06-13 19:04:41 +00:00
|
|
|
return conf_reload_config();
|
2009-03-05 18:18:27 +00:00
|
|
|
}
|
|
|
|
|
2010-07-20 19:35:02 +00:00
|
|
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Conference Bridge Application",
|
2014-07-25 16:47:17 +00:00
|
|
|
.support_level = AST_MODULE_SUPPORT_CORE,
|
2010-07-20 19:35:02 +00:00
|
|
|
.load = load_module,
|
|
|
|
.unload = unload_module,
|
2011-04-21 18:11:40 +00:00
|
|
|
.reload = reload,
|
2010-07-20 19:35:02 +00:00
|
|
|
.load_pri = AST_MODPRI_DEVSTATE_PROVIDER,
|
|
|
|
);
|