mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-26 14:27:14 +00:00
Properly respect GOSUB_RESULT as to what to do with the master channel.
Previously, we would parse GOSUB_RESULT, but not actually do anything with it. Also, allow GOSUB_RETVAL to be inherited back across a peer/master channel. (closes issue #16687) Reported by: bklang Patches: app_dial-preserve-gosub_retval.patch uploaded by bklang (license 919) (with modifications) (closes issue #16686) Reported by: bklang Patches: app_dial-respect-gosub_result.patch uploaded by bklang (license 919) (with modifications) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244393 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -131,6 +131,8 @@ Applications
|
|||||||
argument is provided, the 'f' option works as it always has. If an argument is
|
argument is provided, the 'f' option works as it always has. If an argument is
|
||||||
provided, then the connected party information of all outgoing channels created
|
provided, then the connected party information of all outgoing channels created
|
||||||
during the Dial will be set to the argument passed to the 'f' option.
|
during the Dial will be set to the argument passed to the 'f' option.
|
||||||
|
* Dial now inherits the GOSUB_RETVAL from the peer, when the U() option runs a
|
||||||
|
Gosub on the peer.
|
||||||
|
|
||||||
Dialplan Functions
|
Dialplan Functions
|
||||||
------------------
|
------------------
|
||||||
|
|||||||
@@ -2319,27 +2319,33 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
|
|||||||
|
|
||||||
if (!res9 && (gosub_result = pbx_builtin_getvar_helper(peer, "GOSUB_RESULT"))) {
|
if (!res9 && (gosub_result = pbx_builtin_getvar_helper(peer, "GOSUB_RESULT"))) {
|
||||||
char *gosub_transfer_dest;
|
char *gosub_transfer_dest;
|
||||||
|
const char *gosub_retval = pbx_builtin_getvar_helper(peer, "GOSUB_RETVAL");
|
||||||
|
|
||||||
|
/* Inherit return value from the peer, so it can be used in the master */
|
||||||
|
if (gosub_retval) {
|
||||||
|
pbx_builtin_setvar_helper(chan, "GOSUB_RETVAL", gosub_retval);
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcasecmp(gosub_result, "BUSY")) {
|
if (!strcasecmp(gosub_result, "BUSY")) {
|
||||||
ast_copy_string(pa.status, gosub_result, sizeof(pa.status));
|
ast_copy_string(pa.status, gosub_result, sizeof(pa.status));
|
||||||
ast_set_flag64(peerflags, OPT_GO_ON);
|
ast_set_flag64(peerflags, OPT_GO_ON);
|
||||||
res9 = -1;
|
res = -1;
|
||||||
} else if (!strcasecmp(gosub_result, "CONGESTION") || !strcasecmp(gosub_result, "CHANUNAVAIL")) {
|
} else if (!strcasecmp(gosub_result, "CONGESTION") || !strcasecmp(gosub_result, "CHANUNAVAIL")) {
|
||||||
ast_copy_string(pa.status, gosub_result, sizeof(pa.status));
|
ast_copy_string(pa.status, gosub_result, sizeof(pa.status));
|
||||||
ast_set_flag64(peerflags, OPT_GO_ON);
|
ast_set_flag64(peerflags, OPT_GO_ON);
|
||||||
res9 = -1;
|
res = -1;
|
||||||
} else if (!strcasecmp(gosub_result, "CONTINUE")) {
|
} else if (!strcasecmp(gosub_result, "CONTINUE")) {
|
||||||
/* hangup peer and keep chan alive assuming the macro has changed
|
/* hangup peer and keep chan alive assuming the macro has changed
|
||||||
the context / exten / priority or perhaps
|
the context / exten / priority or perhaps
|
||||||
the next priority in the current exten is desired.
|
the next priority in the current exten is desired.
|
||||||
*/
|
*/
|
||||||
ast_set_flag64(peerflags, OPT_GO_ON);
|
ast_set_flag64(peerflags, OPT_GO_ON);
|
||||||
res9 = -1;
|
res = -1;
|
||||||
} else if (!strcasecmp(gosub_result, "ABORT")) {
|
} else if (!strcasecmp(gosub_result, "ABORT")) {
|
||||||
/* Hangup both ends unless the caller has the g flag */
|
/* Hangup both ends unless the caller has the g flag */
|
||||||
res9 = -1;
|
res = -1;
|
||||||
} else if (!strncasecmp(gosub_result, "GOTO:", 5) && (gosub_transfer_dest = ast_strdupa(gosub_result + 5))) {
|
} else if (!strncasecmp(gosub_result, "GOTO:", 5) && (gosub_transfer_dest = ast_strdupa(gosub_result + 5))) {
|
||||||
res9 = -1;
|
res = -1;
|
||||||
/* perform a transfer to a new extension */
|
/* perform a transfer to a new extension */
|
||||||
if (strchr(gosub_transfer_dest, '^')) { /* context^exten^priority*/
|
if (strchr(gosub_transfer_dest, '^')) { /* context^exten^priority*/
|
||||||
replace_macro_delimiter(gosub_transfer_dest);
|
replace_macro_delimiter(gosub_transfer_dest);
|
||||||
|
|||||||
Reference in New Issue
Block a user