mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Lots more removal of deprecated things
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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 },
|
||||
};
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user