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

Joshua Colp asteriskteam at digium.com
Mon Jun 5 08:44:54 CDT 2017


Joshua Colp has submitted this change and it was merged. ( 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(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit
  Corey Farrell: Looks good to me, but someone else must approve



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: merged
Gerrit-Change-Id: I8ca6da93252d61c76ebdb46a4aa65e73ca985358
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list