summaryrefslogtreecommitdiff
path: root/addons/chan_ooh323.c
diff options
context:
space:
mode:
authorAlexandr Anikin <may@telecom-service.ru>2013-12-19 08:35:28 +0000
committerAlexandr Anikin <may@telecom-service.ru>2013-12-19 08:35:28 +0000
commit1370d405594ff731b9034decec0af9e256b29f1c (patch)
treed5ec5e84c82db640d4274adb9531fcbb613ec328 /addons/chan_ooh323.c
parentc2fd229fbaf161ae91b87ca38845636089d96a4c (diff)
Handle temporary failures on gk registration
Introduce new 'stopped' state for gk client and restart gk client on failures Remove ooh323 stack command lock as it is not need now. (closes issue ASTERISK-21960) Reported by: Dmitry Melekhov Patches: ASTERISK-21960.patch ASTERISK-21960-stacklockup-2.patch Tested by: Dmitry Melekhov ........ Merged revisions 404318 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 404320 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404321 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'addons/chan_ooh323.c')
-rw-r--r--addons/chan_ooh323.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c
index 8111b712e..52c0404a5 100644
--- a/addons/chan_ooh323.c
+++ b/addons/chan_ooh323.c
@@ -295,8 +295,6 @@ AST_MUTEX_DEFINE_STATIC(h323_reload_lock);
static int usecnt = 0;
AST_MUTEX_DEFINE_STATIC(usecnt_lock);
-AST_MUTEX_DEFINE_STATIC(ooh323c_cmd_lock);
-
static long callnumber = 0;
AST_MUTEX_DEFINE_STATIC(ooh323c_cn_lock);
@@ -696,7 +694,7 @@ static struct ast_channel *ooh323_request(const char *type, struct ast_format_ca
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;
@@ -751,7 +749,6 @@ static struct ast_channel *ooh323_request(const char *type, struct ast_format_ca
}
ast_mutex_unlock(&p->lock);
- ast_mutex_lock(&ooh323c_cmd_lock);
ast_cond_init(&p->rtpcond, NULL);
ooMakeCall(data, p->callToken, AST_MAX_EXTENSION, NULL);
ast_mutex_lock(&p->lock);
@@ -760,7 +757,6 @@ static struct ast_channel *ooh323_request(const char *type, struct ast_format_ca
}
ast_mutex_unlock(&p->lock);
ast_cond_destroy(&p->rtpcond);
- ast_mutex_unlock(&ooh323c_cmd_lock);
}
restart_monitor();
@@ -3505,6 +3501,9 @@ static char *handle_cli_ooh323_show_gk(struct ast_cli_entry *e, int cmd, struct
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;
}
@@ -3946,6 +3945,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);