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 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"
|
2013-07-25 04:06:32 +00:00
|
|
|
#include "asterisk/bridge.h"
|
2013-05-21 18:00:22 +00:00
|
|
|
#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;
|
|
|
|
}
|
|
|
|
|
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 *rec_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 ast_channel *chan;
|
|
|
|
struct ast_format format;
|
|
|
|
const char *conf_name = data;
|
|
|
|
|
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
|
|
|
chan = ast_channel_alloc(1, AST_STATE_UP, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0,
|
2013-05-21 18:00:22 +00:00
|
|
|
"CBRec/conf-%s-uid-%d",
|
|
|
|
conf_name, (int) ast_random());
|
|
|
|
if (!chan) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (ast_channel_add_bridge_role(chan, "recorder")) {
|
2013-12-18 19:28:05 +00:00
|
|
|
ast_channel_unlock(chan);
|
2013-05-21 18:00:22 +00:00
|
|
|
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);
|
2013-12-18 19:28:05 +00:00
|
|
|
ast_channel_unlock(chan);
|
2013-05-21 18:00:22 +00:00
|
|
|
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,
|
2013-08-08 14:13:05 +00:00
|
|
|
.properties = AST_CHAN_TP_INTERNAL,
|
2013-05-21 18:00:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ast_channel_tech *conf_record_get_tech(void)
|
|
|
|
{
|
|
|
|
return &record_tech;
|
|
|
|
}
|