changeset 97:9aed16c30622

mgw p2g: set M bit when restarting forwarding after no-forward
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Sep 2022 20:05:02 -0800
parents f24bbfd23c9d
children 423610bb2c9e
files mgw/pstn2gsm.c mgw/struct.h
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mgw/pstn2gsm.c	Sun Sep 25 19:32:27 2022 -0800
+++ b/mgw/pstn2gsm.c	Sun Sep 25 20:05:02 2022 -0800
@@ -109,8 +109,14 @@
 	ep->p2g_last_ts = ntohl(pkt.tstamp);
 	ep->p2g_last_seq = ntohs(pkt.seq);
 	/* actual transcoding and forwarding */
-	if (!(ep->fwd_mode & TMGW_FWD_ENABLE_PSTN2GSM))
+	if (!(ep->fwd_mode & TMGW_FWD_ENABLE_PSTN2GSM)) {
+		ep->p2g_drop_flag = 1;
 		return;
+	}
+	if (ep->p2g_drop_flag) {
+		ep->p2g_drop_flag = 0;
+		m_out = 1;
+	}
 	for (n = 0; n < SAMPLES_PER_FRAME; n++)
 		pcm_samples[n] = pcm_dec_table[pkt.payload[n]];
 	pkt.m_pt = ep->gsm_payload_type;
--- a/mgw/struct.h	Sun Sep 25 19:32:27 2022 -0800
+++ b/mgw/struct.h	Sun Sep 25 20:05:02 2022 -0800
@@ -33,6 +33,7 @@
 	uint32_t	p2g_last_ts;
 	uint16_t	p2g_last_seq;
 	uint16_t	p2g_out_seq;
+	int		p2g_drop_flag;
 	int		p2g_err_flags;
 	/* linked list management */
 	unsigned	ep_id;