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:
@@ -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 */
|
||||
|
Reference in New Issue
Block a user