From 63e614d89664ec81f08e2d42b5ba44b7638a7ee2 Mon Sep 17 00:00:00 2001 From: Alec L Davis Date: Tue, 2 Mar 2010 09:11:56 +0000 Subject: [PATCH] fixes ability to exit echo app when called from a ISDN channel, null frames prevent '#' exit. Now only echo back VOICE and DTMF frames (issue #16880) Reported by: alecdavis Patches: based on echo_exit_1-6-1.diff.txt uploaded by alecdavis (license 585) Tested by: alecdavis git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@249845 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_echo.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/apps/app_echo.c b/apps/app_echo.c index 14f7c6d650..d75d34dc12 100644 --- a/apps/app_echo.c +++ b/apps/app_echo.c @@ -65,18 +65,26 @@ static int echo_exec(struct ast_channel *chan, void *data) while (ast_waitfor(chan, -1) > -1) { struct ast_frame *f = ast_read(chan); - if (!f) + if (!f) { break; - f->delivery.tv_sec = 0; - f->delivery.tv_usec = 0; - if (ast_write(chan, f)) { - ast_frfree(f); - goto end; } - if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) { - res = 0; - ast_frfree(f); - goto end; + switch (f->frametype) { + case AST_FRAME_VOICE: + case AST_FRAME_DTMF: + f->delivery.tv_sec = 0; + f->delivery.tv_usec = 0; + if (ast_write(chan, f)) { + ast_frfree(f); + goto end; + } + if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) { + res = 0; + ast_frfree(f); + goto end; + } + break; + default: + break; } ast_frfree(f); } -- 2.47.2