summaryrefslogtreecommitdiff
path: root/res/res_pjsip_config_wizard.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2014-12-16 17:53:59 +0000
committerGeorge Joseph <george.joseph@fairview5.com>2014-12-16 17:53:59 +0000
commitc4cc668ba9682751d8617d1f49932bcacf43772f (patch)
tree9bb46f8419694366a81ebc49d7a26585d92d9308 /res/res_pjsip_config_wizard.c
parent58095d2486941dc9b953b24b9da3a261b7df9cb9 (diff)
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
Diffstat (limited to 'res/res_pjsip_config_wizard.c')
-rw-r--r--res/res_pjsip_config_wizard.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/res/res_pjsip_config_wizard.c b/res/res_pjsip_config_wizard.c
index 60cbc1077..e5573aaa7 100644
--- a/res/res_pjsip_config_wizard.c
+++ b/res/res_pjsip_config_wizard.c
@@ -801,7 +801,7 @@ static void object_type_loaded_observer(const char *name,
struct ast_category *category = NULL;
struct object_type_wizard *otw = NULL;
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;
if (!strstr("auth aor endpoint identify registration phoneprov", object_type)) {
@@ -815,6 +815,10 @@ static void object_type_loaded_observer(const char *name,
return;
}
+ if (reloaded) {
+ flags.flags |= CONFIG_FLAG_FILEUNCHANGED;
+ }
+
cfg = ast_config_load2(filename, object_type, flags);
if (!cfg) {
@@ -938,7 +942,7 @@ static void instance_created_observer(const char *name, struct ast_sorcery *sorc
static int load_module(void)
{
- struct ast_sorcery *sorcery = ast_sip_get_sorcery();
+ struct ast_sorcery *sorcery = NULL;
int i;
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.
* The we neeed to schedule a reload.
*/
- if (sorcery) {
- /* CLean up and add the observer. */
- ast_sorcery_instance_observer_remove(sorcery, &observer);
- ast_sorcery_instance_observer_add(sorcery, &observer);
+ if (ast_module_check("res_pjsip.so") && ast_sip_get_pjsip_endpoint()) {
+ sorcery = ast_sip_get_sorcery();
+ if (sorcery) {
+ /* Clean up and add the observer. */
+ ast_sorcery_instance_observer_remove(sorcery, &observer);
+ ast_sorcery_instance_observer_add(sorcery, &observer);
+
+ for (i = 0; object_types[i]; i++) {
+ ast_sorcery_apply_wizard_mapping(sorcery, object_types[i], "memory",
+ "pjsip_wizard", 0);
+ }
- for (i = 0; object_types[i]; i++) {
- ast_sorcery_apply_wizard_mapping(sorcery, object_types[i], "memory", "pjsip_wizard", 0);
+ ast_module_reload("res_pjsip.so");
}
-
- ast_module_reload("res_pjsip");
}
return AST_MODULE_LOAD_SUCCESS;