When res_pjsip is reloaded directly, it does the sorcery reload in a pjsip
servant thread as it's supposed to. res_pjsip_config_wizard however
was not which was leading to occasional deadlocks. It now does the reload
in a servant thread just like res_pjsip.
Resolves: #1855
AST_CLI_DEFINE(handle_export_primitives, "Export config wizard primitives"),
};
AST_CLI_DEFINE(handle_export_primitives, "Export config wizard primitives"),
};
+/*!
+ * \internal
+ * \brief Reload configuration within a PJSIP thread
+ */
+static int reload_configuration_task(void *obj)
+{
+ struct ast_sorcery *sip_sorcery = ast_sip_get_sorcery();
+ if (sip_sorcery) {
+ ast_sorcery_reload(sip_sorcery);
+ }
+ return 0;
+}
+
static int reload_module(void)
{
static int reload_module(void)
{
- ast_sorcery_reload(ast_sip_get_sorcery());
+ if (ast_sip_push_task_wait_servant(NULL, reload_configuration_task, NULL)) {
+ ast_log(LOG_WARNING, "Failed to reload PJSIP\n");
+ return -1;
+ }
+