mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 11:28:25 +00:00
Calling a gosub routine defined in AEL from Dial/Queue ceased to work.
A bug in AEL did not distinguish between the "s" extension generated by AEL and an "s" extension that was required to exist by the chan_dahdi (or another channel) that was not supplied with a starting extension. Therefore, AEL made incorrect assumptions about what commands were permissable in the context. This was fixed by making AEL generate a different extension name. However, Dial and Queue make additional assumptions about the name of the default gosub extension. Therefore, they needed to be brought into line with a "macro" rendered by AEL (as a gosub), without breaking traditional dialplans written without the aid of AEL. Related to (issue #18480) Reported by: nivek (closes issue #18729) Reported by: kkm Patches: 20110209__issue18729.diff.txt uploaded by tilghman (license 14) 018729-dial-queue-gosub-try3.patch uploaded by kkm (license 888) Tested by: kkm git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@307750 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2488,14 +2488,24 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
|||||||
|
|
||||||
gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB], ',');
|
gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB], ',');
|
||||||
if (gosub_argstart) {
|
if (gosub_argstart) {
|
||||||
|
const char *what_is_s = "s";
|
||||||
*gosub_argstart = 0;
|
*gosub_argstart = 0;
|
||||||
if (asprintf(&gosub_args, "%s,s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], gosub_argstart + 1) < 0) {
|
if (!ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) &&
|
||||||
|
ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) {
|
||||||
|
what_is_s = "~~s~~";
|
||||||
|
}
|
||||||
|
if (asprintf(&gosub_args, "%s,%s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s, gosub_argstart + 1) < 0) {
|
||||||
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
|
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
|
||||||
gosub_args = NULL;
|
gosub_args = NULL;
|
||||||
}
|
}
|
||||||
*gosub_argstart = ',';
|
*gosub_argstart = ',';
|
||||||
} else {
|
} else {
|
||||||
if (asprintf(&gosub_args, "%s,s,1", opt_args[OPT_ARG_CALLEE_GOSUB]) < 0) {
|
const char *what_is_s = "s";
|
||||||
|
if (!ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) &&
|
||||||
|
ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) {
|
||||||
|
what_is_s = "~~s~~";
|
||||||
|
}
|
||||||
|
if (asprintf(&gosub_args, "%s,%s,1", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s) < 0) {
|
||||||
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
|
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
|
||||||
gosub_args = NULL;
|
gosub_args = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4931,14 +4931,24 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
|||||||
|
|
||||||
gosub_argstart = strchr(gosubexec, ',');
|
gosub_argstart = strchr(gosubexec, ',');
|
||||||
if (gosub_argstart) {
|
if (gosub_argstart) {
|
||||||
|
const char *what_is_s = "s";
|
||||||
*gosub_argstart = 0;
|
*gosub_argstart = 0;
|
||||||
if (asprintf(&gosub_args, "%s,s,1(%s)", gosubexec, gosub_argstart + 1) < 0) {
|
if (!ast_exists_extension(peer, gosubexec, "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) &&
|
||||||
|
ast_exists_extension(peer, gosubexec, "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) {
|
||||||
|
what_is_s = "~~s~~";
|
||||||
|
}
|
||||||
|
if (asprintf(&gosub_args, "%s,%s,1(%s)", gosubexec, what_is_s, gosub_argstart + 1) < 0) {
|
||||||
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
|
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
|
||||||
gosub_args = NULL;
|
gosub_args = NULL;
|
||||||
}
|
}
|
||||||
*gosub_argstart = ',';
|
*gosub_argstart = ',';
|
||||||
} else {
|
} else {
|
||||||
if (asprintf(&gosub_args, "%s,s,1", gosubexec) < 0) {
|
const char *what_is_s = "s";
|
||||||
|
if (!ast_exists_extension(peer, gosubexec, "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) &&
|
||||||
|
ast_exists_extension(peer, gosubexec, "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) {
|
||||||
|
what_is_s = "~~s~~";
|
||||||
|
}
|
||||||
|
if (asprintf(&gosub_args, "%s,%s,1", gosubexec, what_is_s) < 0) {
|
||||||
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
|
ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno));
|
||||||
gosub_args = NULL;
|
gosub_args = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user