[Asterisk-cvs] asterisk/channels chan_h323.c,1.53,1.54

jeremy at lists.digium.com jeremy at lists.digium.com
Thu May 20 17:43:23 CDT 2004


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

Modified Files:
	chan_h323.c 
Log Message:
backout code optimization, add more explict error reporting

Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- chan_h323.c	20 May 2004 07:07:18 -0000	1.53
+++ chan_h323.c	20 May 2004 21:56:12 -0000	1.54
@@ -717,7 +717,7 @@
 		ch->pvt->write = oh323_write;
 		ch->pvt->indicate = oh323_indicate;
 		ch->pvt->fixup = oh323_fixup;
-//		ch->pvt->bridge = ast_rtp_bridge;
+	     /*	ch->pvt->bridge = ast_rtp_bridge; */
 
 		/*  Set the owner of this channel */
 		i->owner = ch;
@@ -990,11 +990,9 @@
 	ast_rtp_get_us(p->rtp, &us);
 	ast_rtp_get_peer(p->rtp, &them);
 
-
 	info->addr = inet_ntoa(us.sin_addr);
 	info->port = ntohs(us.sin_port);
 
-
 	return info;
 }
 
@@ -1067,23 +1065,25 @@
 				strncpy(p->exten, cd.call_dest_alias, sizeof(p->exten)-1);		
 			}
 			if (ast_strlen_zero(default_context)) {
-				ast_log(LOG_ERROR, "Call from user '%s' rejected due to no default context\n", p->cd.call_source_aliases);
+				ast_log(LOG_ERROR, "Call from '%s' rejected due to no default context\n", p->cd.call_source_aliases);
 				return 0;
 			}
 			strncpy(p->context, default_context, sizeof(p->context)-1);
 			ast_log(LOG_DEBUG, "Sending %s to context [%s]\n", cd.call_source_aliases, p->context);
 		} else {					
 			if (user->host) {
-				if (strcasecmp(cd.sourceIp, inet_ntoa(user->addr.sin_addr))){
-					
-					if(ast_strlen_zero(default_context)) {
-						ast_log(LOG_ERROR, "Call from user '%s' rejected due to non-matching IP address of '%s'\n", user->name, cd.sourceIp);
-                				return 0;
+				if (strcasecmp(cd.sourceIp, inet_ntoa(user->addr.sin_addr))){					
+					if (ast_strlen_zero(user->context)) {
+						if (ast_strlen_zero(default_context)) {					
+							ast_log(LOG_ERROR, "Call from '%s' rejected due to non-matching IP address (%s) and no default context\n", user->name, cd.sourceIp);
+                					return 0;
+						}
+						strncpy(p->context, default_context, sizeof(p->context)-1);
+					} else {
+						strncpy(p->context, user->context, sizeof(p->context)-1);
 					}
-					
-					strncpy(p->context, default_context, sizeof(p->context)-1);
-					sprintf(p->exten,"i");
-
+					sprintf(p->exten, "i");
+					ast_log(LOG_ERROR, "Call from '%s' rejected due to non-matching IP address (%s)s\n", user->name, cd.sourceIp);
 					goto exit;					
 				}
 			}
@@ -1095,7 +1095,7 @@
 			}
 			strncpy(p->context, user->context, sizeof(p->context)-1);
 			p->bridge = user->bridge;
-                      p->nat = user->nat;
+                      	p->nat = user->nat;
 
 			if (!ast_strlen_zero(user->callerid)) {
 				strncpy(p->callerid, user->callerid, sizeof(p->callerid) - 1);
@@ -1799,7 +1799,6 @@
 	ast_rtp_get_peer(rtp, &them);	
 	ast_rtp_get_us(rtp, &us);
 
-
 	h323_native_bridge(p->cd.call_token, inet_ntoa(them.sin_addr), mode);
 	
 	return 0;




More information about the svn-commits mailing list