From c40e808b140e7814b8bb45ecd53026bd4cd433cb Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Wed, 27 Nov 2013 16:09:48 +0000 Subject: [PATCH] res_pjsip: Fix crash when reloading certain configurations. Certain options available that specify a SIP URI perform validation on the provided URI using the PJSIP URI parser. This operation requires that the thread executing it be registered with the PJLIB library. During reloads this was done on a thread which was NOT registered with it. This fixes the problem by creating a task which reloads the configuration on a PJSIP thread. (closes issue ASTERISK-22923) Reported by: Anthony Messina git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@403179 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_pjsip/pjsip_configuration.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index 364ed7e19b..4642c5e665 100644 --- a/res/res_pjsip/pjsip_configuration.c +++ b/res/res_pjsip/pjsip_configuration.c @@ -1404,7 +1404,11 @@ void ast_res_pjsip_destroy_configuration(void) ast_sorcery_unref(sip_sorcery); } -int ast_res_pjsip_reload_configuration(void) +/*! + * \internal + * \brief Reload configuration within a PJSIP thread + */ +static int reload_configuration_task(void *obj) { if (sip_sorcery) { ast_sorcery_reload(sip_sorcery); @@ -1412,6 +1416,15 @@ int ast_res_pjsip_reload_configuration(void) return 0; } +int ast_res_pjsip_reload_configuration(void) +{ + if (ast_sip_push_task(NULL, reload_configuration_task, NULL)) { + ast_log(LOG_WARNING, "Failed to reload PJSIP configuration\n"); + } + + return 0; +} + static void subscription_configuration_destroy(struct ast_sip_endpoint_subscription_configuration *subscription) { ast_string_field_free_memory(&subscription->mwi); -- 2.47.2