-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathv150_1.c
More file actions
4486 lines (4148 loc) · 157 KB
/
Copy pathv150_1.c
File metadata and controls
4486 lines (4148 loc) · 157 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* SpanDSP - a series of DSP components for telephony
*
* v150_1.c - An implementation of V.150.1.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2022, 2023 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <inttypes.h>
#include <memory.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include <spandsp/stdbool.h>
#endif
#define SPANDSP_FULLY_DEFINE_SPRT_STATE_T
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/unaligned.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/sprt.h"
#include "spandsp/v150_1.h"
#include "spandsp/v150_1_sse.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/sprt.h"
#include "spandsp/private/v150_1_sse.h"
#include "spandsp/private/v150_1.h"
#include "v150_1_local.h"
#if defined(_WIN32)
/* See the note in spandsp/private/v150_1.h. The near and far members of
v150_1_state_t are referenced by name throughout this file, so the
<windows.h> macros of those names must not be in effect here. */
#undef near
#undef far
#endif
/* Terminology
V.150.1 has several components. The terms used for these are:
Signalling state events (SSE)
An RTP payload type which encodes indications of changes between audio, FoIP, MoIP, and ToIP modes.
In SDP this is referred to as v150fw.
Simple packet relay transport (SPRT)
A hybrid unreliable plus reliable packet over UDP protocol, compatible with sending RTP to and from the
same UDP port. You can also find the term IP-TLP associated wtih this protocol. In SDP this is referred
to udpsprt.
The actual V.150.1 modem relay protocol.
These are are messages which typically pass across an SPRT transport. In SDP this is referred to as v150mr.
*/
/* A Cisco box in V.150.1 mode is quite fussy about what it receives to trigger it into a V.8 exchange with an attached
modem.
Simply sending a bunch of /ANSam RFC3733/RFC4734 packets gets you nowhere, but this does contradict what RFC4734
says.
Waiting 200ms after answer, sending 450ms of ANSam, then switching to sending /ANSam until a v150fw packet
arrives, then sending /ANSam-end, sounds compliant, but a Cisco doesn't like that. It would never happen connected
to a real modem, as it takes a while to detect ANSam, and be sure the AM part if really there. A real modem
connected to a Cisco causes the Cisco to send something like 200ms of ANSam, before the switch to /ANSam. Trying
to mimic that gets you farther.
When I failed to send /ANSam-end at the end of my tone the Cisco behaved quirkily. However, when I call into the
Cisco, it just stops sending /ANSam, and never seems to send any /ANSam-end packets.
Cisco seems to consistently accept the following as a valid ANSamPR, resulting in a v150fw CM packet being received
from the Cisco:
ANSWER
Send 40ms to several seconds of silence
Send 11 to 20 ANSam packets at 20ms per packet
22 fails, and you get an v150fw AA message, instead of a CM message. This is reasonable, as the phase
reversal is almost late, and if you consider the sending end would need some time to detect the
initial tone, its really quite late.
21 acts really quirky, and you may get nothing back. The Cisco seems to get really messed up. No RTP or
SPRT comes from it until the calling hangs up.
Values between 1 and 10 seem quirky. 10 fails, and you get an v150fw AA message, instead of a CM message.
Some values between 1 and 10 often work OK, while others give an AA.
Send sustained /ANSam at 20ms per packet, until...
..... v150fw packet received
Send 4 /ANSam end packets at 20ms intervals
*/
/* A Cisco box has the following parameters:
modem relay latency <milliseconds>
Specifies the estimated one-way delay across the IP network.
Range is 100 to 1000. Default is 200.
modem relay sse redundancy interval <milliseconds>
Specifies the timer value for redundant transmission of SSEs.
Range is 5ms to 50ms. Default is 20ms.
modem relay sse redundancy packet <number>
Specifies the SSE packet transmission count before disconnecting.
Range is 1 to 5 packets. Default is 3.
modem relay sse t1 <milliseconds>
Specifies the repeat interval, in milliseconds (ms), for initial audio SSEs used for resetting the SSE protocol state machine (clearing the call) following error recovery.
Range is 500ms to 3000ms. Default is 1000ms.
modem relay sse retries <value>
Specifies the number of SSE packet retries, repeated every t1 interval, before disconnecting.
Range is 0 to 5. Default is 5.
modem relay sprt retries <value>
Specifies the number of SPRT packet retries, repeated every t1 interval, before disconnecting.
Range is 0 to 10. Default is 10.
modem relay sprt v14 receive playback hold-time <milliseconds>
Configures the time, in ms, to hold incoming data in the V.14 receive queue.
Range is 20ms to 250ms. Default is 50ms.
modem relay sprt v14 transmit hold-time <milliseconds>
Configures the time to wait, in ms, after the first character is ready before sending
the SPRT packet.
Range is 10ms to 30ms. Default is 20ms.
modem relay sprt v14 transmit maximum hold-count <characters>
Configures the number of V.14 characters to be received on the modem interface that will
trigger sending an SPRT packet.
Range is 8 to 128. Default is 16.
*/
/*
There are two defined versions of a modem relay gateway:
U-MR: A Universal Modem Relay
A U-MR needs to support V.92 digital, V.90 digital, V.34, V.32bis, V.32, V.22bis, V.22, V.23 and V.21
V-MR: A V.8 Modem Relay
A V-MR doesn't have to support any specific set of modulations. Instead, V.8 is used to negotiate a
common one. Inter-gateway messages exchanged during call setup can be used for each end to inform the
other which modulations are supported.
The SPRT related SDP needs a entry like:
a=fmtp:120 mr=1;mg=0;CDSCselect=1;jmdelay=no;versn=1.1
mr=0 for V-MR
=1 for U-MR
mg=0 for no transcompression
=1 for single transcompression
=2 for double transcompression
CDSCselect=1 for audio RFC4733
=2 for VBD preferred
=3 for Mixed
mrmods=1-4,10-12,14,17
where 1 = V.34 duplex
2 = V.34 half-duplex
3 = V.32bis/V.32
4 = V.22bis/V.22
5 = V.17
6 = V.29
7 = V.27ter
8 = V.26ter
9 = V.26bis
10 = V.23 duplex
11 = V.23 half-duplex
12 = V.21
13 = V.90 analogue
14 = V.90 digital
15 = V/91
16 = V.92 analogue
17 = V.92 digital
jmdelay=no JM delay not supported
=yes JM delay supported
versn=1.1 This is optional. The current version is 1.1
txalgs=1 V.44 (V.42bis is always required, so is not listed in this tag)
=2 MNP5
v42bNumCodeWords=1024
v42bMaxStringLength=32
v44NumTxCodewords=1024
v44NumRxCodewords=1024
v44MaxTxStringLength=64
v44MaxRxStringLength=64
V44LenTxHistory=3072
V44LenRxHistory=3072
TCXpreference=1
=2
a=sprtparm: 140 132 132 140 32 8
These are the maximum payload sizes for the 4 channels, and the maximum window sizes for
the two reliable channels. A '$' may be used for unspecified values.
a=vndpar: <vendorIDformat> <vendorID> <vendorSpecificDataTag> <vendorSpecificData>
<vendorIDformat>=1 for T.35
=2 for IANA private enterprise number
<vendorID>
<vendorSpecificDataTag>
<vendorSpecificData>
Voice band data (VBD) mode:
|<----------------------------------- Data compression ------------------------------------->|
|<----------------------------------- Error correction ------------------------------------->|
|<-------------------------------------- Modulation ---------------------------------------->|
| |<---- Encapsulated G.711 ---->| |
| | | |
|<---------- PSTN ----------->|<-------Packet network ------>|<----------- PSTN ------------>|
The various modem relay error correction and compression scenarios:
MR1
|<----------------------------------- Data compression --- --------------------------------->|
|<---- Error correction ----->| |<----- Error correction ------>|
|<------- Modulation -------->| |<-------- Modulation --------->|
| |<---- Reliable transport ---->| |
| | | |
|<---------- PSTN ----------->|<-------Packet network ------>|<----------- PSTN ------------>|
MR2
|<---- Data compression ----->| |<----- Data compression ------>|
|<---- Error correction ----->| |<----- Error correction ------>|
|<------- Modulation -------->| |<-------- Modulation --------->|
| |<------- MR2a or MR2b ------->| |
| | | |
|<---------- PSTN ----------->|<-------Packet network ------>|<----------- PSTN ------------>|
MR2a: Reliable transport without data compression
MR2b: Reliable transport with data compression
MR3
|<---- Data compression ----->|<-------------------- Data compression ---------------------->|
|<------------------- Data compression --------------------->|<----- Data compression ------>|
|<---- Error correction -0--->| |<----- Error correction ------>|
|<------- Modulation -------->| |<-------- Modulation --------->|
| |<---- Reliable transport ---->| |
| | | |
|<--------- PSTN ------------>|<------ Packet network ------>|<----------- PSTN ------------>|
MR4
|<------------------- Data compression --------------------->|<----- Data compression ------>|
|<---- Error correction ----->| |<----- Error correction ------>|
|<------- Modulation -------->| |<-------- Modulation --------->|
| |<---- Reliable transport ---->| |
| | | |
|<---------- PSTN ----------->|<-------Packet network ------>|<----------- PSTN ------------>|
*/
/* Example call flows
Establishing Modem Relay with V.32 Modem
M1 G1 G2 M2
| | | |
| | |<-------------ANS--------------|
| |<--------RFC4733 ANS----------| |
|<------------ANS-------------| | |
| | |<------------/ANS--------------|
| |<--------RFC4733 /ANS---------| |
|<-----------/ANS-------------| | |
| | | |
| | | |
|<<----- V.32 signals ------>>| | |
| |-------SSE MR(m,a) AA-------->| |
| | |<<------ V.32 signals ------->>|
| |<------SSE MR(m,m) p'---------| |
|<<----- V.32 signals ------>>| | |
| |-----------SPRT:INIT--------->|<<------ V.32 signals ------->>|
| | | |
| |<----------SPRT:INIT----------| |
|<<----- V.32 signals ------>>| |<<------ V.32 signals ------->>|
| |<--SPRT:MR_EVENT(PHYSUPv32)---| |
| | | |
| |---SPRT:MR_EVENT(PHYSUPv32)-->| |
| | | |
| |<------SPRT:CONNECT(v32)------| |
| | | |
| |-------SPRT:CONNECT(v32)----->| |
| | | |
|<<------ V.32 data -------->>|<<-------- SPRT:data ------->>|<<-------- V.32 data -------->>|
| | | |
| | | |
Establishing Modem Relay with V.34 Modem
M1 G1 G2 M2
| | | |
| | |<-------------ANS--------------|
| |<--------RFC4733 ANS----------| |
|<-----------ANS--------------| | |
| | |<------------/ANS--------------|
| |<--------RFC4733 /ANS---------| |
|<----------/ANS--------------| | |
| | | |
|------------CM-------------->| | |
| |-----SSE MR(m,a) CM(v34)----->| |
| | |--------------CM-------------->|
| |<------SSE MR(m,m) p'---------| |
| | | |
| |-----------SPRT:INIT--------->| |
| | | |
| |<----------SPRT:INIT----------| |
| | |<-------------JM---------------|
| |<-----SPRT:JM_INFO(v34)-------| |
|<-----------JM---------------| | |
| | | |
|<<----- V.34 signals ------>>| |<<------ V.34 signals ------->>|
| |<--SPRT:MR_EVENT(PHYSUPv34)---| |
| | | |
| |---SPRT:MR_EVENT(PHYSUPv34)-->| |
| | | |
| |<------SPRT:CONNECT(v34)------| |
| | | |
| |-------SPRT:CONNECT(v34)----->| |
| | | |
|<<------ V.34 data -------->>|<<-------- SPRT:data ------->>|<<-------- V.34 data -------->>|
| | | |
| | | |
Establishing Modem Relay with ITU V.34 Modem with no JM_INFO Message Sent from G2 Gateway
M1 G1 G2 M2
| | | |
| | |<-------------ANS--------------|
| |<--------RFC4733 ANS----------| |
|<-----------ANS--------------| | |
| | |<------------/ANS--------------|
| |<--------RFC4733 /ANS---------| |
|<----------/ANS--------------| | |
| | | |
|------------CM-------------->| | |
| |-----SSE MR(m,a) CM(v34)----->| |
|<-----------JM---------------| |--------------CM-------------->|
| |<------SSE MR(m,m) p'---------| |
| | | |
| |-----------SPRT:INIT--------->| |
| | | |
| |<----------SPRT:INIT----------| |
| | |<-------------JM---------------|
| | | |
|<<----- V.34 signals ------>>| |<<------ V.34 signals ------->>|
| |<--SPRT:MR_EVENT(PHYSUPv34)---| |
| | | |
| |---SPRT:MR_EVENT(PHYSUPv34)-->| |
| | | |
| |<------SPRT:CONNECT(v34)------| |
| | | |
| |-------SPRT:CONNECT(v34)----->| |
| | | |
|<<------- V.34 data ------->>|<<-------- SPRT:data ------->>|<<-------- V.34 data -------->>|
| | | |
| | | |
Establishing Modem Relay with ITU V.90 Modem
M1 G1 G2 M2
| | | |
| | |<-------------ANS--------------|
| |<--------RFC4733 ANS----------| |
|<------------ANS-------------| | |
| | |<------------/ANS--------------|
| |<--------RFC4733 /ANS---------| |
|<-----------/ANS-------------| | |
| | | |
|-------------CM------------->| | |
| |--SSE MR(m,a) CM(v90 or v92)->| |
| ` | |--------------CM-------------->|
| |<------SSE MR(m,m) p'---------| |
| | | |
| |-----------SPRT:INIT--------->| |
| | | |
| |<----------SPRT:INIT----------| |
| | |<-------------JM---------------|
| |<--SPRT:JM_INFO (v90 or v92)--| |
|<------------JM--------------| | |
| | | |
|<<----- V.90 signals ------>>| |<<------ V.90 signals ------->>|
| |<--SPRT:MR_EVENT(PHYSUPv90)---| |
| | | |
| |<------SPRT:CONNECT(v90)------| |
| | | |
| |---SPRT:MR_EVENT(PHYSUPv90)-->| |
| | | |
| |-------SPRT:CONNECT(v90)----->| |
| | | |
|<<------- V.90 data ------->>|<<-------- SPRT:data ------->>|<<-------- V.90 data -------->>|
| | | |
| | | |
Establishing Modem Relay with ITU V.92 Modem
M1 G1 G2 M2
| | | |
| | |<--------------ANS-------------|
| |<--------RFC4733 ANS----------| |
|<------------ANS-------------| | |
| | |<-------------/ANS-------------|
| |<--------RFC4733 /ANS---------| |
|<-----------/ANS-------------| | |
| | | |
|-------------CM------------->| | |
| |--SSE MR(m,a) CM(v90 or v92)->| |
| | |---------------CM------------->|
| |<------SSE MR(m,m) p'---------| |
| | | |
| |-----------SPRT:INIT--------->| |
| | | |
| |<----------SPRT:INIT----------| |
| | |<--------------JM--------------|
| |<--SPRT:JM_INFO (v90 or v92)--| |
|<------------JM--------------| | |
| | | |
|<<----- V.92 signals ------>>| |<<------- V.92 signals ------>>|
| |<--SPRT:MR_EVENT(PHYSUPv92)---| |
| | | |
| |<------SPRT:CONNECT(v92)------| |
| | | |
| |---SPRT:MR_EVENT(PHYSUPv92)-->| |
| | | |
| |-------SPRT:CONNECT(v90)----->| |
| | | |
|<<------- V.92 data ------->>|<<-------- SPRT:data ------->>|<<-------- V.92 data -------->>|
| | | |
| | | |
*/
/*
telephone network
^
|
|
v
+-----------------------------------+
| |
| Signal processing entity (SPE) |
| |
+-----------------------------------+
| ^
| |
Signal list 1 | | Signal list 2
| |
v |
+-----------------------------------+ Signal list 5 +-----------------------------------+
| | ----------------->| |
| SSE protocol state machine (P) | | Gateway state machine (s,s') |
| |<------------------| |
+-----------------------------------+ Signal list 6 +-----------------------------------+
| ^
| |
Signal list 3 | | Signal list 4
| |
v |
+-----------------------------------+
| |
| IP network processor |
| |
+-----------------------------------+
^
|
|
v
IP network
*/
/*
Table 31/V.150.1 - MoIP initial modes.
<<<<<<<< Additional modes supported >>>>>>>> Starting mode
FoIP (T.38) and/or ToIP (V.151) VoIP
-----------------------------------------------------------------------------
No No MoIP
No Yes VoIP
Yes No MoIP
Yes Yes VoIP
*/
/* Used to verify if a message type is compatible with the transmission
control channel it arrives on */
static uint8_t channel_check[25] =
{
0x0F, /* V150_1_MSGID_NULL */
0x04, /* V150_1_MSGID_INIT */
0x04, /* V150_1_MSGID_XID_XCHG */
0x04, /* V150_1_MSGID_JM_INFO */
0x04, /* V150_1_MSGID_START_JM */
0x04, /* V150_1_MSGID_CONNECT */
0x0F, /* V150_1_MSGID_BREAK */
0x0F, /* V150_1_MSGID_BREAKACK */
0x04, /* V150_1_MSGID_MR_EVENT */
0x04, /* V150_1_MSGID_CLEARDOWN */
0x04, /* V150_1_MSGID_PROF_XCHG */
0x00, /* Reserved (11) */
0x00, /* Reserved (12) */
0x00, /* Reserved (13) */
0x00, /* Reserved (14) */
0x00, /* Reserved (15) */
0x0A, /* V150_1_MSGID_I_RAW_OCTET */
0x0A, /* V150_1_MSGID_I_RAW_BIT (optional) */
0x0A, /* V150_1_MSGID_I_OCTET */
0x0A, /* V150_1_MSGID_I_CHAR_STAT (optional) */
0x0A, /* V150_1_MSGID_I_CHAR_DYN (optional) */
0x0A, /* V150_1_MSGID_I_FRAME (optional) */
0x0A, /* V150_1_MSGID_I_OCTET_CS (optional) (this only makes sense for the SPRT_TCID_UNRELIABLE_SEQUENCED channel) */
0x0A, /* V150_1_MSGID_I_CHAR_STAT_CS (optional) (this only makes sense for the SPRT_TCID_UNRELIABLE_SEQUENCED channel) */
0x0A /* V150_1_MSGID_I_CHAR_DYN_CS (optional) (this only makes sense for the SPRT_TCID_UNRELIABLE_SEQUENCED channel) */
};
static struct
{
uint16_t min_payload_bytes;
uint16_t max_payload_bytes;
} channel_parm_limits[SPRT_CHANNELS] =
{
{
SPRT_MIN_TC0_PAYLOAD_BYTES,
SPRT_MAX_TC0_PAYLOAD_BYTES
},
{
SPRT_MIN_TC1_PAYLOAD_BYTES,
SPRT_MAX_TC1_PAYLOAD_BYTES
},
{
SPRT_MIN_TC2_PAYLOAD_BYTES,
SPRT_MAX_TC2_PAYLOAD_BYTES
},
{
SPRT_MIN_TC3_PAYLOAD_BYTES,
SPRT_MAX_TC3_PAYLOAD_BYTES
}
};
static span_timestamp_t update_call_discrimination_timer(v150_1_state_t *s, span_timestamp_t timeout);
SPAN_DECLARE(const char *) v150_1_msg_id_to_str(int msg_id)
{
const char *res;
res = "unknown";
switch (msg_id)
{
case V150_1_MSGID_NULL:
res = "NULL";
break;
case V150_1_MSGID_INIT:
res = "INIT";
break;
case V150_1_MSGID_XID_XCHG:
res = "XID xchg";
break;
case V150_1_MSGID_JM_INFO:
res = "JM info";
break;
case V150_1_MSGID_START_JM:
res = "Start JM";
break;
case V150_1_MSGID_CONNECT:
res = "Connect";
break;
case V150_1_MSGID_BREAK:
res = "Break";
break;
case V150_1_MSGID_BREAKACK:
res = "Break ack";
break;
case V150_1_MSGID_MR_EVENT:
res = "MR event";
break;
case V150_1_MSGID_CLEARDOWN:
res = "Cleardown";
break;
case V150_1_MSGID_PROF_XCHG:
res = "Prof xchg";
break;
case V150_1_MSGID_I_RAW_OCTET:
res = "I raw octet";
break;
case V150_1_MSGID_I_RAW_BIT:
res = "I raw bit";
break;
case V150_1_MSGID_I_OCTET:
res = "I octet";
break;
case V150_1_MSGID_I_CHAR_STAT:
res = "I char stat";
break;
case V150_1_MSGID_I_CHAR_DYN:
res = "I char dyn";
break;
case V150_1_MSGID_I_FRAME:
res = "I frame";
break;
case V150_1_MSGID_I_OCTET_CS:
res = "I octet cs";
break;
case V150_1_MSGID_I_CHAR_STAT_CS:
res = "I char stat cs";
break;
case V150_1_MSGID_I_CHAR_DYN_CS:
res = "I char dyn cs";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_data_bits_to_str(int code)
{
const char *res;
res = "unknown";
switch (code)
{
case V150_1_DATA_BITS_5:
res = "5 bits";
break;
case V150_1_DATA_BITS_6:
res = "6 bits";
break;
case V150_1_DATA_BITS_7:
res = "7 bits";
break;
case V150_1_DATA_BITS_8:
res = "8 bits";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_parity_to_str(int code)
{
const char *res;
res = "unknown";
switch (code)
{
case V150_1_PARITY_UNKNOWN:
res = "unknown";
break;
case V150_1_PARITY_NONE:
res = "none";
break;
break;
case V150_1_PARITY_EVEN:
res = "even";
break;
case V150_1_PARITY_ODD:
res = "odd";
break;
case V150_1_PARITY_SPACE:
res = "space";
break;
case V150_1_PARITY_MARK:
res = "mark";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_stop_bits_to_str(int code)
{
const char *res;
res = "unknown";
switch (code)
{
case V150_1_STOP_BITS_1:
res = "1 bit";
break;
case V150_1_STOP_BITS_2:
res = "2 bits";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_mr_event_type_to_str(int type)
{
const char *res;
res = "unknown";
switch (type)
{
case V150_1_MR_EVENT_ID_NULL:
res = "NULL";
break;
case V150_1_MR_EVENT_ID_RATE_RENEGOTIATION:
res = "Renegotiation";
break;
case V150_1_MR_EVENT_ID_RETRAIN:
res = "Retrain";
break;
case V150_1_MR_EVENT_ID_PHYSUP:
res = "Physically up";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_cleardown_reason_to_str(int type)
{
const char *res;
res = "unknown";
switch (type)
{
case V150_1_CLEARDOWN_REASON_UNKNOWN:
res = "Unknown";
break;
case V150_1_CLEARDOWN_REASON_PHYSICAL_LAYER_RELEASE:
res = "Physical layer release";
break;
case V150_1_CLEARDOWN_REASON_LINK_LAYER_DISCONNECT:
res = "Link layer disconnect";
break;
case V150_1_CLEARDOWN_REASON_DATA_COMPRESSION_DISCONNECT:
res = "Data compression disconnect";
break;
case V150_1_CLEARDOWN_REASON_ABORT:
res = "Abort";
break;
case V150_1_CLEARDOWN_REASON_ON_HOOK:
res = "On hook";
break;
case V150_1_CLEARDOWN_REASON_NETWORK_LAYER_TERMINATION:
res = "Network layer termination";
break;
case V150_1_CLEARDOWN_REASON_ADMINISTRATIVE:
res = "Administrative";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_symbol_rate_to_str(int code)
{
const char *res;
res = "unknown";
switch (code)
{
case V150_1_SYMBOL_RATE_NULL:
res = "NULL";
break;
case V150_1_SYMBOL_RATE_600:
res = "600 baud";
break;
case V150_1_SYMBOL_RATE_1200:
res = "1200 baud";
break;
case V150_1_SYMBOL_RATE_1600:
res = "1600 baud";
break;
case V150_1_SYMBOL_RATE_2400:
res = "2400 baud";
break;
case V150_1_SYMBOL_RATE_2743:
res = "2743 baud";
break;
case V150_1_SYMBOL_RATE_3000:
res = "3000 baud";
break;
case V150_1_SYMBOL_RATE_3200:
res = "3200 baud";
break;
case V150_1_SYMBOL_RATE_3429:
res = "3429 baud";
break;
case V150_1_SYMBOL_RATE_8000:
res = "8000 baud";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_modulation_to_str(int modulation)
{
const char *res;
res = "unknown";
switch (modulation)
{
case V150_1_SELMOD_NULL:
res = "NULL";
break;
case V150_1_SELMOD_V92:
res = "V.92";
break;
case V150_1_SELMOD_V91:
res = "V.91";
break;
case V150_1_SELMOD_V90:
res = "V90";
break;
case V150_1_SELMOD_V34:
res = "V.34";
break;
case V150_1_SELMOD_V32bis:
res = "V.32bis";
break;
case V150_1_SELMOD_V32:
res = "V.32";
break;
case V150_1_SELMOD_V22bis:
res = "V.22bis";
break;
case V150_1_SELMOD_V22:
res = "V.22";
break;
case V150_1_SELMOD_V17:
res = "V.17";
break;
case V150_1_SELMOD_V29:
res = "V.29";
break;
case V150_1_SELMOD_V27ter:
res = "V.27ter";
break;
case V150_1_SELMOD_V26ter:
res = "V.26ter";
break;
case V150_1_SELMOD_V26bis:
res = "V.26bis";
break;
case V150_1_SELMOD_V23:
res = "V.23";
break;
case V150_1_SELMOD_V21:
res = "V.21";
break;
case V150_1_SELMOD_BELL212:
res = "Bell 212";
break;
case V150_1_SELMOD_BELL103:
res = "Bell 103";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_compression_to_str(int compression)
{
const char *res;
res = "unknown";
switch (compression)
{
case V150_1_COMPRESSION_NONE:
res = "None";
break;
case V150_1_COMPRESSION_V42BIS:
res = "V.42bis";
break;
case V150_1_COMPRESSION_V44:
res = "V.44";
break;
case V150_1_COMPRESSION_MNP5:
res = "MNP5";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_compression_direction_to_str(int direction)
{
const char *res;
res = "unknown";
switch (direction)
{
case V150_1_COMPRESS_NEITHER_WAY:
res = "Neither way";
break;
case V150_1_COMPRESS_TX_ONLY:
res = "Tx only";
break;
case V150_1_COMPRESS_RX_ONLY:
res = "Rx only";
break;
case V150_1_COMPRESS_BIDIRECTIONAL:
res = "Bidirectional";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_error_correction_to_str(int correction)
{
const char *res;
res = "unknown";
switch (correction)
{
case V150_1_ERROR_CORRECTION_NONE:
res = "None";
break;
case V150_1_ERROR_CORRECTION_V42_LAPM:
res = "V.42 LAPM";
break;
case V150_1_ERROR_CORRECTION_V42_ANNEX_A:
res = "V.42 annex A";
break;
}
/*endswitch*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) v150_1_break_source_to_str(int source)
{
const char *res;
res = "unknown";
switch (source)
{