Index: addons/ooh323c/src/ooGkClient.c =================================================================== --- addons/ooh323c/src/ooGkClient.c (revision 390227) +++ addons/ooh323c/src/ooGkClient.c (working copy) @@ -2851,13 +2851,15 @@ int ooGkClientHandleClientOrGkFailure(ooGkClient * { OOTRACEERR1("Error: Gatekeeper error detected. Closing GkClient as " "Gk mode is UseSpecifcGatekeeper\n"); - ooGkClientDestroy(); + // ooGkClientDestroy(); + pGkClient->state = GkClientStopped; return OO_FAILED; } else{ OOTRACEERR1("Error: Gatekeeper error detected. Closing GkClient. NEED" " to implement recovery by rediscovering another gk\n"); - ooGkClientDestroy(); + // ooGkClientDestroy(); + pGkClient->state = GkClientStopped; return OO_FAILED; } } Index: addons/ooh323c/src/ooGkClient.h =================================================================== --- addons/ooh323c/src/ooGkClient.h (revision 390227) +++ addons/ooh323c/src/ooGkClient.h (working copy) @@ -108,7 +108,8 @@ enum OOGkClientState { GkClientRegistered, /* registered with gk */ GkClientUnregistered, GkClientGkErr,/*Gk is not responding, in discover mode can look for new GK*/ - GkClientFailed + GkClientFailed, + GkClientStopped }; Index: addons/ooh323c/src/oochannels.c =================================================================== --- addons/ooh323c/src/oochannels.c (revision 390227) +++ addons/ooh323c/src/oochannels.c (working copy) @@ -603,11 +603,7 @@ int ooProcessFDSETsAndTimers if(gH323ep.gkClient->state == GkClientFailed || gH323ep.gkClient->state == GkClientGkErr) { - if(ooGkClientHandleClientOrGkFailure(gH323ep.gkClient)!=OO_OK) - { - //ooStopMonitorCalls(); //Function calling ooProcessFDSETsAndTimers is responsible for this. - return OO_FAILED; - } + ooGkClientHandleClientOrGkFailure(gH323ep.gkClient); } } Index: addons/chan_ooh323.c =================================================================== --- addons/chan_ooh323.c (revision 390229) +++ addons/chan_ooh323.c (working copy) @@ -694,7 +694,7 @@ static struct ast_channel *ooh323_request(const ch ooh323_destroy(p); ast_mutex_unlock(&iflock); return NULL; - } else if (gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered) { + } else if (!gH323ep.gkClient || (gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered)) { ast_log(LOG_ERROR, "Gatekeeper client is configured but not registered\n"); *cause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE; return NULL; @@ -3425,6 +3425,9 @@ static char *handle_cli_ooh323_show_gk(struct ast_ case GkClientFailed: ast_cli(a->fd, "%-20s%s\n", "GK state:", "Failed"); break; + case GkClientStopped: + ast_cli(a->fd, "%-20s%s\n", "GK state:", "Shutdown"); + break; default: break; } @@ -3850,6 +3853,13 @@ static void *do_monitor(void *data) ast_verb(1, "Reloading H.323\n"); ooh323_do_reload(); } + if (gH323ep.gkClient && gH323ep.gkClient->state == GkClientStopped) { + ooGkClientDestroy(); + ast_verb(0, "Restart stopped gatekeeper client\n"); + ooGkClientInit(gRasGkMode, (gRasGkMode == RasUseSpecificGatekeeper) ? + gGatekeeper : 0, 0); + ooGkClientStart(gH323ep.gkClient); + } /* Check for interfaces needing to be killed */ ast_mutex_lock(&iflock);