[Asterisk-cvs] asterisk/channels chan_h323.c,1.50,1.51

jeremy at lists.digium.com jeremy at lists.digium.com
Tue May 18 06:21:39 CDT 2004


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

Modified Files:
	chan_h323.c 
Log Message:
clean up code and attempt to stablize inbound h.323 calls


Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- chan_h323.c	16 May 2004 07:04:48 -0000	1.50
+++ chan_h323.c	18 May 2004 10:33:46 -0000	1.51
@@ -100,7 +100,7 @@
 struct oh323_pvt {
 	ast_mutex_t lock;					/* Channel private lock */
 	call_options_t calloptions;				/* Options to be used during call setup */
-	int alreadygone;					/* Whether or not we've already been destroyed by or peer */
+	int alreadygone;					/* Whether or not we've already been destroyed by our peer */
 	int needdestroy;					/* if we need to be destroyed */
 	call_details_t cd;					/* Call details */
 	struct ast_channel *owner;				/* Who owns us */
@@ -492,11 +492,11 @@
 
 	/* Start the process if it's not already started */
 	if (!p->alreadygone) {
-		p->needdestroy = 1;
 		if (h323_clear_call((p->cd).call_token)) { 
 			ast_log(LOG_DEBUG, "ClearCall failed.\n");
 		}
-	}
+		p->needdestroy = 1;
+	} 
 
 	/* Update usage counter */
 	ast_mutex_lock(&usecnt_lock);
@@ -603,7 +603,6 @@
 		return 0;
 	case AST_CONTROL_BUSY:
 		if (c->_state != AST_STATE_UP) {
-		//	transmit_response(p, "600 Busy everywhere", &p->initreq);
 			p->alreadygone = 1;
 			ast_softhangup(c, AST_SOFTHANGUP_DEV);
 			break;
@@ -611,7 +610,6 @@
 		return 0;
 	case AST_CONTROL_CONGESTION:
 		if (c->_state != AST_STATE_UP) {
-		//	transmit_response(p, "486 Busy here", &p->initreq);
 			p->alreadygone = 1;
 			ast_softhangup(c, AST_SOFTHANGUP_DEV);
 			break;
@@ -1176,25 +1174,25 @@
 //	struct oh323_peer *peer = NULL;
 	struct oh323_user *user = NULL;
 	struct ast_rtp *rtp = NULL;
-
-	ast_log(LOG_DEBUG, "Cleaning up our mess\n");
 	
 	p = find_call(cd.call_reference);
 
 	if (!p) {
 		return;
 	}
+	ast_mutex_lock(&p->lock);
 
 	/* Decrement usage counter */
 	if (!p->outgoing) {
 		user = find_user(cd);
 		
-		if(user)
+		if(user) {
 			user->inUse--;
+		}
 	}
 
 #if 0
-		if (p->outgoing) {
+	if (p->outgoing) {
 		peer = find_peer(cd.call_dest_alias);
 		peer->inUse--;
 	} else {
@@ -1209,14 +1207,15 @@
 		/* Immediately stop RTP */
 		ast_rtp_destroy(rtp);
 	}
-	
-	p->alreadygone = 1;
 
+	p->alreadygone = 1;
+	
 	/* Send hangup */	
-	if (p->owner)
+	if (p->owner) {
 		ast_queue_hangup(p->owner);
+	} 
 
-	p = NULL;
+	ast_mutex_unlock(&p->lock);
 	return;	
 }
 




More information about the svn-commits mailing list