changeset 212:b3aeacc5722a

sip-manual-out: add pcm-fill command
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 May 2023 15:45:52 -0800
parents fbfa72b114e8
children 55ad0f4bb33c
files sip-manual-out/rtp_tx.c sip-manual-out/user_cmd.c
diffstat 2 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sip-manual-out/rtp_tx.c	Sun May 21 15:33:00 2023 -0800
+++ b/sip-manual-out/rtp_tx.c	Sun May 21 15:45:52 2023 -0800
@@ -104,6 +104,13 @@
 }
 
 void
+set_pcm_fill_octet(oct)
+	unsigned oct;
+{
+	pcm_fill_octet = oct;
+}
+
+void
 send_tfo_req(sig, codec)
 	unsigned sig, codec;
 {
--- a/sip-manual-out/user_cmd.c	Sun May 21 15:33:00 2023 -0800
+++ b/sip-manual-out/user_cmd.c	Sun May 21 15:45:52 2023 -0800
@@ -10,6 +10,30 @@
 #include <strings.h>
 
 static void
+pcm_fill_cmd(arg)
+	char *arg;
+{
+	char *cp;
+	unsigned octet;
+
+	for (cp = arg; isspace(*cp); cp++)
+		;
+	if (!isxdigit(*cp)) {
+inv_syntax:	fprintf(stderr, "error: pcm-fill command invalid syntax\n");
+		return;
+	}
+	octet = strtoul(cp, &cp, 16);
+	if (*cp)
+		goto inv_syntax;
+	if (octet > 0xFF) {
+		fprintf(stderr,
+			"error: pcm-fill octet argument out of range\n");
+		return;
+	}
+	set_pcm_fill_octet(octet);
+}
+
+static void
 tfo_req_cmd(args)
 	char *args;
 {
@@ -67,6 +91,8 @@
 		send_bye_req();
 	else if (!strcmp(cp, "c") || !strcasecmp(cp, "cancel"))
 		send_cancel_req();
+	else if (!strncmp(cp, "pcm-fill", 8) && isspace(cp[8]))
+		pcm_fill_cmd(cp + 9);
 	else if (!strncmp(cp, "tfo-req", 7) && isspace(cp[7]))
 		tfo_req_cmd(cp + 8);
 	else if (!strcmp(cp, "tfo-stop"))