forked from signalwire/freeswitch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitch_types.h
More file actions
2873 lines (2574 loc) · 93.8 KB
/
Copy pathswitch_types.h
File metadata and controls
2873 lines (2574 loc) · 93.8 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
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2015, Anthony Minessale II <[email protected]>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <[email protected]>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <[email protected]>
* Bret McDanel <trixter AT 0xdecafbad dot com>
* Joseph Sullivan <[email protected]>
* Raymond Chandler <[email protected]>
* Emmanuel Schmidbauer <[email protected]>
* Andrey Volk <[email protected]>
*
* switch_types.h -- Data Types
*
*/
/*! \file switch_types.h
\brief Data Types
*/
#ifndef SWITCH_TYPES_H
#define SWITCH_TYPES_H
#include <switch.h>
#include <switch_json.h>
#include <switch_vpx.h>
SWITCH_BEGIN_EXTERN_C
#define SWITCH_ENT_ORIGINATE_DELIM ":_:"
#define SWITCH_BLANK_STRING ""
#define SWITCH_TON_UNDEF 255
#define SWITCH_NUMPLAN_UNDEF 255
#ifdef WIN32
#define SWITCH_SEQ_FWHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
#define SWITCH_SEQ_FRED FOREGROUND_RED | FOREGROUND_INTENSITY
#define SWITCH_SEQ_FMAGEN FOREGROUND_BLUE | FOREGROUND_RED
#define SWITCH_SEQ_FCYAN FOREGROUND_GREEN | FOREGROUND_BLUE
#define SWITCH_SEQ_FGREEN FOREGROUND_GREEN
#define SWITCH_SEQ_FYELLOW FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY
#define SWITCH_SEQ_DEFAULT_COLOR SWITCH_SEQ_FWHITE
#else
#define SWITCH_SEQ_ESC "\033["
/* Ansi Control character suffixes */
#define SWITCH_SEQ_HOME_CHAR 'H'
#define SWITCH_SEQ_HOME_CHAR_STR "H"
#define SWITCH_SEQ_CLEARLINE_CHAR '1'
#define SWITCH_SEQ_CLEARLINE_CHAR_STR "1"
#define SWITCH_SEQ_CLEARLINEEND_CHAR "K"
#define SWITCH_SEQ_CLEARSCR_CHAR0 '2'
#define SWITCH_SEQ_CLEARSCR_CHAR1 'J'
#define SWITCH_SEQ_CLEARSCR_CHAR "2J"
#define SWITCH_SEQ_DEFAULT_COLOR SWITCH_SEQ_ESC SWITCH_SEQ_END_COLOR /* Reset to Default fg/bg color */
#define SWITCH_SEQ_AND_COLOR ";" /* To add multiple color definitions */
#define SWITCH_SEQ_END_COLOR "m" /* To end color definitions */
/* Foreground colors values */
#define SWITCH_SEQ_F_BLACK "30"
#define SWITCH_SEQ_F_RED "31"
#define SWITCH_SEQ_F_GREEN "32"
#define SWITCH_SEQ_F_YELLOW "33"
#define SWITCH_SEQ_F_BLUE "34"
#define SWITCH_SEQ_F_MAGEN "35"
#define SWITCH_SEQ_F_CYAN "36"
#define SWITCH_SEQ_F_WHITE "37"
/* Background colors values */
#define SWITCH_SEQ_B_BLACK "40"
#define SWITCH_SEQ_B_RED "41"
#define SWITCH_SEQ_B_GREEN "42"
#define SWITCH_SEQ_B_YELLOW "43"
#define SWITCH_SEQ_B_BLUE "44"
#define SWITCH_SEQ_B_MAGEN "45"
#define SWITCH_SEQ_B_CYAN "46"
#define SWITCH_SEQ_B_WHITE "47"
/* Preset escape sequences - Change foreground colors only */
#define SWITCH_SEQ_FBLACK SWITCH_SEQ_ESC SWITCH_SEQ_F_BLACK SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_FRED SWITCH_SEQ_ESC SWITCH_SEQ_F_RED SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_FGREEN SWITCH_SEQ_ESC SWITCH_SEQ_F_GREEN SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_FYELLOW SWITCH_SEQ_ESC SWITCH_SEQ_F_YELLOW SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_FBLUE SWITCH_SEQ_ESC SWITCH_SEQ_F_BLUE SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_FMAGEN SWITCH_SEQ_ESC SWITCH_SEQ_F_MAGEN SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_FCYAN SWITCH_SEQ_ESC SWITCH_SEQ_F_CYAN SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_FWHITE SWITCH_SEQ_ESC SWITCH_SEQ_F_WHITE SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_BBLACK SWITCH_SEQ_ESC SWITCH_SEQ_B_BLACK SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_BRED SWITCH_SEQ_ESC SWITCH_SEQ_B_RED SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_BGREEN SWITCH_SEQ_ESC SWITCH_SEQ_B_GREEN SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_BYELLOW SWITCH_SEQ_ESC SWITCH_SEQ_B_YELLOW SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_BBLUE SWITCH_SEQ_ESC SWITCH_SEQ_B_BLUE SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_BMAGEN SWITCH_SEQ_ESC SWITCH_SEQ_B_MAGEN SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_BCYAN SWITCH_SEQ_ESC SWITCH_SEQ_B_CYAN SWITCH_SEQ_END_COLOR
#define SWITCH_SEQ_BWHITE SWITCH_SEQ_ESC SWITCH_SEQ_B_WHITE SWITCH_SEQ_END_COLOR
/* Preset escape sequences */
#define SWITCH_SEQ_HOME SWITCH_SEQ_ESC SWITCH_SEQ_HOME_CHAR_STR
#define SWITCH_SEQ_CLEARLINE SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINE_CHAR_STR
#define SWITCH_SEQ_CLEARLINEEND SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINEEND_CHAR
#define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
#endif
#define SWITCH_DEFAULT_CLID_NAME ""
#define SWITCH_DEFAULT_CLID_NUMBER "0000000000"
#define SWITCH_DEFAULT_DTMF_DURATION 2000
#define SWITCH_DEFAULT_TIMEOUT 60
#define SWITCH_MIN_DTMF_DURATION 400
#define SWITCH_MAX_DTMF_DURATION 192000
#define SWITCH_DEFAULT_DIR_PERMS SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE
#ifdef WIN32
#define SWITCH_PATH_SEPARATOR "/"
#else
#define SWITCH_PATH_SEPARATOR "/"
#endif
#define SWITCH_URL_SEPARATOR "://"
#define SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE "ignore_display_updates"
#define SWITCH_AUDIO_SPOOL_PATH_VARIABLE "audio_spool_path"
#define SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE "bridge_hangup_cause"
#define SWITCH_READ_TERMINATOR_USED_VARIABLE "read_terminator_used"
#define SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE "send_silence_when_idle"
#define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application"
#define SWITCH_CURRENT_APPLICATION_DATA_VARIABLE "current_application_data"
#define SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE "current_application_response"
#define SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE "passthru_ptime_mismatch"
#define SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE "enable_heartbeat_events"
#define SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE "bypass_media_after_bridge"
#define SWITCH_READ_RESULT_VARIABLE "read_result"
#define SWITCH_ATT_XFER_RESULT_VARIABLE "att_xfer_result"
#define SWITCH_COPY_XML_CDR_VARIABLE "copy_xml_cdr"
#define SWITCH_COPY_JSON_CDR_VARIABLE "copy_json_cdr"
#define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application"
#define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause"
#define SWITCH_TRANSFER_HISTORY_VARIABLE "transfer_history"
#define SWITCH_TRANSFER_SOURCE_VARIABLE "transfer_source"
#define SWITCH_SENSITIVE_DTMF_VARIABLE "sensitive_dtmf"
#define SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE "record_post_process_exec_app"
#define SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE "record_post_process_exec_api"
#define SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE "execute_on_answer"
#define SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE "execute_on_pre_answer"
#define SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE "execute_on_media"
#define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring"
#define SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE "execute_on_tone_detect"
#define SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE "execute_on_originate"
#define SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE "execute_on_post_originate"
#define SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE "execute_on_pre_originate"
#define SWITCH_CHANNEL_EXECUTE_ON_PRE_BRIDGE_VARIABLE "execute_on_pre_bridge"
#define SWITCH_CHANNEL_EXECUTE_ON_POST_BRIDGE_VARIABLE "execute_on_post_bridge"
#define SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE "api_on_answer"
#define SWITCH_CHANNEL_API_ON_PRE_ANSWER_VARIABLE "api_on_pre_answer"
#define SWITCH_CHANNEL_API_ON_MEDIA_VARIABLE "api_on_media"
#define SWITCH_CHANNEL_API_ON_RING_VARIABLE "api_on_ring"
#define SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE "api_on_tone_detect"
#define SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE "api_on_originate"
#define SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE "api_on_post_originate"
#define SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE "api_on_pre_originate"
#define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout"
#define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid"
#define SWITCH_SOFT_HOLDING_UUID_VARIABLE "soft_holding_uuid"
#define SWITCH_API_BRIDGE_END_VARIABLE "api_after_bridge"
#define SWITCH_API_BRIDGE_START_VARIABLE "api_before_bridge"
#define SWITCH_API_HANGUP_HOOK_VARIABLE "api_hangup_hook"
#define SWITCH_API_REPORTING_HOOK_VARIABLE "api_reporting_hook"
#define SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE "session_in_hangup_hook"
#define SWITCH_PROCESS_CDR_VARIABLE "process_cdr"
#define SWITCH_SKIP_CDR_CAUSES_VARIABLE "skip_cdr_causes"
#define SWITCH_FORCE_PROCESS_CDR_VARIABLE "force_process_cdr"
#define SWITCH_BRIDGE_CHANNEL_VARIABLE "bridge_channel"
#define SWITCH_CHANNEL_NAME_VARIABLE "channel_name"
#define SWITCH_BRIDGE_UUID_VARIABLE "bridge_uuid"
#define SWITCH_CONTINUE_ON_FAILURE_VARIABLE "continue_on_fail"
#define SWITCH_PLAYBACK_TERMINATORS_VARIABLE "playback_terminators"
#define SWITCH_PLAYBACK_TERMINATOR_USED "playback_terminator_used"
#define SWITCH_CACHE_SPEECH_HANDLES_VARIABLE "cache_speech_handles"
#define SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME "__cache_speech_handles_obj__"
#define SWITCH_BYPASS_MEDIA_VARIABLE "bypass_media"
#define SWITCH_PROXY_MEDIA_VARIABLE "proxy_media"
#define SWITCH_ZRTP_PASSTHRU_VARIABLE "zrtp_passthru"
#define SWITCH_ENDPOINT_DISPOSITION_VARIABLE "endpoint_disposition"
#define SWITCH_HOLD_MUSIC_VARIABLE "hold_music"
#define SWITCH_TEMP_HOLD_MUSIC_VARIABLE "temp_hold_music"
#define SWITCH_EXPORT_VARS_VARIABLE "export_vars"
#define SWITCH_BRIDGE_EXPORT_VARS_VARIABLE "bridge_export_vars"
#define SWITCH_R_SDP_VARIABLE "switch_r_sdp"
#define SWITCH_L_SDP_VARIABLE "switch_l_sdp"
#define SWITCH_B_SDP_VARIABLE "switch_m_sdp"
#define SWITCH_BRIDGE_VARIABLE "bridge_to"
#define SWITCH_LAST_BRIDGE_VARIABLE "last_bridge_to"
#define SWITCH_SIGNAL_BRIDGE_VARIABLE "signal_bridge_to"
#define SWITCH_SIGNAL_BOND_VARIABLE "signal_bond"
#define SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE "originate_signal_bond"
#define SWITCH_ORIGINATOR_VARIABLE "originator"
#define SWITCH_ORIGINATOR_CODEC_VARIABLE "originator_codec"
#define SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE "originator_video_codec"
#define SWITCH_LOCAL_MEDIA_IP_VARIABLE "local_media_ip"
#define SWITCH_LOCAL_MEDIA_PORT_VARIABLE "local_media_port"
#define SWITCH_ADVERTISED_MEDIA_IP_VARIABLE "advertised_media_ip"
#define SWITCH_REMOTE_MEDIA_IP_VARIABLE "remote_media_ip"
#define SWITCH_REMOTE_MEDIA_PORT_VARIABLE "remote_media_port"
#define SWITCH_REMOTE_VIDEO_IP_VARIABLE "remote_video_ip"
#define SWITCH_REMOTE_VIDEO_PORT_VARIABLE "remote_video_port"
#define SWITCH_LOCAL_VIDEO_IP_VARIABLE "local_video_ip"
#define SWITCH_LOCAL_VIDEO_PORT_VARIABLE "local_video_port"
#define SWITCH_LOCAL_TEXT_IP_VARIABLE "local_text_ip"
#define SWITCH_LOCAL_TEXT_PORT_VARIABLE "local_text_port"
#define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE "hangup_after_bridge"
#define SWITCH_PARK_AFTER_BRIDGE_VARIABLE "park_after_bridge"
#define SWITCH_PARK_AFTER_EARLY_BRIDGE_VARIABLE "park_after_early_bridge"
#define SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE "transfer_after_bridge"
#define SWITCH_TRANSFER_AFTER_EARLY_BRIDGE_VARIABLE "transfer_after_early_bridge"
#define SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE "exec_after_bridge_app"
#define SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE "exec_after_bridge_arg"
#define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards"
#define SWITCH_RFC7989_SESSION_ID_VARIABLE "session_uuid"
#define SWITCH_RFC7989_REMOTE_SESSION_ID_VARIABLE "remote_session_uuid"
#define SWITCH_RFC7989_APP_SESSION_ID_VARIABLE "app_session_uuid"
#define SWITCH_RFC7989_GENERIC_PARAM_VARIABLE "generic_param_session_uuid"
#define SWITCH_MAX_SESSION_TRANSFERS_VARIABLE "max_session_transfers"
#define SWITCH_DISABLE_APP_LOG_VARIABLE "disable_app_log"
#define SWITCH_SPEECH_KEY "speech"
#define SWITCH_UUID_BRIDGE "uuid_bridge"
#define SWITCH_BITS_PER_BYTE 8
#define SWITCH_DEFAULT_FILE_BUFFER_LEN 65536
#define SWITCH_DTMF_LOG_LEN 1000
#define SWITCH_MAX_TRANS 2000
#define SWITCH_CORE_SESSION_MAX_PRIVATES 2
#define SWITCH_DEFAULT_VIDEO_SIZE 1200
#define SWITCH_RTCP_AUDIO_INTERVAL_MSEC "1000"
#define SWITCH_RTCP_VIDEO_INTERVAL_MSEC "1000"
#define TEXT_UNICODE_LINEFEED {0xe2, 0x80, 0xa8}
#define MAX_FMTP_LEN 256
/* Jitter */
#define JITTER_VARIANCE_THRESHOLD 400.0
/* IPDV */
#define IPDV_THRESHOLD 1.0
/* Burst and Lost Rate */
#define LOST_BURST_ANALYZE 500
/* Burst */
#define LOST_BURST_CAPTURE 1024
typedef uint8_t switch_byte_t;
typedef enum {
SWITCH_PVT_PRIMARY = 0,
SWITCH_PVT_SECONDARY
} switch_pvt_class_t;
/*!
\enum switch_dtmf_source_t
\brief DTMF sources
<pre>
SWITCH_DTMF_UNKNOWN - Unknown source
SWITCH_DTMF_INBAND_AUDIO - From audio
SWITCH_DTMF_RTP - From RTP as a telephone event
SWITCH_DTMF_ENDPOINT - From endpoint signaling
SWITCH_DTMF_APP - From application
</pre>
*/
typedef enum {
SWITCH_DTMF_UNKNOWN,
SWITCH_DTMF_INBAND_AUDIO,
SWITCH_DTMF_RTP,
SWITCH_DTMF_ENDPOINT,
SWITCH_DTMF_APP
} switch_dtmf_source_t;
typedef enum {
DIGIT_TARGET_SELF,
DIGIT_TARGET_PEER,
DIGIT_TARGET_BOTH
} switch_digit_action_target_t;
typedef enum {
DTMF_FLAG_SKIP_PROCESS = (1 << 0),
DTMF_FLAG_SENSITIVE = (1 << 1)
} dtmf_flag_t;
typedef struct {
char digit;
uint32_t duration;
int32_t flags;
switch_dtmf_source_t source;
} switch_dtmf_t;
typedef enum {
SWITCH_CALL_DIRECTION_INBOUND,
SWITCH_CALL_DIRECTION_OUTBOUND
} switch_call_direction_t;
typedef enum {
SBF_DIAL_ALEG = (1 << 0),
SBF_EXEC_ALEG = (1 << 1),
SBF_DIAL_BLEG = (1 << 2),
SBF_EXEC_BLEG = (1 << 3),
SBF_EXEC_OPPOSITE = (1 << 4),
SBF_EXEC_SAME = (1 << 5),
SBF_ONCE = (1 << 6),
SBF_EXEC_INLINE = (1 << 7)
} switch_bind_flag_enum_t;
typedef uint32_t switch_bind_flag_t;
typedef enum {
SWITCH_DTMF_RECV = 0,
SWITCH_DTMF_SEND = 1
} switch_dtmf_direction_t;
typedef enum {
SOF_NONE = 0,
SOF_NOBLOCK = (1 << 0),
SOF_FORKED_DIAL = (1 << 1),
SOF_NO_EFFECTIVE_ANI = (1 << 2),
SOF_NO_EFFECTIVE_ANIII = (1 << 3),
SOF_NO_EFFECTIVE_CID_NUM = (1 << 4),
SOF_NO_EFFECTIVE_CID_NAME = (1 << 5),
SOF_NO_LIMITS = (1 << 6)
} switch_originate_flag_enum_t;
typedef uint32_t switch_originate_flag_t;
typedef enum {
SPF_NONE = 0,
SPF_ODD = (1 << 0),
SPF_EVEN = (1 << 1),
SPF_ROBUST_TCP = (1 << 2),
SPF_ROBUST_UDP = (1 << 3)
} switch_port_flag_enum_t;
typedef uint32_t switch_port_flag_t;
typedef enum {
ED_NONE = 0,
ED_MUX_READ = (1 << 0),
ED_MUX_WRITE = (1 << 1),
ED_DTMF = (1 << 2),
ED_COPY_DISPLAY = (1 << 3),
ED_BRIDGE_READ = (1 << 4),
ED_BRIDGE_WRITE = (1 << 5),
ED_TAP_READ = (1 << 6),
ED_TAP_WRITE = (1 << 7)
} switch_eavesdrop_flag_enum_t;
typedef uint32_t switch_eavesdrop_flag_t;
typedef enum {
SCF_NONE = 0,
SCF_USE_SQL = (1 << 0),
SCF_NO_NEW_OUTBOUND_SESSIONS = (1 << 1),
SCF_NO_NEW_INBOUND_SESSIONS = (1 << 2),
SCF_NO_NEW_SESSIONS = (SCF_NO_NEW_OUTBOUND_SESSIONS | SCF_NO_NEW_INBOUND_SESSIONS),
SCF_SHUTTING_DOWN = (1 << 3),
SCF_VG = (1 << 4),
SCF_RESTART = (1 << 5),
SCF_SHUTDOWN_REQUESTED = (1 << 6),
SCF_USE_AUTO_NAT = (1 << 7),
SCF_EARLY_HANGUP = (1 << 8),
SCF_CALIBRATE_CLOCK = (1 << 9),
SCF_USE_HEAVY_TIMING = (1 << 10),
SCF_USE_CLOCK_RT = (1 << 11),
SCF_VERBOSE_EVENTS = (1 << 12),
SCF_USE_WIN32_MONOTONIC = (1 << 13),
SCF_AUTO_SCHEMAS = (1 << 14),
SCF_MINIMAL = (1 << 15),
SCF_USE_NAT_MAPPING = (1 << 16),
SCF_CLEAR_SQL = (1 << 17),
SCF_THREADED_SYSTEM_EXEC = (1 << 18),
SCF_SYNC_CLOCK_REQUESTED = (1 << 19),
SCF_CORE_NON_SQLITE_DB_REQ = (1 << 20),
SCF_DEBUG_SQL = (1 << 21),
SCF_API_EXPANSION = (1 << 22),
SCF_SESSION_THREAD_POOL = (1 << 23),
SCF_DIALPLAN_TIMESTAMPS = (1 << 24),
SCF_CPF_SOFT_PREFIX = (1 << 25),
SCF_CPF_SOFT_LOOKUP = (1 << 26),
SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY = (1 << 27),
SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE = (1 << 28),
SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON = (1 << 29)
} switch_core_flag_enum_t;
typedef uint32_t switch_core_flag_t;
typedef enum {
SWITCH_ENDPOINT_INTERFACE,
SWITCH_TIMER_INTERFACE,
SWITCH_DIALPLAN_INTERFACE,
SWITCH_CODEC_INTERFACE,
SWITCH_APPLICATION_INTERFACE,
SWITCH_API_INTERFACE,
SWITCH_FILE_INTERFACE,
SWITCH_SPEECH_INTERFACE,
SWITCH_DIRECTORY_INTERFACE,
SWITCH_CHAT_INTERFACE,
SWITCH_SAY_INTERFACE,
SWITCH_ASR_INTERFACE,
SWITCH_MANAGEMENT_INTERFACE,
SWITCH_LIMIT_INTERFACE,
SWITCH_CHAT_APPLICATION_INTERFACE,
SWITCH_JSON_API_INTERFACE,
SWITCH_DATABASE_INTERFACE,
} switch_module_interface_name_t;
/*!
\enum switch_database_flag_t
\brief Database flags
<pre>
SWITCH_DATABASE_FLAG_ROW_SIZE_LIMIT = (1 << 0) - Indicates that database has got row-size limit for the combined sizes of all columns.
</pre>
*/
typedef enum {
SWITCH_DATABASE_FLAG_ROW_SIZE_LIMIT = (1 << 0)
} switch_database_flag_enum_t;
typedef uint32_t switch_database_flag_t;
typedef enum {
SUF_NONE = 0,
SUF_THREAD_RUNNING = (1 << 0),
SUF_READY = (1 << 1),
SUF_NATIVE = (1 << 2)
} switch_unicast_flag_enum_t;
typedef uint32_t switch_unicast_flag_t;
typedef enum {
SWITCH_FALSE = 0,
SWITCH_TRUE = 1
} switch_bool_t;
/* WARNING, Do not forget to update *SAY_METHOD_NAMES[] in src/switch_ivr_play_say.c */
typedef enum {
SSM_NA,
SSM_PRONOUNCED,
SSM_ITERATED,
SSM_COUNTED,
SSM_PRONOUNCED_YEAR
} switch_say_method_t;
/* WARNING, Do not forget to update *SAY_TYPE_NAMES[] in src/switch_ivr_say.c */
typedef enum {
SST_NUMBER,
SST_ITEMS,
SST_PERSONS,
SST_MESSAGES,
SST_CURRENCY,
SST_TIME_MEASUREMENT,
SST_CURRENT_DATE,
SST_CURRENT_TIME,
SST_CURRENT_DATE_TIME,
SST_TELEPHONE_NUMBER,
SST_TELEPHONE_EXTENSION,
SST_URL,
SST_IP_ADDRESS,
SST_EMAIL_ADDRESS,
SST_POSTAL_ADDRESS,
SST_ACCOUNT_NUMBER,
SST_NAME_SPELLED,
SST_NAME_PHONETIC,
SST_SHORT_DATE_TIME
} switch_say_type_t;
typedef enum {
SSG_MASCULINE,
SSG_FEMININE,
SSG_NEUTER,
SSG_UTRUM
} switch_say_gender_t;
typedef enum {
SMA_NONE,
SMA_GET,
SMA_SET
} switch_management_action_t;
typedef enum {
SSHF_NONE = 0,
SSHF_OWN_THREAD = (1 << 0),
SSHF_FREE_ARG = (1 << 1),
SSHF_NO_DEL = (1 << 2)
} switch_scheduler_flag_enum_t;
typedef uint32_t switch_scheduler_flag_t;
typedef enum {
SMF_NONE = 0,
SMF_REBRIDGE = (1 << 0),
SMF_ECHO_ALEG = (1 << 1),
SMF_ECHO_BLEG = (1 << 2),
SMF_FORCE = (1 << 3),
SMF_LOOP = (1 << 4),
SMF_HOLD_BLEG = (1 << 5),
SMF_IMMEDIATE = (1 << 6),
SMF_EXEC_INLINE = (1 << 7),
SMF_PRIORITY = (1 << 8),
SMF_REPLYONLY_A = (1 << 9),
SMF_REPLYONLY_B = (1 << 10)
} switch_media_flag_enum_t;
typedef uint32_t switch_media_flag_t;
typedef enum {
SWITCH_BITPACK_MODE_RFC3551,
SWITCH_BITPACK_MODE_AAL2
} switch_bitpack_mode_t;
typedef enum {
SWITCH_ABC_TYPE_INIT,
SWITCH_ABC_TYPE_READ,
SWITCH_ABC_TYPE_WRITE,
SWITCH_ABC_TYPE_WRITE_REPLACE,
SWITCH_ABC_TYPE_READ_REPLACE,
SWITCH_ABC_TYPE_READ_PING,
SWITCH_ABC_TYPE_TAP_NATIVE_READ,
SWITCH_ABC_TYPE_TAP_NATIVE_WRITE,
SWITCH_ABC_TYPE_CLOSE,
SWITCH_ABC_TYPE_READ_VIDEO_PING,
SWITCH_ABC_TYPE_WRITE_VIDEO_PING,
SWITCH_ABC_TYPE_STREAM_VIDEO_PING,
SWITCH_ABC_TYPE_VIDEO_PATCH,
SWITCH_ABC_TYPE_READ_TEXT
} switch_abc_type_t;
typedef struct {
switch_byte_t *buf;
uint32_t buflen;
switch_byte_t *cur;
uint32_t bytes;
uint32_t bits_tot;
switch_byte_t bits_cur;
switch_byte_t bits_rem;
switch_byte_t frame_bits;
switch_byte_t shiftby;
switch_byte_t this_byte;
switch_byte_t under;
switch_byte_t over;
switch_bitpack_mode_t mode;
} switch_bitpack_t;
struct switch_directories {
char *base_dir;
char *mod_dir;
char *conf_dir;
char *log_dir;
char *run_dir;
char *db_dir;
char *script_dir;
char *temp_dir;
char *htdocs_dir;
char *grammar_dir;
char *storage_dir;
char *cache_dir;
char *recordings_dir;
char *sounds_dir;
char *lib_dir;
char *certs_dir;
char *fonts_dir;
char *images_dir;
char *data_dir;
char *localstate_dir;
};
typedef struct switch_directories switch_directories;
SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs;
struct switch_filenames {
char *conf_name;
};
typedef struct switch_filenames switch_filenames;
SWITCH_DECLARE_DATA extern switch_filenames SWITCH_GLOBAL_filenames;
#define SWITCH_MAX_STACKS 32
#define SWITCH_THREAD_STACKSIZE 240 * 1024
#define SWITCH_SYSTEM_THREAD_STACKSIZE 8192 * 1024
#define SWITCH_MAX_INTERVAL 120 /* we only do up to 120ms */
#define SWITCH_INTERVAL_PAD 10 /* A little extra buffer space to be safe */
#define SWITCH_MAX_SAMPLE_LEN 48
#define SWITCH_BYTES_PER_SAMPLE 2 /* slin is 2 bytes per sample */
#define SWITCH_RECOMMENDED_BUFFER_SIZE 8192
#define SWITCH_MAX_CODECS 50
#define SWITCH_MAX_STATE_HANDLERS 30
#define SWITCH_CORE_QUEUE_LEN 100000
#define SWITCH_MAX_MANAGEMENT_BUFFER_LEN 1024 * 8
#define SWITCH_ACCEPTABLE_INTERVAL(_i) (_i && _i <= SWITCH_MAX_INTERVAL && (_i % 10) == 0)
typedef enum {
SWITCH_RW_READ,
SWITCH_RW_WRITE
} switch_rw_t;
typedef enum {
SWITCH_CPF_NONE = 0,
SWITCH_CPF_SCREEN = (1 << 0),
SWITCH_CPF_HIDE_NAME = (1 << 1),
SWITCH_CPF_HIDE_NUMBER = (1 << 2),
SWITCH_CPF_SOFT_PREFIX = (1 << 3),
SWITCH_CPF_SOFT_LOOKUP = (1 << 4)
} switch_caller_profile_flag_enum_t;
typedef uint32_t switch_caller_profile_flag_t;
typedef enum {
// flags matching libsndfile
SWITCH_AUDIO_COL_STR_TITLE = 0x01,
SWITCH_AUDIO_COL_STR_COPYRIGHT = 0x02,
SWITCH_AUDIO_COL_STR_SOFTWARE = 0x03,
SWITCH_AUDIO_COL_STR_ARTIST = 0x04,
SWITCH_AUDIO_COL_STR_COMMENT = 0x05,
SWITCH_AUDIO_COL_STR_DATE = 0x06,
SWITCH_AUDIO_COL_STR_ALBUM = 0x07,
SWITCH_AUDIO_COL_STR_LICENSE = 0x08,
SWITCH_AUDIO_COL_STR_TRACKNUMBER = 0x09,
SWITCH_AUDIO_COL_STR_GENRE = 0x10,
// custom flags
SWITCH_AUDIO_COL_STR_FILE_SIZE = 0xF0,
SWITCH_AUDIO_COL_STR_FILE_TRIMMED = 0xF1,
SWITCH_AUDIO_COL_STR_FILE_TRIMMED_MS = 0xF2
} switch_audio_col_t;
typedef enum {
SWITCH_XML_SECTION_RESULT = 0,
SWITCH_XML_SECTION_CONFIG = (1 << 0),
SWITCH_XML_SECTION_DIRECTORY = (1 << 1),
SWITCH_XML_SECTION_DIALPLAN = (1 << 2),
SWITCH_XML_SECTION_LANGUAGES = (1 << 3),
SWITCH_XML_SECTION_CHATPLAN = (1 << 4),
SWITCH_XML_SECTION_CHANNELS = (1 << 5),
/* Nothing after this line */
SWITCH_XML_SECTION_MAX = (1 << 5)
} switch_xml_section_enum_t;
typedef uint32_t switch_xml_section_t;
/*!
\enum switch_vad_flag_t
\brief RTP Related Flags
<pre>
SWITCH_VAD_FLAG_TALKING - Currently Talking
SWITCH_VAD_FLAG_EVENTS_TALK - Fire events when talking is detected
SWITCH_VAD_FLAG_EVENTS_NOTALK - Fire events when not talking is detected
SWITCH_VAD_FLAG_CNG - Send CNG
</pre>
*/
typedef enum {
SWITCH_VAD_FLAG_TALKING = (1 << 0),
SWITCH_VAD_FLAG_EVENTS_TALK = (1 << 1),
SWITCH_VAD_FLAG_EVENTS_NOTALK = (1 << 2),
SWITCH_VAD_FLAG_CNG = (1 << 3)
} switch_vad_flag_enum_t;
typedef uint32_t switch_vad_flag_t;
typedef enum {
SWITCH_VAD_STATE_NONE,
SWITCH_VAD_STATE_START_TALKING,
SWITCH_VAD_STATE_TALKING,
SWITCH_VAD_STATE_STOP_TALKING,
SWITCH_VAD_STATE_ERROR
} switch_vad_state_t;
typedef struct switch_vad_s switch_vad_t;
typedef struct error_period {
int64_t start;
int64_t stop;
uint32_t flaws;
uint32_t consecutive_flaws;
struct error_period *next;
} switch_error_period_t;
typedef struct {
switch_size_t raw_bytes;
switch_size_t media_bytes;
switch_size_t packet_count;
switch_size_t period_packet_count;
switch_size_t media_packet_count;
switch_size_t skip_packet_count;
switch_size_t jb_packet_count;
switch_size_t dtmf_packet_count;
switch_size_t cng_packet_count;
switch_size_t flush_packet_count;
switch_size_t largest_jb_size;
/* Jitter */
int64_t last_proc_time;
int64_t jitter_n;
int64_t jitter_add;
int64_t jitter_addsq;
double variance;
double min_variance;
double max_variance;
double std_deviation;
/* Burst and Packet Loss */
double lossrate;
double burstrate;
double mean_interval;
int loss[LOST_BURST_CAPTURE];
int last_loss;
int recved;
int last_processed_seq;
switch_size_t flaws;
switch_size_t last_flaw;
double R;
double mos;
struct error_period *error_log;
} switch_rtp_numbers_t;
typedef struct {
uint32_t packet_count; /* sent packet count */
uint32_t octet_count;
uint32_t peer_ssrc;
uint32_t last_rpt_ts; /* RTP timestamp at which the last report was generated and sent */
uint32_t ssrc; /* identifier of the source */
uint32_t csrc; /* contributing source 0-15 32bit each */
uint32_t last_pkt_tsdiff; /* Jitter calculation, timestamp difference between the two last received packet */
double inter_jitter; /* Jitter calculation, Interarrival jitter */
uint32_t last_rpt_ext_seq; /* Packet loss calculation, extended sequence number at the begining of this RTCP report interval */
uint16_t last_rpt_cycle; /* Packet loss calculation, sequence number cycle at the begining of the current RTCP report interval */
uint16_t period_pkt_count; /* Packet loss calculation, packet count received during this RTCP report interval */
uint16_t pkt_count; /* Packet loss calculation, packet count received during this session */
uint16_t sent_pkt_count;
uint32_t rtcp_rtp_count; /* RTCP report generated count */
uint32_t high_ext_seq_recv; /* Packet loss calculation, highest extended sequence number received and processed for stats */
uint16_t cycle; /* Packet loss calculation, sequence number cycle of the current RTCP report interval */
uint32_t bad_seq; /* Bad SEQ found, used to detect reset on the other side */
uint16_t base_seq; /* Packet loss calculation, first sequence number received */
uint32_t cum_lost; /* Packet loss calculation, cumulative number of packet lost */
uint32_t last_recv_lsr_local; /* RTT calculation, When receiving an SR we save our local timestamp in fraction of 65536 seconds */
uint32_t last_recv_lsr_peer; /* RTT calculation, When receiving an SR we extract the middle 32bits of the remote NTP timestamp to include it in the next SR LSR */
uint32_t init;
} switch_rtcp_numbers_t;
typedef struct {
uint16_t nack_count;
uint16_t fir_count;
uint16_t pli_count;
uint16_t sr_count;
uint16_t rr_count;
} switch_rtcp_video_counters_t;
typedef struct {
/* counters and stats for the incoming video stream and outgoing RTCP*/
switch_rtcp_video_counters_t video_in;
/* counters and stats for the outgoing video stream and incoming RTCP*/
switch_rtcp_video_counters_t video_out;
} switch_rtcp_video_stats_t;
typedef struct {
switch_rtp_numbers_t inbound;
switch_rtp_numbers_t outbound;
switch_rtcp_numbers_t rtcp;
uint32_t read_count;
} switch_rtp_stats_t;
typedef enum {
SWITCH_RTP_FLUSH_ONCE,
SWITCH_RTP_FLUSH_STICK,
SWITCH_RTP_FLUSH_UNSTICK
} switch_rtp_flush_t;
#define SWITCH_RTP_CNG_PAYLOAD 13
/*!
\enum switch_rtp_flag_t
\brief RTP Related Flags
<pre>
SWITCH_RTP_FLAG_NOBLOCK - Do not block
SWITCH_RTP_FLAG_IO - IO is ready
SWITCH_RTP_FLAG_USE_TIMER - Timeout Reads and replace with a CNG Frame
SWITCH_RTP_FLAG_SECURE - Secure RTP
SWITCH_RTP_FLAG_AUTOADJ - Auto-Adjust the dest based on the source
SWITCH_RTP_FLAG_RAW_WRITE - Try to forward packets unscathed
SWITCH_RTP_FLAG_GOOGLEHACK - Convert payload from 102 to 97
SWITCH_RTP_FLAG_VAD - Enable VAD
SWITCH_RTP_FLAG_BREAK - Stop what you are doing and return SWITCH_STATUS_BREAK
SWITCH_RTP_FLAG_DATAWAIT - Do not return from reads unless there is data even when non blocking
SWITCH_RTP_FLAG_BUGGY_2833 - Emulate the bug in cisco equipment to allow interop
SWITCH_RTP_FLAG_PASS_RFC2833 - Pass 2833 (ignore it)
SWITCH_RTP_FLAG_AUTO_CNG - Generate outbound CNG frames when idle
</pre>
*/
typedef enum {
SWITCH_RTP_FLAG_NOBLOCK = 0,
SWITCH_RTP_FLAG_DTMF_ON,
SWITCH_RTP_FLAG_IO,
SWITCH_RTP_FLAG_USE_TIMER,
SWITCH_RTP_FLAG_RTCP_PASSTHRU,
SWITCH_RTP_FLAG_SECURE_SEND,
SWITCH_RTP_FLAG_SECURE_RECV,
SWITCH_RTP_FLAG_AUTOADJ,
SWITCH_RTP_FLAG_RTCP_AUTOADJ,
SWITCH_RTP_FLAG_RAW_WRITE,
SWITCH_RTP_FLAG_GOOGLEHACK,
SWITCH_RTP_FLAG_VAD,
SWITCH_RTP_FLAG_BREAK,
SWITCH_RTP_FLAG_UDPTL,
SWITCH_RTP_FLAG_DATAWAIT,
SWITCH_RTP_FLAG_BYTESWAP,
SWITCH_RTP_FLAG_PASS_RFC2833,
SWITCH_RTP_FLAG_AUTO_CNG,
SWITCH_RTP_FLAG_SECURE_SEND_RESET,
SWITCH_RTP_FLAG_SECURE_RECV_RESET,
SWITCH_RTP_FLAG_PROXY_MEDIA,
SWITCH_RTP_FLAG_SHUTDOWN,
SWITCH_RTP_FLAG_FLUSH,
SWITCH_RTP_FLAG_AUTOFLUSH,
SWITCH_RTP_FLAG_STICKY_FLUSH,
SWITCH_ZRTP_FLAG_SECURE_SEND,
SWITCH_ZRTP_FLAG_SECURE_RECV,
SWITCH_ZRTP_FLAG_SECURE_MITM_SEND,
SWITCH_ZRTP_FLAG_SECURE_MITM_RECV,
SWITCH_RTP_FLAG_DEBUG_RTP_READ,
SWITCH_RTP_FLAG_DEBUG_RTP_WRITE,
SWITCH_RTP_FLAG_ESTIMATORS,
SWITCH_RTP_FLAG_ADJ_BITRATE_CAP,
SWITCH_RTP_FLAG_VIDEO,
SWITCH_RTP_FLAG_ENABLE_RTCP,
SWITCH_RTP_FLAG_RTCP_MUX,
SWITCH_RTP_FLAG_KILL_JB,
SWITCH_RTP_FLAG_VIDEO_BREAK,
SWITCH_RTP_FLAG_PAUSE,
SWITCH_RTP_FLAG_FIR,
SWITCH_RTP_FLAG_PLI,
SWITCH_RTP_FLAG_RESET,
SWITCH_RTP_FLAG_MUTE,
SWITCH_RTP_FLAG_NACK,
SWITCH_RTP_FLAG_TMMBR,
SWITCH_RTP_FLAG_DETECT_SSRC,
SWITCH_RTP_FLAG_TEXT,
SWITCH_RTP_FLAG_OLD_FIR,
SWITCH_RTP_FLAG_PASSTHRU,
SWITCH_RTP_FLAG_SECURE_SEND_MKI,
SWITCH_RTP_FLAG_SECURE_RECV_MKI,
SWITCH_RTP_FLAG_INVALID
} switch_rtp_flag_t;
typedef enum {
RTP_BUG_NONE = 0, /* won't be using this one much ;) */
RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0),
/* Some Cisco devices get mad when you send the mark bit on new 2833 because it makes
them flush their jitterbuffer and the dtmf along with it.
This flag will disable the sending of the mark bit on the first DTMF packet.
*/
RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1),
/*
Sonus wrongly expects that, when sending a multi-packet 2833 DTMF event, The sender
should increment the RTP timestamp in each packet when, in reality, the sender should
send the same exact timestamp and increment the duration field in the 2833 payload.
This allows a reconstruction of the duration if any of the packets are lost.
final_duration - initial_timestamp = total_samples
However, if the duration value exceeds the space allocated (16 bits), The sender should increment
the timestamp one unit and reset the duration to 0.
Always sending a duration of 0 with a new timestamp should be tolerated but is rarely intentional
and is mistakenly done by many devices.
The issue is that the Sonus expects everyone to do it this way instead of tolerating either way.
Sonus will actually ignore every packet with the same timestamp before concluding if it's DTMF.
This flag will cause each packet to have a new timestamp.
*/
RTP_BUG_IGNORE_MARK_BIT = (1 << 2),
/*
A Huawei SBC has been discovered that sends the mark bit on every single RTP packet.
Since this causes the RTP stack to flush it's buffers, it horribly messes up the timing on the channel.
This flag will do nothing when an inbound packet contains the mark bit.
*/
RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3),
/*
Our friends at Sonus get real mad when the timestamps are not in perfect sequence even during periods of silence.
With this flag, we will only increment the timestamp when write packets even if they are eons apart.
*/
RTP_BUG_START_SEQ_AT_ZERO = (1 << 4),
/*
Our friends at Sonus also get real mad if the sequence number does not start at 0.
Typically, we set this to a random starting value for your saftey.
This is a security risk you take upon yourself when you enable this flag.
*/
RTP_BUG_NEVER_SEND_MARKER = (1 << 5),
/*
Our friends at Sonus are on a roll, They also get easily dumbfounded by marker bits.
This flag will never send any. Sheesh....
*/
RTP_BUG_IGNORE_DTMF_DURATION = (1 << 6),
/*
Guess Who? ... Yep, Sonus (and who know's who else) likes to interweave DTMF with the audio stream making it take
2X as long as it should and sending an incorrect duration making the DTMF very delayed.
This flag will treat every dtmf as if it were 50ms and queue it on recipt of the leading packet rather than at the end.
*/
RTP_BUG_ACCEPT_ANY_PACKETS = (1 << 7),
/*
Oracle's Contact Center Anywhere (CCA) likes to use a single RTP socket to send all its outbound audio.
This messes up our ability to auto adjust to NATTED RTP and causes us to ignore its audio packets.
This flag will allow compatibility with this dying product.
*/
RTP_BUG_GEN_ONE_GEN_ALL = (1 << 8),
/*
Some RTP endpoints (and by some we mean *cough* _SONUS_!) do not like it when the timestamps jump forward or backwards in time.
So say you are generating a file that says "please wait for me to complete your call, or generating ringback"
Now you place and outbound call and you are bridging. Well, while you were playing the file, you were generating your own RTP timestamps.
But, now that you have a remote RTP stream, you'd rather send those timestamps as-is in case they will be fed to a remote jitter buffer......
Ok, so this causes the audio to completely fade out despite the fact that we send the mark bit which should give them heads up its happening.
Sigh, This flag will tell FreeSWITCH that if it ever generates even one RTP packet itself, to continue to generate all of them and ignore the
actual timestamps in the frames.
*/
RTP_BUG_CHANGE_SSRC_ON_MARKER = (1 << 9),
/*
By default FS will change the SSRC when the marker is set and it detects a timestamp reset.
If this setting is enabled it will NOT do this (old behaviour).
*/
RTP_BUG_FLUSH_JB_ON_DTMF = (1 << 10),
/* FLUSH JITTERBUFFER When getting RFC2833 to reduce bleed through */
RTP_BUG_ACCEPT_ANY_PAYLOAD = (1 << 11),
/*
Make FS accept any payload type instead of dropping and returning CNG frame. Workaround while FS only supports a single payload per rtp session.
This can be used by endpoint modules to detect payload changes and act appropriately (ex: sofia could send a reINVITE with single codec).
This should probably be a flag, but flag enum is already full!
*/
RTP_BUG_ALWAYS_AUTO_ADJUST = (1 << 12)
/*
Leave the auto-adjust behavior enableed permenantly rather than only at appropriate times. (IMPLICITLY sets RTP_BUG_ACCEPT_ANY_PACKETS)
*/
} switch_rtp_bug_flag_t;
#ifdef _MSC_VER
#pragma pack(push, r1, 1)
#endif
#if SWITCH_BYTE_ORDER == __BIG_ENDIAN
typedef struct {
unsigned version:2; /* protocol version */
unsigned p:1; /* padding flag */
unsigned x:1; /* header extension flag */
unsigned cc:4; /* CSRC count */
unsigned m:1; /* marker bit */
unsigned pt:7; /* payload type */
unsigned seq:16; /* sequence number */
unsigned ts:32; /* timestamp */
unsigned ssrc:32; /* synchronization source */
} switch_rtp_hdr_t;
typedef struct {
unsigned length:16; /* length */
unsigned profile:16; /* defined by profile */
} switch_rtp_hdr_ext_t;
#else /* BIG_ENDIAN */
typedef struct {