mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
use new app-argument macros, and try to fix yesterday's breakage
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6880 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1675,12 +1675,14 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
|||||||
char agent[AST_MAX_AGENT] = "";
|
char agent[AST_MAX_AGENT] = "";
|
||||||
char xpass[AST_MAX_AGENT] = "";
|
char xpass[AST_MAX_AGENT] = "";
|
||||||
char *errmsg;
|
char *errmsg;
|
||||||
char *info;
|
char *parse;
|
||||||
char *opt_user = NULL;
|
AST_DECLARE_APP_ARGS(args,
|
||||||
char *options = NULL;
|
AST_APP_ARG(agent_id);
|
||||||
|
AST_APP_ARG(options);
|
||||||
|
AST_APP_ARG(extension);
|
||||||
|
);
|
||||||
char *tmpoptions = NULL;
|
char *tmpoptions = NULL;
|
||||||
char *context = NULL;
|
char *context = NULL;
|
||||||
char *exten = NULL;
|
|
||||||
int play_announcement = 1;
|
int play_announcement = 1;
|
||||||
char agent_goodbye[AST_MAX_FILENAME_LEN];
|
char agent_goodbye[AST_MAX_FILENAME_LEN];
|
||||||
int update_cdr = updatecdr;
|
int update_cdr = updatecdr;
|
||||||
@@ -1688,13 +1690,14 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
|||||||
|
|
||||||
LOCAL_USER_ADD(u);
|
LOCAL_USER_ADD(u);
|
||||||
|
|
||||||
info = ast_strdupa(data);
|
if (!(parse = ast_strdupa(data))) {
|
||||||
if (!info) {
|
|
||||||
ast_log(LOG_ERROR, "Out of memory!\n");
|
ast_log(LOG_ERROR, "Out of memory!\n");
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AST_STANDARD_APP_ARGS(args, parse);
|
||||||
|
|
||||||
ast_copy_string(agent_goodbye, agentgoodbye, sizeof(agent_goodbye));
|
ast_copy_string(agent_goodbye, agentgoodbye, sizeof(agent_goodbye));
|
||||||
|
|
||||||
/* Set Channel Specific Login Overrides */
|
/* Set Channel Specific Login Overrides */
|
||||||
@@ -1723,33 +1726,24 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
|||||||
}
|
}
|
||||||
/* End Channel Specific Login Overrides */
|
/* End Channel Specific Login Overrides */
|
||||||
|
|
||||||
/* Read command line options */
|
if (callbackmode && args.extension) {
|
||||||
opt_user = info;
|
parse = args.extension;
|
||||||
if (callbackmode) {
|
args.extension = strsep(&parse, "@");
|
||||||
options = opt_user;
|
context = parse;
|
||||||
strsep(&options, "|");
|
|
||||||
exten = options;
|
|
||||||
strsep(&exten, "|");
|
|
||||||
context = exten;
|
|
||||||
strsep(&context, "@");
|
|
||||||
} else {
|
|
||||||
options = opt_user;
|
|
||||||
strsep(&options, "|");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!ast_strlen_zero(options)) {
|
while (!ast_strlen_zero(args.options)) {
|
||||||
if (*options == 's') {
|
if (*args.options == 's') {
|
||||||
play_announcement = 0;
|
play_announcement = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* End command line options */
|
|
||||||
|
|
||||||
if (chan->_state != AST_STATE_UP)
|
if (chan->_state != AST_STATE_UP)
|
||||||
res = ast_answer(chan);
|
res = ast_answer(chan);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
if (!ast_strlen_zero(opt_user))
|
if (!ast_strlen_zero(args.agent_id))
|
||||||
ast_copy_string(user, opt_user, AST_MAX_AGENT);
|
ast_copy_string(user, args.agent_id, AST_MAX_AGENT);
|
||||||
else
|
else
|
||||||
res = ast_app_getdata(chan, "agent-user", user, sizeof(user) - 1, 0);
|
res = ast_app_getdata(chan, "agent-user", user, sizeof(user) - 1, 0);
|
||||||
}
|
}
|
||||||
@@ -1828,17 +1822,17 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
|||||||
int pos = 0;
|
int pos = 0;
|
||||||
/* Retrieve login chan */
|
/* Retrieve login chan */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (exten) {
|
if (args.extension) {
|
||||||
ast_copy_string(tmpchan, exten, sizeof(tmpchan));
|
ast_copy_string(tmpchan, args.extension, sizeof(tmpchan));
|
||||||
res = 0;
|
res = 0;
|
||||||
} else
|
} else
|
||||||
res = ast_app_getdata(chan, "agent-newlocation", tmpchan+pos, sizeof(tmpchan) - 2, 0);
|
res = ast_app_getdata(chan, "agent-newlocation", tmpchan+pos, sizeof(tmpchan) - 2, 0);
|
||||||
if (ast_strlen_zero(tmpchan) || ast_exists_extension(chan, !ast_strlen_zero(context) ? context : "default", tmpchan,
|
if (ast_strlen_zero(tmpchan) || ast_exists_extension(chan, !ast_strlen_zero(context) ? context : "default", tmpchan,
|
||||||
1, NULL))
|
1, NULL))
|
||||||
break;
|
break;
|
||||||
if (exten) {
|
if (args.extension) {
|
||||||
ast_log(LOG_WARNING, "Extension '%s' is not valid for automatic login of agent '%s'\n", exten, p->agent);
|
ast_log(LOG_WARNING, "Extension '%s' is not valid for automatic login of agent '%s'\n", args.extension, p->agent);
|
||||||
exten = NULL;
|
args.extension = NULL;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, "Extension '%s@%s' is not valid for automatic login of agent '%s'\n", tmpchan, !ast_strlen_zero(context) ? context : "default", p->agent);
|
ast_log(LOG_WARNING, "Extension '%s@%s' is not valid for automatic login of agent '%s'\n", tmpchan, !ast_strlen_zero(context) ? context : "default", p->agent);
|
||||||
@@ -1855,7 +1849,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exten = tmpchan;
|
args.extension = tmpchan;
|
||||||
if (!res) {
|
if (!res) {
|
||||||
set_agentbycallerid(p->logincallerid, NULL);
|
set_agentbycallerid(p->logincallerid, NULL);
|
||||||
if (!ast_strlen_zero(context) && !ast_strlen_zero(tmpchan))
|
if (!ast_strlen_zero(context) && !ast_strlen_zero(tmpchan))
|
||||||
@@ -2079,7 +2073,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
|||||||
pbx_builtin_setvar_helper(chan, "AGENTNUMBER", user);
|
pbx_builtin_setvar_helper(chan, "AGENTNUMBER", user);
|
||||||
if (login_state==1) {
|
if (login_state==1) {
|
||||||
pbx_builtin_setvar_helper(chan, "AGENTSTATUS", "on");
|
pbx_builtin_setvar_helper(chan, "AGENTSTATUS", "on");
|
||||||
pbx_builtin_setvar_helper(chan, "AGENTEXTEN", exten);
|
pbx_builtin_setvar_helper(chan, "AGENTEXTEN", args.extension);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pbx_builtin_setvar_helper(chan, "AGENTSTATUS", "off");
|
pbx_builtin_setvar_helper(chan, "AGENTSTATUS", "off");
|
||||||
|
Reference in New Issue
Block a user