mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-18 02:32:36 +00:00
res_pjsip_config_wizard: fix test breakage
Fix test breakage caused by not checking for res_pjsip before calling ast_sip_get_sorcery. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4269/ ........ Merged revisions 429653 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429654 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -801,7 +801,7 @@ static void object_type_loaded_observer(const char *name,
|
|||||||
struct ast_category *category = NULL;
|
struct ast_category *category = NULL;
|
||||||
struct object_type_wizard *otw = NULL;
|
struct object_type_wizard *otw = NULL;
|
||||||
char *filename = "pjsip_wizard.conf";
|
char *filename = "pjsip_wizard.conf";
|
||||||
struct ast_flags flags = { reloaded ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
struct ast_flags flags = { CONFIG_FLAG_NOCACHE };
|
||||||
struct ast_config *cfg;
|
struct ast_config *cfg;
|
||||||
|
|
||||||
if (!strstr("auth aor endpoint identify registration phoneprov", object_type)) {
|
if (!strstr("auth aor endpoint identify registration phoneprov", object_type)) {
|
||||||
@@ -815,6 +815,10 @@ static void object_type_loaded_observer(const char *name,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reloaded) {
|
||||||
|
flags.flags |= CONFIG_FLAG_FILEUNCHANGED;
|
||||||
|
}
|
||||||
|
|
||||||
cfg = ast_config_load2(filename, object_type, flags);
|
cfg = ast_config_load2(filename, object_type, flags);
|
||||||
|
|
||||||
if (!cfg) {
|
if (!cfg) {
|
||||||
@@ -938,7 +942,7 @@ static void instance_created_observer(const char *name, struct ast_sorcery *sorc
|
|||||||
|
|
||||||
static int load_module(void)
|
static int load_module(void)
|
||||||
{
|
{
|
||||||
struct ast_sorcery *sorcery = ast_sip_get_sorcery();
|
struct ast_sorcery *sorcery = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
AST_VECTOR_INIT(&object_type_wizards, 12);
|
AST_VECTOR_INIT(&object_type_wizards, 12);
|
||||||
@@ -948,16 +952,20 @@ static int load_module(void)
|
|||||||
* and map the wizards because the observers will never get triggered.
|
* and map the wizards because the observers will never get triggered.
|
||||||
* The we neeed to schedule a reload.
|
* The we neeed to schedule a reload.
|
||||||
*/
|
*/
|
||||||
|
if (ast_module_check("res_pjsip.so") && ast_sip_get_pjsip_endpoint()) {
|
||||||
|
sorcery = ast_sip_get_sorcery();
|
||||||
if (sorcery) {
|
if (sorcery) {
|
||||||
/* CLean up and add the observer. */
|
/* Clean up and add the observer. */
|
||||||
ast_sorcery_instance_observer_remove(sorcery, &observer);
|
ast_sorcery_instance_observer_remove(sorcery, &observer);
|
||||||
ast_sorcery_instance_observer_add(sorcery, &observer);
|
ast_sorcery_instance_observer_add(sorcery, &observer);
|
||||||
|
|
||||||
for (i = 0; object_types[i]; i++) {
|
for (i = 0; object_types[i]; i++) {
|
||||||
ast_sorcery_apply_wizard_mapping(sorcery, object_types[i], "memory", "pjsip_wizard", 0);
|
ast_sorcery_apply_wizard_mapping(sorcery, object_types[i], "memory",
|
||||||
|
"pjsip_wizard", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_module_reload("res_pjsip");
|
ast_module_reload("res_pjsip.so");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return AST_MODULE_LOAD_SUCCESS;
|
return AST_MODULE_LOAD_SUCCESS;
|
||||||
|
Reference in New Issue
Block a user