summaryrefslogtreecommitdiff
path: root/res/res_pjsip_outbound_registration.c
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-11-19 09:40:24 -0600
committerMatt Jordan <mjordan@digium.com>2015-11-19 09:44:39 -0600
commit1bca90fcbe7d3581b9c568361267faf488141868 (patch)
tree28a3b410ca30c436c92524ed19ffa340b22272a9 /res/res_pjsip_outbound_registration.c
parent65102d19bc1709beeb15e8141c01efb5da4b272c (diff)
res/res_pjsip_outbound_registration: Apply configuration on object type load
When Asterisk is configured to use a dynamic sorcery backend (such as res_sorcery_astdb) with 'registration' objects, it will fail to create the internal state objects associated with the registration objects on module load. This is due to nothing actually querying for the specific objects and calling their sorcery apply handler during module load. This patch fixes that by calling get_registrations in the sorcery observer's object_type_loaded handler. Doing this causes the sorcery backends to be asked for the current state of all registration objects, which causes the apply handler to be called and the internal run-time state to be created. ASTERISK-25575 #close Change-Id: Ie9306e797098c6d4da7bcf4a5434a15891508b23
Diffstat (limited to 'res/res_pjsip_outbound_registration.c')
-rw-r--r--res/res_pjsip_outbound_registration.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index 7ff5f1619..7b125334a 100644
--- a/res/res_pjsip_outbound_registration.c
+++ b/res/res_pjsip_outbound_registration.c
@@ -1846,6 +1846,13 @@ static void registration_loaded_observer(const char *name, const struct ast_sorc
return;
}
+ /*
+ * Refresh the current configured registrations. We don't need to hold
+ * onto the objects, as the apply handler will cause their states to
+ * be created appropriately.
+ */
+ ao2_cleanup(get_registrations());
+
/* Now to purge dead registrations. */
ao2_callback(states, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, check_state, NULL);
ao2_ref(states, -1);