diff --git a/apps/app_readexten.c b/apps/app_readexten.c index 9a54094ea2ce29c71daec10c889e988c9039194e..b556391555771519d90378006044b5f1fa02e05d 100644 --- a/apps/app_readexten.c +++ b/apps/app_readexten.c @@ -224,12 +224,13 @@ static int readexten_exec(struct ast_channel *chan, void *data) status = "TIMEOUT"; } break; - } else if (res == '#') { - break; } exten[x] = res; if (!ast_matchmore_extension(chan, arglist.context, exten, 1 /* priority */, chan->cid.cid_num)) { + if (!ast_exists_extension(chan, arglist.context, exten, 1, chan->cid.cid_num) && res == '#') { + exten[x] = '\0'; + } break; } }