[svn-commits] oej: branch oej/midcomstuff r53689 - /team/oej/midcomstuff/res/res_netsec.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Feb 8 16:59:45 MST 2007


Author: oej
Date: Thu Feb  8 17:59:44 2007
New Revision: 53689

URL: http://svn.digium.com/view/asterisk?view=rev&rev=53689
Log:
Add insane amount of debug logging

Modified:
    team/oej/midcomstuff/res/res_netsec.c

Modified: team/oej/midcomstuff/res/res_netsec.c
URL: http://svn.digium.com/view/asterisk/team/oej/midcomstuff/res/res_netsec.c?view=diff&rev=53689&r1=53688&r2=53689
==============================================================================
--- team/oej/midcomstuff/res/res_netsec.c (original)
+++ team/oej/midcomstuff/res/res_netsec.c Thu Feb  8 17:59:44 2007
@@ -2330,39 +2330,60 @@
 {
 	struct ast_channel *peer_chan, *my_chan;
 	struct midcom_rule *peer_rule=NULL;
-
-	if (r && r->p) { /* pure paranoia */
-		struct ast_channel_tech *peertech, *mytech;
-
-		 		my_chan = channel_cb->ast_channel_helper(r->p);
-
-		 		peer_chan = channel_cb->ast_bridged_channel_helper(r->p);
-
-		/* Let's check that we have a SIP2SIP call */
-	
+	struct ast_channel_tech *peertech, *mytech;
+
+	if (!r || !r->p) { /* pure paranoia */
 		if (option_debug)
-			ast_log(LOG_DEBUG, "MIDCOM :: Peer channel %s\n", peer_chan ? peer_chan->name : "DOES NOT EXIST!");
-
-		if (peer_chan && peer_chan->_state != AST_STATE_UP)
-			ast_log(LOG_ERROR, "MIDCOM :: Channel is not in UP state - no bridge!\n");
-		 		else if (peer_chan && peer_chan->tech_pvt) {
-			peertech = (struct ast_channel_tech *) peer_chan->tech_pvt;
-			mytech = (struct ast_channel_tech *) my_chan->tech_pvt;
-			if (!strcmp(peertech->type, mytech->type))
-		      			peer_rule = channel_cb->ast_get_hook_struct(peer_chan->tech_pvt);
-			else if (option_debug)
-				ast_log(LOG_DEBUG, "MIDCOM :: We have incompatible channels!\n");
-		} else if (option_debug) {
-			if (!peer_chan)
-				ast_log(LOG_DEBUG, "MIDCOM :: Peer has no chan??? \n");
-			else
-				ast_log(LOG_DEBUG, "MIDCOM :: Peer has no tech??? \n");
-		}
-	} else if (option_debug)
-		ast_log(LOG_DEBUG, "MIDCOM :: We have no peer here. Giving up. Good bye!\n");
-		return peer_rule;
-}
-
+			ast_log(LOG_DEBUG, "MIDCOM :: We have no peer here. Giving up. Good bye!\n");
+		return NULL;
+	}
+
+     	my_chan = channel_cb->ast_channel_helper(r->p);
+	if (!my_chan) {
+		if (option_debug)
+			ast_log(LOG_DEBUG, "MIDCOM :: No my_chan!\n");
+		return NULL;
+	}
+
+     	peer_chan = channel_cb->ast_bridged_channel_helper(r->p);
+
+	if (!peer_chan) {
+		if (option_debug)
+			ast_log(LOG_DEBUG, "MIDCOM :: No peer_chan!\n");
+		return NULL;
+	}
+
+	/* Let's check that we have a SIP2SIP call */
+
+	if (option_debug)
+		ast_log(LOG_DEBUG, "MIDCOM :: Peer channel %s\n", peer_chan ? peer_chan->name : "DOES NOT EXIST!");
+
+	if (peer_chan->_state != AST_STATE_UP) {
+		ast_log(LOG_ERROR, "MIDCOM :: Channel is not in UP state - no bridge!\n");
+		return NULL;
+	}
+     	if (!peer_chan->tech_pvt) {
+		ast_log(LOG_DEBUG, "MIDCOM :: Peer has no tech??? \n");
+		return NULL;
+	} else {
+		ast_log(LOG_DEBUG, "MIDCOM :: Peer tech %s\n", peer_chan->tech->type);
+	}
+	peertech = (struct ast_channel_tech *) peer_chan->tech;
+	mytech = (struct ast_channel_tech *) my_chan->tech;
+	if (!mytech) {
+		ast_log(LOG_DEBUG, "MIDCOM :: No mytech!\n");
+		return NULL;
+	} else
+		ast_log(LOG_DEBUG, "MIDCOM :: My tech %s\n", peer_chan->tech->type);
+	if (option_debug)
+		ast_log(LOG_DEBUG, "MIDCOM :: Peertech type %s Mytech type %s\n", peertech->type, mytech->type);
+
+	if (!strcmp((char *) peertech->type, (char *) mytech->type))
+       		peer_rule = channel_cb->ast_get_hook_struct(peer_chan->tech_pvt);
+	else if (option_debug)
+		ast_log(LOG_DEBUG, "MIDCOM :: We have incompatible channels!\n");
+  	return peer_rule;
+}
 
 static int midcom_mutex_lock(ast_mutex_t *mutex)
 {



More information about the svn-commits mailing list