From 16e4a9d8cf389b59392623b0ada8ac99baece247 Mon Sep 17 00:00:00 2001
From: "Joshua C. Colp" <jcolp@sangoma.com>
Date: Mon, 24 May 2021 15:38:26 -0300
Subject: [PATCH] res_pjsip: On partial transport reload also move factories.

For connection oriented transports PJSIP uses factories to
produce transports. When doing a partial transport reload
we need to also move the factory of the transport over so
that anything referencing the transport (such as an endpoint)
has the factory available.

ASTERISK-29441

Change-Id: Ieae0fb98eab2d9257cad996a1136e5a62d307161
---
 res/res_pjsip/config_transport.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c
index 830b03832d..502ad5b1ce 100644
--- a/res/res_pjsip/config_transport.c
+++ b/res/res_pjsip/config_transport.c
@@ -739,6 +739,8 @@ static int transport_apply(const struct ast_sorcery *sorcery, void *obj)
 		ast_log(LOG_WARNING, "Transport '%s' is not fully reloadable, not reloading: protocol, bind, TLS, TCP, ToS, or CoS options.\n", transport_id);
 		temp_state->state->transport = perm_state->state->transport;
 		perm_state->state->transport = NULL;
+		temp_state->state->factory = perm_state->state->factory;
+		perm_state->state->factory = NULL;
 		res = PJ_SUCCESS;
 	} else if (transport->type == AST_TRANSPORT_UDP) {
 
-- 
GitLab