mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-20 00:30:20 +00:00
This patch does three things:
1. It provides a Surrogate channel technology with a consolidated
"implementation detail flag" on the channel technology. This tells
consumers of Stasis that the creation of this channel is an implementation
detail in Asterisk and can be ignored (if they so choose). This
consolidates the conference recorder/announcer flags as well - these flags
had no additional meaning beyond "ignore this channel please".
2. It modifies allocation of a channel in two ways:
(a) If a channel technology can be determined from the name, we set it
directly in the allocation routine. This prevents the initial
publication of the message from going out with a NULL channel technology
where possible. This lets Stasis consumers get the right channel
technology on the first publication.
(b) It reorganizes allocation to make use of the 'finalized' property on the
channel. This was already used to know that a channel had completely
finished its construction in the masquerade routine; now we also use it
to know whether or not the setting of certain channel properties is
occurring during or post construction. The various set routines were
modified accordingly as well.
3. The masquerade event is now dead, Jim. It no longer served any purpose
whatsoever - if you perform a call pickup you'll get a Pickup event;
if you perform an attended transfer you will still get those events; if you
steal a channel to put it elsewhere you'll get the corresponding NewExten or
BridgeEnter events.
Review: https://reviewboard.asterisk.org/r/2740
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396392 65c4cc65-6c06-0410-ace0-fbb531ad65f3
96 lines
2.5 KiB
C
96 lines
2.5 KiB
C
/*
|
|
* 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 ConfBridge recorder channel driver
|
|
*
|
|
* \author Richard Mudgett <rmudgett@digium.com>
|
|
*
|
|
* See Also:
|
|
* \arg \ref AstCREDITS
|
|
*/
|
|
|
|
|
|
#include "asterisk.h"
|
|
|
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|
|
|
#include "asterisk/channel.h"
|
|
#include "asterisk/bridge.h"
|
|
#include "include/confbridge.h"
|
|
|
|
/* ------------------------------------------------------------------- */
|
|
|
|
static int rec_call(struct ast_channel *chan, const char *addr, int timeout)
|
|
{
|
|
/* Make sure anyone calling ast_call() for this channel driver is going to fail. */
|
|
return -1;
|
|
}
|
|
|
|
static struct ast_frame *rec_read(struct ast_channel *ast)
|
|
{
|
|
return &ast_null_frame;
|
|
}
|
|
|
|
static int rec_write(struct ast_channel *ast, struct ast_frame *f)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static struct ast_channel *rec_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause)
|
|
{
|
|
struct ast_channel *chan;
|
|
struct ast_format format;
|
|
const char *conf_name = data;
|
|
|
|
chan = ast_channel_alloc(1, AST_STATE_UP, NULL, NULL, NULL, NULL, NULL, NULL, 0,
|
|
"CBRec/conf-%s-uid-%d",
|
|
conf_name, (int) ast_random());
|
|
if (!chan) {
|
|
return NULL;
|
|
}
|
|
if (ast_channel_add_bridge_role(chan, "recorder")) {
|
|
ast_channel_release(chan);
|
|
return NULL;
|
|
}
|
|
ast_format_set(&format, AST_FORMAT_SLINEAR, 0);
|
|
ast_channel_tech_set(chan, conf_record_get_tech());
|
|
ast_format_cap_add_all(ast_channel_nativeformats(chan));
|
|
ast_format_copy(ast_channel_writeformat(chan), &format);
|
|
ast_format_copy(ast_channel_rawwriteformat(chan), &format);
|
|
ast_format_copy(ast_channel_readformat(chan), &format);
|
|
ast_format_copy(ast_channel_rawreadformat(chan), &format);
|
|
return chan;
|
|
}
|
|
|
|
static struct ast_channel_tech record_tech = {
|
|
.type = "CBRec",
|
|
.description = "Conference Bridge Recording Channel",
|
|
.requester = rec_request,
|
|
.call = rec_call,
|
|
.read = rec_read,
|
|
.write = rec_write,
|
|
.properties = AST_CHAN_TP_INTERNAL,
|
|
};
|
|
|
|
struct ast_channel_tech *conf_record_get_tech(void)
|
|
{
|
|
return &record_tech;
|
|
}
|