diff sip-manual-out/user_cmd.c @ 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 f3164f732b84
children
line wrap: on
line diff
--- 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"))