FreeCalypso > hg > themwi-system-sw
annotate sip-manual-out/rtp_rx.c @ 203:e89619893c1e
sip-out: require minimum of 7 digits for E.164 numbers
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 04 Apr 2023 21:09:50 -0800 |
parents | 834656633fa0 |
children |
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; |
200
834656633fa0
sip-manual-out TFO: use is_hunt_fill mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
192
diff
changeset
|
35 static unsigned is_offset, is_bit_count, is_hunt_fill; |
190
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 { |
190
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
41 is_state = 0; |
200
834656633fa0
sip-manual-out TFO: use is_hunt_fill mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
192
diff
changeset
|
42 is_hunt_fill = 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; |
200
834656633fa0
sip-manual-out TFO: use is_hunt_fill mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
192
diff
changeset
|
66 is_hunt_fill = 0; |
190
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 |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
69 static void |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
70 is_process_cmd() |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
71 { |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
72 int cont; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
73 |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
74 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
|
75 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
|
76 case 0x05D: |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
77 printf(" (REQ)\n"); |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
78 cont = 1; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
79 break; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
80 case 0x0BA: |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
81 printf(" (ACK)\n"); |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
82 cont = 1; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
83 break; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
84 case 0x0E7: |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
85 printf(" (IPE)\n"); |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
86 cont = 1; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
87 break; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
88 case 0x129: |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
89 printf(" (FILL)\n"); |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
90 cont = 0; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
91 break; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
92 case 0x174: |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
93 printf(" (DUP)\n"); |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
94 cont = 0; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
95 break; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
96 case 0x193: |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
97 printf(" (SYL)\n"); |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
98 cont = 0; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
99 break; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
100 default: |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
101 printf(" (bad)\n"); |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
102 cont = 0; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
103 } |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
104 if (cont) { |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
105 is_state = 2; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
106 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
|
107 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
|
108 } else |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
109 is_state = 0; |
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 |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
112 static void |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
113 is_process_ext() |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
114 { |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
115 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
|
116 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
|
117 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
|
118 is_state = 0; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
119 return; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
120 } |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
121 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
|
122 case 0: |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
123 printf(" (final)\n"); |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
124 is_state = 0; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
125 return; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
126 case 3: |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
127 printf(" (continue)\n"); |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
128 is_state = 2; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
129 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
|
130 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
|
131 return; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
132 default: |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
133 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
|
134 is_state = 0; |
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 |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
138 static void |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
139 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
|
140 uint8_t *input; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
141 unsigned input_pos; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
142 { |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
143 unsigned new_bit; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
144 |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
145 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
|
146 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
|
147 if (!is_state) { |
200
834656633fa0
sip-manual-out TFO: use is_hunt_fill mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
192
diff
changeset
|
148 if (is_hunt_fill < 20) |
834656633fa0
sip-manual-out TFO: use is_hunt_fill mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
192
diff
changeset
|
149 is_hunt_fill++; |
834656633fa0
sip-manual-out TFO: use is_hunt_fill mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
192
diff
changeset
|
150 if (is_hunt_fill == 20) |
834656633fa0
sip-manual-out TFO: use is_hunt_fill mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
192
diff
changeset
|
151 is_rx_hunt(input_pos); |
190
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
152 return; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
153 } |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
154 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
|
155 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
|
156 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
|
157 is_bit_count++; |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
158 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
|
159 is_process_cmd(); |
62ecc0aa081f
sip-manual-out: add state machine for capturing full IS messages
Mychaela Falconia <falcon@freecalypso.org>
parents:
189
diff
changeset
|
160 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
|
161 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
|
162 } |
1266e024de6c
sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents:
188
diff
changeset
|
163 |
187
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 void |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 obtain_rtp_endp() |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 { |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 int rc; |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 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
|
169 |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 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
|
171 if (rc < 0) |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 } |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 void |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 rtp_rx_select() |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 { |
188
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
182 struct rtp_packet pkt; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
183 struct sockaddr_in sin_from; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
184 socklen_t addrlen; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
185 int16_t seq_delta; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
186 int32_t ts_delta; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
187 int rc; |
189
1266e024de6c
sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents:
188
diff
changeset
|
188 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
|
189 |
188
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
190 addrlen = sizeof(struct sockaddr_in); |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
191 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
|
192 (struct sockaddr *) &sin_from, &addrlen); |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
193 if (rc < 0) |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
194 return; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
195 if (rc != RTP_PACKET_SIZE_PSTN) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
196 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
|
197 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
|
198 rtp_bad_flag = 1; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
199 } |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
200 return; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
201 } |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
202 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
|
203 goto bad_rtp_pkt; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
204 switch (pkt.m_pt & 0x7F) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
205 case PSTN_CODEC_PCMU: |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
206 case PSTN_CODEC_PCMA: |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
207 break; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
208 default: |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
209 goto bad_rtp_pkt; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
210 } |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
211 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
|
212 if (!rtp_ssrc_chg_flag) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
213 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
|
214 rtp_ssrc_chg_flag = 1; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
215 } |
189
1266e024de6c
sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents:
188
diff
changeset
|
216 reset_is_hunt(); |
188
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
217 } else if (rtp_start_flag) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
218 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
|
219 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
|
220 if (seq_delta == 0) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
221 if (!rtp_seq_zero_flag) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
222 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
|
223 rtp_seq_zero_flag = 1; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
224 } |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
225 return; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
226 } |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
227 if (seq_delta < 0) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
228 if (!rtp_seq_neg_flag) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
229 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
|
230 rtp_seq_neg_flag = 1; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
231 } |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
232 return; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
233 } |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
234 if (seq_delta != 1) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
235 if (!rtp_seq_brk_flag) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
236 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
|
237 rtp_seq_brk_flag = 1; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
238 } |
189
1266e024de6c
sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents:
188
diff
changeset
|
239 reset_is_hunt(); |
188
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
240 } else if (ts_delta != 160) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
241 if (!rtp_ts_brk_flag) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
242 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
|
243 rtp_ts_brk_flag = 1; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
244 } |
189
1266e024de6c
sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents:
188
diff
changeset
|
245 reset_is_hunt(); |
188
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
246 } |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
247 } |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
248 rtp_ssrc = pkt.ssrc; |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
249 rtp_last_ts = ntohl(pkt.tstamp); |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
250 rtp_last_seq = ntohs(pkt.seq); |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
251 if (!rtp_start_flag) { |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
252 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
|
253 rtp_last_seq, rtp_last_ts); |
6aecee01cf0a
sip-manual-out: add RTP stream continuity analysis
Mychaela Falconia <falcon@freecalypso.org>
parents:
187
diff
changeset
|
254 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
|
255 } |
189
1266e024de6c
sip-manual-out: implement hunt for IS_Header in Rx RTP
Mychaela Falconia <falcon@freecalypso.org>
parents:
188
diff
changeset
|
256 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
|
257 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
|
258 } |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
259 |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 void |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 rtcp_rx_select() |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 { |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 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
|
264 |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 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
|
266 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
|
267 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
|
268 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
|
269 } |
258932879f8b
sip-manual-out: rework for internal RTP handling, using themwi-rtp-mgr
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 } |