Commit 006e25471d for asterisk.org
commit 006e25471d52c707fd2e32d44953f24a942241b2
Author: George Joseph <gjoseph@sangoma.com>
Date: Tue Apr 7 08:36:34 2026 -0600
res_pjsip_config_wizard: Trigger reloads from a pjsip servant thread
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
diff --git a/res/res_pjsip_config_wizard.c b/res/res_pjsip_config_wizard.c
index 1789e34f8d..6d797ab486 100644
--- a/res/res_pjsip_config_wizard.c
+++ b/res/res_pjsip_config_wizard.c
@@ -1331,9 +1331,26 @@ static struct ast_cli_entry config_wizard_cli[] = {
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)
{
- 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;
+ }
+
return 0;
}