[asterisk-commits] may: trunk r356848 - in /trunk/addons: chan_ooh323.c ooh323c/src/ooGkClient.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Feb 26 12:25:27 CST 2012


Author: may
Date: Sun Feb 26 12:25:23 2012
New Revision: 356848

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=356848
Log:
Add support change gatekeeper mode or ip per ooh323 reload command

(issue ASTERISK-19298)
Reported by: Dmitry Melekhov
Patches:
        change_gk_on_reload-1.patch (License #5415)


Modified:
    trunk/addons/chan_ooh323.c
    trunk/addons/ooh323c/src/ooGkClient.c

Modified: trunk/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/chan_ooh323.c?view=diff&rev=356848&r1=356847&r2=356848
==============================================================================
--- trunk/addons/chan_ooh323.c (original)
+++ trunk/addons/chan_ooh323.c Sun Feb 26 12:25:23 2012
@@ -2571,11 +2571,26 @@
 
 static int ooh323_do_reload(void)
 {
+	extern OOH323EndPoint gH323ep;
+
 	if (gH323Debug) {
 		ast_verb(0, "---   ooh323_do_reload\n");
 	}
 
+	/* Gatekeeper */
+	if (gH323ep.gkClient) {
+		ooGkClientDestroy();
+	}
+
    	reload_config(1);
+
+	/* Gatekeeper */
+	if (gRasGkMode == RasUseSpecificGatekeeper || 
+		gRasGkMode == RasDiscoverGatekeeper) {
+		ooGkClientInit(gRasGkMode, (gRasGkMode == RasUseSpecificGatekeeper) ? 
+								gGatekeeper : 0, 0);
+		ooGkClientStart(gH323ep.gkClient);
+	}
 
 	if (gH323Debug) {
 		ast_verb(0, "+++   ooh323_do_reload\n");

Modified: trunk/addons/ooh323c/src/ooGkClient.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooGkClient.c?view=diff&rev=356848&r1=356847&r2=356848
==============================================================================
--- trunk/addons/ooh323c/src/ooGkClient.c (original)
+++ trunk/addons/ooh323c/src/ooGkClient.c Sun Feb 26 12:25:23 2012
@@ -170,23 +170,25 @@
 
 int ooGkClientDestroy(void)
 {
+   ooGkClient *pGkClient = gH323ep.gkClient;
+
    if(gH323ep.gkClient)
    {
-      if(gH323ep.gkClient->state == GkClientRegistered)
+      ast_mutex_lock(&pGkClient->Lock);
+      gH323ep.gkClient = NULL;
+      if(pGkClient->state == GkClientRegistered)
       {
          OOTRACEINFO1("Unregistering from Gatekeeper\n");
-         if(ooGkClientSendURQ(gH323ep.gkClient, NULL)!=OO_OK)
+         if(ooGkClientSendURQ(pGkClient, NULL)!=OO_OK)
             OOTRACEERR1("Error:Failed to send URQ to gatekeeper\n");
       }
       OOTRACEINFO1("Destroying Gatekeeper Client\n");
-      ooGkClientCloseChannel(gH323ep.gkClient);
-      freeContext(&gH323ep.gkClient->msgCtxt);
-      freeContext(&gH323ep.gkClient->ctxt);
-      ast_mutex_lock(&gH323ep.gkClient->Lock);
-      ast_mutex_unlock(&gH323ep.gkClient->Lock);
-      ast_mutex_destroy(&gH323ep.gkClient->Lock);
-      memFreePtr(&gH323ep.ctxt, gH323ep.gkClient);
-      gH323ep.gkClient = NULL;
+      ooGkClientCloseChannel(pGkClient);
+      freeContext(&pGkClient->msgCtxt);
+      freeContext(&pGkClient->ctxt);
+      ast_mutex_unlock(&pGkClient->Lock);
+      ast_mutex_destroy(&pGkClient->Lock);
+      memFreePtr(&gH323ep.ctxt, pGkClient);
    }
    return OO_OK;
 }




More information about the asterisk-commits mailing list