comparison 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
comparison
equal deleted inserted replaced
211:fbfa72b114e8 212:b3aeacc5722a
6 #include <ctype.h> 6 #include <ctype.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <strings.h> 10 #include <strings.h>
11
12 static void
13 pcm_fill_cmd(arg)
14 char *arg;
15 {
16 char *cp;
17 unsigned octet;
18
19 for (cp = arg; isspace(*cp); cp++)
20 ;
21 if (!isxdigit(*cp)) {
22 inv_syntax: fprintf(stderr, "error: pcm-fill command invalid syntax\n");
23 return;
24 }
25 octet = strtoul(cp, &cp, 16);
26 if (*cp)
27 goto inv_syntax;
28 if (octet > 0xFF) {
29 fprintf(stderr,
30 "error: pcm-fill octet argument out of range\n");
31 return;
32 }
33 set_pcm_fill_octet(octet);
34 }
11 35
12 static void 36 static void
13 tfo_req_cmd(args) 37 tfo_req_cmd(args)
14 char *args; 38 char *args;
15 { 39 {
65 return; 89 return;
66 if (!strcmp(cp, "b") || !strcasecmp(cp, "bye")) 90 if (!strcmp(cp, "b") || !strcasecmp(cp, "bye"))
67 send_bye_req(); 91 send_bye_req();
68 else if (!strcmp(cp, "c") || !strcasecmp(cp, "cancel")) 92 else if (!strcmp(cp, "c") || !strcasecmp(cp, "cancel"))
69 send_cancel_req(); 93 send_cancel_req();
94 else if (!strncmp(cp, "pcm-fill", 8) && isspace(cp[8]))
95 pcm_fill_cmd(cp + 9);
70 else if (!strncmp(cp, "tfo-req", 7) && isspace(cp[7])) 96 else if (!strncmp(cp, "tfo-req", 7) && isspace(cp[7]))
71 tfo_req_cmd(cp + 8); 97 tfo_req_cmd(cp + 8);
72 else if (!strcmp(cp, "tfo-stop")) 98 else if (!strcmp(cp, "tfo-stop"))
73 stop_tfo_out(); 99 stop_tfo_out();
74 else 100 else