diff --git a/pbx.c b/pbx.c
index 9a358de3f6a3106ea6fb61e2fbd5fb5cc77b7bad..b721d4b0aa93f4838cac3b1bbaa3d36d75fd0949 100755
--- a/pbx.c
+++ b/pbx.c
@@ -5626,6 +5626,10 @@ static int pbx_builtin_atimeout(struct ast_channel *chan, void *data)
 
 static int pbx_builtin_rtimeout(struct ast_channel *chan, void *data)
 {
+	/* If the channel is not in a PBX, return now */
+	if (!chan->pbx)
+		return 0;
+
 	/* Set the timeout for how long to wait between digits */
 	chan->pbx->rtimeout = atoi((char *)data);
 	if (option_verbose > 2)
@@ -5635,6 +5639,10 @@ static int pbx_builtin_rtimeout(struct ast_channel *chan, void *data)
 
 static int pbx_builtin_dtimeout(struct ast_channel *chan, void *data)
 {
+	/* If the channel is not in a PBX, return now */
+	if (!chan->pbx)
+		return 0;
+
 	/* Set the timeout for how long to wait between digits */
 	chan->pbx->dtimeout = atoi((char *)data);
 	if (option_verbose > 2)