Commit f8a09e90ed for asterisk.org

commit f8a09e90edcfa54e63f416945a100a517008d114
Author: Mike Bradeen <mbradeen@sangoma.com>
Date:   Tue Oct 13 13:02:42 2026 -0600

    res_rtp_asterisk: Fix rtp timestamp calculation during DTMF generation

    Avoid advancing the last tx timestamp when audio is suppressed during DTMF
    generation to avoid mis-calculating the timestamp on the first packet after
    the RTP Event end.

    Resolves: #2230

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 894ce243ad..d5c5968038 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -5284,7 +5284,7 @@ static int rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame *fr
 {
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
 	int pred, mark = 0;
-	unsigned int ms = calc_txstamp(rtp, &frame->delivery);
+	unsigned int ms;
 	struct ast_sockaddr remote_address = { {0,} };
 	int rate = ast_rtp_get_rate(frame->subclass.format) / 1000;
 	unsigned int seqno;
@@ -5300,6 +5300,9 @@ static int rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame *fr
 		return 0;
 	}

+	/* Suppressed audio must not consume elapsed transmit time. */
+	ms = calc_txstamp(rtp, &frame->delivery);
+
 #ifdef TEST_FRAMEWORK
 	if (test && test->send_report) {
 		test->send_report = 0;