]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix mgcp bug (bug #2696)
authorRussell Bryant <russell@russellbryant.com>
Tue, 26 Oct 2004 15:34:30 +0000 (15:34 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 26 Oct 2004 15:34:30 +0000 (15:34 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4105 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_mgcp.c

index 7406428be879d5bb2125a4edbae50791d96ab29a..630806efb874d68f9088bd7fb7c6a266008298d7 100755 (executable)
@@ -1078,7 +1078,11 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub)
 {
        /* Retrieve audio/etc from channel.  Assumes sub->lock is already held. */
        struct ast_frame *f;
+       static struct ast_frame null_frame = { AST_FRAME_NULL, };
        f = ast_rtp_read(sub->rtp);
+       /* Don't send RFC2833 if we're not supposed to */
+       if (f && (f->frametype == AST_FRAME_DTMF) && !(sub->parent->dtmfmode & MGCP_DTMF_RFC2833))
+               return &null_frame;
        if (sub->owner) {
                /* We already hold the channel lock */
                if (f->frametype == AST_FRAME_VOICE) {
@@ -1089,7 +1093,7 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub)
                                ast_set_write_format(sub->owner, sub->owner->writeformat);
                        }
             /* Courtesy fearnor aka alex@pilosoft.com */
-            if (sub->parent->dtmfmode & MGCP_DTMF_INBAND) {
+            if ((sub->parent->dtmfmode & MGCP_DTMF_INBAND) && (sub->parent->dsp)) {
 #if 0
                 ast_log(LOG_NOTICE, "MGCP ast_dsp_process\n");
 #endif
@@ -1103,18 +1107,12 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub)
 
 static struct ast_frame  *mgcp_read(struct ast_channel *ast)
 {
-       struct ast_frame *fr;
+       struct ast_frame *f;
        struct mgcp_subchannel *sub = ast->pvt->pvt;
-       static struct ast_frame null_frame = { AST_FRAME_NULL, };
        ast_mutex_lock(&sub->lock);
-       fr = mgcp_rtp_read(sub);
-       if (!(sub->parent->dtmfmode & MGCP_DTMF_RFC2833)) {
-               if (fr && (fr->frametype == AST_FRAME_DTMF)) {
-                       fr = &null_frame;
-               }
-       }
+       f = mgcp_rtp_read(sub);
        ast_mutex_unlock(&sub->lock);
-       return fr;
+       return f;
 }
 
 static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame)