[Asterisk-code-review] pbx builtin: Properly handle hangup during Background (asterisk[14])

Sean Bright asteriskteam at digium.com
Wed May 31 12:25:47 CDT 2017


Sean Bright has uploaded a new change for review. ( https://gerrit.asterisk.org/5747 )

Change subject: pbx_builtin: Properly handle hangup during Background
......................................................................

pbx_builtin: Properly handle hangup during Background

Before this patch, when a user hung up during a Background, we would
stuff 0xff into a char and attempt a dialplan lookup of it. This caused
problems for some realtime engines which interpreted the value as the
beginning of an invalid UTF-8 sequence.

ASTERISK-19291 #close
Reported by: Andrew Nowrot

Change-Id: I8ca6da93252d61c76ebdb46a4aa65e73ca985358
---
M main/pbx_builtins.c
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/47/5747/1

diff --git a/main/pbx_builtins.c b/main/pbx_builtins.c
index fa15588..605e0c9 100644
--- a/main/pbx_builtins.c
+++ b/main/pbx_builtins.c
@@ -1113,6 +1113,13 @@
 		}
 	}
 
+	/* If ast_waitstream didn't give us back a digit, there is nothing else to do */
+	if (res <= 0) {
+		goto done;
+	}
+
+	exten[0] = res;
+
 	/*
 	 * If the single digit DTMF is an extension in the specified context, then
 	 * go there and signal no DTMF.  Otherwise, we should exit with that DTMF.
@@ -1132,7 +1139,6 @@
 	 * be returned (see #16434).
 	 */
 	if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS)
-		&& (exten[0] = res)
 		&& ast_canmatch_extension(chan, args.context, exten, 1,
 			S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))
 		&& !ast_matchmore_extension(chan, args.context, exten, 1,

-- 
To view, visit https://gerrit.asterisk.org/5747
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ca6da93252d61c76ebdb46a4aa65e73ca985358
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>



More information about the asterisk-code-review mailing list