Commit 28f62ec1e8 for asterisk.org

commit 28f62ec1e8a452d29f2bd77bf7add435596dcad4
Author: Arcadiy Ivanov <arcadiy@ivanov.biz>
Date:   Wed Jan 14 13:29:24 2026 -0500

    res_pjsip_session: Make sure NAT hook runs when packet is retransmitted for whatever reason.

    This hook may not be necessary when we do a retransmit, but when there are two
    INVITEs, one *initial* and one with auth digest, the second INVITE contains wrong (unmodified) media address
    due to the commented line below.
    The NAT hook needs to run due to filters potentially reverting previously modified packets.

    Fixes: #449

diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index a731d3ec65..04e6444689 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -58,7 +58,6 @@
 #define SDP_HANDLER_BUCKETS 11

 #define MOD_DATA_ON_RESPONSE "on_response"
-#define MOD_DATA_NAT_HOOK "nat_hook"

 /* Most common case is one audio and one video stream */
 #define DEFAULT_NUM_SESSION_MEDIA 2
@@ -5498,8 +5497,6 @@ static pjsip_inv_callback inv_callback = {
 static void session_outgoing_nat_hook(pjsip_tx_data *tdata, struct ast_sip_transport *transport)
 {
 	RAII_VAR(struct ast_sip_transport_state *, transport_state, ast_sip_get_transport_state(ast_sorcery_object_get_id(transport)), ao2_cleanup);
-	struct ast_sip_nat_hook *hook = ast_sip_mod_data_get(
-		tdata->mod_data, session_module.id, MOD_DATA_NAT_HOOK);
 	pjsip_sdp_info *sdp_info;
 	pjmedia_sdp_session *sdp;
 	pjsip_dialog *dlg = pjsip_tdata_get_dlg(tdata);
@@ -5507,10 +5504,9 @@ static void session_outgoing_nat_hook(pjsip_tx_data *tdata, struct ast_sip_trans
 	int stream;

 	/*
-	 * If there's no transport_state or body, or the hook
-	 * has already been run, just return.
+	 * If there's no transport_state or body, just return.
 	 */
-	if (ast_strlen_zero(transport->external_media_address) || !transport_state || hook || !tdata->msg->body) {
+	if (ast_strlen_zero(transport->external_media_address) || !transport_state || !tdata->msg->body) {
 		return;
 	}

@@ -5561,8 +5557,6 @@ static void session_outgoing_nat_hook(pjsip_tx_data *tdata, struct ast_sip_trans
 		}
 	}

-	/* We purposely do this so that the hook will not be invoked multiple times, ie: if a retransmit occurs */
-	ast_sip_mod_data_set(tdata->pool, tdata->mod_data, session_module.id, MOD_DATA_NAT_HOOK, nat_hook);
 }

 #ifdef TEST_FRAMEWORK