[asterisk-commits] pcadach: branch pcadach/chan_h323-live r40774 - /team/pcadach/chan_h323-live/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Aug 21 09:39:35 MST 2006


Author: pcadach
Date: Mon Aug 21 11:39:35 2006
New Revision: 40774

URL: http://svn.digium.com/view/asterisk?rev=40774&view=rev
Log:
Let chan_h323 builds again after heavy re-work of module subsystem

Modified:
    team/pcadach/chan_h323-live/channels/Makefile
    team/pcadach/chan_h323-live/channels/chan_h323.c

Modified: team/pcadach/chan_h323-live/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/Makefile?rev=40774&r1=40773&r2=40774&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/Makefile (original)
+++ team/pcadach/chan_h323-live/channels/Makefile Mon Aug 21 11:39:35 2006
@@ -95,11 +95,11 @@
 chan_alsa.o: busy.h ringtone.h
 
 ifeq ($(OSARCH),linux-gnu)
-chan_h323.so: chan_h323.o h323_module_interface.so h323/libchanh323.a h323/Makefile.ast
+chan_h323.so: chan_h323.o h323/libchanh323.a h323/Makefile.ast
 	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
 	$(CMD_PREFIX) $(CC) $(SOLINK) $(H323LDFLAGS) -o $@ $< h323/libchanh323.a $(H323LDLIBS) -lstdc++
 else
-chan_h323.so: chan_h323.o h323_module_interface.so h323/libchanh323.a
+chan_h323.so: chan_h323.o h323/libchanh323.a
 	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
 	$(CMD_PREFIX) $(CC) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat
 endif

Modified: team/pcadach/chan_h323-live/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/chan_h323.c?rev=40774&r1=40773&r2=40774&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/chan_h323.c (original)
+++ team/pcadach/chan_h323-live/channels/chan_h323.c Mon Aug 21 11:39:35 2006
@@ -130,7 +130,7 @@
 static struct ast_jb_conf global_jbconf;
 
 /** Variables required by Asterisk */
-static const char desc[] = "The NuFone Network's Open H.323 Channel Driver";
+static const char tdesc[] = "The NuFone Network's Open H.323 Channel Driver";
 static const char config[] = "h323.conf";
 static char default_context[AST_MAX_CONTEXT] = "default";
 static struct sockaddr_in bindaddr;
@@ -149,6 +149,7 @@
 static int tos = 0;
 static char secret[50];
 static unsigned int unique = 0;
+static int usecnt = 0;
 
 static call_options_t global_options;
 
@@ -571,7 +572,7 @@
 
 	/* Update usage counter */
 	ast_mutex_unlock(&pvt->lock);
-	ast_atomic_fetchadd_int(&__mod_desc->usecnt, -1);
+	ast_atomic_fetchadd_int(&usecnt, -1);
 	ast_update_use_count();
 	return 0;
 }
@@ -775,7 +776,7 @@
 	ast_mutex_unlock(&pvt->lock);
 	ch = ast_channel_alloc(1);
 	/* Update usage counter */
-	ast_atomic_fetchadd_int(&__mod_desc->usecnt, +1);
+	ast_atomic_fetchadd_int(&usecnt, +1);
 	ast_update_use_count();
 	ast_mutex_lock(&pvt->lock);
 	if (ch) {
@@ -2334,7 +2335,7 @@
 	return 0;
 }
 
-static int reload(void *mod)
+static int reload(void)
 {
 	return h323_reload(0, 0, NULL);
 }
@@ -2413,7 +2414,7 @@
 	.set_rtp_peer=  oh323_set_rtp_peer,
 };
 
-static int load_module(void *mod)
+static enum ast_module_load_result load_module(void)
 {
 	int res;
 	ast_mutex_init(&userl.lock);
@@ -2423,24 +2424,32 @@
 	sched = sched_context_create();
 	if (!sched) {
 		ast_log(LOG_WARNING, "Unable to create schedule context\n");
-		return -1;
+		return AST_MODULE_LOAD_FAILURE;
 	}
 	io = io_context_create();
 	if (!io) {
 		ast_log(LOG_WARNING, "Unable to create I/O context\n");
-		return -1;
+		return AST_MODULE_LOAD_FAILURE;
 	}
 	ast_cli_register(&cli_h323_reload);
 	res = reload_config();
 	if (res) {
-		return 0;
+		return AST_MODULE_LOAD_DECLINE;
 	} else {
 		/* Make sure we can register our channel type */
 		if (ast_channel_register(&oh323_tech)) {
 			ast_log(LOG_ERROR, "Unable to register channel class 'H323'\n");
 			ast_cli_unregister(&cli_h323_reload);
 			h323_end_process();
-			return -1;
+			io_context_destroy(io);
+			sched_context_destroy(sched);
+			delete_users();
+			delete_aliases();
+			prune_peers();
+			ast_mutex_destroy(&aliasl.lock);
+			ast_mutex_destroy(&userl.lock);
+			ast_mutex_destroy(&peerl.lock);
+			return AST_MODULE_LOAD_FAILURE;
 		}
 		ast_cli_register_multiple(h323_cli, sizeof(h323_cli) / sizeof(h323_cli[0]));
 
@@ -2464,16 +2473,26 @@
 		/* start the h.323 listener */
 		if (h323_start_listener(h323_signalling_port, bindaddr)) {
 			ast_log(LOG_ERROR, "Unable to create H323 listener.\n");
+			ast_rtp_proto_unregister(&oh323_rtp);
 			ast_cli_unregister_multiple(h323_cli, sizeof(h323_cli) / sizeof(h323_cli[0]));
 			ast_cli_unregister(&cli_h323_reload);
-			return -1;
+			h323_end_process();
+			io_context_destroy(io);
+			sched_context_destroy(sched);
+			delete_users();
+			delete_aliases();
+			prune_peers();
+			ast_mutex_destroy(&aliasl.lock);
+			ast_mutex_destroy(&userl.lock);
+			ast_mutex_destroy(&peerl.lock);
+			return AST_MODULE_LOAD_FAILURE;
 		}
 		/* Possibly register with a GK */
 		if (!gatekeeper_disable) {
 			if (h323_set_gk(gatekeeper_discover, gatekeeper, secret)) {
 				ast_log(LOG_ERROR, "Gatekeeper registration failed.\n");
 				gatekeeper_disable = 1;
-				return 0;
+				return AST_MODULE_LOAD_SUCCESS;
 			}
 		}
 		/* And start the monitor for the first time */
@@ -2482,7 +2501,7 @@
 	return res;
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	struct oh323_pvt *p, *pl;
 
@@ -2556,4 +2575,4 @@
 		.load = load_module,
 		.unload = unload_module,
 		.reload = reload,
-               );
+);



More information about the asterisk-commits mailing list