Lots more removal of deprecated things
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43452 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
901e02171b
commit
2a2a143966
|
@ -1,135 +0,0 @@
|
|||
/*
|
||||
* Asterisk -- An open source telephony toolkit.
|
||||
*
|
||||
* Copyright (C) 2005, Frank Sautter, levigo holding gmbh, www.levigo.de
|
||||
*
|
||||
* Frank Sautter - asterisk+at+sautter+dot+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 App to set the ISDN Transfer Capability
|
||||
*
|
||||
* \author Frank Sautter - asterisk+at+sautter+dot+com
|
||||
*
|
||||
* \ingroup applications
|
||||
*/
|
||||
|
||||
#include "asterisk.h"
|
||||
|
||||
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "asterisk/logger.h"
|
||||
#include "asterisk/channel.h"
|
||||
#include "asterisk/pbx.h"
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/options.h"
|
||||
#include "asterisk/transcap.h"
|
||||
|
||||
|
||||
static char *app = "SetTransferCapability";
|
||||
|
||||
static char *synopsis = "Set ISDN Transfer Capability";
|
||||
|
||||
|
||||
static struct { int val; char *name; } transcaps[] = {
|
||||
{ AST_TRANS_CAP_SPEECH, "SPEECH" },
|
||||
{ AST_TRANS_CAP_DIGITAL, "DIGITAL" },
|
||||
{ AST_TRANS_CAP_RESTRICTED_DIGITAL, "RESTRICTED_DIGITAL" },
|
||||
{ AST_TRANS_CAP_3_1K_AUDIO, "3K1AUDIO" },
|
||||
{ AST_TRANS_CAP_DIGITAL_W_TONES, "DIGITAL_W_TONES" },
|
||||
{ AST_TRANS_CAP_VIDEO, "VIDEO" },
|
||||
};
|
||||
|
||||
static char *descrip =
|
||||
" SetTransferCapability(transfercapability): Set the ISDN Transfer \n"
|
||||
"Capability of a call to a new value.\n"
|
||||
"Valid Transfer Capabilities are:\n"
|
||||
"\n"
|
||||
" SPEECH : 0x00 - Speech (default, voice calls)\n"
|
||||
" DIGITAL : 0x08 - Unrestricted digital information (data calls)\n"
|
||||
" RESTRICTED_DIGITAL : 0x09 - Restricted digital information\n"
|
||||
" 3K1AUDIO : 0x10 - 3.1kHz Audio (fax calls)\n"
|
||||
" DIGITAL_W_TONES : 0x11 - Unrestricted digital information with tones/announcements\n"
|
||||
" VIDEO : 0x18 - Video\n"
|
||||
"\n"
|
||||
;
|
||||
|
||||
static int settransfercapability_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
char *tmp = NULL;
|
||||
struct ast_module_user *u;
|
||||
int x;
|
||||
char *opts;
|
||||
int transfercapability = -1;
|
||||
static int dep_warning = 0;
|
||||
|
||||
u = ast_module_user_add(chan);
|
||||
|
||||
if (!dep_warning) {
|
||||
dep_warning = 1;
|
||||
ast_log(LOG_WARNING, "SetTransferCapability is deprecated. Please use CHANNEL(transfercapability) instead.\n");
|
||||
}
|
||||
|
||||
if (data)
|
||||
tmp = ast_strdupa(data);
|
||||
else
|
||||
tmp = "";
|
||||
|
||||
opts = strchr(tmp, '|');
|
||||
if (opts)
|
||||
*opts = '\0';
|
||||
|
||||
for (x = 0; x < (sizeof(transcaps) / sizeof(transcaps[0])); x++) {
|
||||
if (!strcasecmp(transcaps[x].name, tmp)) {
|
||||
transfercapability = transcaps[x].val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (transfercapability < 0) {
|
||||
ast_log(LOG_WARNING, "'%s' is not a valid transfer capability (see 'show application SetTransferCapability')\n", tmp);
|
||||
ast_module_user_remove(u);
|
||||
return 0;
|
||||
}
|
||||
|
||||
chan->transfercapability = (unsigned short)transfercapability;
|
||||
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Setting transfer capability to: 0x%.2x - %s.\n", transfercapability, tmp);
|
||||
|
||||
ast_module_user_remove(u);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int unload_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
res = ast_unregister_application(app);
|
||||
|
||||
ast_module_user_hangup_all();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int load_module(void)
|
||||
{
|
||||
return ast_register_application(app, settransfercapability_exec, synopsis, descrip);
|
||||
}
|
||||
|
||||
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Set ISDN Transfer Capability");
|
|
@ -77,11 +77,9 @@ static const char tdesc[] = "Call Agent Proxy Channel";
|
|||
static const char config[] = "agents.conf";
|
||||
|
||||
static const char app[] = "AgentLogin";
|
||||
static const char app2[] = "AgentCallbackLogin";
|
||||
static const char app3[] = "AgentMonitorOutgoing";
|
||||
|
||||
static const char synopsis[] = "Call agent login";
|
||||
static const char synopsis2[] = "Call agent callback login";
|
||||
static const char synopsis3[] = "Record agent's outgoing call";
|
||||
|
||||
static const char descrip[] =
|
||||
|
@ -93,14 +91,6 @@ static const char descrip[] =
|
|||
"The option string may contain zero or more of the following characters:\n"
|
||||
" 's' -- silent login - do not announce the login ok segment after agent logged in/off\n";
|
||||
|
||||
static const char descrip2[] =
|
||||
" AgentCallbackLogin([AgentNo][|[options][|[exten]@context]]):\n"
|
||||
"Asks the agent to login to the system with callback.\n"
|
||||
"The agent's callback extension is called (optionally with the specified\n"
|
||||
"context).\n"
|
||||
"The option string may contain zero or more of the following characters:\n"
|
||||
" 's' -- silent login - do not announce the login ok segment agent logged in/off\n";
|
||||
|
||||
static const char descrip3[] =
|
||||
" AgentMonitorOutgoing([options]):\n"
|
||||
"Tries to figure out the id of the agent who is placing outgoing call based on\n"
|
||||
|
@ -1733,24 +1723,14 @@ static char agent_logoff_usage[] =
|
|||
" Sets an agent as no longer logged in.\n"
|
||||
" If 'soft' is specified, do not hangup existing calls.\n";
|
||||
|
||||
static struct ast_cli_entry cli_show_agents_deprecated = {
|
||||
{ "show", "agents", NULL },
|
||||
agents_show, NULL,
|
||||
NULL, NULL };
|
||||
|
||||
static struct ast_cli_entry cli_show_agents_online_deprecated = {
|
||||
{ "show", "agents", "online" },
|
||||
agents_show_online, NULL,
|
||||
NULL, NULL };
|
||||
|
||||
static struct ast_cli_entry cli_agents[] = {
|
||||
{ { "agent", "list", NULL },
|
||||
agents_show, "Show status of agents",
|
||||
show_agents_usage, NULL, &cli_show_agents_deprecated },
|
||||
show_agents_usage },
|
||||
|
||||
{ { "agent", "list", "online" },
|
||||
agents_show_online, "Show all online agents",
|
||||
show_agents_online_usage, NULL, &cli_show_agents_online_deprecated },
|
||||
show_agents_online_usage },
|
||||
|
||||
{ { "agent", "logoff", NULL },
|
||||
agent_logoff_cmd, "Sets an agent offline",
|
||||
|
@ -2200,117 +2180,6 @@ static int login_exec(struct ast_channel *chan, void *data)
|
|||
return __login_exec(chan, data, 0);
|
||||
}
|
||||
|
||||
static void callback_deprecated(void)
|
||||
{
|
||||
static int depwarning = 0;
|
||||
|
||||
if (!depwarning) {
|
||||
depwarning = 1;
|
||||
|
||||
ast_log(LOG_WARNING, "AgentCallbackLogin is deprecated and will be removed in a future release.\n");
|
||||
ast_log(LOG_WARNING, "See doc/queues-with-callback-members.txt for an example of how to achieve\n");
|
||||
ast_log(LOG_WARNING, "the same functionality using only dialplan logic.\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Called by the AgentCallbackLogin application (from the dial plan).
|
||||
*
|
||||
* \param chan
|
||||
* \param data
|
||||
* \returns
|
||||
* \sa login_exec(), agentmonitoroutgoing_exec(), load_module().
|
||||
*/
|
||||
static int callback_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
callback_deprecated();
|
||||
|
||||
return __login_exec(chan, data, 1);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Sets an agent as logged in by callback in the Manager API.
|
||||
* It is registered on load_module() and it gets called by the manager backend.
|
||||
* \param s
|
||||
* \param m
|
||||
* \returns
|
||||
* \sa action_agents(), action_agent_logoff(), load_module().
|
||||
*/
|
||||
static int action_agent_callback_login(struct mansession *s, struct message *m)
|
||||
{
|
||||
char *agent = astman_get_header(m, "Agent");
|
||||
char *exten = astman_get_header(m, "Exten");
|
||||
char *context = astman_get_header(m, "Context");
|
||||
char *wrapuptime_s = astman_get_header(m, "WrapupTime");
|
||||
char *ackcall_s = astman_get_header(m, "AckCall");
|
||||
struct agent_pvt *p;
|
||||
int login_state = 0;
|
||||
|
||||
callback_deprecated();
|
||||
|
||||
if (ast_strlen_zero(agent)) {
|
||||
astman_send_error(s, m, "No agent specified");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(exten)) {
|
||||
astman_send_error(s, m, "No extension specified");
|
||||
return 0;
|
||||
}
|
||||
|
||||
AST_LIST_LOCK(&agents);
|
||||
AST_LIST_TRAVERSE(&agents, p, list) {
|
||||
if (strcmp(p->agent, agent) || p->pending)
|
||||
continue;
|
||||
if (p->chan) {
|
||||
login_state = 2; /* already logged in (and on the phone)*/
|
||||
break;
|
||||
}
|
||||
ast_mutex_lock(&p->lock);
|
||||
login_state = 1; /* Successful Login */
|
||||
|
||||
if (ast_strlen_zero(context))
|
||||
ast_copy_string(p->loginchan, exten, sizeof(p->loginchan));
|
||||
else
|
||||
snprintf(p->loginchan, sizeof(p->loginchan), "%s@%s", exten, context);
|
||||
|
||||
if (!ast_strlen_zero(wrapuptime_s)) {
|
||||
p->wrapuptime = atoi(wrapuptime_s);
|
||||
if (p->wrapuptime < 0)
|
||||
p->wrapuptime = 0;
|
||||
}
|
||||
|
||||
if (ast_true(ackcall_s))
|
||||
p->ackcall = 1;
|
||||
else
|
||||
p->ackcall = 0;
|
||||
|
||||
if (p->loginstart == 0)
|
||||
time(&p->loginstart);
|
||||
manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogin",
|
||||
"Agent: %s\r\n"
|
||||
"Loginchan: %s\r\n",
|
||||
p->agent, p->loginchan);
|
||||
ast_queue_log("NONE", "NONE", agent, "AGENTCALLBACKLOGIN", "%s", p->loginchan);
|
||||
if (option_verbose > 1)
|
||||
ast_verbose(VERBOSE_PREFIX_2 "Callback Agent '%s' logged in on %s\n", p->agent, p->loginchan);
|
||||
ast_device_state_changed("Agent/%s", p->agent);
|
||||
ast_mutex_unlock(&p->lock);
|
||||
if (persistent_agents)
|
||||
dump_agents();
|
||||
}
|
||||
AST_LIST_UNLOCK(&agents);
|
||||
|
||||
if (login_state == 1)
|
||||
astman_send_ack(s, m, "Agent logged in");
|
||||
else if (login_state == 0)
|
||||
astman_send_error(s, m, "No such agent");
|
||||
else if (login_state == 2)
|
||||
astman_send_error(s, m, "Agent already logged in");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Called by the AgentMonitorOutgoing application (from the dial plan).
|
||||
*
|
||||
|
@ -2602,13 +2471,11 @@ static int load_module(void)
|
|||
reload_agents();
|
||||
/* Dialplan applications */
|
||||
ast_register_application(app, login_exec, synopsis, descrip);
|
||||
ast_register_application(app2, callback_exec, synopsis2, descrip2);
|
||||
ast_register_application(app3, agentmonitoroutgoing_exec, synopsis3, descrip3);
|
||||
|
||||
/* Manager commands */
|
||||
ast_manager_register2("Agents", EVENT_FLAG_AGENT, action_agents, "Lists agents and their status", mandescr_agents);
|
||||
ast_manager_register2("AgentLogoff", EVENT_FLAG_AGENT, action_agent_logoff, "Sets an agent as no longer logged in", mandescr_agent_logoff);
|
||||
ast_manager_register2("AgentCallbackLogin", EVENT_FLAG_AGENT, action_agent_callback_login, "Sets an agent as logged in by callback", mandescr_agent_callback_login);
|
||||
|
||||
/* CLI Commands */
|
||||
ast_cli_register_multiple(cli_agents, sizeof(cli_agents) / sizeof(struct ast_cli_entry));
|
||||
|
@ -2638,12 +2505,10 @@ static int unload_module(void)
|
|||
ast_cli_unregister_multiple(cli_agents, sizeof(cli_agents) / sizeof(struct ast_cli_entry));
|
||||
/* Unregister dialplan applications */
|
||||
ast_unregister_application(app);
|
||||
ast_unregister_application(app2);
|
||||
ast_unregister_application(app3);
|
||||
/* Unregister manager command */
|
||||
ast_manager_unregister("Agents");
|
||||
ast_manager_unregister("AgentLogoff");
|
||||
ast_manager_unregister("AgentCallbackLogin");
|
||||
/* Unregister channel */
|
||||
AST_LIST_LOCK(&agents);
|
||||
/* Hangup all interfaces if they have an owner */
|
||||
|
|
|
@ -841,31 +841,6 @@ static struct ast_channel *alsa_request(const char *type, int format, void *data
|
|||
return tmp;
|
||||
}
|
||||
|
||||
static int console_autoanswer_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
int res = RESULT_SUCCESS;
|
||||
|
||||
if ((argc != 1) && (argc != 2))
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
ast_mutex_lock(&alsalock);
|
||||
|
||||
if (argc == 1) {
|
||||
ast_cli(fd, "Auto answer is %s.\n", autoanswer ? "on" : "off");
|
||||
} else {
|
||||
if (!strcasecmp(argv[1], "on"))
|
||||
autoanswer = -1;
|
||||
else if (!strcasecmp(argv[1], "off"))
|
||||
autoanswer = 0;
|
||||
else
|
||||
res = RESULT_SHOWUSAGE;
|
||||
}
|
||||
|
||||
ast_mutex_unlock(&alsalock);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int console_autoanswer(int fd, int argc, char *argv[])
|
||||
{
|
||||
int res = RESULT_SUCCESS;;
|
||||
|
@ -910,38 +885,6 @@ static const char autoanswer_usage[] =
|
|||
" argument, displays the current on/off status of autoanswer.\n"
|
||||
" The default value of autoanswer is in 'alsa.conf'.\n";
|
||||
|
||||
static int console_answer_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
int res = RESULT_SUCCESS;
|
||||
|
||||
if (argc != 1)
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
ast_mutex_lock(&alsalock);
|
||||
|
||||
if (!alsa.owner) {
|
||||
ast_cli(fd, "No one is calling us\n");
|
||||
res = RESULT_FAILURE;
|
||||
} else {
|
||||
hookstate = 1;
|
||||
cursound = -1;
|
||||
grab_owner();
|
||||
if (alsa.owner) {
|
||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
|
||||
ast_queue_frame(alsa.owner, &f);
|
||||
ast_mutex_unlock(&alsa.owner->lock);
|
||||
}
|
||||
answer_sound();
|
||||
}
|
||||
|
||||
snd_pcm_prepare(alsa.icard);
|
||||
snd_pcm_start(alsa.icard);
|
||||
|
||||
ast_mutex_unlock(&alsalock);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int console_answer(int fd, int argc, char *argv[])
|
||||
{
|
||||
int res = RESULT_SUCCESS;
|
||||
|
@ -978,47 +921,6 @@ static char sendtext_usage[] =
|
|||
"Usage: console send text <message>\n"
|
||||
" Sends a text message for display on the remote terminal.\n";
|
||||
|
||||
static int console_sendtext_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
int tmparg = 2;
|
||||
int res = RESULT_SUCCESS;
|
||||
|
||||
if (argc < 2)
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
ast_mutex_lock(&alsalock);
|
||||
|
||||
if (!alsa.owner) {
|
||||
ast_cli(fd, "No one is calling us\n");
|
||||
res = RESULT_FAILURE;
|
||||
} else {
|
||||
struct ast_frame f = { AST_FRAME_TEXT, 0 };
|
||||
char text2send[256] = "";
|
||||
text2send[0] = '\0';
|
||||
while (tmparg < argc) {
|
||||
strncat(text2send, argv[tmparg++], sizeof(text2send) - strlen(text2send) - 1);
|
||||
strncat(text2send, " ", sizeof(text2send) - strlen(text2send) - 1);
|
||||
}
|
||||
text2send[strlen(text2send) - 1] = '\n';
|
||||
f.data = text2send;
|
||||
f.datalen = strlen(text2send) + 1;
|
||||
grab_owner();
|
||||
if (alsa.owner) {
|
||||
ast_queue_frame(alsa.owner, &f);
|
||||
f.frametype = AST_FRAME_CONTROL;
|
||||
f.subclass = AST_CONTROL_ANSWER;
|
||||
f.data = NULL;
|
||||
f.datalen = 0;
|
||||
ast_queue_frame(alsa.owner, &f);
|
||||
ast_mutex_unlock(&alsa.owner->lock);
|
||||
}
|
||||
}
|
||||
|
||||
ast_mutex_unlock(&alsalock);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int console_sendtext(int fd, int argc, char *argv[])
|
||||
{
|
||||
int tmparg = 3;
|
||||
|
@ -1064,34 +966,6 @@ static char answer_usage[] =
|
|||
"Usage: console answer\n"
|
||||
" Answers an incoming call on the console (ALSA) channel.\n";
|
||||
|
||||
static int console_hangup_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
int res = RESULT_SUCCESS;
|
||||
|
||||
if (argc != 1)
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
cursound = -1;
|
||||
|
||||
ast_mutex_lock(&alsalock);
|
||||
|
||||
if (!alsa.owner && !hookstate) {
|
||||
ast_cli(fd, "No call to hangup up\n");
|
||||
res = RESULT_FAILURE;
|
||||
} else {
|
||||
hookstate = 0;
|
||||
grab_owner();
|
||||
if (alsa.owner) {
|
||||
ast_queue_hangup(alsa.owner);
|
||||
ast_mutex_unlock(&alsa.owner->lock);
|
||||
}
|
||||
}
|
||||
|
||||
ast_mutex_unlock(&alsalock);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int console_hangup(int fd, int argc, char *argv[])
|
||||
{
|
||||
int res = RESULT_SUCCESS;
|
||||
|
@ -1124,63 +998,6 @@ static char hangup_usage[] =
|
|||
"Usage: console hangup\n"
|
||||
" Hangs up any call currently placed on the console.\n";
|
||||
|
||||
static int console_dial_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
char tmp[256], *tmp2;
|
||||
char *mye, *myc;
|
||||
char *d;
|
||||
int res = RESULT_SUCCESS;
|
||||
|
||||
if ((argc != 1) && (argc != 2))
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
ast_mutex_lock(&alsalock);
|
||||
|
||||
if (alsa.owner) {
|
||||
if (argc == 2) {
|
||||
d = argv[1];
|
||||
grab_owner();
|
||||
if (alsa.owner) {
|
||||
struct ast_frame f = { AST_FRAME_DTMF };
|
||||
while (*d) {
|
||||
f.subclass = *d;
|
||||
ast_queue_frame(alsa.owner, &f);
|
||||
d++;
|
||||
}
|
||||
ast_mutex_unlock(&alsa.owner->lock);
|
||||
}
|
||||
} else {
|
||||
ast_cli(fd, "You're already in a call. You can use this only to dial digits until you hangup\n");
|
||||
res = RESULT_FAILURE;
|
||||
}
|
||||
} else {
|
||||
mye = exten;
|
||||
myc = context;
|
||||
if (argc == 2) {
|
||||
char *stringp = NULL;
|
||||
strncpy(tmp, argv[1], sizeof(tmp) - 1);
|
||||
stringp = tmp;
|
||||
strsep(&stringp, "@");
|
||||
tmp2 = strsep(&stringp, "@");
|
||||
if (!ast_strlen_zero(tmp))
|
||||
mye = tmp;
|
||||
if (!ast_strlen_zero(tmp2))
|
||||
myc = tmp2;
|
||||
}
|
||||
if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {
|
||||
strncpy(alsa.exten, mye, sizeof(alsa.exten) - 1);
|
||||
strncpy(alsa.context, myc, sizeof(alsa.context) - 1);
|
||||
hookstate = 1;
|
||||
alsa_new(&alsa, AST_STATE_RINGING);
|
||||
} else
|
||||
ast_cli(fd, "No such extension '%s' in context '%s'\n", mye, myc);
|
||||
}
|
||||
|
||||
ast_mutex_unlock(&alsalock);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int console_dial(int fd, int argc, char *argv[])
|
||||
{
|
||||
char tmp[256], *tmp2;
|
||||
|
@ -1242,51 +1059,26 @@ static char dial_usage[] =
|
|||
"Usage: console dial [extension[@context]]\n"
|
||||
" Dials a given extension (and context if specified)\n";
|
||||
|
||||
static struct ast_cli_entry cli_alsa_answer_deprecated = {
|
||||
{ "answer", NULL },
|
||||
console_answer_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_alsa_hangup_deprecated = {
|
||||
{ "hangup", NULL },
|
||||
console_hangup_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_alsa_dial_deprecated = {
|
||||
{ "dial", NULL },
|
||||
console_dial_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_alsa_send_text_deprecated = {
|
||||
{ "send", "text", NULL },
|
||||
console_sendtext_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_alsa_autoanswer_deprecated = {
|
||||
{ "autoanswer", NULL },
|
||||
console_autoanswer_deprecated, NULL,
|
||||
NULL, autoanswer_complete };
|
||||
|
||||
static struct ast_cli_entry cli_alsa[] = {
|
||||
{ { "console", "answer", NULL },
|
||||
console_answer, "Answer an incoming console call",
|
||||
answer_usage, NULL, &cli_alsa_answer_deprecated },
|
||||
answer_usage },
|
||||
|
||||
{ { "console", "hangup", NULL },
|
||||
console_hangup, "Hangup a call on the console",
|
||||
hangup_usage, NULL, &cli_alsa_hangup_deprecated },
|
||||
hangup_usage },
|
||||
|
||||
{ { "console", "dial", NULL },
|
||||
console_dial, "Dial an extension on the console",
|
||||
dial_usage, NULL, &cli_alsa_dial_deprecated },
|
||||
dial_usage },
|
||||
|
||||
{ { "console", "send", "text", NULL },
|
||||
console_sendtext, "Send text to the remote device",
|
||||
sendtext_usage, NULL, &cli_alsa_send_text_deprecated },
|
||||
sendtext_usage },
|
||||
|
||||
{ { "console", "autoanswer", NULL },
|
||||
console_autoanswer, "Sets/displays autoanswer",
|
||||
autoanswer_usage, autoanswer_complete, &cli_alsa_autoanswer_deprecated },
|
||||
autoanswer_usage, autoanswer_complete },
|
||||
};
|
||||
|
||||
static int load_module(void)
|
||||
|
|
|
@ -533,15 +533,10 @@ static char show_features_usage[] =
|
|||
"Usage: feature list channels\n"
|
||||
" Provides summary information on feature channels.\n";
|
||||
|
||||
static struct ast_cli_entry cli_features_show_channels_deprecated = {
|
||||
{ "feature", "show", "channels", NULL },
|
||||
features_show, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_features[] = {
|
||||
{ { "feature", "list", "channels", NULL },
|
||||
features_show, "List status of feature channels",
|
||||
show_features_usage, NULL, &cli_features_show_channels_deprecated },
|
||||
show_features_usage },
|
||||
};
|
||||
|
||||
static int load_module(void)
|
||||
|
|
|
@ -1244,9 +1244,6 @@ static struct oh323_alias *realtime_alias(const char *alias)
|
|||
return a;
|
||||
}
|
||||
|
||||
#define DEPRECATED(_v, _new_opt) \
|
||||
ast_log(LOG_WARNING, "Option %s found at line %d has beed deprecated. Use %s instead.\n", (_v)->name, (_v)->lineno, (_new_opt))
|
||||
|
||||
static int update_common_options(struct ast_variable *v, struct call_options *options)
|
||||
{
|
||||
int tmp;
|
||||
|
@ -1274,19 +1271,10 @@ static int update_common_options(struct ast_variable *v, struct call_options *op
|
|||
options->bridge = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "nat")) {
|
||||
options->nat = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "noFastStart")) {
|
||||
DEPRECATED(v, "fastStart");
|
||||
options->fastStart = !ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "fastStart")) {
|
||||
options->fastStart = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "noH245Tunneling")) {
|
||||
DEPRECATED(v, "h245Tunneling");
|
||||
options->h245Tunneling = !ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "h245Tunneling")) {
|
||||
options->h245Tunneling = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "noSilenceSuppression")) {
|
||||
DEPRECATED(v, "silenceSuppression");
|
||||
options->silenceSuppression = !ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "silenceSuppression")) {
|
||||
options->silenceSuppression = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "progress_setup")) {
|
||||
|
@ -1325,7 +1313,6 @@ static int update_common_options(struct ast_variable *v, struct call_options *op
|
|||
|
||||
return 0;
|
||||
}
|
||||
#undef DEPRECATED
|
||||
|
||||
static struct oh323_user *build_user(char *name, struct ast_variable *v, struct ast_variable *alt, int realtime)
|
||||
{
|
||||
|
|
|
@ -4441,15 +4441,6 @@ static int iax2_do_jb_debug(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int iax2_no_debug_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
return RESULT_SHOWUSAGE;
|
||||
iaxdebug = 0;
|
||||
ast_cli(fd, "IAX2 Debugging Disabled\n");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int iax2_no_debug(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
|
@ -4459,15 +4450,6 @@ static int iax2_no_debug(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int iax2_no_trunk_debug_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 4)
|
||||
return RESULT_SHOWUSAGE;
|
||||
iaxtrunkdebug = 0;
|
||||
ast_cli(fd, "IAX2 Trunk Debugging Disabled\n");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int iax2_no_trunk_debug(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
|
@ -4477,16 +4459,6 @@ static int iax2_no_trunk_debug(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int iax2_no_jb_debug_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 4)
|
||||
return RESULT_SHOWUSAGE;
|
||||
jb_setoutput(jb_error_output, jb_warning_output, NULL);
|
||||
jb_debug_output("\n");
|
||||
ast_cli(fd, "IAX2 Jitterbuffer Debugging Disabled\n");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int iax2_no_jb_debug(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
|
@ -8328,10 +8300,6 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
|
|||
peer->authmethods = get_auth_methods(v->value);
|
||||
} else if (!strcasecmp(v->name, "encryption")) {
|
||||
peer->encmethods = get_encrypt_methods(v->value);
|
||||
} else if (!strcasecmp(v->name, "notransfer")) {
|
||||
ast_log(LOG_NOTICE, "The option 'notransfer' is deprecated in favor of 'transfer' which has options 'yes', 'no', and 'mediaonly'\n");
|
||||
ast_clear_flag(peer, IAX_TRANSFERMEDIA);
|
||||
ast_set2_flag(peer, ast_true(v->value), IAX_NOTRANSFER);
|
||||
} else if (!strcasecmp(v->name, "transfer")) {
|
||||
if (!strcasecmp(v->value, "mediaonly")) {
|
||||
ast_set_flags_to(peer, IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_TRANSFERMEDIA);
|
||||
|
@ -8568,10 +8536,6 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, st
|
|||
user->authmethods = get_auth_methods(v->value);
|
||||
} else if (!strcasecmp(v->name, "encryption")) {
|
||||
user->encmethods = get_encrypt_methods(v->value);
|
||||
} else if (!strcasecmp(v->name, "notransfer")) {
|
||||
ast_log(LOG_NOTICE, "The option 'notransfer' is deprecated in favor of 'transfer' which has options 'yes', 'no', and 'mediaonly'\n");
|
||||
ast_clear_flag(user, IAX_TRANSFERMEDIA);
|
||||
ast_set2_flag(user, ast_true(v->value), IAX_NOTRANSFER);
|
||||
} else if (!strcasecmp(v->name, "transfer")) {
|
||||
if (!strcasecmp(v->value, "mediaonly")) {
|
||||
ast_set_flags_to(user, IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_TRANSFERMEDIA);
|
||||
|
@ -8921,11 +8885,7 @@ static int set_config(char *config_file, int reload)
|
|||
authdebug = ast_true(v->value);
|
||||
else if (!strcasecmp(v->name, "encryption"))
|
||||
iax2_encryption = get_encrypt_methods(v->value);
|
||||
else if (!strcasecmp(v->name, "notransfer")) {
|
||||
ast_log(LOG_NOTICE, "The option 'notransfer' is deprecated in favor of 'transfer' which has options 'yes', 'no', and 'mediaonly'\n");
|
||||
ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA);
|
||||
ast_set2_flag((&globalflags), ast_true(v->value), IAX_NOTRANSFER);
|
||||
} else if (!strcasecmp(v->name, "transfer")) {
|
||||
else if (!strcasecmp(v->name, "transfer")) {
|
||||
if (!strcasecmp(v->value, "mediaonly")) {
|
||||
ast_set_flags_to((&globalflags), IAX_NOTRANSFER|IAX_TRANSFERMEDIA, IAX_TRANSFERMEDIA);
|
||||
} else if (ast_true(v->value)) {
|
||||
|
@ -9752,111 +9712,42 @@ static char iax2_test_jitter_usage[] =
|
|||
" For testing, simulate maximum jitter of +/- <ms> on <pct> percentage of packets. If <pct> is not specified, adds jitter to all packets.\n";
|
||||
#endif /* IAXTESTS */
|
||||
|
||||
static struct ast_cli_entry cli_iax2_trunk_debug_deprecated = {
|
||||
{ "iax2", "trunk", "debug", NULL },
|
||||
iax2_do_trunk_debug, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_jb_debug_deprecated = {
|
||||
{ "iax2", "jb", "debug", NULL },
|
||||
iax2_do_jb_debug, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_no_debug_deprecated = {
|
||||
{ "iax2", "no", "debug", NULL },
|
||||
iax2_no_debug_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_no_trunk_debug_deprecated = {
|
||||
{ "iax2", "no", "trunk", "debug", NULL },
|
||||
iax2_no_trunk_debug_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_no_jb_debug_deprecated = {
|
||||
{ "iax2", "no", "jb", "debug", NULL },
|
||||
iax2_no_jb_debug_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_show_cache_deprecated = {
|
||||
{ "iax2", "show", "cache", NULL },
|
||||
iax2_show_cache, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_show_peers_deprecated = {
|
||||
{ "iax2", "show", "peers", NULL },
|
||||
iax2_show_peers, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_show_stats_deprecated = {
|
||||
{ "iax2", "show", "stats", NULL },
|
||||
iax2_show_stats, NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_show_firmware_deprecated = {
|
||||
{ "iax2", "show", "firmware", NULL },
|
||||
iax2_show_firmware, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_show_channels_deprecated = {
|
||||
{ "iax2", "show", "channels", NULL },
|
||||
iax2_show_channels, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_show_netstats_deprecated = {
|
||||
{ "iax2", "show", "netstats", NULL },
|
||||
iax2_show_netstats, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_show_users_deprecated = {
|
||||
{ "iax2", "show", "users", NULL },
|
||||
iax2_show_users, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_show_threads_deprecated = {
|
||||
{ "iax2", "show", "threads", NULL },
|
||||
iax2_show_threads, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_iax2_show_registry_deprecated = {
|
||||
{ "iax2", "show", "registry", NULL },
|
||||
iax2_show_registry, "Show IAX registration status",
|
||||
show_reg_usage };
|
||||
|
||||
static struct ast_cli_entry cli_iax2[] = {
|
||||
{ { "iax2", "list", "cache", NULL },
|
||||
iax2_show_cache, "Display IAX cached dialplan",
|
||||
show_cache_usage, NULL, &cli_iax2_show_cache_deprecated },
|
||||
show_cache_usage },
|
||||
|
||||
{ { "iax2", "list", "channels", NULL },
|
||||
iax2_show_channels, "List active IAX channels",
|
||||
show_channels_usage, NULL, &cli_iax2_show_channels_deprecated },
|
||||
show_channels_usage },
|
||||
|
||||
{ { "iax2", "list", "firmware", NULL },
|
||||
iax2_show_firmware, "List available IAX firmwares",
|
||||
show_firmware_usage, NULL, &cli_iax2_show_firmware_deprecated },
|
||||
show_firmware_usage },
|
||||
|
||||
{ { "iax2", "list", "netstats", NULL },
|
||||
iax2_show_netstats, "List active IAX channel netstats",
|
||||
show_netstats_usage, NULL, &cli_iax2_show_netstats_deprecated },
|
||||
show_netstats_usage },
|
||||
|
||||
{ { "iax2", "list", "peers", NULL },
|
||||
iax2_show_peers, "List defined IAX peers",
|
||||
show_peers_usage, NULL, &cli_iax2_show_peers_deprecated },
|
||||
show_peers_usage },
|
||||
|
||||
{ { "iax2", "list", "registry", NULL },
|
||||
iax2_show_registry, "Display IAX registration status",
|
||||
show_reg_usage, NULL, &cli_iax2_show_registry_deprecated },
|
||||
show_reg_usage },
|
||||
|
||||
{ { "iax2", "list", "stats", NULL },
|
||||
iax2_show_stats, "Display IAX statistics",
|
||||
show_stats_usage, NULL, &cli_iax2_show_stats_deprecated },
|
||||
show_stats_usage },
|
||||
|
||||
{ { "iax2", "list", "threads", NULL },
|
||||
iax2_show_threads, "Display IAX helper thread info",
|
||||
show_threads_usage, NULL, &cli_iax2_show_threads_deprecated },
|
||||
show_threads_usage },
|
||||
|
||||
{ { "iax2", "list", "users", NULL },
|
||||
iax2_show_users, "List defined IAX users",
|
||||
show_users_usage, NULL, &cli_iax2_show_users_deprecated },
|
||||
show_users_usage },
|
||||
|
||||
{ { "iax2", "prune", "realtime", NULL },
|
||||
iax2_prune_realtime, "Prune a cached realtime lookup",
|
||||
|
@ -9876,23 +9767,23 @@ static struct ast_cli_entry cli_iax2[] = {
|
|||
|
||||
{ { "iax2", "debug", "trunk", NULL },
|
||||
iax2_do_trunk_debug, "Enable IAX trunk debugging",
|
||||
debug_trunk_usage, NULL, &cli_iax2_trunk_debug_deprecated },
|
||||
debug_trunk_usage },
|
||||
|
||||
{ { "iax2", "debug", "jb", NULL },
|
||||
iax2_do_jb_debug, "Enable IAX jitterbuffer debugging",
|
||||
debug_jb_usage, NULL, &cli_iax2_jb_debug_deprecated },
|
||||
debug_jb_usage },
|
||||
|
||||
{ { "iax2", "nodebug", NULL },
|
||||
iax2_no_debug, "Disable IAX debugging",
|
||||
no_debug_usage, NULL, &cli_iax2_no_debug_deprecated },
|
||||
no_debug_usage },
|
||||
|
||||
{ { "iax2", "nodebug", "trunk", NULL },
|
||||
iax2_no_trunk_debug, "Disable IAX trunk debugging",
|
||||
no_debug_trunk_usage, NULL, &cli_iax2_no_trunk_debug_deprecated },
|
||||
no_debug_trunk_usage },
|
||||
|
||||
{ { "iax2", "nodebug", "jb", NULL },
|
||||
iax2_no_jb_debug, "Disable IAX jitterbuffer debugging",
|
||||
no_debug_jb_usage, NULL, &cli_iax2_no_jb_debug_deprecated },
|
||||
no_debug_jb_usage },
|
||||
|
||||
{ { "iax2", "test", "losspct", NULL },
|
||||
iax2_test_losspct, "Set IAX2 incoming frame loss percentage",
|
||||
|
|
|
@ -625,15 +625,10 @@ static char show_locals_usage[] =
|
|||
"Usage: local list channels\n"
|
||||
" Provides summary information on active local proxy channels.\n";
|
||||
|
||||
static struct ast_cli_entry cli_local_show_channels_deprecated = {
|
||||
{ "local", "show", "channels", NULL },
|
||||
locals_show, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_local[] = {
|
||||
{ { "local", "list", "channels", NULL },
|
||||
locals_show, "List status of local channels",
|
||||
show_locals_usage, NULL, &cli_local_show_channels_deprecated },
|
||||
show_locals_usage },
|
||||
};
|
||||
|
||||
/*! \brief Load module into PBX, register channel */
|
||||
|
|
|
@ -1122,15 +1122,6 @@ static int mgcp_do_debug(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int mgcp_no_debug_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
return RESULT_SHOWUSAGE;
|
||||
mgcpdebug = 0;
|
||||
ast_cli(fd, "MGCP Debugging Disabled\n");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int mgcp_no_debug(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
|
@ -1140,29 +1131,14 @@ static int mgcp_no_debug(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static struct ast_cli_entry cli_mgcp_no_debug_deprecated = {
|
||||
{ "mgcp", "no", "debug", NULL },
|
||||
mgcp_no_debug_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_mgcp_audit_endpoint_deprecated = {
|
||||
{ "mgcp", "audit", "endpoint", NULL },
|
||||
mgcp_audit_endpoint, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_mgcp_show_endpoints_deprecated = {
|
||||
{ "mgcp", "show", "endpoints", NULL },
|
||||
mgcp_show_endpoints, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_mgcp[] = {
|
||||
{ { "mgcp", "endpoint", "audit", NULL },
|
||||
mgcp_audit_endpoint, "Audit specified MGCP endpoint",
|
||||
audit_endpoint_usage, NULL, &cli_mgcp_audit_endpoint_deprecated },
|
||||
audit_endpoint_usage },
|
||||
|
||||
{ { "mgcp", "endpoint", "list", NULL },
|
||||
mgcp_show_endpoints, "List defined MGCP endpoints",
|
||||
show_endpoints_usage, NULL, &cli_mgcp_show_endpoints_deprecated },
|
||||
show_endpoints_usage },
|
||||
|
||||
{ { "mgcp", "debug", NULL },
|
||||
mgcp_do_debug, "Enable MGCP debugging",
|
||||
|
@ -1170,7 +1146,7 @@ static struct ast_cli_entry cli_mgcp[] = {
|
|||
|
||||
{ { "mgcp", "nodebug", NULL },
|
||||
mgcp_no_debug, "Disable MGCP debugging",
|
||||
no_debug_usage, NULL, &cli_mgcp_no_debug_deprecated },
|
||||
no_debug_usage },
|
||||
|
||||
{ { "mgcp", "reload", NULL },
|
||||
mgcp_reload, "Reload MGCP configuration",
|
||||
|
|
|
@ -1068,29 +1068,6 @@ static struct ast_channel *oss_request(const char *type, int format, void *data,
|
|||
return c;
|
||||
}
|
||||
|
||||
static int console_autoanswer_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
|
||||
if (argc == 1) {
|
||||
ast_cli(fd, "Auto answer is %s.\n", o->autoanswer ? "on" : "off");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
if (argc != 2)
|
||||
return RESULT_SHOWUSAGE;
|
||||
if (o == NULL) {
|
||||
ast_log(LOG_WARNING, "Cannot find device %s (should not happen!)\n", oss_active);
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
if (!strcasecmp(argv[1], "on"))
|
||||
o->autoanswer = -1;
|
||||
else if (!strcasecmp(argv[1], "off"))
|
||||
o->autoanswer = 0;
|
||||
else
|
||||
return RESULT_SHOWUSAGE;
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int console_autoanswer(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
|
@ -1115,13 +1092,6 @@ static int console_autoanswer(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static char *autoanswer_complete_deprecated(const char *line, const char *word, int pos, int state)
|
||||
{
|
||||
static char *choices[] = { "on", "off", NULL };
|
||||
|
||||
return (pos != 2) ? NULL : ast_cli_complete(word, choices, state);
|
||||
}
|
||||
|
||||
static char *autoanswer_complete(const char *line, const char *word, int pos, int state)
|
||||
{
|
||||
static char *choices[] = { "on", "off", NULL };
|
||||
|
@ -1138,28 +1108,6 @@ static char autoanswer_usage[] =
|
|||
/*
|
||||
* answer command from the console
|
||||
*/
|
||||
static int console_answer_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
|
||||
if (argc != 1)
|
||||
return RESULT_SHOWUSAGE;
|
||||
if (!o->owner) {
|
||||
ast_cli(fd, "No one is calling us\n");
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
o->hookstate = 1;
|
||||
o->cursound = -1;
|
||||
o->nosound = 0;
|
||||
ast_queue_frame(o->owner, &f);
|
||||
#if 0
|
||||
/* XXX do we really need it ? considering we shut down immediately... */
|
||||
ring(o, AST_CONTROL_ANSWER);
|
||||
#endif
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int console_answer(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
|
||||
|
@ -1190,31 +1138,6 @@ static char answer_usage[] =
|
|||
* concatenate all arguments into a single string. argv is NULL-terminated
|
||||
* so we can use it right away
|
||||
*/
|
||||
static int console_sendtext_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
char buf[TEXT_SIZE];
|
||||
|
||||
if (argc < 2)
|
||||
return RESULT_SHOWUSAGE;
|
||||
if (!o->owner) {
|
||||
ast_cli(fd, "Not in a call\n");
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
ast_join(buf, sizeof(buf) - 1, argv + 2);
|
||||
if (!ast_strlen_zero(buf)) {
|
||||
struct ast_frame f = { 0, };
|
||||
int i = strlen(buf);
|
||||
buf[i] = '\n';
|
||||
f.frametype = AST_FRAME_TEXT;
|
||||
f.subclass = 0;
|
||||
f.data = buf;
|
||||
f.datalen = i + 1;
|
||||
ast_queue_frame(o->owner, &f);
|
||||
}
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int console_sendtext(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
|
@ -1244,25 +1167,6 @@ static char sendtext_usage[] =
|
|||
"Usage: console send text <message>\n"
|
||||
" Sends a text message for display on the remote terminal.\n";
|
||||
|
||||
static int console_hangup_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
|
||||
if (argc != 1)
|
||||
return RESULT_SHOWUSAGE;
|
||||
o->cursound = -1;
|
||||
o->nosound = 0;
|
||||
if (!o->owner && !o->hookstate) { /* XXX maybe only one ? */
|
||||
ast_cli(fd, "No call to hang up\n");
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
o->hookstate = 0;
|
||||
if (o->owner)
|
||||
ast_queue_hangup(o->owner);
|
||||
setformat(o, O_CLOSE);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int console_hangup(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
|
@ -1286,25 +1190,6 @@ static char hangup_usage[] =
|
|||
"Usage: console hangup\n"
|
||||
" Hangs up any call currently placed on the console.\n";
|
||||
|
||||
static int console_flash_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH };
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
|
||||
if (argc != 1)
|
||||
return RESULT_SHOWUSAGE;
|
||||
o->cursound = -1;
|
||||
o->nosound = 0; /* when cursound is -1 nosound must be 0 */
|
||||
if (!o->owner) { /* XXX maybe !o->hookstate too ? */
|
||||
ast_cli(fd, "No call to flash\n");
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
o->hookstate = 0;
|
||||
if (o->owner) /* XXX must be true, right ? */
|
||||
ast_queue_frame(o->owner, &f);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int console_flash(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH };
|
||||
|
@ -1328,47 +1213,6 @@ static char flash_usage[] =
|
|||
"Usage: console flash\n"
|
||||
" Flashes the call currently placed on the console.\n";
|
||||
|
||||
static int console_dial_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
char *s = NULL, *mye = NULL, *myc = NULL;
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
|
||||
if (argc != 1 && argc != 2)
|
||||
return RESULT_SHOWUSAGE;
|
||||
if (o->owner) { /* already in a call */
|
||||
int i;
|
||||
struct ast_frame f = { AST_FRAME_DTMF, 0 };
|
||||
|
||||
if (argc == 1) { /* argument is mandatory here */
|
||||
ast_cli(fd, "Already in a call. You can only dial digits until you hangup.\n");
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
s = argv[1];
|
||||
/* send the string one char at a time */
|
||||
for (i = 0; i < strlen(s); i++) {
|
||||
f.subclass = s[i];
|
||||
ast_queue_frame(o->owner, &f);
|
||||
}
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
/* if we have an argument split it into extension and context */
|
||||
if (argc == 2)
|
||||
s = ast_ext_ctx(argv[1], &mye, &myc);
|
||||
/* supply default values if needed */
|
||||
if (mye == NULL)
|
||||
mye = o->ext;
|
||||
if (myc == NULL)
|
||||
myc = o->ctx;
|
||||
if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {
|
||||
o->hookstate = 1;
|
||||
oss_new(o, mye, myc, AST_STATE_RINGING);
|
||||
} else
|
||||
ast_cli(fd, "No such extension '%s' in context '%s'\n", mye, myc);
|
||||
if (s)
|
||||
free(s);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int console_dial(int fd, int argc, char *argv[])
|
||||
{
|
||||
char *s = NULL, *mye = NULL, *myc = NULL;
|
||||
|
@ -1422,14 +1266,6 @@ static int __console_mute_unmute(int mute)
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int console_mute_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 1)
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
return __console_mute_unmute(1);
|
||||
}
|
||||
|
||||
static int console_mute(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
|
@ -1441,14 +1277,6 @@ static int console_mute(int fd, int argc, char *argv[])
|
|||
static char mute_usage[] =
|
||||
"Usage: console mute\nMutes the microphone\n";
|
||||
|
||||
static int console_unmute_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 1)
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
return __console_mute_unmute(0);
|
||||
}
|
||||
|
||||
static int console_unmute(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
|
@ -1460,37 +1288,6 @@ static int console_unmute(int fd, int argc, char *argv[])
|
|||
static char unmute_usage[] =
|
||||
"Usage: console unmute\nUnmutes the microphone\n";
|
||||
|
||||
static int console_transfer_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
struct ast_channel *b = NULL;
|
||||
char *tmp, *ext, *ctx;
|
||||
|
||||
if (argc != 2)
|
||||
return RESULT_SHOWUSAGE;
|
||||
if (o == NULL)
|
||||
return RESULT_FAILURE;
|
||||
if (o->owner ==NULL || (b = ast_bridged_channel(o->owner)) == NULL) {
|
||||
ast_cli(fd, "There is no call to transfer\n");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
tmp = ast_ext_ctx(argv[1], &ext, &ctx);
|
||||
if (ctx == NULL) /* supply default context if needed */
|
||||
ctx = o->owner->context;
|
||||
if (!ast_exists_extension(b, ctx, ext, 1, b->cid.cid_num))
|
||||
ast_cli(fd, "No such extension exists\n");
|
||||
else {
|
||||
ast_cli(fd, "Whee, transferring %s to %s@%s.\n",
|
||||
b->name, ext, ctx);
|
||||
if (ast_async_goto(b, ctx, ext, 1))
|
||||
ast_cli(fd, "Failed to transfer :(\n");
|
||||
}
|
||||
if (tmp)
|
||||
free(tmp);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int console_transfer(int fd, int argc, char *argv[])
|
||||
{
|
||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||
|
@ -1526,28 +1323,6 @@ static char transfer_usage[] =
|
|||
" Transfers the currently connected call to the given extension (and\n"
|
||||
"context if specified)\n";
|
||||
|
||||
static int console_active_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc == 1)
|
||||
ast_cli(fd, "active console is [%s]\n", oss_active);
|
||||
else if (argc != 2)
|
||||
return RESULT_SHOWUSAGE;
|
||||
else {
|
||||
struct chan_oss_pvt *o;
|
||||
if (strcmp(argv[1], "show") == 0) {
|
||||
for (o = oss_default.next; o; o = o->next)
|
||||
ast_cli(fd, "device [%s] exists\n", o->name);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
o = find_desc(argv[1]);
|
||||
if (o == NULL)
|
||||
ast_cli(fd, "No device [%s] exists\n", argv[1]);
|
||||
else
|
||||
oss_active = o->name;
|
||||
}
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int console_active(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc == 2)
|
||||
|
@ -1609,105 +1384,50 @@ static int do_boost(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static struct ast_cli_entry cli_oss_answer_deprecated = {
|
||||
{ "answer", NULL },
|
||||
console_answer_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_oss_hangup_deprecated = {
|
||||
{ "hangup", NULL },
|
||||
console_hangup_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_oss_flash_deprecated = {
|
||||
{ "flash", NULL },
|
||||
console_flash_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_oss_dial_deprecated = {
|
||||
{ "dial", NULL },
|
||||
console_dial_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_oss_mute_deprecated = {
|
||||
{ "mute", NULL },
|
||||
console_mute_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_oss_unmute_deprecated = {
|
||||
{ "unmute", NULL },
|
||||
console_unmute_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_oss_transfer_deprecated = {
|
||||
{ "transfer", NULL },
|
||||
console_transfer_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_oss_send_text_deprecated = {
|
||||
{ "send", "text", NULL },
|
||||
console_sendtext_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_oss_autoanswer_deprecated = {
|
||||
{ "autoanswer", NULL },
|
||||
console_autoanswer_deprecated, NULL,
|
||||
NULL, autoanswer_complete_deprecated };
|
||||
|
||||
static struct ast_cli_entry cli_oss_boost_deprecated = {
|
||||
{ "oss", "boost", NULL },
|
||||
do_boost, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_oss_active_deprecated = {
|
||||
{ "console", NULL },
|
||||
console_active_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_oss[] = {
|
||||
{ { "console", "answer", NULL },
|
||||
console_answer, "Answer an incoming console call",
|
||||
answer_usage, NULL, &cli_oss_answer_deprecated },
|
||||
answer_usage },
|
||||
|
||||
{ { "console", "hangup", NULL },
|
||||
console_hangup, "Hangup a call on the console",
|
||||
hangup_usage, NULL, &cli_oss_hangup_deprecated },
|
||||
hangup_usage },
|
||||
|
||||
{ { "console", "flash", NULL },
|
||||
console_flash, "Flash a call on the console",
|
||||
flash_usage, NULL, &cli_oss_flash_deprecated },
|
||||
flash_usage },
|
||||
|
||||
{ { "console", "dial", NULL },
|
||||
console_dial, "Dial an extension on the console",
|
||||
dial_usage, NULL, &cli_oss_dial_deprecated },
|
||||
dial_usage },
|
||||
|
||||
{ { "console", "mute", NULL },
|
||||
console_mute, "Disable mic input",
|
||||
mute_usage, NULL, &cli_oss_mute_deprecated },
|
||||
mute_usage },
|
||||
|
||||
{ { "console", "unmute", NULL },
|
||||
console_unmute, "Enable mic input",
|
||||
unmute_usage, NULL, &cli_oss_unmute_deprecated },
|
||||
unmute_usage },
|
||||
|
||||
{ { "console", "transfer", NULL },
|
||||
console_transfer, "Transfer a call to a different extension",
|
||||
transfer_usage, NULL, &cli_oss_transfer_deprecated },
|
||||
transfer_usage },
|
||||
|
||||
{ { "console", "send", "text", NULL },
|
||||
console_sendtext, "Send text to the remote device",
|
||||
sendtext_usage, NULL, &cli_oss_send_text_deprecated },
|
||||
sendtext_usage },
|
||||
|
||||
{ { "console", "autoanswer", NULL },
|
||||
console_autoanswer, "Sets/displays autoanswer",
|
||||
autoanswer_usage, autoanswer_complete, &cli_oss_autoanswer_deprecated },
|
||||
autoanswer_usage, autoanswer_complete },
|
||||
|
||||
{ { "console", "boost", NULL },
|
||||
do_boost, "Sets/displays mic boost in dB",
|
||||
NULL, NULL, &cli_oss_boost_deprecated },
|
||||
NULL },
|
||||
|
||||
{ { "console", "active", NULL },
|
||||
console_active, "Sets/displays active console",
|
||||
active_usage, NULL, &cli_oss_active_deprecated },
|
||||
active_usage },
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -80,11 +80,6 @@
|
|||
* \par Hanging up
|
||||
* The PBX issues a hangup on both incoming and outgoing calls through
|
||||
* the sip_hangup() function
|
||||
*
|
||||
* \par Deprecated stuff
|
||||
* This is deprecated and will be removed after the 1.4 release
|
||||
* - the SIPUSERAGENT dialplan variable
|
||||
* - the ALERT_INFO dialplan variable
|
||||
*/
|
||||
|
||||
|
||||
|
@ -10644,15 +10639,6 @@ static int sip_notify(int fd, int argc, char *argv[])
|
|||
}
|
||||
|
||||
/*! \brief Disable SIP Debugging in CLI */
|
||||
static int sip_no_debug_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
return RESULT_SHOWUSAGE;
|
||||
ast_clear_flag(&global_flags[1], SIP_PAGE2_DEBUG_CONSOLE);
|
||||
ast_cli(fd, "SIP Debugging Disabled\n");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int sip_no_debug(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
|
@ -10674,16 +10660,6 @@ static int sip_do_history(int fd, int argc, char *argv[])
|
|||
}
|
||||
|
||||
/*! \brief Disable SIP History logging (CLI) */
|
||||
static int sip_no_history_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3) {
|
||||
return RESULT_SHOWUSAGE;
|
||||
}
|
||||
recordhistory = FALSE;
|
||||
ast_cli(fd, "SIP History Recording Disabled\n");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int sip_no_history(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2) {
|
||||
|
@ -14863,8 +14839,6 @@ static struct ast_channel *sip_request_call(const char *type, int format, void *
|
|||
static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v)
|
||||
{
|
||||
int res = 0;
|
||||
static int dep_insecure_very = 0;
|
||||
static int dep_insecure_yes = 0;
|
||||
|
||||
if (!strcasecmp(v->name, "trustrpid")) {
|
||||
ast_set_flag(&mask[0], SIP_TRUSTRPID);
|
||||
|
@ -14932,21 +14906,7 @@ static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask
|
|||
} else if (!strcasecmp(v->name, "insecure")) {
|
||||
ast_set_flag(&mask[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
|
||||
ast_clear_flag(&flags[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
|
||||
if (!strcasecmp(v->value, "very")) {
|
||||
ast_set_flag(&flags[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
|
||||
if (!dep_insecure_very) {
|
||||
ast_log(LOG_WARNING, "insecure=very at line %d is deprecated; use insecure=port,invite instead\n", v->lineno);
|
||||
dep_insecure_very = 1;
|
||||
}
|
||||
}
|
||||
else if (ast_true(v->value)) {
|
||||
ast_set_flag(&flags[0], SIP_INSECURE_PORT);
|
||||
if (!dep_insecure_yes) {
|
||||
ast_log(LOG_WARNING, "insecure=%s at line %d is deprecated; use insecure=port instead\n", v->value, v->lineno);
|
||||
dep_insecure_yes = 1;
|
||||
}
|
||||
}
|
||||
else if (!ast_false(v->value)) {
|
||||
if (!ast_false(v->value)) {
|
||||
char buf[64];
|
||||
char *word, *next;
|
||||
|
||||
|
@ -15621,7 +15581,6 @@ static int reload_config(enum channelreloadreason reason)
|
|||
int auto_sip_domains = FALSE;
|
||||
struct sockaddr_in old_bindaddr = bindaddr;
|
||||
int registry_count = 0, peer_count = 0, user_count = 0;
|
||||
unsigned int temp_tos = 0;
|
||||
struct ast_flags debugflag = {0};
|
||||
|
||||
cfg = ast_config_load(config);
|
||||
|
@ -15907,14 +15866,6 @@ static int reload_config(enum channelreloadreason reason)
|
|||
} else if (!strcasecmp(v->name, "register")) {
|
||||
if (sip_register(v->value, v->lineno) == 0)
|
||||
registry_count++;
|
||||
} else if (!strcasecmp(v->name, "tos")) {
|
||||
if (!ast_str2tos(v->value, &temp_tos)) {
|
||||
global_tos_sip = temp_tos;
|
||||
global_tos_audio = temp_tos;
|
||||
global_tos_video = temp_tos;
|
||||
ast_log(LOG_WARNING, "tos value at line %d is deprecated. See doc/ip-tos.txt for more information.", v->lineno);
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Invalid tos value at line %d, See doc/ip-tos.txt for more information.\n", v->lineno);
|
||||
} else if (!strcasecmp(v->name, "tos_sip")) {
|
||||
if (ast_str2tos(v->value, &global_tos_sip))
|
||||
ast_log(LOG_WARNING, "Invalid tos_sip value at line %d, recommended value is 'cs3'. See doc/ip-tos.txt.\n", v->lineno);
|
||||
|
@ -16666,97 +16617,42 @@ static int reload(void)
|
|||
return sip_reload(0, 0, NULL);
|
||||
}
|
||||
|
||||
static struct ast_cli_entry cli_sip_no_history_deprecated = {
|
||||
{ "sip", "no", "history", NULL },
|
||||
sip_no_history_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip_no_debug_deprecated = {
|
||||
{ "sip", "no", "debug", NULL },
|
||||
sip_no_debug_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip_show_objects_deprecated = {
|
||||
{ "sip", "show", "objects", NULL },
|
||||
sip_show_objects, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip_show_users_deprecated = {
|
||||
{ "sip", "show", "users", NULL },
|
||||
sip_show_users, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip_show_subscriptions_deprecated = {
|
||||
{ "sip", "show", "subscriptions", NULL },
|
||||
sip_show_subscriptions, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip_show_channels_deprecated = {
|
||||
{ "sip", "show", "channels", NULL },
|
||||
sip_show_channels, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip_show_domains_deprecated = {
|
||||
{ "sip", "show", "domains", NULL },
|
||||
sip_show_domains, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip_show_settings_deprecated = {
|
||||
{ "sip", "show", "settings", NULL },
|
||||
sip_show_settings, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip_show_peers_deprecated = {
|
||||
{ "sip", "show", "peers", NULL },
|
||||
sip_show_peers, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip_show_inuse_deprecated = {
|
||||
{ "sip", "show", "inuse", NULL },
|
||||
sip_show_inuse, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip_show_registry_deprecated = {
|
||||
{ "sip", "show", "registry", NULL },
|
||||
sip_show_registry, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_sip[] = {
|
||||
{ { "sip", "list", "channels", NULL },
|
||||
sip_show_channels, "List active SIP channels",
|
||||
show_channels_usage, NULL, &cli_sip_show_channels_deprecated },
|
||||
show_channels_usage },
|
||||
|
||||
{ { "sip", "list", "domains", NULL },
|
||||
sip_show_domains, "List our local SIP domains.",
|
||||
show_domains_usage, NULL, &cli_sip_show_domains_deprecated },
|
||||
show_domains_usage },
|
||||
|
||||
{ { "sip", "list", "inuse", NULL },
|
||||
sip_show_inuse, "List all inuse/limits",
|
||||
show_inuse_usage, NULL, &cli_sip_show_inuse_deprecated },
|
||||
show_inuse_usage },
|
||||
|
||||
{ { "sip", "list", "objects", NULL },
|
||||
sip_show_objects, "List all SIP object allocations",
|
||||
show_objects_usage, NULL, &cli_sip_show_objects_deprecated },
|
||||
show_objects_usage },
|
||||
|
||||
{ { "sip", "list", "peers", NULL },
|
||||
sip_show_peers, "List defined SIP peers",
|
||||
show_peers_usage, NULL, &cli_sip_show_peers_deprecated },
|
||||
show_peers_usage },
|
||||
|
||||
{ { "sip", "list", "registry", NULL },
|
||||
sip_show_registry, "List SIP registration status",
|
||||
show_reg_usage, NULL, &cli_sip_show_registry_deprecated },
|
||||
show_reg_usage },
|
||||
|
||||
{ { "sip", "list", "settings", NULL },
|
||||
sip_show_settings, "List SIP global settings",
|
||||
show_settings_usage, NULL, &cli_sip_show_settings_deprecated },
|
||||
show_settings_usage },
|
||||
|
||||
{ { "sip", "list", "subscriptions", NULL },
|
||||
sip_show_subscriptions, "List active SIP subscriptions",
|
||||
show_subscriptions_usage, NULL, &cli_sip_show_subscriptions_deprecated },
|
||||
show_subscriptions_usage },
|
||||
|
||||
{ { "sip", "list", "users", NULL },
|
||||
sip_show_users, "List defined SIP users",
|
||||
show_users_usage, NULL, &cli_sip_show_users_deprecated },
|
||||
show_users_usage },
|
||||
|
||||
{ { "sip", "notify", NULL },
|
||||
sip_notify, "Send a notify packet to a SIP peer",
|
||||
|
@ -16804,7 +16700,7 @@ static struct ast_cli_entry cli_sip[] = {
|
|||
|
||||
{ { "sip", "nodebug", NULL },
|
||||
sip_no_debug, "Disable SIP debugging",
|
||||
no_debug_usage, NULL, &cli_sip_no_debug_deprecated },
|
||||
no_debug_usage },
|
||||
|
||||
{ { "sip", "history", NULL },
|
||||
sip_do_history, "Enable SIP history",
|
||||
|
@ -16812,7 +16708,7 @@ static struct ast_cli_entry cli_sip[] = {
|
|||
|
||||
{ { "sip", "nohistory", NULL },
|
||||
sip_no_history, "Disable SIP history",
|
||||
no_history_usage, NULL, &cli_sip_no_history_deprecated },
|
||||
no_history_usage },
|
||||
|
||||
{ { "sip", "reload", NULL },
|
||||
sip_reload, "Reload SIP configuration",
|
||||
|
|
|
@ -1652,16 +1652,6 @@ static int skinny_do_debug(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int skinny_no_debug_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3) {
|
||||
return RESULT_SHOWUSAGE;
|
||||
}
|
||||
skinnydebug = 0;
|
||||
ast_cli(fd, "Skinny Debugging Disabled\n");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int skinny_no_debug(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2) {
|
||||
|
@ -1872,29 +1862,14 @@ static char reset_usage[] =
|
|||
"Usage: skinny reset <DeviceId|all> [restart]\n"
|
||||
" Causes a Skinny device to reset itself, optionally with a full restart\n";
|
||||
|
||||
static struct ast_cli_entry cli_skinny_show_devices_deprecated = {
|
||||
{ "skinny", "show", "devices", NULL },
|
||||
skinny_show_devices, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_skinny_show_lines_deprecated = {
|
||||
{ "skinny", "show", "lines", NULL },
|
||||
skinny_show_lines, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_skinny_no_debug_deprecated = {
|
||||
{ "skinny", "no", "debug", NULL },
|
||||
skinny_no_debug_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_skinny[] = {
|
||||
{ { "skinny", "list", "devices", NULL },
|
||||
skinny_show_devices, "List defined Skinny devices",
|
||||
show_devices_usage, NULL, &cli_skinny_show_devices_deprecated },
|
||||
show_devices_usage },
|
||||
|
||||
{ { "skinny", "list", "lines", NULL },
|
||||
skinny_show_lines, "List defined Skinny lines per device",
|
||||
show_lines_usage, NULL, &cli_skinny_show_lines_deprecated },
|
||||
show_lines_usage },
|
||||
|
||||
{ { "skinny", "debug", NULL },
|
||||
skinny_do_debug, "Enable Skinny debugging",
|
||||
|
@ -1902,7 +1877,7 @@ static struct ast_cli_entry cli_skinny[] = {
|
|||
|
||||
{ { "skinny", "nodebug", NULL },
|
||||
skinny_no_debug, "Disable Skinny debugging",
|
||||
no_debug_usage, NULL, &cli_skinny_no_debug_deprecated },
|
||||
no_debug_usage },
|
||||
|
||||
{ { "skinny", "reset", NULL },
|
||||
skinny_reset_device, "Reset Skinny device(s)",
|
||||
|
@ -4367,15 +4342,12 @@ static int reload_config(void)
|
|||
ast_parse_allow_disallow(&default_prefs, &default_capability, v->value, 1);
|
||||
} else if (!strcasecmp(v->name, "disallow")) {
|
||||
ast_parse_allow_disallow(&default_prefs, &default_capability, v->value, 0);
|
||||
} else if (!strcasecmp(v->name, "bindport") || !strcasecmp(v->name, "port")) {
|
||||
} else if (!strcasecmp(v->name, "bindport")) {
|
||||
if (sscanf(v->value, "%d", &ourport) == 1) {
|
||||
bindaddr.sin_port = htons(ourport);
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Invalid bindport '%s' at line %d of %s\n", v->value, v->lineno, config);
|
||||
}
|
||||
if (!strcasecmp(v->name, "port")) { /*! \todo Remove 'port' option after 1.4 */
|
||||
ast_log(LOG_WARNING, "Option 'port' at line %d of %s has been deprecated. Please use 'bindport' instead.\n", v->lineno, config);
|
||||
}
|
||||
}
|
||||
v = v->next;
|
||||
}
|
||||
|
|
|
@ -13,9 +13,6 @@ In sip.conf, there are three parameters that control the TOS settings:
|
|||
signalling packets are set to. tos_audio controls what TOS RTP audio
|
||||
packets are set to. tos_video controls what TOS RTP video packets are
|
||||
set to.
|
||||
There is a "tos" parameter that is supported for backwards
|
||||
compatibility. The tos parameter should be avoided in sip.conf
|
||||
because it sets all three tos settings in sip.conf to the same value.
|
||||
|
||||
* IAX2
|
||||
------
|
||||
|
|
851
pbx/pbx_config.c
851
pbx/pbx_config.c
|
@ -114,25 +114,6 @@ static char reload_extensions_help[] =
|
|||
/*!
|
||||
* REMOVE INCLUDE command stuff
|
||||
*/
|
||||
static int handle_context_dont_include_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 5)
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
if (strcmp(argv[3], "into"))
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
if (!ast_context_remove_include(argv[4], argv[2], registrar)) {
|
||||
ast_cli(fd, "We are not including '%s' into '%s' now\n",
|
||||
argv[2], argv[4]);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ast_cli(fd, "Failed to remove '%s' include from '%s' context\n",
|
||||
argv[2], argv[4]);
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
|
||||
static int handle_context_remove_include(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 6)
|
||||
|
@ -227,127 +208,6 @@ static int split_ec(const char *src, char **ext, char ** const ctx)
|
|||
}
|
||||
|
||||
/* _X_ is the string we need to complete */
|
||||
static char *complete_context_dont_include_deprecated(const char *line, const char *word,
|
||||
int pos, int state)
|
||||
{
|
||||
int which = 0;
|
||||
char *res = NULL;
|
||||
int len = strlen(word); /* how many bytes to match */
|
||||
struct ast_context *c = NULL;
|
||||
|
||||
if (pos == 2) { /* "dont include _X_" */
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_ERROR, "Failed to lock context list\n");
|
||||
return NULL;
|
||||
}
|
||||
/* walk contexts and their includes, return the n-th match */
|
||||
while (!res && (c = ast_walk_contexts(c))) {
|
||||
struct ast_include *i = NULL;
|
||||
|
||||
if (ast_lock_context(c)) /* error ? skip this one */
|
||||
continue;
|
||||
|
||||
while ( !res && (i = ast_walk_context_includes(c, i)) ) {
|
||||
const char *i_name = ast_get_include_name(i);
|
||||
struct ast_context *nc = NULL;
|
||||
int already_served = 0;
|
||||
|
||||
if (!partial_match(i_name, word, len))
|
||||
continue; /* not matched */
|
||||
|
||||
/* check if this include is already served or not */
|
||||
|
||||
/* go through all contexts again till we reach actual
|
||||
* context or already_served = 1
|
||||
*/
|
||||
while ( (nc = ast_walk_contexts(nc)) && nc != c && !already_served)
|
||||
already_served = lookup_ci(nc, i_name);
|
||||
|
||||
if (!already_served && ++which > state)
|
||||
res = strdup(i_name);
|
||||
}
|
||||
ast_unlock_context(c);
|
||||
}
|
||||
|
||||
ast_unlock_contexts();
|
||||
return res;
|
||||
} else if (pos == 3) { /* "dont include CTX _X_" */
|
||||
/*
|
||||
* complete as 'in', but only if previous context is really
|
||||
* included somewhere
|
||||
*/
|
||||
char *context, *dupline;
|
||||
const char *s = skip_words(line, 2); /* skip 'dont' 'include' */
|
||||
|
||||
if (state > 0)
|
||||
return NULL;
|
||||
context = dupline = strdup(s);
|
||||
if (!dupline) {
|
||||
ast_log(LOG_ERROR, "Out of free memory\n");
|
||||
return NULL;
|
||||
}
|
||||
strsep(&dupline, " ");
|
||||
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_ERROR, "Failed to lock contexts list\n");
|
||||
free(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* go through all contexts and check if is included ... */
|
||||
while (!res && (c = ast_walk_contexts(c)))
|
||||
if (lookup_ci(c, context)) /* context is really included, complete "in" command */
|
||||
res = strdup("in");
|
||||
ast_unlock_contexts();
|
||||
if (!res)
|
||||
ast_log(LOG_WARNING, "%s not included anywhere\n", context);
|
||||
free(context);
|
||||
return res;
|
||||
} else if (pos == 4) { /* "dont include CTX in _X_" */
|
||||
/*
|
||||
* Context from which we removing include ...
|
||||
*/
|
||||
char *context, *dupline, *in;
|
||||
const char *s = skip_words(line, 2); /* skip 'dont' 'include' */
|
||||
context = dupline = strdup(s);
|
||||
if (!dupline) {
|
||||
ast_log(LOG_ERROR, "Out of free memory\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strsep(&dupline, " "); /* skip context */
|
||||
|
||||
/* third word must be 'in' */
|
||||
in = strsep(&dupline, " ");
|
||||
if (!in || strcmp(in, "in")) {
|
||||
free(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_ERROR, "Failed to lock context list\n");
|
||||
free(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* walk through all contexts ... */
|
||||
c = NULL;
|
||||
while ( !res && (c = ast_walk_contexts(c))) {
|
||||
const char *c_name = ast_get_context_name(c);
|
||||
if (!partial_match(c_name, word, len)) /* not a good target */
|
||||
continue;
|
||||
/* walk through all includes and check if it is our context */
|
||||
if (lookup_ci(c, context) && ++which > state)
|
||||
res = strdup(c_name);
|
||||
}
|
||||
ast_unlock_contexts();
|
||||
free(context);
|
||||
return res;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *complete_context_remove_include(const char *line, const char *word,
|
||||
int pos, int state)
|
||||
{
|
||||
|
@ -472,73 +332,6 @@ static char *complete_context_remove_include(const char *line, const char *word,
|
|||
/*!
|
||||
* REMOVE EXTENSION command stuff
|
||||
*/
|
||||
static int handle_context_remove_extension_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
int removing_priority = 0;
|
||||
char *exten, *context;
|
||||
int ret = RESULT_FAILURE;
|
||||
|
||||
if (argc != 4 && argc != 3) return RESULT_SHOWUSAGE;
|
||||
|
||||
/*
|
||||
* Priority input checking ...
|
||||
*/
|
||||
if (argc == 4) {
|
||||
char *c = argv[3];
|
||||
|
||||
/* check for digits in whole parameter for right priority ...
|
||||
* why? because atoi (strtol) returns 0 if any characters in
|
||||
* string and whole extension will be removed, it's not good
|
||||
*/
|
||||
if (!strcmp("hint", c))
|
||||
removing_priority = PRIORITY_HINT;
|
||||
else {
|
||||
while (*c && isdigit(*c))
|
||||
c++;
|
||||
if (*c) { /* non-digit in string */
|
||||
ast_cli(fd, "Invalid priority '%s'\n", argv[3]);
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
removing_priority = atoi(argv[3]);
|
||||
}
|
||||
|
||||
if (removing_priority == 0) {
|
||||
ast_cli(fd, "If you want to remove whole extension, please " \
|
||||
"omit priority argument\n");
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX original overwrote argv[2] */
|
||||
/*
|
||||
* Format exten@context checking ...
|
||||
*/
|
||||
if (split_ec(argv[2], &exten, &context))
|
||||
return RESULT_FAILURE; /* XXX malloc failure */
|
||||
if ((!strlen(exten)) || (!(strlen(context)))) {
|
||||
ast_cli(fd, "Missing extension or context name in second argument '%s'\n",
|
||||
argv[2]);
|
||||
free(exten);
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
|
||||
if (!ast_context_remove_extension(context, exten, removing_priority, registrar)) {
|
||||
if (!removing_priority)
|
||||
ast_cli(fd, "Whole extension %s@%s removed\n",
|
||||
exten, context);
|
||||
else
|
||||
ast_cli(fd, "Extension %s@%s with priority %d removed\n",
|
||||
exten, context, removing_priority);
|
||||
|
||||
ret = RESULT_SUCCESS;
|
||||
} else {
|
||||
ast_cli(fd, "Failed to remove extension %s@%s\n", exten, context);
|
||||
ret = RESULT_FAILURE;
|
||||
}
|
||||
free(exten);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int handle_context_remove_extension(int fd, int argc, char *argv[])
|
||||
{
|
||||
int removing_priority = 0;
|
||||
|
@ -653,128 +446,6 @@ static int fix_complete_args(const char *line, char **word, int *pos)
|
|||
}
|
||||
#endif /* BROKEN_READLINE */
|
||||
|
||||
static char *complete_context_remove_extension_deprecated(const char *line, const char *word, int pos,
|
||||
int state)
|
||||
{
|
||||
char *ret = NULL;
|
||||
int which = 0;
|
||||
|
||||
#ifdef BROKEN_READLINE
|
||||
char *word2;
|
||||
/*
|
||||
* Fix arguments, *word is a new allocated structure, REMEMBER to
|
||||
* free *word when you want to return from this function ...
|
||||
*/
|
||||
if (fix_complete_args(line, &word2, &pos)) {
|
||||
ast_log(LOG_ERROR, "Out of free memory\n");
|
||||
return NULL;
|
||||
}
|
||||
word = word2;
|
||||
#endif
|
||||
|
||||
if (pos == 2) { /* 'remove extension _X_' (exten@context ... */
|
||||
struct ast_context *c = NULL;
|
||||
char *context = NULL, *exten = NULL;
|
||||
int le = 0; /* length of extension */
|
||||
int lc = 0; /* length of context */
|
||||
|
||||
lc = split_ec(word, &exten, &context);
|
||||
#ifdef BROKEN_READLINE
|
||||
free(word2);
|
||||
#endif
|
||||
if (lc) /* error */
|
||||
return NULL;
|
||||
le = strlen(exten);
|
||||
lc = strlen(context);
|
||||
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_ERROR, "Failed to lock context list\n");
|
||||
goto error2;
|
||||
}
|
||||
|
||||
/* find our context ... */
|
||||
while ( (c = ast_walk_contexts(c)) ) { /* match our context if any */
|
||||
struct ast_exten *e = NULL;
|
||||
/* XXX locking ? */
|
||||
if (!partial_match(ast_get_context_name(c), context, lc))
|
||||
continue; /* context not matched */
|
||||
while ( (e = ast_walk_context_extensions(c, e)) ) { /* try to complete extensions ... */
|
||||
if ( partial_match(ast_get_extension_name(e), exten, le) && ++which > state) { /* n-th match */
|
||||
/* If there is an extension then return exten@context. XXX otherwise ? */
|
||||
if (exten)
|
||||
asprintf(&ret, "%s@%s", ast_get_extension_name(e), ast_get_context_name(c));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (e) /* got a match */
|
||||
break;
|
||||
}
|
||||
|
||||
ast_unlock_contexts();
|
||||
error2:
|
||||
if (exten)
|
||||
free(exten);
|
||||
} else if (pos == 3) { /* 'remove extension EXT _X_' (priority) */
|
||||
char *exten = NULL, *context, *p;
|
||||
struct ast_context *c;
|
||||
int le, lc, len;
|
||||
const char *s = skip_words(line, 2); /* skip 'remove' 'extension' */
|
||||
int i = split_ec(s, &exten, &context); /* parse ext@context */
|
||||
|
||||
if (i) /* error */
|
||||
goto error3;
|
||||
if ( (p = strchr(exten, ' ')) ) /* remove space after extension */
|
||||
*p = '\0';
|
||||
if ( (p = strchr(context, ' ')) ) /* remove space after context */
|
||||
*p = '\0';
|
||||
le = strlen(exten);
|
||||
lc = strlen(context);
|
||||
len = strlen(word);
|
||||
if (le == 0 || lc == 0)
|
||||
goto error3;
|
||||
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_ERROR, "Failed to lock context list\n");
|
||||
goto error3;
|
||||
}
|
||||
|
||||
/* walk contexts */
|
||||
c = NULL;
|
||||
while ( (c = ast_walk_contexts(c)) ) {
|
||||
/* XXX locking on c ? */
|
||||
struct ast_exten *e;
|
||||
if (strcmp(ast_get_context_name(c), context) != 0)
|
||||
continue;
|
||||
/* got it, we must match here */
|
||||
e = NULL;
|
||||
while ( (e = ast_walk_context_extensions(c, e)) ) {
|
||||
struct ast_exten *priority;
|
||||
char buffer[10];
|
||||
|
||||
if (strcmp(ast_get_extension_name(e), exten) != 0)
|
||||
continue;
|
||||
/* XXX lock e ? */
|
||||
priority = NULL;
|
||||
while ( !ret && (priority = ast_walk_extension_priorities(e, priority)) ) {
|
||||
snprintf(buffer, sizeof(buffer), "%u", ast_get_extension_priority(priority));
|
||||
if (partial_match(buffer, word, len) && ++which > state) /* n-th match */
|
||||
ret = strdup(buffer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
ast_unlock_contexts();
|
||||
error3:
|
||||
if (exten)
|
||||
free(exten);
|
||||
#ifdef BROKEN_READLINE
|
||||
free(word2);
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *complete_context_remove_extension(const char *line, const char *word, int pos,
|
||||
int state)
|
||||
{
|
||||
|
@ -900,51 +571,6 @@ static char *complete_context_remove_extension(const char *line, const char *wor
|
|||
/*!
|
||||
* Include context ...
|
||||
*/
|
||||
static int handle_context_add_include_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 5) /* include context CTX in CTX */
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
/* third arg must be 'in' ... */
|
||||
if (strcmp(argv[3], "in") && strcmp(argv[3], "into")) /* XXX why both ? */
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
if (ast_context_add_include(argv[4], argv[2], registrar)) {
|
||||
switch (errno) {
|
||||
case ENOMEM:
|
||||
ast_cli(fd, "Out of memory for context addition\n");
|
||||
break;
|
||||
|
||||
case EBUSY:
|
||||
ast_cli(fd, "Failed to lock context(s) list, please try again later\n");
|
||||
break;
|
||||
|
||||
case EEXIST:
|
||||
ast_cli(fd, "Context '%s' already included in '%s' context\n",
|
||||
argv[2], argv[4]);
|
||||
break;
|
||||
|
||||
case ENOENT:
|
||||
case EINVAL:
|
||||
ast_cli(fd, "There is no existence of context '%s'\n",
|
||||
errno == ENOENT ? argv[4] : argv[2]);
|
||||
break;
|
||||
|
||||
default:
|
||||
ast_cli(fd, "Failed to include '%s' in '%s' context\n",
|
||||
argv[2], argv[4]);
|
||||
break;
|
||||
}
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
|
||||
/* show some info ... */
|
||||
ast_cli(fd, "Context '%s' included in '%s' context\n",
|
||||
argv[2], argv[4]);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int handle_context_add_include(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 6) /* dialplan add include CTX in CTX */
|
||||
|
@ -990,101 +616,6 @@ static int handle_context_add_include(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static char *complete_context_add_include_deprecated(const char *line, const char *word, int pos,
|
||||
int state)
|
||||
{
|
||||
struct ast_context *c;
|
||||
int which = 0;
|
||||
char *ret = NULL;
|
||||
int len = strlen(word);
|
||||
|
||||
if (pos == 2) { /* 'include context _X_' (context) ... */
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_ERROR, "Failed to lock context list\n");
|
||||
return NULL;
|
||||
}
|
||||
for (c = NULL; !ret && (c = ast_walk_contexts(c)); )
|
||||
if (partial_match(ast_get_context_name(c), word, len) && ++which > state)
|
||||
ret = strdup(ast_get_context_name(c));
|
||||
ast_unlock_contexts();
|
||||
return ret;
|
||||
} else if (pos == 3) { /* include context CTX _X_ */
|
||||
/* complete as 'in' if context exists or we are unable to check */
|
||||
char *context, *dupline;
|
||||
struct ast_context *c;
|
||||
const char *s = skip_words(line, 2); /* should not fail */
|
||||
|
||||
if (state != 0) /* only once */
|
||||
return NULL;
|
||||
|
||||
/* parse context from line ... */
|
||||
context = dupline = strdup(s);
|
||||
if (!context) {
|
||||
ast_log(LOG_ERROR, "Out of free memory\n");
|
||||
return strdup("in");
|
||||
}
|
||||
strsep(&dupline, " ");
|
||||
|
||||
/* check for context existence ... */
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_ERROR, "Failed to lock context list\n");
|
||||
/* our fault, we can't check, so complete 'in' ... */
|
||||
ret = strdup("in");
|
||||
} else {
|
||||
for (c = NULL; !ret && (c = ast_walk_contexts(c)); )
|
||||
if (!strcmp(context, ast_get_context_name(c)))
|
||||
ret = strdup("in"); /* found */
|
||||
ast_unlock_contexts();
|
||||
}
|
||||
free(context);
|
||||
return ret;
|
||||
} else if (pos == 4) { /* 'include context CTX in _X_' (dst context) */
|
||||
char *context, *dupline, *in;
|
||||
const char *s = skip_words(line, 2); /* should not fail */
|
||||
context = dupline = strdup(s);
|
||||
if (!dupline) {
|
||||
ast_log(LOG_ERROR, "Out of free memory\n");
|
||||
return NULL;
|
||||
}
|
||||
strsep(&dupline, " "); /* skip context */
|
||||
in = strsep(&dupline, " ");
|
||||
/* error if missing context or third word is not 'in' */
|
||||
if (!strlen(context) || strcmp(in, "in")) {
|
||||
ast_log(LOG_ERROR, "bad context %s or missing in %s\n",
|
||||
context, in);
|
||||
goto error3;
|
||||
}
|
||||
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_ERROR, "Failed to lock context list\n");
|
||||
goto error3;
|
||||
}
|
||||
|
||||
for (c = NULL; (c = ast_walk_contexts(c)); )
|
||||
if (!strcmp(context, ast_get_context_name(c)))
|
||||
break;
|
||||
if (c) { /* first context exists, go on... */
|
||||
/* go through all contexts ... */
|
||||
for (c = NULL; !ret && (c = ast_walk_contexts(c)); ) {
|
||||
if (!strcmp(context, ast_get_context_name(c)))
|
||||
continue; /* skip ourselves */
|
||||
if (partial_match(ast_get_context_name(c), word, len) &&
|
||||
!lookup_ci(c, context) /* not included yet */ &&
|
||||
++which > state)
|
||||
ret = strdup(ast_get_context_name(c));
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "context %s not found\n", context);
|
||||
}
|
||||
ast_unlock_contexts();
|
||||
error3:
|
||||
free(context);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *complete_context_add_include(const char *line, const char *word, int pos,
|
||||
int state)
|
||||
{
|
||||
|
@ -1404,99 +935,6 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
|
|||
/*!
|
||||
* \brief ADD EXTENSION command stuff
|
||||
*/
|
||||
static int handle_context_add_extension_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
char *whole_exten;
|
||||
char *exten, *prior;
|
||||
int iprior = -2;
|
||||
char *cidmatch, *app, *app_data;
|
||||
char *start, *end;
|
||||
|
||||
/* check for arguments at first */
|
||||
if (argc != 5 && argc != 6)
|
||||
return RESULT_SHOWUSAGE;
|
||||
if (strcmp(argv[3], "into"))
|
||||
return RESULT_SHOWUSAGE;
|
||||
if (argc == 6) if (strcmp(argv[5], "replace")) return RESULT_SHOWUSAGE;
|
||||
|
||||
/* XXX overwrite argv[2] */
|
||||
whole_exten = argv[2];
|
||||
exten = strsep(&whole_exten,",");
|
||||
if (strchr(exten, '/')) {
|
||||
cidmatch = exten;
|
||||
strsep(&cidmatch,"/");
|
||||
} else {
|
||||
cidmatch = NULL;
|
||||
}
|
||||
prior = strsep(&whole_exten,",");
|
||||
if (prior) {
|
||||
if (!strcmp(prior, "hint")) {
|
||||
iprior = PRIORITY_HINT;
|
||||
} else {
|
||||
if (sscanf(prior, "%d", &iprior) != 1) {
|
||||
ast_cli(fd, "'%s' is not a valid priority\n", prior);
|
||||
prior = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
app = whole_exten;
|
||||
if (app && (start = strchr(app, '(')) && (end = strrchr(app, ')'))) {
|
||||
*start = *end = '\0';
|
||||
app_data = start + 1;
|
||||
ast_process_quotes_and_slashes(app_data, ',', '|');
|
||||
} else {
|
||||
if (app) {
|
||||
app_data = strchr(app, ',');
|
||||
if (app_data) {
|
||||
*app_data = '\0';
|
||||
app_data++;
|
||||
}
|
||||
} else
|
||||
app_data = NULL;
|
||||
}
|
||||
|
||||
if (!exten || !prior || !app || (!app_data && iprior != PRIORITY_HINT))
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
if (!app_data)
|
||||
app_data="";
|
||||
if (ast_add_extension(argv[4], argc == 6 ? 1 : 0, exten, iprior, NULL, cidmatch, app,
|
||||
(void *)strdup(app_data), free, registrar)) {
|
||||
switch (errno) {
|
||||
case ENOMEM:
|
||||
ast_cli(fd, "Out of free memory\n");
|
||||
break;
|
||||
|
||||
case EBUSY:
|
||||
ast_cli(fd, "Failed to lock context(s) list, please try again later\n");
|
||||
break;
|
||||
|
||||
case ENOENT:
|
||||
ast_cli(fd, "No existence of '%s' context\n", argv[4]);
|
||||
break;
|
||||
|
||||
case EEXIST:
|
||||
ast_cli(fd, "Extension %s@%s with priority %s already exists\n",
|
||||
exten, argv[4], prior);
|
||||
break;
|
||||
|
||||
default:
|
||||
ast_cli(fd, "Failed to add '%s,%s,%s,%s' extension into '%s' context\n",
|
||||
exten, prior, app, app_data, argv[4]);
|
||||
break;
|
||||
}
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
|
||||
if (argc == 6)
|
||||
ast_cli(fd, "Extension %s@%s (%s) replace by '%s,%s,%s,%s'\n",
|
||||
exten, argv[4], prior, exten, prior, app, app_data);
|
||||
else
|
||||
ast_cli(fd, "Extension '%s,%s,%s,%s' added into '%s' context\n",
|
||||
exten, prior, app, app_data, argv[4]);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
static int handle_context_add_extension(int fd, int argc, char *argv[])
|
||||
{
|
||||
char *whole_exten;
|
||||
|
@ -1592,35 +1030,6 @@ static int handle_context_add_extension(int fd, int argc, char *argv[])
|
|||
}
|
||||
|
||||
/*! dialplan add extension 6123,1,Dial,IAX/212.71.138.13/6123 into local */
|
||||
static char *complete_context_add_extension_deprecated(const char *line, const char *word, int pos, int state)
|
||||
{
|
||||
int which = 0;
|
||||
|
||||
if (pos == 3) { /* complete 'into' word ... */
|
||||
return (state == 0) ? strdup("into") : NULL;
|
||||
} else if (pos == 4) { /* complete context */
|
||||
struct ast_context *c = NULL;
|
||||
int len = strlen(word);
|
||||
char *res = NULL;
|
||||
|
||||
/* try to lock contexts list ... */
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_WARNING, "Failed to lock contexts list\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* walk through all contexts */
|
||||
while ( !res && (c = ast_walk_contexts(c)) )
|
||||
if (partial_match(ast_get_context_name(c), word, len) && ++which > state)
|
||||
res = strdup(ast_get_context_name(c));
|
||||
ast_unlock_contexts();
|
||||
return res;
|
||||
} else if (pos == 5) {
|
||||
return state == 0 ? strdup("replace") : NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *complete_context_add_extension(const char *line, const char *word, int pos, int state)
|
||||
{
|
||||
int which = 0;
|
||||
|
@ -1653,45 +1062,6 @@ static char *complete_context_add_extension(const char *line, const char *word,
|
|||
/*!
|
||||
* IGNOREPAT CLI stuff
|
||||
*/
|
||||
static int handle_context_add_ignorepat_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 5)
|
||||
return RESULT_SHOWUSAGE;
|
||||
if (strcmp(argv[3], "into"))
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
if (ast_context_add_ignorepat(argv[4], argv[2], registrar)) {
|
||||
switch (errno) {
|
||||
case ENOMEM:
|
||||
ast_cli(fd, "Out of free memory\n");
|
||||
break;
|
||||
|
||||
case ENOENT:
|
||||
ast_cli(fd, "There is no existence of '%s' context\n", argv[4]);
|
||||
break;
|
||||
|
||||
case EEXIST:
|
||||
ast_cli(fd, "Ignore pattern '%s' already included in '%s' context\n",
|
||||
argv[2], argv[4]);
|
||||
break;
|
||||
|
||||
case EBUSY:
|
||||
ast_cli(fd, "Failed to lock context(s) list, please, try again later\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
ast_cli(fd, "Failed to add ingore pattern '%s' into '%s' context\n",
|
||||
argv[2], argv[4]);
|
||||
break;
|
||||
}
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
|
||||
ast_cli(fd, "Ignore pattern '%s' added into '%s' context\n",
|
||||
argv[2], argv[4]);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int handle_context_add_ignorepat(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 6)
|
||||
|
@ -1731,55 +1101,6 @@ static int handle_context_add_ignorepat(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static char *complete_context_add_ignorepat_deprecated(const char *line, const char *word,
|
||||
int pos, int state)
|
||||
{
|
||||
if (pos == 3)
|
||||
return state == 0 ? strdup("into") : NULL;
|
||||
else if (pos == 4) {
|
||||
struct ast_context *c;
|
||||
int which = 0;
|
||||
char *dupline, *ignorepat = NULL;
|
||||
const char *s;
|
||||
char *ret = NULL;
|
||||
int len = strlen(word);
|
||||
|
||||
/* XXX skip first two words 'add' 'ignorepat' */
|
||||
s = skip_words(line, 2);
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
dupline = strdup(s);
|
||||
if (!dupline) {
|
||||
ast_log(LOG_ERROR, "Malloc failure\n");
|
||||
return NULL;
|
||||
}
|
||||
ignorepat = strsep(&dupline, " ");
|
||||
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_ERROR, "Failed to lock contexts list\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (c = NULL; !ret && (c = ast_walk_contexts(c));) {
|
||||
int found = 0;
|
||||
|
||||
if (!partial_match(ast_get_context_name(c), word, len))
|
||||
continue; /* not mine */
|
||||
if (ignorepat) /* there must be one, right ? */
|
||||
found = lookup_c_ip(c, ignorepat);
|
||||
if (!found && ++which > state)
|
||||
ret = strdup(ast_get_context_name(c));
|
||||
}
|
||||
|
||||
if (ignorepat)
|
||||
free(ignorepat);
|
||||
ast_unlock_contexts();
|
||||
return ret;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *complete_context_add_ignorepat(const char *line, const char *word,
|
||||
int pos, int state)
|
||||
{
|
||||
|
@ -1829,40 +1150,6 @@ static char *complete_context_add_ignorepat(const char *line, const char *word,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int handle_context_remove_ignorepat_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 5)
|
||||
return RESULT_SHOWUSAGE;
|
||||
if (strcmp(argv[3], "from"))
|
||||
return RESULT_SHOWUSAGE;
|
||||
|
||||
if (ast_context_remove_ignorepat(argv[4], argv[2], registrar)) {
|
||||
switch (errno) {
|
||||
case EBUSY:
|
||||
ast_cli(fd, "Failed to lock context(s) list, please try again later\n");
|
||||
break;
|
||||
|
||||
case ENOENT:
|
||||
ast_cli(fd, "There is no existence of '%s' context\n", argv[4]);
|
||||
break;
|
||||
|
||||
case EINVAL:
|
||||
ast_cli(fd, "There is no existence of '%s' ignore pattern in '%s' context\n",
|
||||
argv[2], argv[4]);
|
||||
break;
|
||||
|
||||
default:
|
||||
ast_cli(fd, "Failed to remove ignore pattern '%s' from '%s' context\n", argv[2], argv[4]);
|
||||
break;
|
||||
}
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
|
||||
ast_cli(fd, "Ignore pattern '%s' removed from '%s' context\n",
|
||||
argv[2], argv[4]);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int handle_context_remove_ignorepat(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 6)
|
||||
|
@ -1897,88 +1184,6 @@ static int handle_context_remove_ignorepat(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static char *complete_context_remove_ignorepat_deprecated(const char *line, const char *word,
|
||||
int pos, int state)
|
||||
{
|
||||
struct ast_context *c;
|
||||
int which = 0;
|
||||
char *ret = NULL;
|
||||
|
||||
if (pos == 2) {
|
||||
int len = strlen(word);
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_WARNING, "Failed to lock contexts list\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (c = NULL; !ret && (c = ast_walk_contexts(c));) {
|
||||
struct ast_ignorepat *ip;
|
||||
|
||||
if (ast_lock_context(c)) /* error, skip it */
|
||||
continue;
|
||||
|
||||
for (ip = NULL; !ret && (ip = ast_walk_context_ignorepats(c, ip));) {
|
||||
if (partial_match(ast_get_ignorepat_name(ip), word, len) && ++which > state) {
|
||||
/* n-th match */
|
||||
struct ast_context *cw = NULL;
|
||||
int found = 0;
|
||||
while ( (cw = ast_walk_contexts(cw)) && cw != c && !found) {
|
||||
/* XXX do i stop on c, or skip it ? */
|
||||
found = lookup_c_ip(cw, ast_get_ignorepat_name(ip));
|
||||
}
|
||||
if (!found)
|
||||
ret = strdup(ast_get_ignorepat_name(ip));
|
||||
}
|
||||
}
|
||||
ast_unlock_context(c);
|
||||
}
|
||||
ast_unlock_contexts();
|
||||
return ret;
|
||||
} else if (pos == 3) {
|
||||
return state == 0 ? strdup("from") : NULL;
|
||||
} else if (pos == 4) { /* XXX check this */
|
||||
char *dupline, *duplinet, *ignorepat;
|
||||
int len = strlen(word);
|
||||
|
||||
dupline = strdup(line);
|
||||
if (!dupline) {
|
||||
ast_log(LOG_WARNING, "Out of free memory\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
duplinet = dupline;
|
||||
strsep(&duplinet, " ");
|
||||
strsep(&duplinet, " ");
|
||||
ignorepat = strsep(&duplinet, " ");
|
||||
|
||||
if (!ignorepat) {
|
||||
free(dupline);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ast_lock_contexts()) {
|
||||
ast_log(LOG_WARNING, "Failed to lock contexts list\n");
|
||||
free(dupline);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (c = NULL; !ret && (c = ast_walk_contexts(c)); ) {
|
||||
if (ast_lock_context(c)) /* fail, skip it */
|
||||
continue;
|
||||
if (!partial_match(ast_get_context_name(c), word, len))
|
||||
continue;
|
||||
if (lookup_c_ip(c, ignorepat) && ++which > state)
|
||||
ret = strdup(ast_get_context_name(c));
|
||||
ast_unlock_context(c);
|
||||
}
|
||||
ast_unlock_contexts();
|
||||
free(dupline);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *complete_context_remove_ignorepat(const char *line, const char *word,
|
||||
int pos, int state)
|
||||
{
|
||||
|
@ -2074,81 +1279,41 @@ static int handle_reload_extensions(int fd, int argc, char *argv[])
|
|||
/*!
|
||||
* CLI entries for commands provided by this module
|
||||
*/
|
||||
static struct ast_cli_entry cli_dont_include_deprecated = {
|
||||
{ "dont", "include", NULL },
|
||||
handle_context_dont_include_deprecated, NULL,
|
||||
NULL, complete_context_dont_include_deprecated };
|
||||
|
||||
static struct ast_cli_entry cli_remove_extension_deprecated = {
|
||||
{ "remove", "extension", NULL },
|
||||
handle_context_remove_extension_deprecated, NULL,
|
||||
NULL, complete_context_remove_extension_deprecated };
|
||||
|
||||
static struct ast_cli_entry cli_include_context_deprecated = {
|
||||
{ "include", "context", NULL },
|
||||
handle_context_add_include_deprecated, NULL,
|
||||
NULL, complete_context_add_include_deprecated };
|
||||
|
||||
static struct ast_cli_entry cli_add_extension_deprecated = {
|
||||
{ "add", "extension", NULL },
|
||||
handle_context_add_extension_deprecated, NULL,
|
||||
NULL, complete_context_add_extension_deprecated };
|
||||
|
||||
static struct ast_cli_entry cli_add_ignorepat_deprecated = {
|
||||
{ "add", "ignorepat", NULL },
|
||||
handle_context_add_ignorepat_deprecated, NULL,
|
||||
NULL, complete_context_add_ignorepat_deprecated };
|
||||
|
||||
static struct ast_cli_entry cli_remove_ignorepat_deprecated = {
|
||||
{ "remove", "ignorepat", NULL },
|
||||
handle_context_remove_ignorepat_deprecated, NULL,
|
||||
NULL, complete_context_remove_ignorepat_deprecated };
|
||||
|
||||
static struct ast_cli_entry cli_extensions_reload_deprecated = {
|
||||
{ "extensions", "reload", NULL },
|
||||
handle_reload_extensions, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_save_dialplan_deprecated = {
|
||||
{ "save", "dialplan", NULL },
|
||||
handle_save_dialplan, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_pbx_config[] = {
|
||||
{ { "dialplan", "add", "extension", NULL },
|
||||
handle_context_add_extension, "Add new extension into context",
|
||||
context_add_extension_help, complete_context_add_extension, &cli_add_extension_deprecated },
|
||||
context_add_extension_help, complete_context_add_extension },
|
||||
|
||||
{ { "dialplan", "remove", "extension", NULL },
|
||||
handle_context_remove_extension, "Remove a specified extension",
|
||||
context_remove_extension_help, complete_context_remove_extension, &cli_remove_extension_deprecated },
|
||||
context_remove_extension_help, complete_context_remove_extension },
|
||||
|
||||
{ { "dialplan", "add", "ignorepat", NULL },
|
||||
handle_context_add_ignorepat, "Add new ignore pattern",
|
||||
context_add_ignorepat_help, complete_context_add_ignorepat, &cli_add_ignorepat_deprecated },
|
||||
context_add_ignorepat_help, complete_context_add_ignorepat },
|
||||
|
||||
{ { "dialplan", "remove", "ignorepat", NULL },
|
||||
handle_context_remove_ignorepat, "Remove ignore pattern from context",
|
||||
context_remove_ignorepat_help, complete_context_remove_ignorepat, &cli_remove_ignorepat_deprecated },
|
||||
context_remove_ignorepat_help, complete_context_remove_ignorepat },
|
||||
|
||||
{ { "dialplan", "add", "include", NULL },
|
||||
handle_context_add_include, "Include context in other context",
|
||||
context_add_include_help, complete_context_add_include, &cli_include_context_deprecated },
|
||||
context_add_include_help, complete_context_add_include },
|
||||
|
||||
{ { "dialplan", "remove", "include", NULL },
|
||||
handle_context_remove_include, "Remove a specified include from context",
|
||||
context_remove_include_help, complete_context_remove_include, &cli_dont_include_deprecated },
|
||||
context_remove_include_help, complete_context_remove_include },
|
||||
|
||||
{ { "dialplan", "reload", NULL },
|
||||
handle_reload_extensions, "Reload extensions and *only* extensions",
|
||||
reload_extensions_help, NULL, &cli_extensions_reload_deprecated },
|
||||
reload_extensions_help },
|
||||
};
|
||||
|
||||
|
||||
static struct ast_cli_entry cli_dialplan_save = {
|
||||
{ "dialplan", "save", NULL },
|
||||
handle_save_dialplan, "Save dialplan",
|
||||
save_dialplan_help, NULL, &cli_save_dialplan_deprecated };
|
||||
save_dialplan_help };
|
||||
|
||||
/*!
|
||||
* Standard module functions ...
|
||||
|
|
|
@ -1314,15 +1314,6 @@ static int agi_do_debug(int fd, int argc, char *argv[])
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int agi_no_debug_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
return RESULT_SHOWUSAGE;
|
||||
agidebug = 0;
|
||||
ast_cli(fd, "AGI Debugging Disabled\n");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int agi_no_debug(int fd, int argc, char *argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
|
@ -2093,21 +2084,6 @@ static char dumpagihtml_help[] =
|
|||
"Usage: agi dumphtml <filename>\n"
|
||||
" Dumps the agi command list in html format to given filename\n";
|
||||
|
||||
static struct ast_cli_entry cli_show_agi_deprecated = {
|
||||
{ "show", "agi", NULL },
|
||||
handle_showagi, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_dump_agihtml_deprecated = {
|
||||
{ "dump", "agihtml", NULL },
|
||||
handle_agidumphtml, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_agi_no_debug_deprecated = {
|
||||
{ "agi", "no", "debug", NULL },
|
||||
agi_no_debug_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_agi[] = {
|
||||
{ { "agi", "debug", NULL },
|
||||
agi_do_debug, "Enable AGI debugging",
|
||||
|
@ -2115,15 +2091,15 @@ static struct ast_cli_entry cli_agi[] = {
|
|||
|
||||
{ { "agi", "nodebug", NULL },
|
||||
agi_no_debug, "Disable AGI debugging",
|
||||
no_debug_usage, NULL, &cli_agi_no_debug_deprecated },
|
||||
no_debug_usage },
|
||||
|
||||
{ { "agi", "list", NULL },
|
||||
handle_showagi, "List AGI commands or specific help",
|
||||
showagi_help, NULL, &cli_show_agi_deprecated },
|
||||
showagi_help },
|
||||
|
||||
{ { "agi", "dumphtml", NULL },
|
||||
handle_agidumphtml, "Dumps a list of agi commands in html format",
|
||||
dumpagihtml_help, NULL, &cli_dump_agihtml_deprecated },
|
||||
dumpagihtml_help },
|
||||
};
|
||||
|
||||
static int unload_module(void)
|
||||
|
|
|
@ -54,73 +54,6 @@ static int split_ext(char *filename, char **name, char **ext)
|
|||
}
|
||||
|
||||
/*! \brief Convert a file from one format to another */
|
||||
static int cli_audio_convert_deprecated(int fd, int argc, char *argv[])
|
||||
{
|
||||
int ret = RESULT_FAILURE;
|
||||
struct ast_filestream *fs_in = NULL, *fs_out = NULL;
|
||||
struct ast_frame *f;
|
||||
struct timeval start;
|
||||
int cost;
|
||||
char *file_in = NULL, *file_out = NULL;
|
||||
char *name_in, *ext_in, *name_out, *ext_out;
|
||||
|
||||
/* ugly, can be removed when CLI entries have ast_module pointers */
|
||||
ast_module_ref(ast_module_info->self);
|
||||
|
||||
if (argc != 3 || ast_strlen_zero(argv[1]) || ast_strlen_zero(argv[2])) {
|
||||
ret = RESULT_SHOWUSAGE;
|
||||
goto fail_out;
|
||||
}
|
||||
|
||||
file_in = ast_strdupa(argv[1]);
|
||||
file_out = ast_strdupa(argv[2]);
|
||||
|
||||
if (split_ext(file_in, &name_in, &ext_in)) {
|
||||
ast_cli(fd, "'%s' is an invalid filename!\n", argv[1]);
|
||||
goto fail_out;
|
||||
}
|
||||
if (!(fs_in = ast_readfile(name_in, ext_in, NULL, O_RDONLY, 0, 0))) {
|
||||
ast_cli(fd, "Unable to open input file: %s\n", argv[1]);
|
||||
goto fail_out;
|
||||
}
|
||||
|
||||
if (split_ext(file_out, &name_out, &ext_out)) {
|
||||
ast_cli(fd, "'%s' is an invalid filename!\n", argv[2]);
|
||||
goto fail_out;
|
||||
}
|
||||
if (!(fs_out = ast_writefile(name_out, ext_out, NULL, O_CREAT|O_TRUNC|O_WRONLY, 0, 0644))) {
|
||||
ast_cli(fd, "Unable to open output file: %s\n", argv[2]);
|
||||
goto fail_out;
|
||||
}
|
||||
|
||||
start = ast_tvnow();
|
||||
|
||||
while ((f = ast_readframe(fs_in))) {
|
||||
if (ast_writestream(fs_out, f)) {
|
||||
ast_cli(fd, "Failed to convert %s.%s to %s.%s!\n", name_in, ext_in, name_out, ext_out);
|
||||
goto fail_out;
|
||||
}
|
||||
}
|
||||
|
||||
cost = ast_tvdiff_ms(ast_tvnow(), start);
|
||||
ast_cli(fd, "Converted %s.%s to %s.%s in %dms\n", name_in, ext_in, name_out, ext_out, cost);
|
||||
ret = RESULT_SUCCESS;
|
||||
|
||||
fail_out:
|
||||
if (fs_out) {
|
||||
ast_closestream(fs_out);
|
||||
if (ret != RESULT_SUCCESS)
|
||||
ast_filedelete(name_out, ext_out);
|
||||
}
|
||||
|
||||
if (fs_in)
|
||||
ast_closestream(fs_in);
|
||||
|
||||
ast_module_unref(ast_module_info->self);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cli_audio_convert(int fd, int argc, char *argv[])
|
||||
{
|
||||
int ret = RESULT_FAILURE;
|
||||
|
@ -195,15 +128,10 @@ static char usage_audio_convert[] =
|
|||
"Example:\n"
|
||||
" file convert tt-weasels.gsm tt-weasels.ulaw\n";
|
||||
|
||||
static struct ast_cli_entry cli_convert_deprecated = {
|
||||
{ "convert" , NULL },
|
||||
cli_audio_convert_deprecated, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_convert[] = {
|
||||
{ { "file", "convert" , NULL },
|
||||
cli_audio_convert, "Convert audio file",
|
||||
usage_audio_convert, NULL, &cli_convert_deprecated },
|
||||
usage_audio_convert },
|
||||
};
|
||||
|
||||
static int unload_module(void)
|
||||
|
|
|
@ -561,24 +561,14 @@ static char init_keys_usage[] =
|
|||
"Usage: keys init\n"
|
||||
" Initializes private keys (by reading in pass code from the user)\n";
|
||||
|
||||
static struct ast_cli_entry cli_show_keys_deprecated = {
|
||||
{ "show", "keys", NULL },
|
||||
show_keys, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_init_keys_deprecated = {
|
||||
{ "init", "keys", NULL },
|
||||
init_keys, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_crypto[] = {
|
||||
{ { "keys", "list", NULL },
|
||||
show_keys, "Displays RSA key information",
|
||||
show_key_usage, NULL, &cli_show_keys_deprecated },
|
||||
show_key_usage },
|
||||
|
||||
{ { "keys", "init", NULL },
|
||||
init_keys, "Initialize RSA key passcodes",
|
||||
init_keys_usage, NULL, &cli_init_keys_deprecated },
|
||||
init_keys_usage },
|
||||
};
|
||||
|
||||
static int crypto_init(void)
|
||||
|
|
|
@ -1919,15 +1919,10 @@ static char showparked_help[] =
|
|||
"Usage: show parkedcalls\n"
|
||||
" Lists currently parked calls.\n";
|
||||
|
||||
static struct ast_cli_entry cli_show_features_deprecated = {
|
||||
{ "show", "features", NULL },
|
||||
handle_showfeatures, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_features[] = {
|
||||
{ { "feature", "list", NULL },
|
||||
handle_showfeatures, "Lists configured features",
|
||||
showfeatures_help, NULL, &cli_show_features_deprecated },
|
||||
showfeatures_help },
|
||||
|
||||
{ { "show", "parkedcalls", NULL },
|
||||
handle_parkedcalls, "Lists parked calls",
|
||||
|
|
|
@ -345,11 +345,6 @@ out: v = v->next;
|
|||
/*
|
||||
* CLI entries for commands provided by this module
|
||||
*/
|
||||
static struct ast_cli_entry cli_show_indications_deprecated = {
|
||||
{ "show", "indications", NULL },
|
||||
handle_show_indications, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_indications[] = {
|
||||
{ { "indication", "add", NULL },
|
||||
handle_add_indication, "Add the given indication to the country",
|
||||
|
@ -361,7 +356,7 @@ static struct ast_cli_entry cli_indications[] = {
|
|||
|
||||
{ { "indication", "list", NULL },
|
||||
handle_show_indications, "Display a list of all countries/indications",
|
||||
help_show_indications, NULL, &cli_show_indications_deprecated },
|
||||
help_show_indications },
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -961,11 +961,8 @@ static int load_moh_classes(int reload)
|
|||
struct ast_config *cfg;
|
||||
struct ast_variable *var;
|
||||
struct mohclass *class;
|
||||
char *data;
|
||||
char *args;
|
||||
char *cat;
|
||||
int numclasses = 0;
|
||||
static int dep_warning = 0;
|
||||
|
||||
cfg = ast_config_load("musiconhold.conf");
|
||||
|
||||
|
@ -974,6 +971,7 @@ static int load_moh_classes(int reload)
|
|||
|
||||
cat = ast_category_browse(cfg, NULL);
|
||||
for (; cat; cat = ast_category_browse(cfg, cat)) {
|
||||
/* These names were deprecated in 1.4 and should not be used until after the next major release. */
|
||||
if (strcasecmp(cat, "classes") && strcasecmp(cat, "moh_files")) {
|
||||
if (!(class = moh_class_malloc())) {
|
||||
break;
|
||||
|
@ -1026,63 +1024,6 @@ static int load_moh_classes(int reload)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Deprecated Old-School Configuration */
|
||||
var = ast_variable_browse(cfg, "classes");
|
||||
while (var) {
|
||||
if (!dep_warning) {
|
||||
ast_log(LOG_WARNING, "The old musiconhold.conf syntax has been deprecated! Please refer to the sample configuration for information on the new syntax.\n");
|
||||
dep_warning = 1;
|
||||
}
|
||||
data = strchr(var->value, ':');
|
||||
if (data) {
|
||||
*data++ = '\0';
|
||||
args = strchr(data, ',');
|
||||
if (args)
|
||||
*args++ = '\0';
|
||||
if (!(get_mohbyname(var->name))) {
|
||||
if (!(class = moh_class_malloc())) {
|
||||
return numclasses;
|
||||
}
|
||||
|
||||
ast_copy_string(class->name, var->name, sizeof(class->name));
|
||||
ast_copy_string(class->dir, data, sizeof(class->dir));
|
||||
ast_copy_string(class->mode, var->value, sizeof(class->mode));
|
||||
if (args)
|
||||
ast_copy_string(class->args, args, sizeof(class->args));
|
||||
|
||||
moh_register(class, reload);
|
||||
numclasses++;
|
||||
}
|
||||
}
|
||||
var = var->next;
|
||||
}
|
||||
var = ast_variable_browse(cfg, "moh_files");
|
||||
while (var) {
|
||||
if (!dep_warning) {
|
||||
ast_log(LOG_WARNING, "The old musiconhold.conf syntax has been deprecated! Please refer to the sample configuration for information on the new syntax.\n");
|
||||
dep_warning = 1;
|
||||
}
|
||||
if (!(get_mohbyname(var->name))) {
|
||||
args = strchr(var->value, ',');
|
||||
if (args)
|
||||
*args++ = '\0';
|
||||
if (!(class = moh_class_malloc())) {
|
||||
return numclasses;
|
||||
}
|
||||
|
||||
ast_copy_string(class->name, var->name, sizeof(class->name));
|
||||
ast_copy_string(class->dir, var->value, sizeof(class->dir));
|
||||
strcpy(class->mode, "files");
|
||||
if (args)
|
||||
ast_copy_string(class->args, args, sizeof(class->args));
|
||||
|
||||
moh_register(class, reload);
|
||||
numclasses++;
|
||||
}
|
||||
var = var->next;
|
||||
}
|
||||
|
||||
ast_config_destroy(cfg);
|
||||
|
||||
return numclasses;
|
||||
|
@ -1187,16 +1128,6 @@ static int moh_classes_show(int fd, int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct ast_cli_entry cli_moh_classes_show_deprecated = {
|
||||
{ "moh", "classes", "show"},
|
||||
moh_classes_show, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_moh_files_show_deprecated = {
|
||||
{ "moh", "files", "show"},
|
||||
cli_files_show, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_moh[] = {
|
||||
{ { "moh", "reload"},
|
||||
moh_cli, "Music On Hold",
|
||||
|
@ -1204,11 +1135,11 @@ static struct ast_cli_entry cli_moh[] = {
|
|||
|
||||
{ { "moh", "list", "classes"},
|
||||
moh_classes_show, "List MOH classes",
|
||||
"Lists all MOH classes", NULL, &cli_moh_classes_show_deprecated },
|
||||
"Lists all MOH classes" },
|
||||
|
||||
{ { "moh", "list", "files"},
|
||||
cli_files_show, "List MOH file-based classes",
|
||||
"Lists all loaded file-based MOH classes and their files", NULL, &cli_moh_files_show_deprecated },
|
||||
"Lists all loaded file-based MOH classes and their files" },
|
||||
};
|
||||
|
||||
static int init_classes(int reload)
|
||||
|
|
|
@ -341,15 +341,10 @@ static char show_usage[] =
|
|||
" List settings of a particular ODBC class.\n"
|
||||
" or, if not specified, all classes.\n";
|
||||
|
||||
static struct ast_cli_entry cli_odbc_show_deprecated = {
|
||||
{ "odbc", "show", NULL },
|
||||
odbc_show_command, NULL,
|
||||
NULL };
|
||||
|
||||
static struct ast_cli_entry cli_odbc[] = {
|
||||
{ { "odbc", "list", NULL },
|
||||
odbc_show_command, "List ODBC DSN(s)",
|
||||
show_usage, NULL, &cli_odbc_show_deprecated },
|
||||
show_usage },
|
||||
};
|
||||
|
||||
static int odbc_register_class(struct odbc_class *class, int connect)
|
||||
|
|
Reference in New Issue