2013-05-21 18:00:22 +00:00
|
|
|
/*
|
|
|
|
* Asterisk -- An open source telephony toolkit.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 Digium, Inc.
|
|
|
|
*
|
|
|
|
* Richard Mudgett <rmudgett@digium.com>
|
|
|
|
*
|
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
|
|
|
*
|
|
|
|
* This program is free software, distributed under the terms of
|
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \file
|
|
|
|
* \brief Local proxy channel driver.
|
|
|
|
*
|
|
|
|
* \author Richard Mudgett <rmudgett@digium.com>
|
|
|
|
*
|
|
|
|
* See Also:
|
|
|
|
* \arg \ref AstCREDITS
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*** MODULEINFO
|
|
|
|
<support_level>core</support_level>
|
|
|
|
***/
|
|
|
|
|
|
|
|
|
|
|
|
#include "asterisk.h"
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#include "asterisk/channel.h"
|
|
|
|
#include "asterisk/pbx.h"
|
|
|
|
#include "asterisk/cli.h"
|
|
|
|
#include "asterisk/manager.h"
|
|
|
|
#include "asterisk/devicestate.h"
|
|
|
|
#include "asterisk/astobj2.h"
|
2013-07-25 04:06:32 +00:00
|
|
|
#include "asterisk/bridge.h"
|
2013-05-21 18:00:22 +00:00
|
|
|
#include "asterisk/core_unreal.h"
|
|
|
|
#include "asterisk/core_local.h"
|
2013-07-08 14:26:40 +00:00
|
|
|
#include "asterisk/stasis.h"
|
|
|
|
#include "asterisk/stasis_channels.h"
|
2013-05-21 18:00:22 +00:00
|
|
|
#include "asterisk/_private.h"
|
2013-07-01 13:16:09 +00:00
|
|
|
#include "asterisk/stasis_channels.h"
|
2013-05-21 18:00:22 +00:00
|
|
|
|
|
|
|
/*** DOCUMENTATION
|
|
|
|
<manager name="LocalOptimizeAway" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Optimize away a local channel when possible.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
|
|
|
|
<parameter name="Channel" required="true">
|
|
|
|
<para>The channel name to optimize away.</para>
|
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
<para>A local channel created with "/n" will not automatically optimize away.
|
|
|
|
Calling this command on the local channel will clear that flag and allow
|
|
|
|
it to optimize away if it's bridged or when it becomes bridged.</para>
|
|
|
|
</description>
|
|
|
|
</manager>
|
2013-07-01 13:16:09 +00:00
|
|
|
<managerEvent language="en_US" name="LocalBridge">
|
|
|
|
<managerEventInstance class="EVENT_FLAG_CALL">
|
|
|
|
<synopsis>Raised when two halves of a Local Channel form a bridge.</synopsis>
|
|
|
|
<syntax>
|
2013-08-01 17:07:52 +00:00
|
|
|
<channel_snapshot prefix="LocalOne"/>
|
|
|
|
<channel_snapshot prefix="LocalTwo"/>
|
2013-07-01 13:16:09 +00:00
|
|
|
<parameter name="Context">
|
|
|
|
<para>The context in the dialplan that Channel2 starts in.</para>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="Exten">
|
|
|
|
<para>The extension in the dialplan that Channel2 starts in.</para>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="LocalOptimization">
|
|
|
|
<enumlist>
|
|
|
|
<enum name="Yes"/>
|
|
|
|
<enum name="No"/>
|
|
|
|
</enumlist>
|
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
</managerEventInstance>
|
|
|
|
</managerEvent>
|
2013-07-08 14:26:40 +00:00
|
|
|
<managerEvent language="en_US" name="LocalOptimizationBegin">
|
|
|
|
<managerEventInstance class="EVENT_FLAG_CALL">
|
|
|
|
<synopsis>Raised when two halves of a Local Channel begin to optimize
|
|
|
|
themselves out of the media path.</synopsis>
|
|
|
|
<syntax>
|
2013-08-01 17:07:52 +00:00
|
|
|
<channel_snapshot prefix="LocalOne"/>
|
|
|
|
<channel_snapshot prefix="LocalTwo"/>
|
2013-08-22 18:52:41 +00:00
|
|
|
<channel_snapshot prefix="Source"/>
|
|
|
|
<parameter name="DestUniqueId">
|
|
|
|
<para>The unique ID of the bridge into which the local channel is optimizing.</para>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="Id">
|
|
|
|
<para>Identification for the optimization operation.</para>
|
|
|
|
</parameter>
|
2013-07-08 14:26:40 +00:00
|
|
|
</syntax>
|
|
|
|
<see-also>
|
|
|
|
<ref type="managerEvent">LocalOptimizationEnd</ref>
|
|
|
|
<ref type="manager">LocalOptimizeAway</ref>
|
|
|
|
</see-also>
|
|
|
|
</managerEventInstance>
|
|
|
|
</managerEvent>
|
|
|
|
<managerEvent language="en_US" name="LocalOptimizationEnd">
|
|
|
|
<managerEventInstance class="EVENT_FLAG_CALL">
|
|
|
|
<synopsis>Raised when two halves of a Local Channel have finished optimizing
|
|
|
|
themselves out of the media path.</synopsis>
|
|
|
|
<syntax>
|
2013-08-01 17:07:52 +00:00
|
|
|
<channel_snapshot prefix="LocalOne"/>
|
|
|
|
<channel_snapshot prefix="LocalTwo"/>
|
2013-08-22 18:52:41 +00:00
|
|
|
<parameter name="Success">
|
|
|
|
<para>Indicates whether the local optimization succeeded.</para>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="Id">
|
|
|
|
<para>Identification for the optimization operation. Matches the <replaceable>Id</replaceable>
|
|
|
|
from a previous <literal>LocalOptimizationBegin</literal></para>
|
|
|
|
</parameter>
|
2013-07-08 14:26:40 +00:00
|
|
|
</syntax>
|
|
|
|
<see-also>
|
|
|
|
<ref type="managerEvent">LocalOptimizationBegin</ref>
|
|
|
|
<ref type="manager">LocalOptimizeAway</ref>
|
|
|
|
</see-also>
|
|
|
|
</managerEventInstance>
|
|
|
|
</managerEvent>
|
2013-05-21 18:00:22 +00:00
|
|
|
***/
|
|
|
|
|
|
|
|
static const char tdesc[] = "Local Proxy Channel Driver";
|
|
|
|
|
|
|
|
static struct ao2_container *locals;
|
|
|
|
|
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
|
|
|
static struct ast_channel *local_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause);
|
2013-05-21 18:00:22 +00:00
|
|
|
static int local_call(struct ast_channel *ast, const char *dest, int timeout);
|
|
|
|
static int local_hangup(struct ast_channel *ast);
|
|
|
|
static int local_devicestate(const char *data);
|
2013-08-22 18:52:41 +00:00
|
|
|
static void local_optimization_started_cb(struct ast_unreal_pvt *base, struct ast_channel *source,
|
|
|
|
enum ast_unreal_channel_indicator dest, unsigned int id);
|
|
|
|
static void local_optimization_finished_cb(struct ast_unreal_pvt *base, int success, unsigned int id);
|
2013-07-08 14:26:40 +00:00
|
|
|
|
|
|
|
static struct ast_manager_event_blob *local_message_to_ami(struct stasis_message *msg);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @{ \brief Define local channel message types.
|
|
|
|
*/
|
|
|
|
STASIS_MESSAGE_TYPE_DEFN(ast_local_bridge_type,
|
|
|
|
.to_ami = local_message_to_ami,
|
|
|
|
);
|
|
|
|
STASIS_MESSAGE_TYPE_DEFN(ast_local_optimization_begin_type,
|
|
|
|
.to_ami = local_message_to_ami,
|
|
|
|
);
|
|
|
|
STASIS_MESSAGE_TYPE_DEFN(ast_local_optimization_end_type,
|
|
|
|
.to_ami = local_message_to_ami,
|
|
|
|
);
|
|
|
|
/*! @} */
|
|
|
|
|
|
|
|
/*! \brief Callbacks from the unreal core when channel optimization occurs */
|
|
|
|
struct ast_unreal_pvt_callbacks local_unreal_callbacks = {
|
|
|
|
.optimization_started = local_optimization_started_cb,
|
|
|
|
.optimization_finished = local_optimization_finished_cb,
|
|
|
|
};
|
2013-05-21 18:00:22 +00:00
|
|
|
|
|
|
|
/* PBX interface structure for channel registration */
|
|
|
|
static struct ast_channel_tech local_tech = {
|
|
|
|
.type = "Local",
|
|
|
|
.description = tdesc,
|
|
|
|
.requester = local_request,
|
|
|
|
.send_digit_begin = ast_unreal_digit_begin,
|
|
|
|
.send_digit_end = ast_unreal_digit_end,
|
|
|
|
.call = local_call,
|
|
|
|
.hangup = local_hangup,
|
|
|
|
.answer = ast_unreal_answer,
|
|
|
|
.read = ast_unreal_read,
|
|
|
|
.write = ast_unreal_write,
|
|
|
|
.write_video = ast_unreal_write,
|
|
|
|
.exception = ast_unreal_read,
|
|
|
|
.indicate = ast_unreal_indicate,
|
|
|
|
.fixup = ast_unreal_fixup,
|
|
|
|
.send_html = ast_unreal_sendhtml,
|
|
|
|
.send_text = ast_unreal_sendtext,
|
|
|
|
.devicestate = local_devicestate,
|
|
|
|
.queryoption = ast_unreal_queryoption,
|
|
|
|
.setoption = ast_unreal_setoption,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*! What to do with the ;2 channel when ast_call() happens. */
|
|
|
|
enum local_call_action {
|
|
|
|
/* The ast_call() will run dialplan on the ;2 channel. */
|
|
|
|
LOCAL_CALL_ACTION_DIALPLAN,
|
|
|
|
/* The ast_call() will impart the ;2 channel into a bridge. */
|
|
|
|
LOCAL_CALL_ACTION_BRIDGE,
|
|
|
|
/* The ast_call() will masquerade the ;2 channel into a channel. */
|
|
|
|
LOCAL_CALL_ACTION_MASQUERADE,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*! Join a bridge on ast_call() parameters. */
|
|
|
|
struct local_bridge {
|
|
|
|
/*! Bridge to join. */
|
|
|
|
struct ast_bridge *join;
|
|
|
|
/*! Channel to swap with when joining bridge. */
|
|
|
|
struct ast_channel *swap;
|
|
|
|
/*! Features that are specific to this channel when pushed into the bridge. */
|
|
|
|
struct ast_bridge_features *features;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief the local pvt structure for all channels
|
|
|
|
*
|
|
|
|
* The local channel pvt has two ast_chan objects - the "owner" and the "next channel", the outbound channel
|
|
|
|
*
|
|
|
|
* ast_chan owner -> local_pvt -> ast_chan chan
|
|
|
|
*/
|
|
|
|
struct local_pvt {
|
|
|
|
/*! Unreal channel driver base class values. */
|
|
|
|
struct ast_unreal_pvt base;
|
|
|
|
/*! Additional action arguments */
|
|
|
|
union {
|
|
|
|
/*! Make ;2 join a bridge on ast_call(). */
|
|
|
|
struct local_bridge bridge;
|
|
|
|
/*! Make ;2 masquerade into this channel on ast_call(). */
|
|
|
|
struct ast_channel *masq;
|
|
|
|
} action;
|
|
|
|
/*! What to do with the ;2 channel on ast_call(). */
|
|
|
|
enum local_call_action type;
|
|
|
|
/*! Context to call */
|
|
|
|
char context[AST_MAX_CONTEXT];
|
|
|
|
/*! Extension to call */
|
|
|
|
char exten[AST_MAX_EXTENSION];
|
|
|
|
};
|
|
|
|
|
2016-03-01 22:18:21 +00:00
|
|
|
void ast_local_lock_all(struct ast_channel *chan, struct ast_channel **outchan,
|
|
|
|
struct ast_channel **outowner)
|
|
|
|
{
|
|
|
|
struct local_pvt *p = ast_channel_tech_pvt(chan);
|
|
|
|
|
|
|
|
*outchan = NULL;
|
|
|
|
*outowner = NULL;
|
|
|
|
|
|
|
|
if (p) {
|
|
|
|
ao2_ref(p, 1);
|
|
|
|
ast_unreal_lock_all(&p->base, outchan, outowner);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ast_local_unlock_all(struct ast_channel *chan)
|
|
|
|
{
|
|
|
|
struct local_pvt *p = ast_channel_tech_pvt(chan);
|
|
|
|
struct ast_unreal_pvt *base;
|
|
|
|
|
|
|
|
if (!p) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
base = &p->base;
|
|
|
|
|
|
|
|
if (base->owner) {
|
|
|
|
ast_channel_unlock(base->owner);
|
|
|
|
ast_channel_unref(base->owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (base->chan) {
|
|
|
|
ast_channel_unlock(base->chan);
|
|
|
|
ast_channel_unref(base->chan);
|
|
|
|
}
|
|
|
|
|
|
|
|
ao2_unlock(base);
|
|
|
|
ao2_ref(p, -1);
|
|
|
|
}
|
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
struct ast_channel *ast_local_get_peer(struct ast_channel *ast)
|
|
|
|
{
|
|
|
|
struct local_pvt *p = ast_channel_tech_pvt(ast);
|
|
|
|
struct local_pvt *found;
|
|
|
|
struct ast_channel *peer;
|
|
|
|
|
|
|
|
if (!p) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
found = p ? ao2_find(locals, p, 0) : NULL;
|
|
|
|
if (!found) {
|
|
|
|
/* ast is either not a local channel or it has alredy been hungup */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
ao2_lock(found);
|
|
|
|
if (ast == p->base.owner) {
|
|
|
|
peer = p->base.chan;
|
|
|
|
} else if (ast == p->base.chan) {
|
|
|
|
peer = p->base.owner;
|
|
|
|
} else {
|
|
|
|
peer = NULL;
|
|
|
|
}
|
|
|
|
if (peer) {
|
|
|
|
ast_channel_ref(peer);
|
|
|
|
}
|
|
|
|
ao2_unlock(found);
|
|
|
|
ao2_ref(found, -1);
|
|
|
|
return peer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Adds devicestate to local channels */
|
|
|
|
static int local_devicestate(const char *data)
|
|
|
|
{
|
|
|
|
int is_inuse = 0;
|
|
|
|
int res = AST_DEVICE_INVALID;
|
|
|
|
char *exten = ast_strdupa(data);
|
|
|
|
char *context;
|
|
|
|
char *opts;
|
|
|
|
struct local_pvt *lp;
|
|
|
|
struct ao2_iterator it;
|
|
|
|
|
|
|
|
/* Strip options if they exist */
|
|
|
|
opts = strchr(exten, '/');
|
|
|
|
if (opts) {
|
|
|
|
*opts = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
context = strchr(exten, '@');
|
|
|
|
if (!context) {
|
|
|
|
ast_log(LOG_WARNING,
|
|
|
|
"Someone used Local/%s somewhere without a @context. This is bad.\n", data);
|
|
|
|
return AST_DEVICE_INVALID;
|
|
|
|
}
|
|
|
|
*context++ = '\0';
|
|
|
|
|
|
|
|
it = ao2_iterator_init(locals, 0);
|
|
|
|
for (; (lp = ao2_iterator_next(&it)); ao2_ref(lp, -1)) {
|
|
|
|
ao2_lock(lp);
|
|
|
|
if (!strcmp(exten, lp->exten)
|
|
|
|
&& !strcmp(context, lp->context)) {
|
|
|
|
res = AST_DEVICE_NOT_INUSE;
|
|
|
|
if (lp->base.owner
|
|
|
|
&& ast_test_flag(&lp->base, AST_UNREAL_CARETAKER_THREAD)) {
|
|
|
|
is_inuse = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ao2_unlock(lp);
|
|
|
|
if (is_inuse) {
|
|
|
|
res = AST_DEVICE_INUSE;
|
|
|
|
ao2_ref(lp, -1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ao2_iterator_destroy(&it);
|
|
|
|
|
|
|
|
if (res == AST_DEVICE_INVALID) {
|
|
|
|
ast_debug(3, "Checking if extension %s@%s exists (devicestate)\n", exten, context);
|
|
|
|
if (ast_exists_extension(NULL, context, exten, 1, NULL)) {
|
|
|
|
res = AST_DEVICE_NOT_INUSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2013-08-22 18:52:41 +00:00
|
|
|
static struct ast_multi_channel_blob *local_channel_optimization_blob(struct local_pvt *p,
|
|
|
|
struct ast_json *json_object)
|
2013-07-01 13:16:09 +00:00
|
|
|
{
|
2013-08-22 18:52:41 +00:00
|
|
|
struct ast_multi_channel_blob *payload;
|
2013-07-08 14:26:40 +00:00
|
|
|
RAII_VAR(struct ast_channel_snapshot *, local_one_snapshot, NULL, ao2_cleanup);
|
|
|
|
RAII_VAR(struct ast_channel_snapshot *, local_two_snapshot, NULL, ao2_cleanup);
|
|
|
|
|
stasis: Reduce creation of channel snapshots to improve performance
During some performance testing of Asterisk with AGI, ARI, and lots of Local
channels, we noticed that there's quite a hit in performance during channel
creation and releasing to the dialplan (ARI continue). After investigating
the performance spike that occurs during channel creation, we discovered
that we create a lot of channel snapshots that are technically unnecessary.
This includes creating snapshots during:
* AGI execution
* Returning objects for ARI commands
* During some Local channel operations
* During some dialling operations
* During variable setting
* During some bridging operations
And more.
This patch does the following:
- It removes a number of fields from channel snapshots. These fields were
rarely used, were expensive to have on the snapshot, and hurt performance.
This included formats, translation paths, Log Call ID, callgroup, pickup
group, and all channel variables. As a result, AMI Status,
"core show channel", "core show channelvar", and "pjsip show channel" were
modified to either hit the live channel or not show certain pieces of data.
While this is unfortunate, the performance gain from this patch is worth
the loss in behaviour.
- It adds a mechanism to publish a cached snapshot + blob. A large number of
publications were changed to use this, including:
- During Dial begin
- During Variable assignment (if no AMI variables are emitted - if AMI
variables are set, we have to make snapshots when a variable is changed)
- During channel pickup
- When a channel is put on hold/unhold
- When a DTMF digit is begun/ended
- When creating a bridge snapshot
- When an AOC event is raised
- During Local channel optimization/Local bridging
- When endpoint snapshots are generated
- All AGI events
- All ARI responses that return a channel
- Events in the AgentPool, MeetMe, and some in Queue
- Additionally, some extraneous channel snapshots were being made that were
unnecessary. These were removed.
- The result of ast_hashtab_hash_string is now cached in stasis_cache. This
reduces a large number of calls to ast_hashtab_hash_string, which reduced
the amount of time spent in this function in gprof by around 50%.
#ASTERISK-23811 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3568/
........
Merged revisions 416211 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-13 18:24:49 +00:00
|
|
|
local_one_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(p->base.owner));
|
2013-07-08 14:26:40 +00:00
|
|
|
if (!local_one_snapshot) {
|
2013-08-22 18:52:41 +00:00
|
|
|
return NULL;
|
2013-07-08 14:26:40 +00:00
|
|
|
}
|
|
|
|
|
stasis: Reduce creation of channel snapshots to improve performance
During some performance testing of Asterisk with AGI, ARI, and lots of Local
channels, we noticed that there's quite a hit in performance during channel
creation and releasing to the dialplan (ARI continue). After investigating
the performance spike that occurs during channel creation, we discovered
that we create a lot of channel snapshots that are technically unnecessary.
This includes creating snapshots during:
* AGI execution
* Returning objects for ARI commands
* During some Local channel operations
* During some dialling operations
* During variable setting
* During some bridging operations
And more.
This patch does the following:
- It removes a number of fields from channel snapshots. These fields were
rarely used, were expensive to have on the snapshot, and hurt performance.
This included formats, translation paths, Log Call ID, callgroup, pickup
group, and all channel variables. As a result, AMI Status,
"core show channel", "core show channelvar", and "pjsip show channel" were
modified to either hit the live channel or not show certain pieces of data.
While this is unfortunate, the performance gain from this patch is worth
the loss in behaviour.
- It adds a mechanism to publish a cached snapshot + blob. A large number of
publications were changed to use this, including:
- During Dial begin
- During Variable assignment (if no AMI variables are emitted - if AMI
variables are set, we have to make snapshots when a variable is changed)
- During channel pickup
- When a channel is put on hold/unhold
- When a DTMF digit is begun/ended
- When creating a bridge snapshot
- When an AOC event is raised
- During Local channel optimization/Local bridging
- When endpoint snapshots are generated
- All AGI events
- All ARI responses that return a channel
- Events in the AgentPool, MeetMe, and some in Queue
- Additionally, some extraneous channel snapshots were being made that were
unnecessary. These were removed.
- The result of ast_hashtab_hash_string is now cached in stasis_cache. This
reduces a large number of calls to ast_hashtab_hash_string, which reduced
the amount of time spent in this function in gprof by around 50%.
#ASTERISK-23811 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3568/
........
Merged revisions 416211 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-13 18:24:49 +00:00
|
|
|
local_two_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(p->base.chan));
|
2013-07-08 14:26:40 +00:00
|
|
|
if (!local_two_snapshot) {
|
2013-08-22 18:52:41 +00:00
|
|
|
return NULL;
|
2013-07-08 14:26:40 +00:00
|
|
|
}
|
|
|
|
|
2013-08-22 18:52:41 +00:00
|
|
|
payload = ast_multi_channel_blob_create(json_object);
|
2013-07-08 14:26:40 +00:00
|
|
|
if (!payload) {
|
2013-08-22 18:52:41 +00:00
|
|
|
return NULL;
|
2013-07-08 14:26:40 +00:00
|
|
|
}
|
|
|
|
ast_multi_channel_blob_add_channel(payload, "1", local_one_snapshot);
|
|
|
|
ast_multi_channel_blob_add_channel(payload, "2", local_two_snapshot);
|
|
|
|
|
2013-08-22 18:52:41 +00:00
|
|
|
return payload;
|
2013-07-08 14:26:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Callback for \ref ast_unreal_pvt_callbacks \ref optimization_started_cb */
|
2013-08-22 18:52:41 +00:00
|
|
|
static void local_optimization_started_cb(struct ast_unreal_pvt *base, struct ast_channel *source,
|
|
|
|
enum ast_unreal_channel_indicator dest, unsigned int id)
|
2013-07-08 14:26:40 +00:00
|
|
|
{
|
2013-08-22 18:52:41 +00:00
|
|
|
RAII_VAR(struct ast_json *, json_object, ast_json_null(), ast_json_unref);
|
|
|
|
RAII_VAR(struct ast_multi_channel_blob *, payload, NULL, ao2_cleanup);
|
|
|
|
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
|
2013-07-08 14:26:40 +00:00
|
|
|
struct local_pvt *p = (struct local_pvt *)base;
|
2013-08-22 18:52:41 +00:00
|
|
|
|
2014-08-06 12:55:28 +00:00
|
|
|
if (!ast_local_optimization_begin_type()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-08-22 18:52:41 +00:00
|
|
|
json_object = ast_json_pack("{s: i, s: i}",
|
|
|
|
"dest", dest, "id", id);
|
|
|
|
|
|
|
|
if (!json_object) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
payload = local_channel_optimization_blob(p, json_object);
|
|
|
|
if (!payload) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (source) {
|
|
|
|
RAII_VAR(struct ast_channel_snapshot *, source_snapshot, NULL, ao2_cleanup);
|
stasis: Reduce creation of channel snapshots to improve performance
During some performance testing of Asterisk with AGI, ARI, and lots of Local
channels, we noticed that there's quite a hit in performance during channel
creation and releasing to the dialplan (ARI continue). After investigating
the performance spike that occurs during channel creation, we discovered
that we create a lot of channel snapshots that are technically unnecessary.
This includes creating snapshots during:
* AGI execution
* Returning objects for ARI commands
* During some Local channel operations
* During some dialling operations
* During variable setting
* During some bridging operations
And more.
This patch does the following:
- It removes a number of fields from channel snapshots. These fields were
rarely used, were expensive to have on the snapshot, and hurt performance.
This included formats, translation paths, Log Call ID, callgroup, pickup
group, and all channel variables. As a result, AMI Status,
"core show channel", "core show channelvar", and "pjsip show channel" were
modified to either hit the live channel or not show certain pieces of data.
While this is unfortunate, the performance gain from this patch is worth
the loss in behaviour.
- It adds a mechanism to publish a cached snapshot + blob. A large number of
publications were changed to use this, including:
- During Dial begin
- During Variable assignment (if no AMI variables are emitted - if AMI
variables are set, we have to make snapshots when a variable is changed)
- During channel pickup
- When a channel is put on hold/unhold
- When a DTMF digit is begun/ended
- When creating a bridge snapshot
- When an AOC event is raised
- During Local channel optimization/Local bridging
- When endpoint snapshots are generated
- All AGI events
- All ARI responses that return a channel
- Events in the AgentPool, MeetMe, and some in Queue
- Additionally, some extraneous channel snapshots were being made that were
unnecessary. These were removed.
- The result of ast_hashtab_hash_string is now cached in stasis_cache. This
reduces a large number of calls to ast_hashtab_hash_string, which reduced
the amount of time spent in this function in gprof by around 50%.
#ASTERISK-23811 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3568/
........
Merged revisions 416211 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-13 18:24:49 +00:00
|
|
|
source_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(source));
|
2013-08-22 18:52:41 +00:00
|
|
|
if (!source_snapshot) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_multi_channel_blob_add_channel(payload, "source", source_snapshot);
|
|
|
|
}
|
|
|
|
|
|
|
|
msg = stasis_message_create(ast_local_optimization_begin_type(), payload);
|
|
|
|
if (!msg) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
stasis_publish(ast_channel_topic(p->base.owner), msg);
|
2013-07-08 14:26:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Callback for \ref ast_unreal_pvt_callbacks \ref optimization_finished_cb */
|
2013-08-22 18:52:41 +00:00
|
|
|
static void local_optimization_finished_cb(struct ast_unreal_pvt *base, int success, unsigned int id)
|
2013-07-08 14:26:40 +00:00
|
|
|
{
|
2013-08-22 18:52:41 +00:00
|
|
|
RAII_VAR(struct ast_json *, json_object, ast_json_null(), ast_json_unref);
|
|
|
|
RAII_VAR(struct ast_multi_channel_blob *, payload, NULL, ao2_cleanup);
|
|
|
|
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
|
2013-07-08 14:26:40 +00:00
|
|
|
struct local_pvt *p = (struct local_pvt *)base;
|
2013-08-22 18:52:41 +00:00
|
|
|
|
2014-08-06 12:55:28 +00:00
|
|
|
if (!ast_local_optimization_end_type()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-08-22 18:52:41 +00:00
|
|
|
json_object = ast_json_pack("{s: i, s: i}", "success", success, "id", id);
|
|
|
|
|
|
|
|
if (!json_object) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
payload = local_channel_optimization_blob(p, json_object);
|
|
|
|
if (!payload) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
msg = stasis_message_create(ast_local_optimization_end_type(), payload);
|
|
|
|
if (!msg) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
stasis_publish(ast_channel_topic(p->base.owner), msg);
|
2013-07-08 14:26:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct ast_manager_event_blob *local_message_to_ami(struct stasis_message *message)
|
|
|
|
{
|
|
|
|
struct ast_multi_channel_blob *obj = stasis_message_data(message);
|
|
|
|
struct ast_json *blob = ast_multi_channel_blob_get_json(obj);
|
|
|
|
struct ast_channel_snapshot *local_snapshot_one;
|
|
|
|
struct ast_channel_snapshot *local_snapshot_two;
|
|
|
|
RAII_VAR(struct ast_str *, local_channel_one, NULL, ast_free);
|
|
|
|
RAII_VAR(struct ast_str *, local_channel_two, NULL, ast_free);
|
2013-09-06 20:21:21 +00:00
|
|
|
RAII_VAR(struct ast_str *, event_buffer, NULL, ast_free);
|
2013-07-08 14:26:40 +00:00
|
|
|
const char *event;
|
|
|
|
|
|
|
|
local_snapshot_one = ast_multi_channel_blob_get_channel(obj, "1");
|
|
|
|
local_snapshot_two = ast_multi_channel_blob_get_channel(obj, "2");
|
|
|
|
if (!local_snapshot_one || !local_snapshot_two) {
|
2013-07-01 13:16:09 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-09-06 20:21:21 +00:00
|
|
|
event_buffer = ast_str_create(1024);
|
2013-07-08 14:26:40 +00:00
|
|
|
local_channel_one = ast_manager_build_channel_state_string_prefix(local_snapshot_one, "LocalOne");
|
|
|
|
local_channel_two = ast_manager_build_channel_state_string_prefix(local_snapshot_two, "LocalTwo");
|
2013-09-06 20:21:21 +00:00
|
|
|
if (!event_buffer || !local_channel_one || !local_channel_two) {
|
2013-07-01 13:16:09 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-08 14:26:40 +00:00
|
|
|
if (stasis_message_type(message) == ast_local_optimization_begin_type()) {
|
2013-08-22 18:52:41 +00:00
|
|
|
struct ast_channel_snapshot *source_snapshot;
|
|
|
|
RAII_VAR(struct ast_str *, source_str, NULL, ast_free);
|
|
|
|
const char *dest_uniqueid;
|
|
|
|
|
|
|
|
source_snapshot = ast_multi_channel_blob_get_channel(obj, "source");
|
|
|
|
if (source_snapshot) {
|
|
|
|
source_str = ast_manager_build_channel_state_string_prefix(source_snapshot, "Source");
|
|
|
|
if (!source_str) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dest_uniqueid = ast_json_object_get(blob, "dest") == AST_UNREAL_OWNER ?
|
|
|
|
local_snapshot_one->uniqueid : local_snapshot_two->uniqueid;
|
|
|
|
|
2013-07-08 14:26:40 +00:00
|
|
|
event = "LocalOptimizationBegin";
|
2013-08-22 18:52:41 +00:00
|
|
|
if (source_str) {
|
|
|
|
ast_str_append(&event_buffer, 0, "%s", ast_str_buffer(source_str));
|
|
|
|
}
|
|
|
|
ast_str_append(&event_buffer, 0, "DestUniqueId: %s\r\n", dest_uniqueid);
|
|
|
|
ast_str_append(&event_buffer, 0, "Id: %u\r\n", (unsigned int) ast_json_integer_get(ast_json_object_get(blob, "id")));
|
2013-07-08 14:26:40 +00:00
|
|
|
} else if (stasis_message_type(message) == ast_local_optimization_end_type()) {
|
|
|
|
event = "LocalOptimizationEnd";
|
2013-08-22 18:52:41 +00:00
|
|
|
ast_str_append(&event_buffer, 0, "Success: %s\r\n", ast_json_integer_get(ast_json_object_get(blob, "success")) ? "Yes" : "No");
|
|
|
|
ast_str_append(&event_buffer, 0, "Id: %u\r\n", (unsigned int) ast_json_integer_get(ast_json_object_get(blob, "id")));
|
2013-07-08 14:26:40 +00:00
|
|
|
} else if (stasis_message_type(message) == ast_local_bridge_type()) {
|
|
|
|
event = "LocalBridge";
|
|
|
|
ast_str_append(&event_buffer, 0, "Context: %s\r\n", ast_json_string_get(ast_json_object_get(blob, "context")));
|
|
|
|
ast_str_append(&event_buffer, 0, "Exten: %s\r\n", ast_json_string_get(ast_json_object_get(blob, "exten")));
|
|
|
|
ast_str_append(&event_buffer, 0, "LocalOptimization: %s\r\n", ast_json_is_true(ast_json_object_get(blob, "can_optimize")) ? "Yes" : "No");
|
|
|
|
} else {
|
|
|
|
return NULL;
|
|
|
|
}
|
2013-07-01 13:16:09 +00:00
|
|
|
|
2013-07-08 14:26:40 +00:00
|
|
|
return ast_manager_event_blob_create(EVENT_FLAG_CALL, event,
|
2013-07-01 13:16:09 +00:00
|
|
|
"%s"
|
|
|
|
"%s"
|
2013-07-08 14:26:40 +00:00
|
|
|
"%s",
|
|
|
|
ast_str_buffer(local_channel_one),
|
|
|
|
ast_str_buffer(local_channel_two),
|
|
|
|
ast_str_buffer(event_buffer));
|
2013-07-01 13:16:09 +00:00
|
|
|
}
|
|
|
|
|
2013-05-21 18:00:22 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
2013-07-08 14:26:40 +00:00
|
|
|
* \brief Post the \ref ast_local_bridge_type \ref stasis message
|
2013-05-21 18:00:22 +00:00
|
|
|
* \since 12.0.0
|
|
|
|
*
|
2013-07-08 14:26:40 +00:00
|
|
|
* \param p local_pvt to raise the local bridge message
|
2013-05-21 18:00:22 +00:00
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
2013-07-08 14:26:40 +00:00
|
|
|
static void publish_local_bridge_message(struct local_pvt *p)
|
2013-05-21 18:00:22 +00:00
|
|
|
{
|
2013-07-01 13:16:09 +00:00
|
|
|
RAII_VAR(struct ast_multi_channel_blob *, multi_blob, NULL, ao2_cleanup);
|
|
|
|
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
|
|
|
|
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
|
|
|
|
RAII_VAR(struct ast_channel_snapshot *, one_snapshot, NULL, ao2_cleanup);
|
|
|
|
RAII_VAR(struct ast_channel_snapshot *, two_snapshot, NULL, ao2_cleanup);
|
2013-12-18 20:33:37 +00:00
|
|
|
struct ast_channel *owner;
|
|
|
|
struct ast_channel *chan;
|
|
|
|
|
2014-08-06 12:55:28 +00:00
|
|
|
if (!ast_local_bridge_type()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-12-18 20:33:37 +00:00
|
|
|
ast_unreal_lock_all(&p->base, &chan, &owner);
|
2013-07-01 13:16:09 +00:00
|
|
|
|
|
|
|
blob = ast_json_pack("{s: s, s: s, s: b}",
|
|
|
|
"context", p->context,
|
|
|
|
"exten", p->exten,
|
2013-07-08 14:26:40 +00:00
|
|
|
"can_optimize", !ast_test_flag(&p->base, AST_UNREAL_NO_OPTIMIZATION));
|
2013-07-01 13:16:09 +00:00
|
|
|
if (!blob) {
|
2013-12-18 20:33:37 +00:00
|
|
|
goto end;
|
2013-07-01 13:16:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
multi_blob = ast_multi_channel_blob_create(blob);
|
|
|
|
if (!multi_blob) {
|
2013-12-18 20:33:37 +00:00
|
|
|
goto end;
|
2013-07-01 13:16:09 +00:00
|
|
|
}
|
|
|
|
|
stasis: Reduce creation of channel snapshots to improve performance
During some performance testing of Asterisk with AGI, ARI, and lots of Local
channels, we noticed that there's quite a hit in performance during channel
creation and releasing to the dialplan (ARI continue). After investigating
the performance spike that occurs during channel creation, we discovered
that we create a lot of channel snapshots that are technically unnecessary.
This includes creating snapshots during:
* AGI execution
* Returning objects for ARI commands
* During some Local channel operations
* During some dialling operations
* During variable setting
* During some bridging operations
And more.
This patch does the following:
- It removes a number of fields from channel snapshots. These fields were
rarely used, were expensive to have on the snapshot, and hurt performance.
This included formats, translation paths, Log Call ID, callgroup, pickup
group, and all channel variables. As a result, AMI Status,
"core show channel", "core show channelvar", and "pjsip show channel" were
modified to either hit the live channel or not show certain pieces of data.
While this is unfortunate, the performance gain from this patch is worth
the loss in behaviour.
- It adds a mechanism to publish a cached snapshot + blob. A large number of
publications were changed to use this, including:
- During Dial begin
- During Variable assignment (if no AMI variables are emitted - if AMI
variables are set, we have to make snapshots when a variable is changed)
- During channel pickup
- When a channel is put on hold/unhold
- When a DTMF digit is begun/ended
- When creating a bridge snapshot
- When an AOC event is raised
- During Local channel optimization/Local bridging
- When endpoint snapshots are generated
- All AGI events
- All ARI responses that return a channel
- Events in the AgentPool, MeetMe, and some in Queue
- Additionally, some extraneous channel snapshots were being made that were
unnecessary. These were removed.
- The result of ast_hashtab_hash_string is now cached in stasis_cache. This
reduces a large number of calls to ast_hashtab_hash_string, which reduced
the amount of time spent in this function in gprof by around 50%.
#ASTERISK-23811 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3568/
........
Merged revisions 416211 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-13 18:24:49 +00:00
|
|
|
one_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(owner));
|
2013-07-01 13:16:09 +00:00
|
|
|
if (!one_snapshot) {
|
2013-12-18 20:33:37 +00:00
|
|
|
goto end;
|
2013-07-01 13:16:09 +00:00
|
|
|
}
|
|
|
|
|
stasis: Reduce creation of channel snapshots to improve performance
During some performance testing of Asterisk with AGI, ARI, and lots of Local
channels, we noticed that there's quite a hit in performance during channel
creation and releasing to the dialplan (ARI continue). After investigating
the performance spike that occurs during channel creation, we discovered
that we create a lot of channel snapshots that are technically unnecessary.
This includes creating snapshots during:
* AGI execution
* Returning objects for ARI commands
* During some Local channel operations
* During some dialling operations
* During variable setting
* During some bridging operations
And more.
This patch does the following:
- It removes a number of fields from channel snapshots. These fields were
rarely used, were expensive to have on the snapshot, and hurt performance.
This included formats, translation paths, Log Call ID, callgroup, pickup
group, and all channel variables. As a result, AMI Status,
"core show channel", "core show channelvar", and "pjsip show channel" were
modified to either hit the live channel or not show certain pieces of data.
While this is unfortunate, the performance gain from this patch is worth
the loss in behaviour.
- It adds a mechanism to publish a cached snapshot + blob. A large number of
publications were changed to use this, including:
- During Dial begin
- During Variable assignment (if no AMI variables are emitted - if AMI
variables are set, we have to make snapshots when a variable is changed)
- During channel pickup
- When a channel is put on hold/unhold
- When a DTMF digit is begun/ended
- When creating a bridge snapshot
- When an AOC event is raised
- During Local channel optimization/Local bridging
- When endpoint snapshots are generated
- All AGI events
- All ARI responses that return a channel
- Events in the AgentPool, MeetMe, and some in Queue
- Additionally, some extraneous channel snapshots were being made that were
unnecessary. These were removed.
- The result of ast_hashtab_hash_string is now cached in stasis_cache. This
reduces a large number of calls to ast_hashtab_hash_string, which reduced
the amount of time spent in this function in gprof by around 50%.
#ASTERISK-23811 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3568/
........
Merged revisions 416211 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-13 18:24:49 +00:00
|
|
|
two_snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(chan));
|
2013-07-01 13:16:09 +00:00
|
|
|
if (!two_snapshot) {
|
2013-12-18 20:33:37 +00:00
|
|
|
goto end;
|
2013-07-01 13:16:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ast_multi_channel_blob_add_channel(multi_blob, "1", one_snapshot);
|
|
|
|
ast_multi_channel_blob_add_channel(multi_blob, "2", two_snapshot);
|
|
|
|
|
2013-07-08 14:26:40 +00:00
|
|
|
msg = stasis_message_create(ast_local_bridge_type(), multi_blob);
|
2013-07-01 13:16:09 +00:00
|
|
|
if (!msg) {
|
2013-12-18 20:33:37 +00:00
|
|
|
goto end;
|
2013-07-01 13:16:09 +00:00
|
|
|
}
|
|
|
|
|
2013-12-18 20:33:37 +00:00
|
|
|
stasis_publish(ast_channel_topic(owner), msg);
|
|
|
|
|
|
|
|
end:
|
|
|
|
ast_channel_unlock(owner);
|
|
|
|
ast_channel_unref(owner);
|
|
|
|
|
|
|
|
ast_channel_unlock(chan);
|
|
|
|
ast_channel_unref(chan);
|
|
|
|
|
|
|
|
ao2_unlock(&p->base);
|
2013-05-21 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int ast_local_setup_bridge(struct ast_channel *ast, struct ast_bridge *bridge, struct ast_channel *swap, struct ast_bridge_features *features)
|
|
|
|
{
|
|
|
|
struct local_pvt *p;
|
|
|
|
struct local_pvt *found;
|
|
|
|
int res = -1;
|
|
|
|
|
|
|
|
/* Sanity checks. */
|
|
|
|
if (!ast || !bridge) {
|
|
|
|
ast_bridge_features_destroy(features);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_channel_lock(ast);
|
|
|
|
p = ast_channel_tech_pvt(ast);
|
|
|
|
ast_channel_unlock(ast);
|
|
|
|
|
|
|
|
found = p ? ao2_find(locals, p, 0) : NULL;
|
|
|
|
if (found) {
|
|
|
|
ao2_lock(found);
|
|
|
|
if (found->type == LOCAL_CALL_ACTION_DIALPLAN
|
|
|
|
&& found->base.owner
|
|
|
|
&& found->base.chan
|
|
|
|
&& !ast_test_flag(&found->base, AST_UNREAL_CARETAKER_THREAD)) {
|
|
|
|
ao2_ref(bridge, +1);
|
|
|
|
if (swap) {
|
|
|
|
ast_channel_ref(swap);
|
|
|
|
}
|
|
|
|
found->type = LOCAL_CALL_ACTION_BRIDGE;
|
|
|
|
found->action.bridge.join = bridge;
|
|
|
|
found->action.bridge.swap = swap;
|
|
|
|
found->action.bridge.features = features;
|
|
|
|
res = 0;
|
|
|
|
} else {
|
|
|
|
ast_bridge_features_destroy(features);
|
|
|
|
}
|
|
|
|
ao2_unlock(found);
|
|
|
|
ao2_ref(found, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ast_local_setup_masquerade(struct ast_channel *ast, struct ast_channel *masq)
|
|
|
|
{
|
|
|
|
struct local_pvt *p;
|
|
|
|
struct local_pvt *found;
|
|
|
|
int res = -1;
|
|
|
|
|
|
|
|
/* Sanity checks. */
|
|
|
|
if (!ast || !masq) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_channel_lock(ast);
|
|
|
|
p = ast_channel_tech_pvt(ast);
|
|
|
|
ast_channel_unlock(ast);
|
|
|
|
|
|
|
|
found = p ? ao2_find(locals, p, 0) : NULL;
|
|
|
|
if (found) {
|
|
|
|
ao2_lock(found);
|
|
|
|
if (found->type == LOCAL_CALL_ACTION_DIALPLAN
|
|
|
|
&& found->base.owner
|
|
|
|
&& found->base.chan
|
|
|
|
&& !ast_test_flag(&found->base, AST_UNREAL_CARETAKER_THREAD)) {
|
|
|
|
ast_channel_ref(masq);
|
|
|
|
found->type = LOCAL_CALL_ACTION_MASQUERADE;
|
|
|
|
found->action.masq = masq;
|
|
|
|
res = 0;
|
|
|
|
}
|
|
|
|
ao2_unlock(found);
|
|
|
|
ao2_ref(found, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Initiate new call, part of PBX interface
|
|
|
|
* dest is the dial string */
|
|
|
|
static int local_call(struct ast_channel *ast, const char *dest, int timeout)
|
|
|
|
{
|
|
|
|
struct local_pvt *p = ast_channel_tech_pvt(ast);
|
|
|
|
int pvt_locked = 0;
|
|
|
|
|
|
|
|
struct ast_channel *owner = NULL;
|
|
|
|
struct ast_channel *chan = NULL;
|
|
|
|
int res;
|
|
|
|
char *reduced_dest = ast_strdupa(dest);
|
|
|
|
char *slash;
|
|
|
|
const char *chan_cid;
|
|
|
|
|
|
|
|
if (!p) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* since we are letting go of channel locks that were locked coming into
|
|
|
|
* this function, then we need to give the tech pvt a ref */
|
|
|
|
ao2_ref(p, 1);
|
|
|
|
ast_channel_unlock(ast);
|
|
|
|
|
|
|
|
ast_unreal_lock_all(&p->base, &chan, &owner);
|
|
|
|
pvt_locked = 1;
|
|
|
|
|
|
|
|
if (owner != ast) {
|
|
|
|
res = -1;
|
|
|
|
goto return_cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!owner || !chan) {
|
|
|
|
res = -1;
|
|
|
|
goto return_cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_unreal_call_setup(owner, chan);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the local channel has /n on the end of it, we need to lop
|
|
|
|
* that off for our argument to setting up the CC_INTERFACES
|
|
|
|
* variable.
|
|
|
|
*/
|
|
|
|
if ((slash = strrchr(reduced_dest, '/'))) {
|
|
|
|
*slash = '\0';
|
|
|
|
}
|
|
|
|
ast_set_cc_interfaces_chanvar(chan, reduced_dest);
|
|
|
|
|
|
|
|
ao2_unlock(p);
|
|
|
|
pvt_locked = 0;
|
|
|
|
|
|
|
|
ast_channel_unlock(owner);
|
|
|
|
|
|
|
|
chan_cid = S_COR(ast_channel_caller(chan)->id.number.valid,
|
|
|
|
ast_channel_caller(chan)->id.number.str, NULL);
|
|
|
|
if (chan_cid) {
|
|
|
|
chan_cid = ast_strdupa(chan_cid);
|
|
|
|
}
|
|
|
|
ast_channel_unlock(chan);
|
|
|
|
|
|
|
|
res = -1;
|
|
|
|
switch (p->type) {
|
|
|
|
case LOCAL_CALL_ACTION_DIALPLAN:
|
|
|
|
if (!ast_exists_extension(NULL, p->context, p->exten, 1, chan_cid)) {
|
|
|
|
ast_log(LOG_NOTICE, "No such extension/context %s@%s while calling Local channel\n",
|
|
|
|
p->exten, p->context);
|
|
|
|
} else {
|
2013-07-08 14:26:40 +00:00
|
|
|
publish_local_bridge_message(p);
|
2013-05-21 18:00:22 +00:00
|
|
|
|
|
|
|
/* Start switch on sub channel */
|
|
|
|
res = ast_pbx_start(chan);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LOCAL_CALL_ACTION_BRIDGE:
|
2013-07-08 14:26:40 +00:00
|
|
|
publish_local_bridge_message(p);
|
2013-05-21 18:00:22 +00:00
|
|
|
ast_answer(chan);
|
|
|
|
res = ast_bridge_impart(p->action.bridge.join, chan, p->action.bridge.swap,
|
2013-09-13 22:19:23 +00:00
|
|
|
p->action.bridge.features, AST_BRIDGE_IMPART_CHAN_INDEPENDENT);
|
2013-05-21 18:00:22 +00:00
|
|
|
ao2_ref(p->action.bridge.join, -1);
|
|
|
|
p->action.bridge.join = NULL;
|
|
|
|
ao2_cleanup(p->action.bridge.swap);
|
|
|
|
p->action.bridge.swap = NULL;
|
|
|
|
p->action.bridge.features = NULL;
|
|
|
|
break;
|
|
|
|
case LOCAL_CALL_ACTION_MASQUERADE:
|
2013-07-08 14:26:40 +00:00
|
|
|
publish_local_bridge_message(p);
|
2013-05-21 18:00:22 +00:00
|
|
|
ast_answer(chan);
|
2013-06-05 23:29:43 +00:00
|
|
|
res = ast_channel_move(p->action.masq, chan);
|
2013-05-21 18:00:22 +00:00
|
|
|
if (!res) {
|
|
|
|
/* Chan is now an orphaned zombie. Destroy it. */
|
|
|
|
ast_hangup(chan);
|
|
|
|
}
|
|
|
|
p->action.masq = ast_channel_unref(p->action.masq);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!res) {
|
|
|
|
ao2_lock(p);
|
|
|
|
ast_set_flag(&p->base, AST_UNREAL_CARETAKER_THREAD);
|
|
|
|
ao2_unlock(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we already unlocked them, clear them here so the cleanup label won't touch them. */
|
|
|
|
owner = ast_channel_unref(owner);
|
|
|
|
chan = ast_channel_unref(chan);
|
|
|
|
|
|
|
|
return_cleanup:
|
|
|
|
if (p) {
|
|
|
|
if (pvt_locked) {
|
|
|
|
ao2_unlock(p);
|
|
|
|
}
|
|
|
|
ao2_ref(p, -1);
|
|
|
|
}
|
|
|
|
if (chan) {
|
|
|
|
ast_channel_unlock(chan);
|
|
|
|
ast_channel_unref(chan);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* owner is supposed to be == to ast, if it is, don't unlock it
|
|
|
|
* because ast must exit locked
|
|
|
|
*/
|
|
|
|
if (owner) {
|
|
|
|
if (owner != ast) {
|
|
|
|
ast_channel_unlock(owner);
|
|
|
|
ast_channel_lock(ast);
|
|
|
|
}
|
|
|
|
ast_channel_unref(owner);
|
|
|
|
} else {
|
|
|
|
/* we have to exit with ast locked */
|
|
|
|
ast_channel_lock(ast);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Hangup a call through the local proxy channel */
|
|
|
|
static int local_hangup(struct ast_channel *ast)
|
|
|
|
{
|
|
|
|
struct local_pvt *p = ast_channel_tech_pvt(ast);
|
|
|
|
int res;
|
|
|
|
|
|
|
|
if (!p) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* give the pvt a ref to fulfill calling requirements. */
|
|
|
|
ao2_ref(p, +1);
|
|
|
|
res = ast_unreal_hangup(&p->base, ast);
|
|
|
|
if (!res) {
|
|
|
|
int unlink;
|
|
|
|
|
|
|
|
ao2_lock(p);
|
|
|
|
unlink = !p->base.owner && !p->base.chan;
|
|
|
|
ao2_unlock(p);
|
|
|
|
if (unlink) {
|
|
|
|
ao2_unlink(locals, p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ao2_ref(p, -1);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief struct local_pvt destructor.
|
|
|
|
*
|
|
|
|
* \param vdoomed Object to destroy.
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
|
|
|
static void local_pvt_destructor(void *vdoomed)
|
|
|
|
{
|
|
|
|
struct local_pvt *doomed = vdoomed;
|
|
|
|
|
|
|
|
switch (doomed->type) {
|
|
|
|
case LOCAL_CALL_ACTION_DIALPLAN:
|
|
|
|
break;
|
|
|
|
case LOCAL_CALL_ACTION_BRIDGE:
|
|
|
|
ao2_cleanup(doomed->action.bridge.join);
|
|
|
|
ao2_cleanup(doomed->action.bridge.swap);
|
|
|
|
ast_bridge_features_destroy(doomed->action.bridge.features);
|
|
|
|
break;
|
|
|
|
case LOCAL_CALL_ACTION_MASQUERADE:
|
|
|
|
ao2_cleanup(doomed->action.masq);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ast_unreal_destructor(&doomed->base);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Create a call structure */
|
|
|
|
static struct local_pvt *local_alloc(const char *data, struct ast_format_cap *cap)
|
|
|
|
{
|
|
|
|
struct local_pvt *pvt;
|
|
|
|
char *parse;
|
|
|
|
char *context;
|
|
|
|
char *opts;
|
|
|
|
|
|
|
|
pvt = (struct local_pvt *) ast_unreal_alloc(sizeof(*pvt), local_pvt_destructor, cap);
|
|
|
|
if (!pvt) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2013-07-08 14:26:40 +00:00
|
|
|
pvt->base.callbacks = &local_unreal_callbacks;
|
2013-05-21 18:00:22 +00:00
|
|
|
|
|
|
|
parse = ast_strdupa(data);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local channels intercept MOH by default.
|
|
|
|
*
|
|
|
|
* This is a silly default because it represents state held by
|
|
|
|
* the local channels. Unless local channel optimization is
|
|
|
|
* disabled, the state will dissapear when the local channels
|
|
|
|
* optimize out.
|
|
|
|
*/
|
|
|
|
ast_set_flag(&pvt->base, AST_UNREAL_MOH_INTERCEPT);
|
|
|
|
|
|
|
|
/* Look for options */
|
|
|
|
if ((opts = strchr(parse, '/'))) {
|
|
|
|
*opts++ = '\0';
|
|
|
|
if (strchr(opts, 'n')) {
|
|
|
|
ast_set_flag(&pvt->base, AST_UNREAL_NO_OPTIMIZATION);
|
|
|
|
}
|
|
|
|
if (strchr(opts, 'j')) {
|
|
|
|
if (ast_test_flag(&pvt->base, AST_UNREAL_NO_OPTIMIZATION)) {
|
|
|
|
ast_set_flag(&pvt->base.jb_conf, AST_JB_ENABLED);
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR, "You must use the 'n' option with the 'j' option to enable the jitter buffer\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (strchr(opts, 'm')) {
|
|
|
|
ast_clear_flag(&pvt->base, AST_UNREAL_MOH_INTERCEPT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Look for a context */
|
|
|
|
if ((context = strchr(parse, '@'))) {
|
|
|
|
*context++ = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_copy_string(pvt->context, S_OR(context, "default"), sizeof(pvt->context));
|
|
|
|
ast_copy_string(pvt->exten, parse, sizeof(pvt->exten));
|
|
|
|
snprintf(pvt->base.name, sizeof(pvt->base.name), "%s@%s", pvt->exten, pvt->context);
|
|
|
|
|
|
|
|
return pvt; /* this is returned with a ref */
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief Part of PBX interface */
|
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
|
|
|
static struct ast_channel *local_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
|
2013-05-21 18:00:22 +00:00
|
|
|
{
|
|
|
|
struct local_pvt *p;
|
|
|
|
struct ast_channel *chan;
|
2015-03-13 01:12:35 +00:00
|
|
|
ast_callid callid;
|
2013-05-21 18:00:22 +00:00
|
|
|
|
|
|
|
/* Allocate a new private structure and then Asterisk channels */
|
|
|
|
p = local_alloc(data, cap);
|
|
|
|
if (!p) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
callid = ast_read_threadstorage_callid();
|
|
|
|
chan = ast_unreal_new_channels(&p->base, &local_tech, AST_STATE_DOWN, AST_STATE_RING,
|
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
|
|
|
p->exten, p->context, assignedids, requestor, callid);
|
2013-05-21 18:00:22 +00:00
|
|
|
if (chan) {
|
|
|
|
ao2_link(locals, p);
|
|
|
|
}
|
|
|
|
ao2_ref(p, -1); /* kill the ref from the alloc */
|
|
|
|
|
|
|
|
return chan;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! \brief CLI command "local show channels" */
|
|
|
|
static char *locals_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
{
|
|
|
|
struct local_pvt *p;
|
|
|
|
struct ao2_iterator it;
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "local show channels";
|
|
|
|
e->usage =
|
|
|
|
"Usage: local show channels\n"
|
|
|
|
" Provides summary information on active local proxy channels.\n";
|
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a->argc != 3) {
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ao2_container_count(locals) == 0) {
|
|
|
|
ast_cli(a->fd, "No local channels in use\n");
|
|
|
|
return RESULT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
it = ao2_iterator_init(locals, 0);
|
|
|
|
while ((p = ao2_iterator_next(&it))) {
|
|
|
|
ao2_lock(p);
|
|
|
|
ast_cli(a->fd, "%s -- %s\n",
|
|
|
|
p->base.owner ? ast_channel_name(p->base.owner) : "<unowned>",
|
|
|
|
p->base.name);
|
|
|
|
ao2_unlock(p);
|
|
|
|
ao2_ref(p, -1);
|
|
|
|
}
|
|
|
|
ao2_iterator_destroy(&it);
|
|
|
|
|
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct ast_cli_entry cli_local[] = {
|
|
|
|
AST_CLI_DEFINE(locals_show, "List status of local channels"),
|
|
|
|
};
|
|
|
|
|
|
|
|
static int manager_optimize_away(struct mansession *s, const struct message *m)
|
|
|
|
{
|
|
|
|
const char *channel;
|
|
|
|
struct local_pvt *p;
|
|
|
|
struct local_pvt *found;
|
|
|
|
struct ast_channel *chan;
|
|
|
|
|
|
|
|
channel = astman_get_header(m, "Channel");
|
|
|
|
if (ast_strlen_zero(channel)) {
|
|
|
|
astman_send_error(s, m, "'Channel' not specified.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
chan = ast_channel_get_by_name(channel);
|
|
|
|
if (!chan) {
|
|
|
|
astman_send_error(s, m, "Channel does not exist.");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
p = ast_channel_tech_pvt(chan);
|
|
|
|
ast_channel_unref(chan);
|
|
|
|
|
|
|
|
found = p ? ao2_find(locals, p, 0) : NULL;
|
|
|
|
if (found) {
|
|
|
|
ao2_lock(found);
|
|
|
|
ast_clear_flag(&found->base, AST_UNREAL_NO_OPTIMIZATION);
|
|
|
|
ao2_unlock(found);
|
|
|
|
ao2_ref(found, -1);
|
|
|
|
astman_send_ack(s, m, "Queued channel to be optimized away");
|
|
|
|
} else {
|
|
|
|
astman_send_error(s, m, "Unable to find channel");
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int locals_cmp_cb(void *obj, void *arg, int flags)
|
|
|
|
{
|
|
|
|
return (obj == arg) ? CMP_MATCH : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Shutdown the local proxy channel.
|
|
|
|
* \since 12.0.0
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
|
|
|
static void local_shutdown(void)
|
|
|
|
{
|
|
|
|
/* First, take us out of the channel loop */
|
|
|
|
ast_cli_unregister_multiple(cli_local, ARRAY_LEN(cli_local));
|
|
|
|
ast_manager_unregister("LocalOptimizeAway");
|
|
|
|
ast_channel_unregister(&local_tech);
|
|
|
|
|
|
|
|
ao2_ref(locals, -1);
|
|
|
|
locals = 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_cleanup(local_tech.capabilities);
|
|
|
|
local_tech.capabilities = NULL;
|
2013-07-08 14:26:40 +00:00
|
|
|
|
|
|
|
STASIS_MESSAGE_TYPE_CLEANUP(ast_local_optimization_begin_type);
|
|
|
|
STASIS_MESSAGE_TYPE_CLEANUP(ast_local_optimization_end_type);
|
|
|
|
STASIS_MESSAGE_TYPE_CLEANUP(ast_local_bridge_type);
|
2013-05-21 18:00:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int ast_local_init(void)
|
|
|
|
{
|
2013-07-08 14:26:40 +00:00
|
|
|
|
|
|
|
if (STASIS_MESSAGE_TYPE_INIT(ast_local_optimization_begin_type)) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (STASIS_MESSAGE_TYPE_INIT(ast_local_optimization_end_type)) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (STASIS_MESSAGE_TYPE_INIT(ast_local_bridge_type)) {
|
2013-07-01 13:16:09 +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
|
|
|
if (!(local_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
|
2013-05-21 18:00:22 +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_by_type(local_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
|
2013-05-21 18:00:22 +00:00
|
|
|
|
|
|
|
locals = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, locals_cmp_cb);
|
|
|
|
if (!locals) {
|
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(local_tech.capabilities);
|
|
|
|
local_tech.capabilities = NULL;
|
2013-05-21 18:00:22 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure we can register our channel type */
|
|
|
|
if (ast_channel_register(&local_tech)) {
|
|
|
|
ast_log(LOG_ERROR, "Unable to register channel class 'Local'\n");
|
|
|
|
ao2_ref(locals, -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
|
|
|
ao2_cleanup(local_tech.capabilities);
|
|
|
|
local_tech.capabilities = NULL;
|
2013-05-21 18:00:22 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
ast_cli_register_multiple(cli_local, ARRAY_LEN(cli_local));
|
|
|
|
ast_manager_register_xml_core("LocalOptimizeAway", EVENT_FLAG_SYSTEM|EVENT_FLAG_CALL, manager_optimize_away);
|
|
|
|
|
2015-03-26 22:24:26 +00:00
|
|
|
ast_register_cleanup(local_shutdown);
|
2013-05-21 18:00:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|