chan_ooh323: fix loading module failure if there no accessible h323_log or ooh323 config file

change return 1 to return AST_MODULE_LOAD_FAILURE on module load routine
few cosmetic changes

ASTERISK-23814 #close

(closes issue ASTERISK-23814)

Reported by: Igor Goncharovsky
Patches:
	ASTERISK-23814-ast11.patch


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@415599 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/61/61/1
Alexandr Anikin 11 years ago
parent ea8009da8e
commit 73945f9a97

@ -747,10 +747,8 @@ static struct ast_channel *ooh323_request(const char *type, struct ast_format_ca
return NULL; return NULL;
} }
ast_mutex_unlock(&p->lock);
ast_cond_init(&p->rtpcond, NULL); ast_cond_init(&p->rtpcond, NULL);
ooMakeCall(data, p->callToken, AST_MAX_EXTENSION, NULL); ooMakeCall(data, p->callToken, AST_MAX_EXTENSION, NULL);
ast_mutex_lock(&p->lock);
if (!p->rtp) { if (!p->rtp) {
ast_cond_wait(&p->rtpcond, &p->lock); ast_cond_wait(&p->rtpcond, &p->lock);
} }
@ -3754,10 +3752,10 @@ static int load_module(void)
.onMediaChanged = (cb_OnMediaChanged) setup_rtp_remote, .onMediaChanged = (cb_OnMediaChanged) setup_rtp_remote,
}; };
if (!(gCap = ast_format_cap_alloc())) { if (!(gCap = ast_format_cap_alloc())) {
return 1; return AST_MODULE_LOAD_FAILURE;
} }
if (!(ooh323_tech.capabilities = ast_format_cap_alloc())) { if (!(ooh323_tech.capabilities = ast_format_cap_alloc())) {
return 1; return AST_MODULE_LOAD_FAILURE;
} }
ast_format_cap_add(gCap, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0)); ast_format_cap_add(gCap, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0));
ast_format_cap_add_all(ooh323_tech.capabilities); ast_format_cap_add_all(ooh323_tech.capabilities);
@ -3784,22 +3782,23 @@ static int load_module(void)
if (!reload_config(0)) { if (!reload_config(0)) {
/* fire up the H.323 Endpoint */
if (OO_OK != ooH323EpInitialize(OO_CALLMODE_AUDIOCALL, gLogFile)) {
ast_log(LOG_ERROR, "Failed to initialize OOH323 endpoint-"
"OOH323 Disabled\n");
return AST_MODULE_LOAD_FAILURE;
}
/* Make sure we can register our OOH323 channel type */ /* Make sure we can register our OOH323 channel type */
if (ast_channel_register(&ooh323_tech)) { if (ast_channel_register(&ooh323_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type); ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
return 0; return AST_MODULE_LOAD_FAILURE;
} }
ast_rtp_glue_register(&ooh323_rtp); ast_rtp_glue_register(&ooh323_rtp);
ast_udptl_proto_register(&ooh323_udptl); ast_udptl_proto_register(&ooh323_udptl);
ast_cli_register_multiple(cli_ooh323, sizeof(cli_ooh323) / sizeof(struct ast_cli_entry)); ast_cli_register_multiple(cli_ooh323, sizeof(cli_ooh323) / sizeof(struct ast_cli_entry));
/* fire up the H.323 Endpoint */
if (OO_OK != ooH323EpInitialize(OO_CALLMODE_AUDIOCALL, gLogFile)) {
ast_log(LOG_ERROR, "Failed to initialize OOH323 endpoint-"
"OOH323 Disabled\n");
return 1;
}
if (gIsGateway) if (gIsGateway)
ooH323EpSetAsGateway(); ooH323EpSetAsGateway();
@ -3814,10 +3813,9 @@ static int load_module(void)
} }
ooH323EpSetCallerID(gCallerID); ooH323EpSetCallerID(gCallerID);
if(ooH323EpSetTCPPortRange(ooconfig.mTCPPortStart, if(ooH323EpSetTCPPortRange(ooconfig.mTCPPortStart, ooconfig.mTCPPortEnd) == OO_FAILED) {
ooconfig.mTCPPortEnd) == OO_FAILED) { ast_log(LOG_ERROR, "h225portrange: Failed to set range\n");
ast_log(LOG_ERROR, "h225portrange: Failed to set range\n"); }
}
/* Set aliases if any */ /* Set aliases if any */
for (pNewAlias = gAliasList; pNewAlias; pNewAlias = pNewAlias->next) { for (pNewAlias = gAliasList; pNewAlias; pNewAlias = pNewAlias->next) {
@ -3831,8 +3829,8 @@ static int load_module(void)
case T_H225AliasAddress_email_ID: case T_H225AliasAddress_email_ID:
ooH323EpAddAliasEmailID(pNewAlias->value); ooH323EpAddAliasEmailID(pNewAlias->value);
break; break;
default: default:
; ;
} }
} }
@ -3899,6 +3897,9 @@ static int load_module(void)
} }
/* And start the monitor for the first time */ /* And start the monitor for the first time */
restart_monitor(); restart_monitor();
} else {
ast_log(LOG_ERROR, "Can't load ooh323 config file, OOH323 Disabled\n");
return AST_MODULE_LOAD_FAILURE;
} }
return 0; return 0;

Loading…
Cancel
Save