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

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Sep 9 13:01:02 MST 2006


Author: pcadach
Date: Sat Sep  9 15:01:01 2006
New Revision: 42592

URL: http://svn.digium.com/view/asterisk?rev=3D42592&view=3Drev
Log:
Track GK configuration on reloads

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

Modified: team/pcadach/chan_h323-live/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channe=
ls/chan_h323.c?rev=3D42592&r1=3D42591&r2=3D42592&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- team/pcadach/chan_h323-live/channels/chan_h323.c (original)
+++ team/pcadach/chan_h323-live/channels/chan_h323.c Sat Sep  9 15:01:01 20=
06
@@ -2506,7 +2506,7 @@
 		"Show all active call tokens", show_tokens_usage },
 };
 =

-static int reload_config(void)
+static int reload_config(int is_reload)
 {	=

 	int format;
 	struct ast_config *cfg;
@@ -2518,6 +2518,8 @@
 	char *cat;
 	char *utype;
 	int is_user, is_peer, is_alias;
+	char _gatekeeper[100];
+	int gk_discover, gk_disable, gk_changed;
 	=

 	cfg =3D ast_config_load(config);
 =

@@ -2531,6 +2533,9 @@
 	if (!h323_end_point_exist()) {
 		h323_end_point_create();
 	}
+	strncpy(_gatekeeper, gatekeeper, sizeof(_gatekeeper));
+	gk_discover =3D gatekeeper_discover;
+	gk_disable =3D gatekeeper_disable;
 	memset(&bindaddr, 0, sizeof(bindaddr));
 	memset(&global_options, 0, sizeof(global_options));
 	global_options.dtmfcodec =3D 101;
@@ -2670,6 +2675,25 @@
 	} while (0) );
 	ASTOBJ_CONTAINER_UNLOCK(&aliasl);
 =

+	/* Don't touch GK if nothing changed because URQ will drop all existing c=
alls */
+	gk_changed =3D 0;
+	if (gatekeeper_disable !=3D gk_disable)
+		gk_changed =3D is_reload;
+	else if(!gatekeeper_disable && (gatekeeper_discover !=3D gk_discover))
+		gk_changed =3D is_reload;
+	else if(!gatekeeper_disable && (strncmp(_gatekeeper, gatekeeper, sizeof(_=
gatekeeper)) !=3D 0))
+		gk_changed =3D is_reload;
+	if (gk_changed) {
+		if(!gk_disable)
+			h323_gk_urq();
+		if (!gatekeeper_disable) {
+			if (h323_set_gk(gatekeeper_discover, gatekeeper, secret)) {
+				ast_log(LOG_ERROR, "Gatekeeper registration failed.\n");
+				gatekeeper_disable =3D 1;
+				usingGk =3D 0;
+			}
+		}
+	}
 	return 0;
 }
 =

@@ -2741,7 +2765,7 @@
 	delete_users();
 	delete_aliases();
 	prune_peers();
-	reload_config();
+	reload_config(1);
 	return 0;
 }
 =

@@ -2853,7 +2877,7 @@
 	ASTOBJ_CONTAINER_INIT(&userl);
 	ASTOBJ_CONTAINER_INIT(&peerl);
 	ASTOBJ_CONTAINER_INIT(&aliasl);
-	res =3D reload_config();
+	res =3D reload_config(0);
 	if (res) {
 		return AST_MODULE_LOAD_DECLINE;
 	} else {
@@ -2917,6 +2941,7 @@
 			if (h323_set_gk(gatekeeper_discover, gatekeeper, secret)) {
 				ast_log(LOG_ERROR, "Gatekeeper registration failed.\n");
 				gatekeeper_disable =3D 1;
+				usingGk =3D 0;
 				return AST_MODULE_LOAD_SUCCESS;
 			}
 		}



More information about the asterisk-commits mailing list