]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_config_wizard: Trigger reloads from a pjsip servant thread master
authorGeorge Joseph <gjoseph@sangoma.com>
Tue, 7 Apr 2026 14:36:34 +0000 (08:36 -0600)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Wed, 8 Apr 2026 17:03:11 +0000 (17:03 +0000)
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

res/res_pjsip_config_wizard.c

index 1789e34f8d172c70a0606961cd2d3467689b6ee0..6d797ab4863b87cf0334774a0055a1c47d904992 100644 (file)
@@ -1331,9 +1331,26 @@ static struct ast_cli_entry config_wizard_cli[] = {
        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;
+       }
+
        return 0;
 }
 
        return 0;
 }