Make ack_sleep do something
authorMark Spencer <markster@digium.com>
Tue, 26 Aug 2003 18:50:46 +0000 (18:50 +0000)
committerMark Spencer <markster@digium.com>
Tue, 26 Aug 2003 18:50:46 +0000 (18:50 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1441 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_agent.c

index 48708ec..403dd26 100755 (executable)
@@ -541,6 +541,7 @@ static int agent_ack_sleep( void *data )
        struct agent_pvt *p;
        int res=0;
        int to = 1000;
+       struct ast_frame *f;
 
        /* Wait a second and look for something */
 
@@ -556,6 +557,16 @@ static int agent_ack_sleep( void *data )
                                res = 0;
                                break;
                        }
+                       f = ast_read(p->chan);
+                       if (!f) {
+                               res = -1;
+                               break;
+                       }
+                       if (f->frametype == AST_FRAME_DTMF)
+                               res = f->subclass;
+                       else
+                               res = 0;
+                       ast_frfree(f);
                        ast_mutex_lock(&p->lock);
                        if (!p->app_sleep_cond) {
                                ast_mutex_unlock(&p->lock);