Files
asterisk/apps/confbridge/conf_chan_record.c
Matt Jordan 4a58261694 git migration: Refactor the ASTERISK_FILE_VERSION macro
Git does not support the ability to replace a token with a version
string during check-in. While it does have support for replacing a
token on clone, this is somewhat sub-optimal: the token is replaced
with the object hash, which is not particularly easy for human
consumption. What's more, in practice, the source file version was often
not terribly useful. Generally, when triaging bugs, the overall version
of Asterisk is far more useful than an individual SVN version of a file. As a
result, this patch removes Asterisk's support for showing source file
versions.

Specifically, it does the following:

* Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and
  remove passing the version in with the macro. Other facilities
  than 'core show file version' make use of the file names, such as
  setting a debug level only on a specific file. As such, the act of
  registering source files with the Asterisk core still has use. The
  macro rename now reflects the new macro purpose.

* main/asterisk:
  - Refactor the file_version structure to reflect that it no longer
    tracks a version field.
  - Remove the "core show file version" CLI command. Without the file
    version, it is no longer useful.
  - Remove the ast_file_version_find function. The file version is no
    longer tracked.
  - Rename ast_register_file_version/ast_unregister_file_version to
    ast_register_file/ast_unregister_file, respectively.

* main/manager: Remove value from the Version key of the ModuleCheck
  Action. The actual key itself has not been removed, as doing so would
  absolutely constitute a backwards incompatible change. However, since
  the file version is no longer tracked, there is no need to attempt to
  include it in the Version key.

* UPGRADE: Add notes for:
  - Modification to the ModuleCheck AMI Action
  - Removal of the "core show file version" CLI command

Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-04-13 03:48:57 -04:00

108 lines
2.9 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_REGISTER_FILE()
#include "asterisk/channel.h"
#include "asterisk/bridge.h"
#include "asterisk/format_cache.h"
#include "include/confbridge.h"
/* ------------------------------------------------------------------- */
static unsigned int name_sequence = 0;
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_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
{
struct ast_channel *chan;
const char *conf_name = data;
RAII_VAR(struct ast_format_cap *, capabilities, NULL, ao2_cleanup);
int generated_seqno = ast_atomic_fetchadd_int((int *) &name_sequence, +1);
capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
if (!capabilities) {
return NULL;
}
ast_format_cap_append_by_type(capabilities, AST_MEDIA_TYPE_UNKNOWN);
chan = ast_channel_alloc(1, AST_STATE_UP, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0,
"CBRec/%s-%08x",
conf_name, (unsigned) generated_seqno);
if (!chan) {
return NULL;
}
if (ast_channel_add_bridge_role(chan, "recorder")) {
ast_channel_unlock(chan);
ast_channel_release(chan);
return NULL;
}
ast_channel_tech_set(chan, conf_record_get_tech());
ast_channel_nativeformats_set(chan, capabilities);
ast_channel_set_writeformat(chan, ast_format_slin);
ast_channel_set_rawwriteformat(chan, ast_format_slin);
ast_channel_set_readformat(chan, ast_format_slin);
ast_channel_set_rawreadformat(chan, ast_format_slin);
ast_channel_unlock(chan);
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;
}