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
This commit is contained in:
Joshua Colp
2013-11-27 16:09:48 +00:00
parent 094c5e2cca
commit c40e808b14

View File

@@ -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);