[Asterisk-cvs] asterisk/channels chan_iax.c,1.43,1.44

markster at lists.digium.com markster at lists.digium.com
Sat Jan 10 14:20:03 CST 2004


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

Modified Files:
	chan_iax.c 
Log Message:
Reorder events in IAX, make "IAX1" compatibility


Index: chan_iax.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- chan_iax.c	9 Dec 2003 23:55:17 -0000	1.43
+++ chan_iax.c	10 Jan 2004 20:11:48 -0000	1.44
@@ -83,7 +83,8 @@
 
 static char *desc = "Inter Asterisk eXchange";
 static char *tdesc = "Inter Asterisk eXchange Drver";
-static char *type = "IAX";
+static char *ctype = "IAX";
+static char *type = "IAX1";
 
 static char context[80] = "default";
 
@@ -5404,15 +5405,6 @@
 
 	set_config(config,&sin);
 
-	if (ast_channel_register(type, tdesc, iax_capability, iax_request)) {
-		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
-		__unload_module();
-		return -1;
-	}
-
-	if (ast_register_switch(&iax_switch)) 
-		ast_log(LOG_ERROR, "Unable to register IAX switch\n");
-	
 	/* Make a UDP socket */
 	netsocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
 	
@@ -5422,6 +5414,8 @@
 	}
 	if (bind(netsocket,(struct sockaddr *)&sin, sizeof(sin))) {
 		ast_log(LOG_ERROR, "Unable to bind to %s port %d: %s\n", inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), strerror(errno));
+		close(netsocket);
+		netsocket = -1;
 		return -1;
 	}
 
@@ -5430,6 +5424,21 @@
 
 	if (setsockopt(netsocket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))) 
 		ast_log(LOG_WARNING, "Unable to set TOS to %d\n", tos);
+	
+	if (ast_channel_register(type, tdesc, iax_capability, iax_request)) {
+		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
+		__unload_module();
+		return -1;
+	}
+
+	if (ast_channel_register(ctype, tdesc, iax_capability, iax_request)) {
+		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
+		__unload_module();
+		return -1;
+	}
+
+	if (ast_register_switch(&iax_switch)) 
+		ast_log(LOG_ERROR, "Unable to register IAX switch\n");
 	
 	if (!res) {
 		res = start_network_thread();




More information about the svn-commits mailing list