mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 16:20:37 +00:00
Remove deprecated CLI apps from the core
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -95,7 +95,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
|
||||
enum {
|
||||
QUEUE_STRATEGY_RINGALL = 0,
|
||||
QUEUE_STRATEGY_ROUNDROBIN,
|
||||
QUEUE_STRATEGY_LEASTRECENT,
|
||||
QUEUE_STRATEGY_FEWESTCALLS,
|
||||
QUEUE_STRATEGY_RANDOM,
|
||||
@@ -107,7 +106,6 @@ static struct strategy {
|
||||
char *name;
|
||||
} strategies[] = {
|
||||
{ QUEUE_STRATEGY_RINGALL, "ringall" },
|
||||
{ QUEUE_STRATEGY_ROUNDROBIN, "roundrobin" },
|
||||
{ QUEUE_STRATEGY_LEASTRECENT, "leastrecent" },
|
||||
{ QUEUE_STRATEGY_FEWESTCALLS, "fewestcalls" },
|
||||
{ QUEUE_STRATEGY_RANDOM, "random" },
|
||||
@@ -403,16 +401,6 @@ static AST_LIST_HEAD_STATIC(queues, call_queue);
|
||||
|
||||
static int set_member_paused(char *queuename, char *interface, int paused);
|
||||
|
||||
static void rr_dep_warning(void)
|
||||
{
|
||||
static unsigned int warned = 0;
|
||||
|
||||
if (!warned) {
|
||||
ast_log(LOG_NOTICE, "The 'roundrobin' queue strategy is deprecated. Please use the 'rrmemory' strategy instead.\n");
|
||||
warned = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void set_queue_result(struct ast_channel *chan, enum queue_result res)
|
||||
{
|
||||
int i;
|
||||
@@ -1052,9 +1040,6 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
|
||||
queue_set_param(q, tmp_name, v->value, -1, 0);
|
||||
}
|
||||
|
||||
if (q->strategy == QUEUE_STRATEGY_ROUNDROBIN)
|
||||
rr_dep_warning();
|
||||
|
||||
/* Temporarily set non-dynamic members dead so we can detect deleted ones. */
|
||||
for (m = q->members; m; m = m->next) {
|
||||
if (!m->dynamic)
|
||||
@@ -2223,18 +2208,6 @@ static int calc_metric(struct call_queue *q, struct member *mem, int pos, struct
|
||||
/* Everyone equal, except for penalty */
|
||||
tmp->metric = mem->penalty * 1000000;
|
||||
break;
|
||||
case QUEUE_STRATEGY_ROUNDROBIN:
|
||||
if (!pos) {
|
||||
if (!q->wrapped) {
|
||||
/* No more channels, start over */
|
||||
q->rrpos = 0;
|
||||
} else {
|
||||
/* Prioritize next entry */
|
||||
q->rrpos++;
|
||||
}
|
||||
q->wrapped = 0;
|
||||
}
|
||||
/* Fall through */
|
||||
case QUEUE_STRATEGY_RRMEMORY:
|
||||
if (pos < q->rrpos) {
|
||||
tmp->metric = 1000 + pos;
|
||||
@@ -3814,9 +3787,6 @@ static int reload_queues(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (q->strategy == QUEUE_STRATEGY_ROUNDROBIN)
|
||||
rr_dep_warning();
|
||||
|
||||
if (new) {
|
||||
AST_LIST_INSERT_HEAD(&queues, q, list);
|
||||
} else
|
||||
@@ -4373,42 +4343,22 @@ static char qam_cmd_usage[] =
|
||||
static char qrm_cmd_usage[] =
|
||||
"Usage: queue remove member <channel> from <queue>\n";
|
||||
|
||||
static struct ast_cli_entry cli_show_queues_deprecated = {
|
||||
{ "show", "queues", NULL },
|
||||
queue_list, NULL,
|
||||
NULL, NULL };
|
||||
|
||||
static struct ast_cli_entry cli_show_queue_deprecated = {
|
||||
{ "show", "queue", NULL },
|
||||
queue_show, NULL,
|
||||
NULL, complete_queue };
|
||||
|
||||
static struct ast_cli_entry cli_add_queue_member_deprecated = {
|
||||
{ "add", "queue", "member", NULL },
|
||||
handle_queue_add_member, NULL,
|
||||
NULL, complete_queue_add_member };
|
||||
|
||||
static struct ast_cli_entry cli_remove_queue_member_deprecated = {
|
||||
{ "remove", "queue", "member", NULL },
|
||||
handle_queue_remove_member, NULL,
|
||||
NULL, complete_queue_remove_member };
|
||||
|
||||
static struct ast_cli_entry cli_queue[] = {
|
||||
{ { "queue", "list", NULL },
|
||||
queue_list, "Show status of queues",
|
||||
queue_list_usage, NULL, &cli_show_queues_deprecated },
|
||||
queue_list_usage, NULL, NULL },
|
||||
|
||||
{ { "queue", "show", NULL },
|
||||
queue_show, "Show status of a specified queue",
|
||||
queue_show_usage, complete_queue, &cli_show_queue_deprecated },
|
||||
queue_show_usage, complete_queue, NULL },
|
||||
|
||||
{ { "queue", "add", "member", NULL },
|
||||
handle_queue_add_member, "Add a channel to a specified queue",
|
||||
qam_cmd_usage, complete_queue_add_member, &cli_add_queue_member_deprecated },
|
||||
qam_cmd_usage, complete_queue_add_member, NULL },
|
||||
|
||||
{ { "queue", "remove", "member", NULL },
|
||||
handle_queue_remove_member, "Removes a channel from a specified queue",
|
||||
qrm_cmd_usage, complete_queue_remove_member, &cli_remove_queue_member_deprecated },
|
||||
qrm_cmd_usage, complete_queue_remove_member, NULL },
|
||||
};
|
||||
|
||||
static int unload_module(void)
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Asterisk -- An open source telephony toolkit.
|
||||
*
|
||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
||||
*
|
||||
* Justin Huff <jjhuff@mspin.net>
|
||||
*
|
||||
* 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 Applictions connected with CDR engine
|
||||
*
|
||||
* \author Justin Huff <jjhuff@mspin.net>
|
||||
*
|
||||
* \ingroup applications
|
||||
*/
|
||||
|
||||
#include "asterisk.h"
|
||||
|
||||
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "asterisk/channel.h"
|
||||
#include "asterisk/cdr.h"
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/pbx.h"
|
||||
#include "asterisk/logger.h"
|
||||
#include "asterisk/config.h"
|
||||
#include "asterisk/manager.h"
|
||||
#include "asterisk/utils.h"
|
||||
|
||||
|
||||
static char *setcdruserfield_descrip =
|
||||
"[Synopsis]\n"
|
||||
"SetCDRUserField(value)\n\n"
|
||||
"[Description]\n"
|
||||
"SetCDRUserField(value): Set the CDR 'user field' to value\n"
|
||||
" The Call Data Record (CDR) user field is an extra field you\n"
|
||||
" can use for data not stored anywhere else in the record.\n"
|
||||
" CDR records can be used for billing or storing other arbitrary data\n"
|
||||
" (I.E. telephone survey responses)\n"
|
||||
" Also see AppendCDRUserField().\n";
|
||||
|
||||
|
||||
static char *setcdruserfield_app = "SetCDRUserField";
|
||||
static char *setcdruserfield_synopsis = "Set the CDR user field";
|
||||
|
||||
static char *appendcdruserfield_descrip =
|
||||
"[Synopsis]\n"
|
||||
"AppendCDRUserField(value)\n\n"
|
||||
"[Description]\n"
|
||||
"AppendCDRUserField(value): Append value to the CDR user field\n"
|
||||
" The Call Data Record (CDR) user field is an extra field you\n"
|
||||
" can use for data not stored anywhere else in the record.\n"
|
||||
" CDR records can be used for billing or storing other arbitrary data\n"
|
||||
" (I.E. telephone survey responses)\n"
|
||||
" Also see SetCDRUserField().\n";
|
||||
|
||||
static char *appendcdruserfield_app = "AppendCDRUserField";
|
||||
static char *appendcdruserfield_synopsis = "Append to the CDR user field";
|
||||
|
||||
|
||||
static int action_setcdruserfield(struct mansession *s, struct message *m)
|
||||
{
|
||||
struct ast_channel *c = NULL;
|
||||
char *userfield = astman_get_header(m, "UserField");
|
||||
char *channel = astman_get_header(m, "Channel");
|
||||
char *append = astman_get_header(m, "Append");
|
||||
|
||||
if (ast_strlen_zero(channel)) {
|
||||
astman_send_error(s, m, "No Channel specified");
|
||||
return 0;
|
||||
}
|
||||
if (ast_strlen_zero(userfield)) {
|
||||
astman_send_error(s, m, "No UserField specified");
|
||||
return 0;
|
||||
}
|
||||
c = ast_get_channel_by_name_locked(channel);
|
||||
if (!c) {
|
||||
astman_send_error(s, m, "No such channel");
|
||||
return 0;
|
||||
}
|
||||
if (ast_true(append))
|
||||
ast_cdr_appenduserfield(c, userfield);
|
||||
else
|
||||
ast_cdr_setuserfield(c, userfield);
|
||||
ast_mutex_unlock(&c->lock);
|
||||
astman_send_ack(s, m, "CDR Userfield Set");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setcdruserfield_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
struct ast_module_user *u;
|
||||
int res = 0;
|
||||
static int dep_warning = 0;
|
||||
|
||||
u = ast_module_user_add(chan);
|
||||
|
||||
if (chan->cdr && data) {
|
||||
ast_cdr_setuserfield(chan, (char*)data);
|
||||
}
|
||||
|
||||
if (!dep_warning) {
|
||||
dep_warning = 1;
|
||||
ast_log(LOG_WARNING, "SetCDRUserField is deprecated. Please use CDR(userfield) instead.\n");
|
||||
}
|
||||
|
||||
ast_module_user_remove(u);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int appendcdruserfield_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
struct ast_module_user *u;
|
||||
int res = 0;
|
||||
static int dep_warning = 0;
|
||||
|
||||
u = ast_module_user_add(chan);
|
||||
|
||||
if (chan->cdr && data) {
|
||||
ast_cdr_appenduserfield(chan, (char*)data);
|
||||
}
|
||||
|
||||
if (!dep_warning) {
|
||||
dep_warning = 1;
|
||||
ast_log(LOG_WARNING, "AppendCDRUserField is deprecated. Please use CDR(userfield) instead.\n");
|
||||
}
|
||||
|
||||
ast_module_user_remove(u);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int unload_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = ast_unregister_application(setcdruserfield_app);
|
||||
res |= ast_unregister_application(appendcdruserfield_app);
|
||||
res |= ast_manager_unregister("SetCDRUserField");
|
||||
|
||||
ast_module_user_hangup_all();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int load_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = ast_register_application(setcdruserfield_app, setcdruserfield_exec, setcdruserfield_synopsis, setcdruserfield_descrip);
|
||||
res |= ast_register_application(appendcdruserfield_app, appendcdruserfield_exec, appendcdruserfield_synopsis, appendcdruserfield_descrip);
|
||||
res |= ast_manager_register("SetCDRUserField", EVENT_FLAG_CALL, action_setcdruserfield, "Set the CDR UserField");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "CDR user field apps");
|
||||
Reference in New Issue
Block a user