[Asterisk-cvs] asterisk/channels chan_mgcp.c,1.79.2.4,1.79.2.5

russell at lists.digium.com russell at lists.digium.com
Tue Oct 26 11:31:04 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv1805/channels

Modified Files:
      Tag: v1-0
	chan_mgcp.c 
Log Message:
fix mgcp bug (bug #2696)


Index: chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.79.2.4
retrieving revision 1.79.2.5
diff -u -d -r1.79.2.4 -r1.79.2.5
--- chan_mgcp.c	17 Oct 2004 04:57:10 -0000	1.79.2.4
+++ chan_mgcp.c	26 Oct 2004 15:34:30 -0000	1.79.2.5
@@ -1078,7 +1078,11 @@
 {
 	/* 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 @@
 				ast_set_write_format(sub->owner, sub->owner->writeformat);
 			}
             /* Courtesy fearnor aka alex at 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_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)




More information about the svn-commits mailing list