[Asterisk-cvs] asterisk/channels chan_h323.c,1.74.2.1,1.74.2.2

russell at lists.digium.com russell at lists.digium.com
Fri Nov 19 08:25:01 CST 2004


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

Modified Files:
      Tag: v1-0
	chan_h323.c 
Log Message:
little fixes (bug #2899)


Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.74.2.1
retrieving revision 1.74.2.2
diff -u -d -r1.74.2.1 -r1.74.2.2
--- chan_h323.c	29 Oct 2004 14:03:28 -0000	1.74.2.1
+++ chan_h323.c	19 Nov 2004 13:25:17 -0000	1.74.2.2
@@ -82,7 +82,7 @@
 clear_con_cb		on_connection_cleared;
 answer_call_cb		on_answer_call;
 
-int h323debug;
+int h323debug = 0;
 
 /** String variables required by ASTERISK */
 static char *type	= "H323";
@@ -348,7 +348,9 @@
  	} else {
 		ast_mutex_unlock(&peerl.lock);
 		peer = (struct oh323_peer*)malloc(sizeof(struct oh323_peer));
-		memset(peer, 0, sizeof(struct oh323_peer));
+		if (peer) {
+			memset(peer, 0, sizeof(struct oh323_peer));
+		}
 	}
 	if (peer) {
 		if (!found) {
@@ -403,7 +405,7 @@
 		ast_rtp_senddigit(p->rtp, digit);
 	}
 	/* If in-band DTMF is desired, send that */
-	if (p->dtmfmode & H323_DTMF_INBAND)
+	if (!(p->dtmfmode & H323_DTMF_RFC2833))
 		h323_send_tone(p->cd.call_token, digit);
 	return 0;
 }
@@ -442,14 +444,14 @@
 	/* Clear the call token */
 	if ((p->cd).call_token == NULL)
 		(p->cd).call_token = (char *)malloc(128);
-
-	memset((char *)(p->cd).call_token, 0, 128);
 	
-	if (p->cd.call_token == NULL) {
+	if ((p->cd).call_token == NULL) {
 		ast_log(LOG_ERROR, "Not enough memory.\n");
 		return -1;
 	}
 
+	memset((char *)(p->cd).call_token, 0, 128);
+
 	/* Build the address to call */
 	memset(called_addr, 0, sizeof(called_addr));
 	memcpy(called_addr, dest, strlen(dest));
@@ -601,7 +603,7 @@
 			}
 		
 			/* Do in-band DTMF detection */
-			if (p->dtmfmode & H323_DTMF_INBAND) {
+			if ((p->dtmfmode & H323_DTMF_INBAND) && p->vad) {
                    f = ast_dsp_process(p->owner,p->vad,f);
 				   if (f->frametype == AST_FRAME_DTMF)
 					ast_log(LOG_DEBUG, "Got in-band digit %c.\n", f->subclass);
@@ -1032,8 +1034,6 @@
 	   the oh323_pvt structure XXX */
 	static char iabuf[INET_ADDRSTRLEN];
 
-	info = (struct rtp_info *) malloc(sizeof(struct rtp_info));
-
 	p = find_call(call_reference, token); 
 
 	if (!p) {
@@ -1041,6 +1041,12 @@
 		return NULL;
 	}
 
+	info = (struct rtp_info *) malloc(sizeof(struct rtp_info));
+	if (!info) {
+		ast_log(LOG_ERROR, "Unable to allocate rtp_info, this is very bad.\n");
+		return NULL;
+	}
+
 	/* figure out our local RTP port and tell the H.323 stack about it*/
 	ast_rtp_get_us(p->rtp, &us);
 	ast_rtp_get_peer(p->rtp, &them);




More information about the svn-commits mailing list