mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
Allow AgentCallbackLogin to specify new location (bug #46)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1334 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -915,6 +915,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
|||||||
char *opt_user = NULL;
|
char *opt_user = NULL;
|
||||||
char *options = NULL;
|
char *options = NULL;
|
||||||
char *context = NULL;
|
char *context = NULL;
|
||||||
|
char *exten = NULL;
|
||||||
int play_announcement;
|
int play_announcement;
|
||||||
char *filename = "agent-loginok";
|
char *filename = "agent-loginok";
|
||||||
|
|
||||||
@@ -934,6 +935,10 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
|||||||
*context = '\0';
|
*context = '\0';
|
||||||
context++;
|
context++;
|
||||||
}
|
}
|
||||||
|
exten = options;
|
||||||
|
while(*exten && ((*exten < '0') || (*exten > '9'))) exten++;
|
||||||
|
if (!*exten)
|
||||||
|
exten = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -979,7 +984,11 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
|
|||||||
if (callbackmode) {
|
if (callbackmode) {
|
||||||
char tmpchan[256] = "";
|
char tmpchan[256] = "";
|
||||||
/* Retrieve login chan */
|
/* Retrieve login chan */
|
||||||
res = ast_app_getdata(chan, "agent-newlocation", tmpchan, sizeof(tmpchan) - 1, 0);
|
if (exten) {
|
||||||
|
strncpy(tmpchan, exten, sizeof(tmpchan) - 1);
|
||||||
|
res = 0;
|
||||||
|
} else
|
||||||
|
res = ast_app_getdata(chan, "agent-newlocation", tmpchan, sizeof(tmpchan) - 1, 0);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
if (context && strlen(context) && strlen(tmpchan))
|
if (context && strlen(context) && strlen(tmpchan))
|
||||||
snprintf(p->loginchan, sizeof(p->loginchan), "%s@%s", tmpchan, context);
|
snprintf(p->loginchan, sizeof(p->loginchan), "%s@%s", tmpchan, context);
|
||||||
|
Reference in New Issue
Block a user