annotate sip-manual-out/rtp_rx.c @ 192:f8a33603288f

sip-manual-out: generate outgoing RTP stream with PCM silence
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 17 Mar 2023 13:45:31 -0800
parents sip-manual-out/rtp.c@62ecc0aa081f
children 834656633fa0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
187
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we implement our RTP handling: obtaining a PSTN-side
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * RTP endpoint from themwi-rtp-mgr, then handling read select on RTP
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * and RTCP UDP sockets.
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <sys/types.h>
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <sys/socket.h>
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <netinet/in.h>
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdio.h>
188
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
11 #include <stdint.h>
187
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <stdlib.h>
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <string.h>
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include <strings.h>
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include "../include/tmgw_const.h"
188
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
16 #include "../include/rtp_defs.h"
187
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #include "../librtpalloc/rtp_alloc_simple.h"
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 struct sockaddr_in rtp_local_addr;
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 int rtp_udp_fd, rtcp_udp_fd;
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
188
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
22 static int rtp_start_flag, rtp_bad_flag, rtp_ssrc_chg_flag;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
23 static int rtp_seq_brk_flag, rtp_seq_zero_flag, rtp_seq_neg_flag;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
24 static int rtp_ts_brk_flag;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
25 static uint32_t rtp_ssrc;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
26 static uint32_t rtp_last_ts;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
27 static uint16_t rtp_last_seq;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
28 static int got_some_rtcp;
187
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
30 static const uint8_t hdr_pattern[20] = {0, 1, 0, 1, 0, 1, 1, 0, 1, 0,
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
31 0, 1, 1, 0, 1, 0, 1, 0, 0, 1};
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
32
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
33 static uint8_t is_hunt_buf[320];
190
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
34 static int is_state;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
35 static unsigned is_offset, is_bit_count;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
36 static uint32_t is_rx_word;
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
37
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
38 static void
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
39 reset_is_hunt()
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
40 {
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
41 memset(is_hunt_buf, 0xFF, 320);
190
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
42 is_state = 0;
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
43 }
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
44
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
45 static void
190
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
46 is_rx_hunt(input_pos)
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
47 unsigned input_pos;
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
48 {
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
49 unsigned offset, n;
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
50
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
51 for (offset = 0; offset < 16; offset++) {
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
52 for (n = 0; n < 20; n++)
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
53 if ((is_hunt_buf[offset + n*16] & 1) != hdr_pattern[n])
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
54 break;
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
55 if (n == 20)
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
56 break;
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
57 }
190
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
58 if (n != 20)
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
59 return;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
60 printf("Found IS_Header, last bit offset %u\n",
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
61 input_pos * 16 + offset);
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
62 is_offset = offset;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
63 is_state = 1;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
64 is_bit_count = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
65 is_rx_word = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
66 }
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
67
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
68 static void
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
69 is_process_cmd()
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
70 {
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
71 int cont;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
72
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
73 printf("IS_Command: 0x%03X", is_rx_word);
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
74 switch (is_rx_word) {
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
75 case 0x05D:
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
76 printf(" (REQ)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
77 cont = 1;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
78 break;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
79 case 0x0BA:
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
80 printf(" (ACK)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
81 cont = 1;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
82 break;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
83 case 0x0E7:
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
84 printf(" (IPE)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
85 cont = 1;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
86 break;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
87 case 0x129:
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
88 printf(" (FILL)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
89 cont = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
90 break;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
91 case 0x174:
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
92 printf(" (DUP)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
93 cont = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
94 break;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
95 case 0x193:
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
96 printf(" (SYL)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
97 cont = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
98 break;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
99 default:
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
100 printf(" (bad)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
101 cont = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
102 }
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
103 if (cont) {
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
104 is_state = 2;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
105 is_bit_count = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
106 is_rx_word = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
107 } else
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
108 is_state = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
109 }
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
110
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
111 static void
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
112 is_process_ext()
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
113 {
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
114 printf("IS_Extension: 0x%05X", is_rx_word);
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
115 if (is_rx_word & 0x80200) {
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
116 printf(" (bad sync)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
117 is_state = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
118 return;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
119 }
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
120 switch (is_rx_word & 3) {
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
121 case 0:
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
122 printf(" (final)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
123 is_state = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
124 return;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
125 case 3:
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
126 printf(" (continue)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
127 is_state = 2;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
128 is_bit_count = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
129 is_rx_word = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
130 return;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
131 default:
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
132 printf(" (bad EX)\n");
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
133 is_state = 0;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
134 }
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
135 }
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
136
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
137 static void
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
138 is_rx_process(input, input_pos)
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
139 uint8_t *input;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
140 unsigned input_pos;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
141 {
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
142 unsigned new_bit;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
143
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
144 memmove(is_hunt_buf, is_hunt_buf + 16, 304);
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
145 memcpy(is_hunt_buf + 304, input, 16);
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
146 if (!is_state) {
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
147 is_rx_hunt(input_pos);
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
148 return;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
149 }
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
150 new_bit = input[is_offset] & 1;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
151 is_rx_word <<= 1;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
152 is_rx_word |= new_bit;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
153 is_bit_count++;
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
154 if (is_state == 1 && is_bit_count == 10)
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
155 is_process_cmd();
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
156 else if (is_state == 2 && is_bit_count == 20)
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
157 is_process_ext();
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
158 }
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
159
187
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 void
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 obtain_rtp_endp()
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 {
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 int rc;
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 struct rtp_alloc_simple res;
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 rc = rtp_alloc_simple(TMGW_EP_TYPE_PSTN_ONLY, &res);
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 if (rc < 0)
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 exit(1); /* error msg already printed */
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 bcopy(&res.pstn_addr, &rtp_local_addr, sizeof(struct sockaddr_in));
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 rtp_udp_fd = res.pstn_rtp_fd;
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 rtcp_udp_fd = res.pstn_rtcp_fd;
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
172 reset_is_hunt();
187
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 }
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 void
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 rtp_rx_select()
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 {
188
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
178 struct rtp_packet pkt;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
179 struct sockaddr_in sin_from;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
180 socklen_t addrlen;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
181 int16_t seq_delta;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
182 int32_t ts_delta;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
183 int rc;
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
184 unsigned is_chunk;
187
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185
188
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
186 addrlen = sizeof(struct sockaddr_in);
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
187 rc = recvfrom(rtp_udp_fd, &pkt, sizeof pkt, 0,
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
188 (struct sockaddr *) &sin_from, &addrlen);
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
189 if (rc < 0)
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
190 return;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
191 if (rc != RTP_PACKET_SIZE_PSTN) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
192 bad_rtp_pkt: if (!rtp_bad_flag) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
193 printf("Got a bad RTP packet\n");
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
194 rtp_bad_flag = 1;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
195 }
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
196 return;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
197 }
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
198 if (pkt.v_p_x_cc != 0x80)
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
199 goto bad_rtp_pkt;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
200 switch (pkt.m_pt & 0x7F) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
201 case PSTN_CODEC_PCMU:
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
202 case PSTN_CODEC_PCMA:
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
203 break;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
204 default:
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
205 goto bad_rtp_pkt;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
206 }
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
207 if (rtp_start_flag && pkt.ssrc != rtp_ssrc) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
208 if (!rtp_ssrc_chg_flag) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
209 printf("Rx RTP stream changed SSRC\n");
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
210 rtp_ssrc_chg_flag = 1;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
211 }
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
212 reset_is_hunt();
188
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
213 } else if (rtp_start_flag) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
214 seq_delta = ntohs(pkt.seq) - rtp_last_seq;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
215 ts_delta = ntohl(pkt.tstamp) - rtp_last_ts;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
216 if (seq_delta == 0) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
217 if (!rtp_seq_zero_flag) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
218 printf("Rx RTP seq zero increment\n");
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
219 rtp_seq_zero_flag = 1;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
220 }
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
221 return;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
222 }
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
223 if (seq_delta < 0) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
224 if (!rtp_seq_neg_flag) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
225 printf("Rx RTP seq negative increment\n");
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
226 rtp_seq_neg_flag = 1;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
227 }
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
228 return;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
229 }
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
230 if (seq_delta != 1) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
231 if (!rtp_seq_brk_flag) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
232 printf("Rx RTP stream seq break\n");
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
233 rtp_seq_brk_flag = 1;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
234 }
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
235 reset_is_hunt();
188
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
236 } else if (ts_delta != 160) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
237 if (!rtp_ts_brk_flag) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
238 printf("Rx RTP stream tstamp break\n");
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
239 rtp_ts_brk_flag = 1;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
240 }
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
241 reset_is_hunt();
188
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
242 }
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
243 }
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
244 rtp_ssrc = pkt.ssrc;
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
245 rtp_last_ts = ntohl(pkt.tstamp);
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
246 rtp_last_seq = ntohs(pkt.seq);
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
247 if (!rtp_start_flag) {
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
248 printf("Rx RTP stream begins with seq=%u ts=%u\n",
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
249 rtp_last_seq, rtp_last_ts);
6aecee01cf0a sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents: 187
diff changeset
250 rtp_start_flag = 1;
187
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 }
189
1266e024de6c sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents: 188
diff changeset
252 for (is_chunk = 0; is_chunk < 10; is_chunk++)
190
62ecc0aa081f sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents: 189
diff changeset
253 is_rx_process(pkt.payload + is_chunk * 16, is_chunk);
187
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 }
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 void
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 rtcp_rx_select()
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 {
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 u_char buf[512];
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 recv(rtcp_udp_fd, buf, sizeof buf, 0);
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 if (!got_some_rtcp) {
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 printf("Got some RTCP\n");
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 got_some_rtcp = 1;
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 }
258932879f8b sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 }