changeset 202:f3164f732b84

sip-manual-out: add tfo-stop command
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 02 Apr 2023 18:05:30 -0800
parents d3c99b41fb04
children e89619893c1e
files sip-manual-out/rtp_tx.c sip-manual-out/user_cmd.c
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sip-manual-out/rtp_tx.c	Sun Apr 02 18:01:34 2023 -0800
+++ b/sip-manual-out/rtp_tx.c	Sun Apr 02 18:05:30 2023 -0800
@@ -27,6 +27,7 @@
 static uint16_t tfo_fill_buf[9], tfo_req_buf[7];
 static uint16_t *is_out_ptr;
 static unsigned is_out_count;
+static int tfo_stop_req;
 
 void
 assign_rtpout_ssrc()
@@ -81,7 +82,7 @@
 	if (is_out_count) {
 		insert_is_msg(pkt.payload, *is_out_ptr++);
 		is_out_count--;
-		if (!is_out_count) {
+		if (!is_out_count && !tfo_stop_req) {
 			is_out_ptr = tfo_req_buf;
 			is_out_count = 7;
 		}
@@ -103,4 +104,11 @@
 	encode_tfo_ext_words(sig, codec, 0, tfo_req_buf + 5);
 	is_out_ptr = tfo_fill_buf;
 	is_out_count = 9;
+	tfo_stop_req = 0;
 }
+
+void
+stop_tfo_out()
+{
+	tfo_stop_req = 1;
+}
--- a/sip-manual-out/user_cmd.c	Sun Apr 02 18:01:34 2023 -0800
+++ b/sip-manual-out/user_cmd.c	Sun Apr 02 18:05:30 2023 -0800
@@ -69,6 +69,8 @@
 		send_cancel_req();
 	else if (!strncmp(cp, "tfo-req", 7) && isspace(cp[7]))
 		tfo_req_cmd(cp + 8);
+	else if (!strcmp(cp, "tfo-stop"))
+		stop_tfo_out();
 	else
 		fprintf(stderr, "error: non-understood stdin command\n");
 }