mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Verify extension is correct
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -983,12 +983,35 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
||||
if (!p->chan) {
|
||||
if (callbackmode) {
|
||||
char tmpchan[256] = "";
|
||||
int pos = 0;
|
||||
/* Retrieve login chan */
|
||||
for (;;) {
|
||||
if (exten) {
|
||||
strncpy(tmpchan, exten, sizeof(tmpchan) - 1);
|
||||
res = 0;
|
||||
} else
|
||||
res = ast_app_getdata(chan, "agent-newlocation", tmpchan, sizeof(tmpchan) - 1, 0);
|
||||
res = ast_app_getdata(chan, "agent-newlocation", tmpchan+pos, sizeof(tmpchan) - 2, 0);
|
||||
if (!strlen(tmpchan) || ast_exists_extension(chan, context && strlen(context) ? context : "default", tmpchan,
|
||||
1, NULL))
|
||||
break;
|
||||
if (exten) {
|
||||
ast_log(LOG_WARNING, "Extension '%s' is not valid for automatic login of agent '%s'\n", exten, p->agent);
|
||||
exten = NULL;
|
||||
pos = 0;
|
||||
} else {
|
||||
res = ast_streamfile(chan, "invalid", chan->language);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
if (res > 0) {
|
||||
tmpchan[0] = res;
|
||||
tmpchan[1] = '\0';
|
||||
pos = 1;
|
||||
} else {
|
||||
tmpchan[0] = '\0';
|
||||
pos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!res) {
|
||||
if (context && strlen(context) && strlen(tmpchan))
|
||||
snprintf(p->loginchan, sizeof(p->loginchan), "%s@%s", tmpchan, context);
|
||||
|
Reference in New Issue
Block a user