FreeSWITCH API Documentation  1.7.0
switch_types.h
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Anthony Minessale II <anthm@freeswitch.org>
27  * Bret McDanel <trixter AT 0xdecafbad dot com>
28  * Joseph Sullivan <jossulli@amazon.com>
29  * Raymond Chandler <intralanman@freeswitch.org>
30  * Emmanuel Schmidbauer <e.schmidbauer@gmail.com>
31  *
32  * switch_types.h -- Data Types
33  *
34  */
35 /*! \file switch_types.h
36  \brief Data Types
37 */
38 #ifndef SWITCH_TYPES_H
39 #define SWITCH_TYPES_H
40 
41 #include <switch.h>
42 #include <switch_json.h>
43 #include <switch_vpx.h>
44 
46 #define SWITCH_ENT_ORIGINATE_DELIM ":_:"
47 #define SWITCH_BLANK_STRING ""
48 #define SWITCH_TON_UNDEF 255
49 #define SWITCH_NUMPLAN_UNDEF 255
50 #ifdef WIN32
51 #define SWITCH_SEQ_FWHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
52 #define SWITCH_SEQ_FRED FOREGROUND_RED | FOREGROUND_INTENSITY
53 #define SWITCH_SEQ_FMAGEN FOREGROUND_BLUE | FOREGROUND_RED
54 #define SWITCH_SEQ_FCYAN FOREGROUND_GREEN | FOREGROUND_BLUE
55 #define SWITCH_SEQ_FGREEN FOREGROUND_GREEN
56 #define SWITCH_SEQ_FYELLOW FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY
57 #define SWITCH_SEQ_DEFAULT_COLOR SWITCH_SEQ_FWHITE
58 #else
59 #define SWITCH_SEQ_ESC "\033["
60 /* Ansi Control character suffixes */
61 #define SWITCH_SEQ_HOME_CHAR 'H'
62 #define SWITCH_SEQ_HOME_CHAR_STR "H"
63 #define SWITCH_SEQ_CLEARLINE_CHAR '1'
64 #define SWITCH_SEQ_CLEARLINE_CHAR_STR "1"
65 #define SWITCH_SEQ_CLEARLINEEND_CHAR "K"
66 #define SWITCH_SEQ_CLEARSCR_CHAR0 '2'
67 #define SWITCH_SEQ_CLEARSCR_CHAR1 'J'
68 #define SWITCH_SEQ_CLEARSCR_CHAR "2J"
69 #define SWITCH_SEQ_DEFAULT_COLOR SWITCH_SEQ_ESC SWITCH_SEQ_END_COLOR /* Reset to Default fg/bg color */
70 #define SWITCH_SEQ_AND_COLOR ";" /* To add multiple color definitions */
71 #define SWITCH_SEQ_END_COLOR "m" /* To end color definitions */
72 /* Foreground colors values */
73 #define SWITCH_SEQ_F_BLACK "30"
74 #define SWITCH_SEQ_F_RED "31"
75 #define SWITCH_SEQ_F_GREEN "32"
76 #define SWITCH_SEQ_F_YELLOW "33"
77 #define SWITCH_SEQ_F_BLUE "34"
78 #define SWITCH_SEQ_F_MAGEN "35"
79 #define SWITCH_SEQ_F_CYAN "36"
80 #define SWITCH_SEQ_F_WHITE "37"
81 /* Background colors values */
82 #define SWITCH_SEQ_B_BLACK "40"
83 #define SWITCH_SEQ_B_RED "41"
84 #define SWITCH_SEQ_B_GREEN "42"
85 #define SWITCH_SEQ_B_YELLOW "43"
86 #define SWITCH_SEQ_B_BLUE "44"
87 #define SWITCH_SEQ_B_MAGEN "45"
88 #define SWITCH_SEQ_B_CYAN "46"
89 #define SWITCH_SEQ_B_WHITE "47"
90 /* Preset escape sequences - Change foreground colors only */
91 #define SWITCH_SEQ_FBLACK SWITCH_SEQ_ESC SWITCH_SEQ_F_BLACK SWITCH_SEQ_END_COLOR
92 #define SWITCH_SEQ_FRED SWITCH_SEQ_ESC SWITCH_SEQ_F_RED SWITCH_SEQ_END_COLOR
93 #define SWITCH_SEQ_FGREEN SWITCH_SEQ_ESC SWITCH_SEQ_F_GREEN SWITCH_SEQ_END_COLOR
94 #define SWITCH_SEQ_FYELLOW SWITCH_SEQ_ESC SWITCH_SEQ_F_YELLOW SWITCH_SEQ_END_COLOR
95 #define SWITCH_SEQ_FBLUE SWITCH_SEQ_ESC SWITCH_SEQ_F_BLUE SWITCH_SEQ_END_COLOR
96 #define SWITCH_SEQ_FMAGEN SWITCH_SEQ_ESC SWITCH_SEQ_F_MAGEN SWITCH_SEQ_END_COLOR
97 #define SWITCH_SEQ_FCYAN SWITCH_SEQ_ESC SWITCH_SEQ_F_CYAN SWITCH_SEQ_END_COLOR
98 #define SWITCH_SEQ_FWHITE SWITCH_SEQ_ESC SWITCH_SEQ_F_WHITE SWITCH_SEQ_END_COLOR
99 #define SWITCH_SEQ_BBLACK SWITCH_SEQ_ESC SWITCH_SEQ_B_BLACK SWITCH_SEQ_END_COLOR
100 #define SWITCH_SEQ_BRED SWITCH_SEQ_ESC SWITCH_SEQ_B_RED SWITCH_SEQ_END_COLOR
101 #define SWITCH_SEQ_BGREEN SWITCH_SEQ_ESC SWITCH_SEQ_B_GREEN SWITCH_SEQ_END_COLOR
102 #define SWITCH_SEQ_BYELLOW SWITCH_SEQ_ESC SWITCH_SEQ_B_YELLOW SWITCH_SEQ_END_COLOR
103 #define SWITCH_SEQ_BBLUE SWITCH_SEQ_ESC SWITCH_SEQ_B_BLUE SWITCH_SEQ_END_COLOR
104 #define SWITCH_SEQ_BMAGEN SWITCH_SEQ_ESC SWITCH_SEQ_B_MAGEN SWITCH_SEQ_END_COLOR
105 #define SWITCH_SEQ_BCYAN SWITCH_SEQ_ESC SWITCH_SEQ_B_CYAN SWITCH_SEQ_END_COLOR
106 #define SWITCH_SEQ_BWHITE SWITCH_SEQ_ESC SWITCH_SEQ_B_WHITE SWITCH_SEQ_END_COLOR
107 /* Preset escape sequences */
108 #define SWITCH_SEQ_HOME SWITCH_SEQ_ESC SWITCH_SEQ_HOME_CHAR_STR
109 #define SWITCH_SEQ_CLEARLINE SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINE_CHAR_STR
110 #define SWITCH_SEQ_CLEARLINEEND SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINEEND_CHAR
111 #define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
112 #endif
113 #define SWITCH_DEFAULT_CLID_NAME ""
114 #define SWITCH_DEFAULT_CLID_NUMBER "0000000000"
115 #define SWITCH_DEFAULT_DTMF_DURATION 2000
116 #define SWITCH_MIN_DTMF_DURATION 400
117 #define SWITCH_MAX_DTMF_DURATION 192000
118 #define SWITCH_DEFAULT_DIR_PERMS SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE
119 #ifdef WIN32
120 #define SWITCH_PATH_SEPARATOR "/"
121 #else
122 #define SWITCH_PATH_SEPARATOR "/"
123 #endif
124 #define SWITCH_URL_SEPARATOR "://"
125 #define SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE "ignore_display_updates"
126 #define SWITCH_AUDIO_SPOOL_PATH_VARIABLE "audio_spool_path"
127 #define SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE "bridge_hangup_cause"
128 #define SWITCH_READ_TERMINATOR_USED_VARIABLE "read_terminator_used"
129 #define SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE "send_silence_when_idle"
130 #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application"
131 #define SWITCH_CURRENT_APPLICATION_DATA_VARIABLE "current_application_data"
132 #define SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE "current_application_response"
133 #define SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE "passthru_ptime_mismatch"
134 #define SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE "enable_heartbeat_events"
135 #define SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE "bypass_media_after_bridge"
136 #define SWITCH_READ_RESULT_VARIABLE "read_result"
137 #define SWITCH_ATT_XFER_RESULT_VARIABLE "att_xfer_result"
138 #define SWITCH_COPY_XML_CDR_VARIABLE "copy_xml_cdr"
139 #define SWITCH_COPY_JSON_CDR_VARIABLE "copy_json_cdr"
140 #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application"
141 #define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause"
142 #define SWITCH_TRANSFER_HISTORY_VARIABLE "transfer_history"
143 #define SWITCH_TRANSFER_SOURCE_VARIABLE "transfer_source"
144 #define SWITCH_SENSITIVE_DTMF_VARIABLE "sensitive_dtmf"
145 #define SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE "record_post_process_exec_app"
146 #define SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE "record_post_process_exec_api"
147 
148 #define SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE "execute_on_answer"
149 #define SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE "execute_on_pre_answer"
150 #define SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE "execute_on_media"
151 #define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring"
152 #define SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE "execute_on_tone_detect"
153 #define SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE "execute_on_originate"
154 #define SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE "execute_on_post_originate"
155 #define SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE "execute_on_pre_originate"
156 
157 #define SWITCH_CHANNEL_EXECUTE_ON_PRE_BRIDGE_VARIABLE "execute_on_pre_bridge"
158 #define SWITCH_CHANNEL_EXECUTE_ON_POST_BRIDGE_VARIABLE "execute_on_post_bridge"
159 
160 #define SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE "api_on_answer"
161 #define SWITCH_CHANNEL_API_ON_PRE_ANSWER_VARIABLE "api_on_pre_answer"
162 #define SWITCH_CHANNEL_API_ON_MEDIA_VARIABLE "api_on_media"
163 #define SWITCH_CHANNEL_API_ON_RING_VARIABLE "api_on_ring"
164 #define SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE "api_on_tone_detect"
165 #define SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE "api_on_originate"
166 #define SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE "api_on_post_originate"
167 #define SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE "api_on_pre_originate"
168 
169 #define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout"
170 #define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid"
171 #define SWITCH_SOFT_HOLDING_UUID_VARIABLE "soft_holding_uuid"
172 #define SWITCH_API_BRIDGE_END_VARIABLE "api_after_bridge"
173 #define SWITCH_API_BRIDGE_START_VARIABLE "api_before_bridge"
174 #define SWITCH_API_HANGUP_HOOK_VARIABLE "api_hangup_hook"
175 #define SWITCH_API_REPORTING_HOOK_VARIABLE "api_reporting_hook"
176 #define SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE "session_in_hangup_hook"
177 #define SWITCH_PROCESS_CDR_VARIABLE "process_cdr"
178 #define SWITCH_SKIP_CDR_CAUSES_VARIABLE "skip_cdr_causes"
179 #define SWITCH_FORCE_PROCESS_CDR_VARIABLE "force_process_cdr"
180 #define SWITCH_BRIDGE_CHANNEL_VARIABLE "bridge_channel"
181 #define SWITCH_CHANNEL_NAME_VARIABLE "channel_name"
182 #define SWITCH_BRIDGE_UUID_VARIABLE "bridge_uuid"
183 #define SWITCH_CONTINUE_ON_FAILURE_VARIABLE "continue_on_fail"
184 #define SWITCH_PLAYBACK_TERMINATORS_VARIABLE "playback_terminators"
185 #define SWITCH_PLAYBACK_TERMINATOR_USED "playback_terminator_used"
186 #define SWITCH_CACHE_SPEECH_HANDLES_VARIABLE "cache_speech_handles"
187 #define SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME "__cache_speech_handles_obj__"
188 #define SWITCH_BYPASS_MEDIA_VARIABLE "bypass_media"
189 #define SWITCH_PROXY_MEDIA_VARIABLE "proxy_media"
190 #define SWITCH_ZRTP_PASSTHRU_VARIABLE "zrtp_passthru"
191 #define SWITCH_ENDPOINT_DISPOSITION_VARIABLE "endpoint_disposition"
192 #define SWITCH_HOLD_MUSIC_VARIABLE "hold_music"
193 #define SWITCH_TEMP_HOLD_MUSIC_VARIABLE "temp_hold_music"
194 #define SWITCH_EXPORT_VARS_VARIABLE "export_vars"
195 #define SWITCH_BRIDGE_EXPORT_VARS_VARIABLE "bridge_export_vars"
196 #define SWITCH_R_SDP_VARIABLE "switch_r_sdp"
197 #define SWITCH_L_SDP_VARIABLE "switch_l_sdp"
198 #define SWITCH_B_SDP_VARIABLE "switch_m_sdp"
199 #define SWITCH_BRIDGE_VARIABLE "bridge_to"
200 #define SWITCH_LAST_BRIDGE_VARIABLE "last_bridge_to"
201 #define SWITCH_SIGNAL_BRIDGE_VARIABLE "signal_bridge_to"
202 #define SWITCH_SIGNAL_BOND_VARIABLE "signal_bond"
203 #define SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE "originate_signal_bond"
204 #define SWITCH_ORIGINATOR_VARIABLE "originator"
205 #define SWITCH_ORIGINATOR_CODEC_VARIABLE "originator_codec"
206 #define SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE "originator_video_codec"
207 #define SWITCH_LOCAL_MEDIA_IP_VARIABLE "local_media_ip"
208 #define SWITCH_LOCAL_MEDIA_PORT_VARIABLE "local_media_port"
209 #define SWITCH_ADVERTISED_MEDIA_IP_VARIABLE "advertised_media_ip"
210 #define SWITCH_REMOTE_MEDIA_IP_VARIABLE "remote_media_ip"
211 #define SWITCH_REMOTE_MEDIA_PORT_VARIABLE "remote_media_port"
212 #define SWITCH_REMOTE_VIDEO_IP_VARIABLE "remote_video_ip"
213 #define SWITCH_REMOTE_VIDEO_PORT_VARIABLE "remote_video_port"
214 #define SWITCH_LOCAL_VIDEO_IP_VARIABLE "local_video_ip"
215 #define SWITCH_LOCAL_VIDEO_PORT_VARIABLE "local_video_port"
216 #define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE "hangup_after_bridge"
217 #define SWITCH_PARK_AFTER_BRIDGE_VARIABLE "park_after_bridge"
218 #define SWITCH_PARK_AFTER_EARLY_BRIDGE_VARIABLE "park_after_early_bridge"
219 #define SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE "transfer_after_bridge"
220 #define SWITCH_TRANSFER_AFTER_EARLY_BRIDGE_VARIABLE "transfer_after_early_bridge"
221 #define SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE "exec_after_bridge_app"
222 #define SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE "exec_after_bridge_arg"
223 #define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards"
224 #define SWITCH_MAX_SESSION_TRANSFERS_VARIABLE "max_session_transfers"
225 #define SWITCH_DISABLE_APP_LOG_VARIABLE "disable_app_log"
226 #define SWITCH_SPEECH_KEY "speech"
227 #define SWITCH_UUID_BRIDGE "uuid_bridge"
228 #define SWITCH_BITS_PER_BYTE 8
229 #define SWITCH_DEFAULT_FILE_BUFFER_LEN 65536
230 #define SWITCH_DTMF_LOG_LEN 1000
231 #define SWITCH_MAX_TRANS 2000
232 #define SWITCH_CORE_SESSION_MAX_PRIVATES 2
233 #define SWITCH_DEFAULT_VIDEO_SIZE 1200
234 #define SWITCH_RTCP_AUDIO_INTERVAL_MSEC "5000"
235 #define SWITCH_RTCP_VIDEO_INTERVAL_MSEC "2000"
236 
237 /* Jitter */
238 #define JITTER_VARIANCE_THRESHOLD 400.0
239 /* IPDV */
240 #define IPDV_THRESHOLD 1.0
241 /* Burst and Lost Rate */
242 #define LOST_BURST_ANALYZE 500
243 /* Burst */
244 #define LOST_BURST_CAPTURE 1024
245 
246 typedef uint8_t switch_byte_t;
247 
248 typedef enum {
252 
253 
254 /*!
255  \enum switch_dtmf_source_t
256  \brief DTMF sources
257 <pre>
258  SWITCH_DTMF_UNKNOWN - Unknown source
259  SWITCH_DTMF_INBAND_AUDIO - From audio
260  SWITCH_DTMF_RTP - From RTP as a telephone event
261  SWITCH_DTMF_ENDPOINT - From endpoint signaling
262  SWITCH_DTMF_APP - From application
263 </pre>
264  */
265 typedef enum {
272 
273 typedef enum {
278 
279 
280 
281 typedef enum {
284 } dtmf_flag_t;
285 
286 typedef struct {
287  char digit;
288  uint32_t duration;
289  int32_t flags;
291 } switch_dtmf_t;
292 
293 typedef enum {
297 
298 typedef enum {
299  SBF_DIAL_ALEG = (1 << 0),
300  SBF_EXEC_ALEG = (1 << 1),
301  SBF_DIAL_BLEG = (1 << 2),
302  SBF_EXEC_BLEG = (1 << 3),
303  SBF_EXEC_OPPOSITE = (1 << 4),
304  SBF_EXEC_SAME = (1 << 5),
305  SBF_ONCE = (1 << 6),
306  SBF_EXEC_INLINE = (1 << 7)
308 typedef uint32_t switch_bind_flag_t;
309 
310 typedef enum {
314 
315 typedef enum {
316  SOF_NONE = 0,
317  SOF_NOBLOCK = (1 << 0),
318  SOF_FORKED_DIAL = (1 << 1),
323  SOF_NO_LIMITS = (1 << 6)
325 typedef uint32_t switch_originate_flag_t;
326 
327 typedef enum {
328  SPF_NONE = 0,
329  SPF_ODD = (1 << 0),
330  SPF_EVEN = (1 << 1),
331  SPF_ROBUST_TCP = (1 << 2),
332  SPF_ROBUST_UDP = (1 << 3)
334 typedef uint32_t switch_port_flag_t;
335 
336 typedef enum {
337  ED_NONE = 0,
338  ED_MUX_READ = (1 << 0),
339  ED_MUX_WRITE = (1 << 1),
340  ED_DTMF = (1 << 2),
341  ED_COPY_DISPLAY = (1 << 3),
342  ED_BRIDGE_READ = (1 << 4),
343  ED_BRIDGE_WRITE = (1 << 5)
345 typedef uint32_t switch_eavesdrop_flag_t;
346 
347 typedef enum {
348  SCF_NONE = 0,
349  SCF_USE_SQL = (1 << 0),
353  SCF_SHUTTING_DOWN = (1 << 3),
354  SCF_VG = (1 << 4),
355  SCF_RESTART = (1 << 5),
357  SCF_USE_AUTO_NAT = (1 << 7),
358  SCF_EARLY_HANGUP = (1 << 8),
360  SCF_USE_HEAVY_TIMING = (1 << 10),
361  SCF_USE_CLOCK_RT = (1 << 11),
362  SCF_VERBOSE_EVENTS = (1 << 12),
364  SCF_AUTO_SCHEMAS = (1 << 14),
365  SCF_MINIMAL = (1 << 15),
366  SCF_USE_NAT_MAPPING = (1 << 16),
367  SCF_CLEAR_SQL = (1 << 17),
371  SCF_DEBUG_SQL = (1 << 21),
372  SCF_API_EXPANSION = (1 << 22),
376 typedef uint32_t switch_core_flag_t;
377 
378 typedef enum {
396 
397 typedef enum {
398  SUF_NONE = 0,
399  SUF_THREAD_RUNNING = (1 << 0),
400  SUF_READY = (1 << 1),
401  SUF_NATIVE = (1 << 2)
403 typedef uint32_t switch_unicast_flag_t;
404 
405 typedef enum {
408 } switch_bool_t;
409 
410 /* WARNING, Do not forget to update *SAY_METHOD_NAMES[] in src/switch_ivr_play_say.c */
411 typedef enum {
418 
419 /* WARNING, Do not forget to update *SAY_TYPE_NAMES[] in src/switch_ivr_say.c */
420 typedef enum {
441 
442 typedef enum {
448 
449 typedef enum {
454 
455 typedef enum {
457  SSHF_OWN_THREAD = (1 << 0),
458  SSHF_FREE_ARG = (1 << 1),
459  SSHF_NO_DEL = (1 << 2)
461 typedef uint32_t switch_scheduler_flag_t;
462 
463 typedef enum {
464  SMF_NONE = 0,
465  SMF_REBRIDGE = (1 << 0),
466  SMF_ECHO_ALEG = (1 << 1),
467  SMF_ECHO_BLEG = (1 << 2),
468  SMF_FORCE = (1 << 3),
469  SMF_LOOP = (1 << 4),
470  SMF_HOLD_BLEG = (1 << 5),
471  SMF_IMMEDIATE = (1 << 6),
472  SMF_EXEC_INLINE = (1 << 7),
473  SMF_PRIORITY = (1 << 8),
474  SMF_REPLYONLY_A = (1 << 9),
475  SMF_REPLYONLY_B = (1 << 10)
477 typedef uint32_t switch_media_flag_t;
478 
479 typedef enum {
483 
484 typedef enum {
499 
500 typedef struct {
502  uint32_t buflen;
504  uint32_t bytes;
505  uint32_t bits_tot;
515 
516 
518  char *base_dir;
519  char *mod_dir;
520  char *conf_dir;
521  char *log_dir;
522  char *run_dir;
523  char *db_dir;
524  char *script_dir;
525  char *temp_dir;
526  char *htdocs_dir;
527  char *grammar_dir;
528  char *storage_dir;
529  char *cache_dir;
531  char *sounds_dir;
532  char *lib_dir;
533  char *certs_dir;
534  char *fonts_dir;
535  char *images_dir;
536  char *data_dir;
538 };
539 
542 
544  char *conf_name;
545 };
546 
549 
550 #define SWITCH_MAX_STACKS 16
551 #define SWITCH_THREAD_STACKSIZE 240 * 1024
552 #define SWITCH_SYSTEM_THREAD_STACKSIZE 8192 * 1024
553 #define SWITCH_MAX_INTERVAL 120 /* we only do up to 120ms */
554 #define SWITCH_INTERVAL_PAD 10 /* A little extra buffer space to be safe */
555 #define SWITCH_MAX_SAMPLE_LEN 48
556 #define SWITCH_BYTES_PER_SAMPLE 2 /* slin is 2 bytes per sample */
557 #define SWITCH_RECOMMENDED_BUFFER_SIZE 8192
558 #define SWITCH_MAX_CODECS 50
559 #define SWITCH_MAX_STATE_HANDLERS 30
560 #define SWITCH_CORE_QUEUE_LEN 100000
561 #define SWITCH_MAX_MANAGEMENT_BUFFER_LEN 1024 * 8
562 
563 #define SWITCH_ACCEPTABLE_INTERVAL(_i) (_i && _i <= SWITCH_MAX_INTERVAL && (_i % 10) == 0)
564 
565 typedef enum {
568 } switch_rw_t;
569 
570 typedef enum {
572  SWITCH_CPF_SCREEN = (1 << 0),
577 
578 typedef enum {
586 
587 typedef enum {
595  /* Nothing after this line */
598 typedef uint32_t switch_xml_section_t;
599 
600 /*!
601  \enum switch_vad_flag_t
602  \brief RTP Related Flags
603 <pre>
604  SWITCH_VAD_FLAG_TALKING - Currently Talking
605  SWITCH_VAD_FLAG_EVENTS_TALK - Fire events when talking is detected
606  SWITCH_VAD_FLAG_EVENTS_NOTALK - Fire events when not talking is detected
607  SWITCH_VAD_FLAG_CNG - Send CNG
608 </pre>
609  */
610 typedef enum {
616 typedef uint32_t switch_vad_flag_t;
617 
618 
619 typedef struct error_period {
620  int64_t start;
621  int64_t stop;
624 
625 
626 typedef struct {
638  /* Jitter */
639  int64_t last_proc_time;
640  int64_t jitter_n;
641  int64_t jitter_add;
642  int64_t jitter_addsq;
643 
644  double variance;
645  double min_variance;
646  double max_variance;
648 
649  /* Burst and Packet Loss */
650  double lossrate;
651  double burstrate;
655  int recved;
659  double R;
660  double mos;
663 
664 typedef struct {
665  uint32_t packet_count; /* sent packet count */
666  uint32_t octet_count;
667  uint32_t peer_ssrc;
668  uint32_t last_rpt_ts; /* RTP timestamp at which the last report was generated and sent */
669  uint32_t ssrc; /* identifier of the source */
670  uint32_t csrc; /* contributing source 0-15 32bit each */
671  uint32_t last_pkt_tsdiff; /* Jitter calculation, timestamp difference between the two last received packet */
672  double inter_jitter; /* Jitter calculation, Interarrival jitter */
673  uint32_t last_rpt_ext_seq; /* Packet loss calculation, extended sequence number at the begining of this RTCP report interval */
674  uint16_t last_rpt_cycle; /* Packet loss calculation, sequence number cycle at the begining of the current RTCP report interval */
675  uint16_t period_pkt_count; /* Packet loss calculation, packet count received during this RTCP report interval */
676  uint16_t pkt_count; /* Packet loss calculation, packet count received during this session */
677  uint16_t sent_pkt_count;
678  uint32_t rtcp_rtp_count; /* RTCP report generated count */
679  uint32_t high_ext_seq_recv; /* Packet loss calculation, highest extended sequence number received and processed for stats */
680  uint16_t cycle; /* Packet loss calculation, sequence number cycle of the current RTCP report interval */
681  uint32_t bad_seq; /* Bad SEQ found, used to detect reset on the other side */
682  uint16_t base_seq; /* Packet loss calculation, first sequence number received */
683  uint32_t cum_lost; /* Packet loss calculation, cumulative number of packet lost */
684  uint32_t last_recv_lsr_local; /* RTT calculation, When receiving an SR we save our local timestamp in fraction of 65536 seconds */
685  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 */
686  uint32_t init;
688 
689 typedef struct {
693  uint32_t read_count;
695 
696 typedef enum {
701 
702 #define SWITCH_RTP_CNG_PAYLOAD 13
703 
704 /*!
705  \enum switch_rtp_flag_t
706  \brief RTP Related Flags
707 <pre>
708  SWITCH_RTP_FLAG_NOBLOCK - Do not block
709  SWITCH_RTP_FLAG_IO - IO is ready
710  SWITCH_RTP_FLAG_USE_TIMER - Timeout Reads and replace with a CNG Frame
711  SWITCH_RTP_FLAG_SECURE - Secure RTP
712  SWITCH_RTP_FLAG_AUTOADJ - Auto-Adjust the dest based on the source
713  SWITCH_RTP_FLAG_RAW_WRITE - Try to forward packets unscathed
714  SWITCH_RTP_FLAG_GOOGLEHACK - Convert payload from 102 to 97
715  SWITCH_RTP_FLAG_VAD - Enable VAD
716  SWITCH_RTP_FLAG_BREAK - Stop what you are doing and return SWITCH_STATUS_BREAK
717  SWITCH_RTP_FLAG_DATAWAIT - Do not return from reads unless there is data even when non blocking
718  SWITCH_RTP_FLAG_BUGGY_2833 - Emulate the bug in cisco equipment to allow interop
719  SWITCH_RTP_FLAG_PASS_RFC2833 - Pass 2833 (ignore it)
720  SWITCH_RTP_FLAG_AUTO_CNG - Generate outbound CNG frames when idle
721 </pre>
722  */
723 typedef enum {
769 
770 
771 typedef enum {
772  RTP_BUG_NONE = 0, /* won't be using this one much ;) */
773 
775  /* Some Cisco devices get mad when you send the mark bit on new 2833 because it makes
776  them flush their jitterbuffer and the dtmf along with it.
777 
778  This flag will disable the sending of the mark bit on the first DTMF packet.
779  */
780 
781 
783  /*
784  Sonus wrongly expects that, when sending a multi-packet 2833 DTMF event, The sender
785  should increment the RTP timestamp in each packet when, in reality, the sender should
786  send the same exact timestamp and increment the duration field in the 2833 payload.
787  This allows a reconstruction of the duration if any of the packets are lost.
788 
789  final_duration - initial_timestamp = total_samples
790 
791  However, if the duration value exceeds the space allocated (16 bits), The sender should increment
792  the timestamp one unit and reset the duration to 0.
793 
794  Always sending a duration of 0 with a new timestamp should be tolerated but is rarely intentional
795  and is mistakenly done by many devices.
796  The issue is that the Sonus expects everyone to do it this way instead of tolerating either way.
797  Sonus will actually ignore every packet with the same timestamp before concluding if it's DTMF.
798 
799  This flag will cause each packet to have a new timestamp.
800  */
801 
802 
804 
805  /*
806  A Huawei SBC has been discovered that sends the mark bit on every single RTP packet.
807  Since this causes the RTP stack to flush it's buffers, it horribly messes up the timing on the channel.
808 
809  This flag will do nothing when an inbound packet contains the mark bit.
810 
811  */
812 
813 
815 
816  /*
817  Our friends at Sonus get real mad when the timestamps are not in perfect sequence even during periods of silence.
818  With this flag, we will only increment the timestamp when write packets even if they are eons apart.
819 
820  */
821 
823 
824  /*
825  Our friends at Sonus also get real mad if the sequence number does not start at 0.
826  Typically, we set this to a random starting value for your saftey.
827  This is a security risk you take upon yourself when you enable this flag.
828  */
829 
830 
832 
833  /*
834  Our friends at Sonus are on a roll, They also get easily dumbfounded by marker bits.
835  This flag will never send any. Sheesh....
836  */
837 
839 
840  /*
841  Guess Who? ... Yep, Sonus (and who know's who else) likes to interweave DTMF with the audio stream making it take
842  2X as long as it should and sending an incorrect duration making the DTMF very delayed.
843  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.
844  */
845 
846 
848 
849  /*
850  Oracle's Contact Center Anywhere (CCA) likes to use a single RTP socket to send all its outbound audio.
851  This messes up our ability to auto adjust to NATTED RTP and causes us to ignore its audio packets.
852  This flag will allow compatibility with this dying product.
853  */
854 
855 
857 
858  /*
859  Some RTP endpoints (and by some we mean *cough* _SONUS_!) do not like it when the timestamps jump forward or backwards in time.
860  So say you are generating a file that says "please wait for me to complete your call, or generating ringback"
861  Now you place and outbound call and you are bridging. Well, while you were playing the file, you were generating your own RTP timestamps.
862  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......
863  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.
864 
865  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
866  actual timestamps in the frames.
867 
868  */
869 
871 
872  /*
873  By default FS will change the SSRC when the marker is set and it detects a timestamp reset.
874  If this setting is enabled it will NOT do this (old behaviour).
875  */
876 
878 
879  /* FLUSH JITTERBUFFER When getting RFC2833 to reduce bleed through */
880 
882 
883  /*
884  Make FS accept any payload type instead of dropping and returning CNG frame. Workaround while FS only supports a single payload per rtp session.
885  This can be used by endpoint modules to detect payload changes and act appropriately (ex: sofia could send a reINVITE with single codec).
886  This should probably be a flag, but flag enum is already full!
887  */
888 
889 
891 
892  /*
893  Leave the auto-adjust behavior enableed permenantly rather than only at appropriate times. (IMPLICITLY sets RTP_BUG_ACCEPT_ANY_PACKETS)
894 
895  */
896 
897 
899 
900 #ifdef _MSC_VER
901 #pragma pack(push, r1, 1)
902 #endif
903 
904 #if SWITCH_BYTE_ORDER == __BIG_ENDIAN
905 typedef struct {
906  unsigned version:2; /* protocol version */
907  unsigned p:1; /* padding flag */
908  unsigned x:1; /* header extension flag */
909  unsigned cc:4; /* CSRC count */
910  unsigned m:1; /* marker bit */
911  unsigned pt:7; /* payload type */
912  unsigned seq:16; /* sequence number */
913  unsigned ts:32; /* timestamp */
914  unsigned ssrc:32; /* synchronization source */
916 
917 typedef struct {
918  unsigned length:16; /* length */
919  unsigned profile:16; /* defined by profile */
921 
922 #else /* BIG_ENDIAN */
923 
924 typedef struct {
925  unsigned cc:4; /* CSRC count */
926  unsigned x:1; /* header extension flag */
927  unsigned p:1; /* padding flag */
928  unsigned version:2; /* protocol version */
929  unsigned pt:7; /* payload type */
930  unsigned m:1; /* marker bit */
931  unsigned seq:16; /* sequence number */
932  unsigned ts:32; /* timestamp */
933  unsigned ssrc:32; /* synchronization source */
935 
936 typedef struct {
937  unsigned profile:16; /* defined by profile */
938  unsigned length:16; /* length */
940 
941 #endif
942 
943 #ifdef _MSC_VER
944 #pragma pack(pop, r1)
945 #endif
946 
947 #ifdef _MSC_VER
948 #pragma pack(push, r1, 1)
949 #endif
950 
951 #if SWITCH_BYTE_ORDER == __BIG_ENDIAN
952 typedef struct switch_rtcp_hdr_s {
953  unsigned version:2; /* protocol version */
954  unsigned p:1; /* padding flag */
955  unsigned count:5; /* number of reception report blocks */
956  unsigned type:8; /* packet type */
957  unsigned length:16; /* length in 32-bit words - 1 */
959 
960 #else /* BIG_ENDIAN */
961 
962 typedef struct switch_rtcp_hdr_s {
963  unsigned count:5; /* number of reception report blocks */
964  unsigned p:1; /* padding flag */
965  unsigned version:2; /* protocol version */
966  unsigned type:8; /* packet type */
967  unsigned length:16; /* length in 32-bit words - 1 */
969 
970 #endif
971 
972 #ifdef _MSC_VER
973 #pragma pack(pop, r1)
974 #endif
975 
976 typedef struct audio_buffer_header_s {
977  uint32_t ts;
978  uint32_t len;
980 
981 
982 /*!
983  \enum switch_priority_t
984  \brief Priority Indication
985 <pre>
986  SWITCH_PRIORITY_NORMAL - Normal Priority
987  SWITCH_PRIORITY_LOW - Low Priority
988  SWITCH_PRIORITY_HIGH - High Priority
989 </pre>
990  */
991 typedef enum {
996 
997 /*!
998  \enum switch_ivr_option_t
999  \brief Possible options related to ivr functions
1000 <pre>
1001  SWITCH_IVR_OPTION_NONE - nothing whatsoever
1002  SWITCH_IVR_OPTION_ASYNC - Asynchronous (do things in the background when applicable)
1003  SWITCH_IVR_OPTION_FILE - string argument implies a filename
1004 </pre>
1005  */
1006 typedef enum {
1011 typedef uint32_t switch_ivr_option_t;
1012 
1013 /*!
1014  \enum switch_core_session_message_types_t
1015  \brief Possible types of messages for inter-session communication
1016 <pre>
1017  SWITCH_MESSAGE_REDIRECT_AUDIO - Indication to redirect audio to another location if possible
1018  SWITCH_MESSAGE_TRANSMIT_TEXT - A text message
1019  SWITCH_MESSAGE_INDICATE_ANSWER - indicate answer
1020  SWITCH_MESSAGE_INDICATE_PROGRESS - indicate progress
1021  SWITCH_MESSAGE_INDICATE_BRIDGE - indicate a bridge starting
1022  SWITCH_MESSAGE_INDICATE_UNBRIDGE - indicate a bridge ending
1023  SWITCH_MESSAGE_INDICATE_TRANSFER - indicate a transfer is taking place
1024  SWITCH_MESSAGE_INDICATE_MEDIA - indicate media is required
1025  SWITCH_MESSAGE_INDICATE_NOMEDIA - indicate no-media is required
1026  SWITCH_MESSAGE_INDICATE_HOLD - indicate hold
1027  SWITCH_MESSAGE_INDICATE_UNHOLD - indicate unhold
1028  SWITCH_MESSAGE_INDICATE_REDIRECT - indicate redirect
1029  SWITCH_MESSAGE_INDICATE_RESPOND - indicate reject
1030  SWITCH_MESSAGE_INDICATE_BROADCAST - indicate media broadcast
1031  SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT - indicate media broadcast
1032  SWITCH_MESSAGE_INDICATE_DEFLECT - indicate deflect
1033  SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ - indicate video refresh request
1034 </pre>
1035  */
1036 typedef enum {
1096 
1097 typedef struct {
1098  uint16_t T38FaxVersion;
1099  uint32_t T38MaxBitRate;
1106  const char *T38FaxUdpEC;
1107  const char *T38VendorInfo;
1108  const char *remote_ip;
1109  uint16_t remote_port;
1110  const char *local_ip;
1111  uint16_t local_port;
1112  const char *sdp_o_line;
1114 
1115 /*!
1116  \enum switch_stack_t
1117  \brief Expression of how to stack a list
1118 <pre>
1119 SWITCH_STACK_BOTTOM - Stack on the bottom
1120 SWITCH_STACK_TOP - Stack on the top
1121 </pre>
1122  */
1123 typedef enum {
1125  SWITCH_STACK_TOP = (1 << 1),
1128  SWITCH_STACK_PUSH = (1 << 4),
1129 } switch_stack_t;
1130 
1131 /*!
1132  \enum switch_status_t
1133  \brief Common return values
1134 <pre>
1135  SWITCH_STATUS_SUCCESS - General Success (common return value for most functions)
1136  SWITCH_STATUS_FALSE - General Falsehood
1137  SWITCH_STATUS_TIMEOUT - A Timeout has occured
1138  SWITCH_STATUS_RESTART - An indication to restart the previous operation
1139  SWITCH_STATUS_TERM - An indication to terminate
1140  SWITCH_STATUS_NOTIMPL - An indication that requested resource is not impelemented
1141  SWITCH_STATUS_MEMERR - General memory error
1142  SWITCH_STATUS_NOOP - NOTHING
1143  SWITCH_STATUS_RESAMPLE - An indication that a resample has occured
1144  SWITCH_STATUS_GENERR - A general Error
1145  SWITCH_STATUS_INUSE - An indication that requested resource is in use
1146  SWITCH_STATUS_BREAK - A non-fatal break of an operation
1147  SWITCH_STATUS_SOCKERR - A socket error
1148  SWITCH_STATUS_MORE_DATA - Need More Data
1149  SWITCH_STATUS_NOTFOUND - Not Found
1150  SWITCH_STATUS_UNLOAD - Unload
1151  SWITCH_STATUS_NOUNLOAD - Never Unload
1152 </pre>
1153  */
1154 typedef enum {
1181 } switch_status_t;
1182 
1183 
1184 
1185 /*!
1186 \enum switch_log_level_t
1187 \brief Log Level Enumeration
1188 <pre>
1189  SWITCH_LOG_DEBUG - Debug
1190  SWITCH_LOG_INFO - Info
1191  SWITCH_LOG_NOTICE - Notice
1192  SWITCH_LOG_WARNING - Warning
1193  SWITCH_LOG_ERROR - Error
1194  SWITCH_LOG_CRIT - Critical
1195  SWITCH_LOG_ALERT - Alert
1196  SWITCH_LOG_CONSOLE - Console
1197 </pre>
1198  */
1199 typedef enum {
1221 
1222 
1223 /*!
1224 \enum switch_text_channel_t
1225 \brief A target to write log/debug info to
1226 <pre>
1227 SWITCH_CHANNEL_ID_LOG - Write to the currently defined log
1228 SWITCH_CHANNEL_ID_LOG_CLEAN - Write to the currently defined log with no extra file/line/date information
1229 SWITCH_CHANNEL_ID_EVENT - Write to the event engine as a LOG event
1230 </pre>
1231  */
1232 typedef enum {
1238 
1239 typedef enum {
1240  SCSMF_DYNAMIC = (1 << 0),
1245 
1246 #define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
1247 #define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
1248 #define SWITCH_CHANNEL_SESSION_LOG_CLEAN(x) SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, switch_core_session_get_uuid((x))
1249 #define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
1250 #define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)(x)
1251 #define SWITCH_CHANNEL_CHANNEL_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)switch_channel_get_session(x)
1252 #define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, (x)
1253 
1254 typedef enum {
1265 
1266 typedef enum {
1275 
1276 
1277 /*!
1278  \enum switch_channel_state_t
1279  \brief Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are often overridden by specific apps)
1280 <pre>
1281 CS_NEW - Channel is newly created.
1282 CS_INIT - Channel has been initialized.
1283 CS_ROUTING - Channel is looking for an extension to execute.
1284 CS_SOFT_EXECUTE - Channel is ready to execute from 3rd party control.
1285 CS_EXECUTE - Channel is executing it's dialplan.
1286 CS_EXCHANGE_MEDIA - Channel is exchanging media with another channel.
1287 CS_PARK - Channel is accepting media awaiting commands.
1288 CS_CONSUME_MEDIA - Channel is consuming all media and dropping it.
1289 CS_HIBERNATE - Channel is in a sleep state.
1290 CS_RESET - Channel is in a reset state.
1291 CS_HANGUP - Channel is flagged for hangup and ready to end.
1292 CS_REPORTING - Channel is ready to collect call detail.
1293 CS_DESTROY - Channel is ready to be destroyed and out of the state machine.
1294 </pre>
1295  */
1296 typedef enum {
1312 
1313 typedef enum {
1318 
1319 
1320 /*!
1321  \enum switch_channel_flag_t
1322  \brief Channel Flags
1323 
1324 <pre>
1325 CF_ANSWERED - Channel is answered
1326 CF_OUTBOUND - Channel is an outbound channel
1327 CF_EARLY_MEDIA - Channel is ready for audio before answer
1328 CF_ORIGINATOR - Channel is an originator
1329 CF_TRANSFER - Channel is being transfered
1330 CF_ACCEPT_CNG - Channel will accept CNG frames
1331 CF_REDIRECT - Channel is being redirected
1332 CF_BRIDGED - Channel in a bridge
1333 CF_HOLD - Channel is on hold
1334 CF_SERVICE - Channel has a service thread
1335 CF_TAGGED - Channel is tagged
1336 CF_WINNER - Channel is the winner
1337 CF_CONTROLLED - Channel is under control
1338 CF_PROXY_MODE - Channel has no media
1339 CF_SUSPEND - Suspend i/o
1340 CF_EVENT_PARSE - Suspend control events
1341 CF_GEN_RINGBACK - Channel is generating it's own ringback
1342 CF_RING_READY - Channel is ready to send ringback
1343 CF_BREAK - Channel should stop what it's doing
1344 CF_BROADCAST - Channel is broadcasting
1345 CF_UNICAST - Channel has a unicast connection
1346 CF_VIDEO - Channel has video
1347 CF_EVENT_LOCK - Don't parse events
1348 CF_RESET - Tell extension parser to reset
1349 CF_ORIGINATING - Channel is originating
1350 CF_STOP_BROADCAST - Signal to stop broadcast
1351 
1352 CF_AUDIO_PAUSE - Audio is not ready to read/write
1353 CF_VIDEO_PAUSE - Video is not ready to read/write
1354 
1355 CF_MEDIA_SET - Session has read codec assigned
1356 
1357 </pre>
1358  */
1359 
1360 typedef enum {
1367  /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
1370 
1371 typedef enum {
1468  CF_PROTO_HOLD, //TFLAG_SIP_HOLD
1470  CF_VIDEO_POSSIBLE,//TFLAG_VIDEO
1511  /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
1512  /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
1515 
1516 typedef struct switch_vid_params_s {
1517  uint32_t width;
1518  uint32_t height;
1519  uint32_t fps;
1521 
1522 
1523 
1524 typedef enum {
1525  CF_APP_TAGGED = (1 << 0),
1526  CF_APP_T38 = (1 << 1),
1527  CF_APP_T38_REQ = (1 << 2),
1528  CF_APP_T38_FAIL = (1 << 3),
1531 
1532 
1533 /*!
1534  \enum switch_frame_flag_t
1535  \brief Frame Flags
1536 
1537 <pre>
1538 SFF_CNG = (1 << 0) - Frame represents comfort noise
1539 SFF_RAW_RTP = (1 << 1) - Frame has raw rtp accessible
1540 SFF_RTP_HEADER = (1 << 2) - Get the rtp header from the frame header
1541 SFF_PLC = (1 << 3) - Frame has generated PLC data
1542 SFF_RFC2833 = (1 << 4) - Frame has rfc2833 dtmf data
1543 SFF_DYNAMIC = (1 << 5) - Frame is dynamic and should be freed
1544 SFF_MARKER = (1 << 11) - Frame flag has Marker set, only set by encoder
1545 SFF_WAIT_KEY_FRAME = (1 << 12) - Need a key from before could decode, or force generate a key frame on encode
1546 </pre>
1547  */
1548 typedef enum {
1550  SFF_CNG = (1 << 0),
1551  SFF_RAW_RTP = (1 << 1),
1552  SFF_RTP_HEADER = (1 << 2),
1553  SFF_PLC = (1 << 3),
1554  SFF_RFC2833 = (1 << 4),
1555  SFF_PROXY_PACKET = (1 << 5),
1556  SFF_DYNAMIC = (1 << 6),
1557  SFF_ZRTP = (1 << 7),
1558  SFF_UDPTL_PACKET = (1 << 8),
1559  SFF_NOT_AUDIO = (1 << 9),
1560  SFF_RTCP = (1 << 10),
1561  SFF_MARKER = (1 << 11),
1562  SFF_WAIT_KEY_FRAME = (1 << 12),
1564  SFF_PICTURE_RESET = (1 << 14),
1565  SFF_SAME_IMAGE = (1 << 15),
1567  SFF_ENCODED = (1 << 17)
1569 typedef uint32_t switch_frame_flag_t;
1570 
1571 
1572 typedef enum {
1575  SAF_ROUTING_EXEC = (1 << 1),
1576  SAF_MEDIA_TAP = (1 << 2),
1577  SAF_ZOMBIE_EXEC = (1 << 3),
1578  SAF_NO_LOOPBACK = (1 << 4)
1580 typedef uint32_t switch_application_flag_t;
1581 
1582 typedef enum {
1586 
1587 
1588 /*!
1589  \enum switch_signal_t
1590  \brief Signals to send to channels
1591 <pre>
1592 SWITCH_SIG_KILL - Kill the channel
1593 SWITCH_SIG_XFER - Stop the current io but leave it viable
1594 </pre>
1595  */
1596 
1597 typedef enum {
1602 } switch_signal_t;
1603 
1604 /*!
1605  \enum switch_codec_flag_t
1606  \brief Codec related flags
1607 <pre>
1608 SWITCH_CODEC_FLAG_ENCODE = (1 << 0) - Codec can encode
1609 SWITCH_CODEC_FLAG_DECODE = (1 << 1) - Codec can decode
1610 SWITCH_CODEC_FLAG_SILENCE_START = (1 << 2) - Start period of silence
1611 SWITCH_CODEC_FLAG_SILENCE_STOP = (1 << 3) - End period of silence
1612 SWITCH_CODEC_FLAG_SILENCE = (1 << 4) - Silence
1613 SWITCH_CODEC_FLAG_FREE_POOL = (1 << 5) - Free codec's pool on destruction
1614 SWITCH_CODEC_FLAG_AAL2 = (1 << 6) - USE AAL2 Bitpacking
1615 SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7) - Passthrough only
1616 </pre>
1617 */
1618 typedef enum {
1630 typedef uint32_t switch_codec_flag_t;
1631 
1632 
1633 /*!
1634  \enum switch_speech_flag_t
1635  \brief Speech related flags
1636 <pre>
1637 SWITCH_SPEECH_FLAG_HASTEXT = (1 << 0) - Interface is has text to read.
1638 SWITCH_SPEECH_FLAG_PEEK = (1 << 1) - Read data but do not erase it.
1639 SWITCH_SPEECH_FLAG_FREE_POOL = (1 << 2) - Free interface's pool on destruction.
1640 SWITCH_SPEECH_FLAG_BLOCKING = (1 << 3) - Indicate that a blocking call is desired
1641 SWITCH_SPEECH_FLAG_PAUSE = (1 << 4) - Pause toggle for playback
1642 </pre>
1643 */
1644 typedef enum {
1654 typedef uint32_t switch_speech_flag_t;
1655 
1656 /*!
1657  \enum switch_asr_flag_t
1658  \brief Asr related flags
1659 <pre>
1660 SWITCH_ASR_FLAG_DATA = (1 << 0) - Interface has data
1661 SWITCH_ASR_FLAG_FREE_POOL = (1 << 1) - Pool needs to be freed
1662 SWITCH_ASR_FLAG_CLOSED = (1 << 2) - Interface has been closed
1663 SWITCH_ASR_FLAG_FIRE_EVENTS = (1 << 3) - Fire all speech events
1664 SWITCH_ASR_FLAG_AUTO_RESUME = (1 << 4) - Auto Resume
1665 </pre>
1666 */
1667 typedef enum {
1674 
1676 typedef uint32_t switch_asr_flag_t;
1677 
1678 /*!
1679  \enum switch_directory_flag_t
1680  \brief Directory Handle related flags
1681 <pre>
1682 SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0) - Free interface's pool on destruction.
1683 </pre>
1684 */
1685 typedef enum {
1687 
1689 typedef uint32_t switch_directory_flag_t;
1690 
1691 /*!
1692  \enum switch_codec_type_t
1693  \brief Codec types
1694 <pre>
1695 SWITCH_CODEC_TYPE_AUDIO - Audio Codec
1696 SWITCH_CODEC_TYPE_VIDEO - Video Codec
1697 SWITCH_CODEC_TYPE_T38 - T38 Codec
1698 SWITCH_CODEC_TYPE_APP - Application Codec
1699 </pre>
1700  */
1701 typedef enum {
1707 
1708 typedef enum {
1712 #define SWITCH_MEDIA_TYPE_TOTAL 2
1713 
1714 
1715 /*!
1716  \enum switch_timer_flag_t
1717  \brief Timer related flags
1718 <pre>
1719 SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0) - Free timer's pool on destruction
1720 </pre>
1721 */
1722 typedef enum {
1725 typedef uint32_t switch_timer_flag_t;
1726 
1727 
1728 /*!
1729  \enum switch_timer_flag_t
1730  \brief Timer related flags
1731 <pre>
1732 SMBF_READ_STREAM - Include the Read Stream
1733 SMBF_WRITE_STREAM - Include the Write Stream
1734 SMBF_WRITE_REPLACE - Replace the Write Stream
1735 SMBF_READ_REPLACE - Replace the Read Stream
1736 SMBF_STEREO - Record in stereo
1737 SMBF_ANSWER_REQ - Don't record until the channel is answered
1738 SMBF_BRIDGE_REQ - Don't record until the channel is bridged
1739 SMBF_THREAD_LOCK - Only let the same thread who created the bug remove it.
1740 SMBF_PRUNE -
1741 SMBF_NO_PAUSE -
1742 SMBF_STEREO_SWAP - Record in stereo: Write Stream - left channel, Read Stream - right channel
1743 </pre>
1744 */
1745 typedef enum {
1747  SMBF_READ_STREAM = (1 << 0),
1748  SMBF_WRITE_STREAM = (1 << 1),
1750  SMBF_READ_REPLACE = (1 << 3),
1751  SMBF_READ_PING = (1 << 4),
1752  SMBF_STEREO = (1 << 5),
1753  SMBF_ANSWER_REQ = (1 << 6),
1754  SMBF_BRIDGE_REQ = (1 << 7),
1755  SMBF_THREAD_LOCK = (1 << 8),
1756  SMBF_PRUNE = (1 << 9),
1757  SMBF_NO_PAUSE = (1 << 10),
1758  SMBF_STEREO_SWAP = (1 << 11),
1759  SMBF_LOCK = (1 << 12),
1762  SMBF_ONE_ONLY = (1 << 15),
1763  SMBF_MASK = (1 << 16),
1768  SMBF_VIDEO_PATCH = (1 << 21),
1772 typedef uint32_t switch_media_bug_flag_t;
1773 
1774 /*!
1775  \enum switch_file_flag_t
1776  \brief File flags
1777 <pre>
1778 SWITCH_FILE_FLAG_READ = (1 << 0) - Open for read
1779 SWITCH_FILE_FLAG_WRITE = (1 << 1) - Open for write
1780 SWITCH_FILE_FLAG_FREE_POOL = (1 << 2) - Free file handle's pool on destruction
1781 SWITCH_FILE_DATA_SHORT = (1 << 3) - Read data in shorts
1782 SWITCH_FILE_DATA_INT = (1 << 4) - Read data in ints
1783 SWITCH_FILE_DATA_FLOAT = (1 << 5) - Read data in floats
1784 SWITCH_FILE_DATA_DOUBLE = (1 << 6) - Read data in doubles
1785 SWITCH_FILE_DATA_RAW = (1 << 7) - Read data as is
1786 SWITCH_FILE_PAUSE = (1 << 8) - Pause
1787 SWITCH_FILE_NATIVE = (1 << 9) - File is in native format (no transcoding)
1788 SWITCH_FILE_SEEK = (1 << 10) - File has done a seek
1789 SWITCH_FILE_OPEN = (1 << 11) - File is open
1790 </pre>
1791  */
1792 typedef enum {
1801  SWITCH_FILE_PAUSE = (1 << 8),
1803  SWITCH_FILE_SEEK = (1 << 10),
1804  SWITCH_FILE_OPEN = (1 << 11),
1806  SWITCH_FILE_DONE = (1 << 13),
1810  SWITCH_FILE_NOMUX = (1 << 17),
1815 typedef uint32_t switch_file_flag_t;
1816 
1817 typedef enum {
1823 typedef uint32_t switch_io_flag_t;
1824 
1825 /* make sure this is synced with the EVENT_NAMES array in switch_event.c
1826  also never put any new ones before EVENT_ALL
1827 */
1828 /*!
1829  \enum switch_event_types_t
1830  \brief Built-in Events
1831 
1832 <pre>
1833  SWITCH_EVENT_CUSTOM - A custom event
1834  SWITCH_EVENT_CLONE - A cloned event
1835  SWITCH_EVENT_CHANNEL_CREATE - A channel has been created
1836  SWITCH_EVENT_CHANNEL_DESTROY - A channel has been destroyed
1837  SWITCH_EVENT_CHANNEL_STATE - A channel has changed state
1838  SWITCH_EVENT_CHANNEL_CALLSTATE - A channel has changed call state
1839  SWITCH_EVENT_CHANNEL_ANSWER - A channel has been answered
1840  SWITCH_EVENT_CHANNEL_HANGUP - A channel has been hungup
1841  SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE - A channel has completed the hangup
1842  SWITCH_EVENT_CHANNEL_EXECUTE - A channel has executed a module's application
1843  SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE - A channel has finshed executing a module's application
1844  SWITCH_EVENT_CHANNEL_HOLD - A channel has been put on hold
1845  SWITCH_EVENT_CHANNEL_UNHOLD - A channel has been unheld
1846  SWITCH_EVENT_CHANNEL_BRIDGE - A channel has bridged to another channel
1847  SWITCH_EVENT_CHANNEL_UNBRIDGE - A channel has unbridged from another channel
1848  SWITCH_EVENT_CHANNEL_PROGRESS - A channel has started ringing
1849  SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA - A channel has started early media
1850  SWITCH_EVENT_CHANNEL_OUTGOING - A channel has been unparked
1851  SWITCH_EVENT_CHANNEL_PARK - A channel has been parked
1852  SWITCH_EVENT_CHANNEL_UNPARK - A channel has been unparked
1853  SWITCH_EVENT_CHANNEL_APPLICATION- A channel has called and event from an application
1854  SWITCH_EVENT_CHANNEL_ORIGINATE - A channel has been originated
1855  SWITCH_EVENT_CHANNEL_UUID - A channel has changed uuid
1856  SWITCH_EVENT_API - An API call has been executed
1857  SWITCH_EVENT_LOG - A LOG event has been triggered
1858  SWITCH_EVENT_INBOUND_CHAN - A new inbound channel has been created
1859  SWITCH_EVENT_OUTBOUND_CHAN - A new outbound channel has been created
1860  SWITCH_EVENT_STARTUP - The system has been started
1861  SWITCH_EVENT_SHUTDOWN - The system has been shutdown
1862  SWITCH_EVENT_PUBLISH - Publish
1863  SWITCH_EVENT_UNPUBLISH - UnPublish
1864  SWITCH_EVENT_TALK - Talking Detected
1865  SWITCH_EVENT_NOTALK - Not Talking Detected
1866  SWITCH_EVENT_SESSION_CRASH - Session Crashed
1867  SWITCH_EVENT_MODULE_LOAD - Module was loaded
1868  SWITCH_EVENT_MODULE_UNLOAD - Module was unloaded
1869  SWITCH_EVENT_DTMF - DTMF was sent
1870  SWITCH_EVENT_MESSAGE - A Basic Message
1871  SWITCH_EVENT_PRESENCE_IN - Presence in
1872  SWITCH_EVENT_NOTIFY_IN - Received incoming NOTIFY from gateway subscription
1873  SWITCH_EVENT_PRESENCE_OUT - Presence out
1874  SWITCH_EVENT_PRESENCE_PROBE - Presence probe
1875  SWITCH_EVENT_MESSAGE_WAITING - A message is waiting
1876  SWITCH_EVENT_MESSAGE_QUERY - A query for MESSAGE_WAITING events
1877  SWITCH_EVENT_ROSTER - ?
1878  SWITCH_EVENT_CODEC - Codec Change
1879  SWITCH_EVENT_BACKGROUND_JOB - Background Job
1880  SWITCH_EVENT_DETECTED_SPEECH - Detected Speech
1881  SWITCH_EVENT_DETECTED_TONE - Detected Tone
1882  SWITCH_EVENT_PRIVATE_COMMAND - A private command event
1883  SWITCH_EVENT_HEARTBEAT - Machine is alive
1884  SWITCH_EVENT_TRAP - Error Trap
1885  SWITCH_EVENT_ADD_SCHEDULE - Something has been scheduled
1886  SWITCH_EVENT_DEL_SCHEDULE - Something has been unscheduled
1887  SWITCH_EVENT_EXE_SCHEDULE - Something scheduled has been executed
1888  SWITCH_EVENT_RE_SCHEDULE - Something scheduled has been rescheduled
1889  SWITCH_EVENT_RELOADXML - XML registry has been reloaded
1890  SWITCH_EVENT_NOTIFY - Notification
1891  SWITCH_EVENT_PHONE_FEATURE - Notification (DND/CFWD/etc)
1892  SWITCH_EVENT_PHONE_FEATURE_SUBSCRIBE - Phone feature subscription
1893  SWITCH_EVENT_SEND_MESSAGE - Message
1894  SWITCH_EVENT_RECV_MESSAGE - Message
1895  SWITCH_EVENT_REQUEST_PARAMS
1896  SWITCH_EVENT_CHANNEL_DATA
1897  SWITCH_EVENT_GENERAL
1898  SWITCH_EVENT_COMMAND
1899  SWITCH_EVENT_SESSION_HEARTBEAT
1900  SWITCH_EVENT_CLIENT_DISCONNECTED
1901  SWITCH_EVENT_SERVER_DISCONNECTED
1902  SWITCH_EVENT_SEND_INFO
1903  SWITCH_EVENT_RECV_INFO
1904  SWITCH_EVENT_RECV_RTCP_MESSAGE
1905  SWITCH_EVENT_CALL_SECURE
1906  SWITCH_EVENT_NAT - NAT Management (new/del/status)
1907  SWITCH_EVENT_RECORD_START
1908  SWITCH_EVENT_RECORD_STOP
1909  SWITCH_EVENT_PLAYBACK_START
1910  SWITCH_EVENT_PLAYBACK_STOP
1911  SWITCH_EVENT_CALL_UPDATE
1912  SWITCH_EVENT_FAILURE - A failure occurred which might impact the normal functioning of the switch
1913  SWITCH_EVENT_SOCKET_DATA
1914  SWITCH_EVENT_MEDIA_BUG_START
1915  SWITCH_EVENT_MEDIA_BUG_STOP
1916  SWITCH_EVENT_CONFERENCE_DATA_QUERY
1917  SWITCH_EVENT_CONFERENCE_DATA
1918  SWITCH_EVENT_CALL_SETUP_REQ
1919  SWITCH_EVENT_CALL_SETUP_RESULT
1920  SWITCH_EVENT_CALL_DETAIL
1921  SWITCH_EVENT_DEVICE_STATE
1922  SWITCH_EVENT_ALL - All events at once
1923 </pre>
1924 
1925  */
1926 typedef enum {
2018 
2019 typedef enum {
2023 
2024 typedef enum {
2096 
2097 typedef enum {
2142 
2143 typedef enum {
2144  SSH_FLAG_STICKY = (1 << 0)
2146 
2147 #ifdef WIN32
2148 typedef SOCKET switch_os_socket_t;
2149 #define SWITCH_SOCK_INVALID INVALID_SOCKET
2150 #else
2152 #define SWITCH_SOCK_INVALID -1
2153 #endif
2154 
2155 typedef struct apr_pool_t switch_memory_pool_t;
2156 typedef uint16_t switch_port_t;
2157 typedef uint8_t switch_payload_t;
2159 typedef struct switch_rtp switch_rtp_t;
2160 typedef struct switch_rtcp switch_rtcp_t;
2184 typedef struct switch_odbc_handle switch_odbc_handle_t;
2185 typedef struct switch_pgsql_handle switch_pgsql_handle_t;
2186 typedef struct switch_pgsql_result switch_pgsql_result_t;
2187 
2210 
2211 typedef void (*hashtable_destructor_t)(void *ptr);
2212 
2214  char *val;
2216 };
2218 
2222  int count;
2223  int dynamic;
2224 };
2226 
2227 typedef void (*switch_media_bug_exec_cb_t)(switch_media_bug_t *bug, void *user_data);
2228 
2230 typedef void (*switch_cap_callback_t) (const char *var, const char *val, void *user_data);
2233 typedef switch_bool_t (*switch_tone_detect_callback_t) (switch_core_session_t *, const char *, const char *);
2235 
2236 typedef void (*switch_video_function_t) (switch_core_session_t *session, void *user_data);
2237 
2239  switch_codec_t *other_codec,
2240  void *decoded_data,
2241  uint32_t decoded_data_len,
2242  uint32_t decoded_rate,
2243  void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag);
2244 
2245 
2247  switch_codec_t *other_codec,
2248  void *encoded_data,
2249  uint32_t encoded_data_len,
2250  uint32_t encoded_rate,
2251  void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag);
2252 
2254 
2256 
2257 typedef enum {
2265 
2266 typedef enum {
2271 
2272 typedef enum {
2276 
2280  void *cmd_data,
2282  void *cmd_arg,
2284  void **ret_data);
2285 
2286 
2290 
2291 
2293 #define SWITCH_STANDARD_CHAT_APP(name) static switch_status_t name (switch_event_t *message, const char *data)
2294 
2295 typedef void (*switch_application_function_t) (switch_core_session_t *, const char *);
2296 #define SWITCH_STANDARD_APP(name) static void name (switch_core_session_t *session, const char *data)
2297 
2298 typedef int (*switch_core_recover_callback_t)(switch_core_session_t *session);
2299 typedef void (*switch_event_callback_t) (switch_event_t *);
2300 typedef switch_caller_extension_t *(*switch_dialplan_hunt_function_t) (switch_core_session_t *, void *, switch_caller_profile_t *);
2301 #define SWITCH_STANDARD_DIALPLAN(name) static switch_caller_extension_t *name (switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
2302 
2303 typedef switch_bool_t (*switch_hash_delete_callback_t) (_In_ const void *key, _In_ const void *val, _In_opt_ void *pData);
2304 #define SWITCH_HASH_DELETE_FUNC(name) static switch_bool_t name (const void *key, const void *val, void *pData)
2305 
2307 
2309 
2310 #define SWITCH_STANDARD_SCHED_FUNC(name) static void name (switch_scheduler_task_t *task)
2311 
2312 typedef switch_status_t (*switch_state_handler_t) (switch_core_session_t *);
2314 typedef uint8_t * (*switch_stream_handle_read_function_t) (switch_stream_handle_t *handle, int *len);
2317 
2318 typedef switch_status_t (*switch_api_function_t) (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session,
2319  _In_ switch_stream_handle_t *stream);
2320 
2321 
2322 #define SWITCH_STANDARD_API(name) static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream)
2323 
2324 
2325 typedef switch_status_t (*switch_json_api_function_t) (const cJSON *json, _In_opt_ switch_core_session_t *session, cJSON **json_reply);
2326 
2327 
2328 #define SWITCH_STANDARD_JSON_API(name) static switch_status_t name (const cJSON *json, _In_opt_ switch_core_session_t *session, cJSON **json_reply)
2329 
2330 typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session_t *session, void *input,
2331  switch_input_type_t input_type, void *buf, unsigned int buflen);
2332 typedef switch_status_t (*switch_read_frame_callback_function_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data);
2334 
2335 #define DMACHINE_MAX_DIGIT_LEN 512
2336 
2337 typedef enum {
2340 } dm_match_type_t;
2341 
2342 struct switch_ivr_dmachine;
2344 
2347  const char *match_digits;
2348  int32_t match_key;
2350  void *user_data;
2351 };
2352 
2355 
2356 #define MAX_ARG_RECURSION 25
2357 
2358 #define arg_recursion_check_start(_args) if (_args) { \
2359  if (_args->loops >= MAX_ARG_RECURSION) { \
2360  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, \
2361  "RECURSION ERROR! It's not the best idea to call things that collect input recursively from an input callback.\n"); \
2362  return SWITCH_STATUS_GENERR; \
2363  } else {_args->loops++;} \
2364  }
2365 
2366 
2367 #define arg_recursion_check_stop(_args) if (_args) _args->loops--
2368 
2369 typedef struct {
2371  void *buf;
2372  uint32_t buflen;
2374  void *user_data;
2376  int loops;
2378 
2379 
2380 typedef struct {
2384  const char *ext;
2386 
2387 
2388 typedef switch_status_t (*switch_say_callback_t) (switch_core_session_t *session,
2389  char *tosay,
2390  switch_say_args_t *say_args,
2391  switch_input_args_t *args);
2392 
2393 typedef switch_status_t (*switch_say_string_callback_t) (switch_core_session_t *session,
2394  char *tosay,
2395  switch_say_args_t *say_args, char **rstr);
2396 
2397 struct switch_say_file_handle;
2399 
2401  char *tosay,
2402  switch_say_args_t *say_args);
2403 
2404 
2405 typedef struct switch_xml *switch_xml_t;
2407 typedef switch_xml_t(*switch_xml_open_root_function_t) (uint8_t reload, const char **err, void *user_data);
2408 typedef switch_xml_t(*switch_xml_search_function_t) (const char *section,
2409  const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
2410  void *user_data);
2411 
2412 struct switch_hashtable;
2417 
2418 struct switch_network_list;
2420 
2421 
2422 #define SWITCH_API_VERSION 5
2423 #define SWITCH_MODULE_LOAD_ARGS (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)
2424 #define SWITCH_MODULE_RUNTIME_ARGS (void)
2425 #define SWITCH_MODULE_SHUTDOWN_ARGS (void)
2426 typedef switch_status_t (*switch_module_load_t) SWITCH_MODULE_LOAD_ARGS;
2427 typedef switch_status_t (*switch_module_runtime_t) SWITCH_MODULE_RUNTIME_ARGS;
2428 typedef switch_status_t (*switch_module_shutdown_t) SWITCH_MODULE_SHUTDOWN_ARGS;
2429 #define SWITCH_MODULE_LOAD_FUNCTION(name) switch_status_t name SWITCH_MODULE_LOAD_ARGS
2430 #define SWITCH_MODULE_RUNTIME_FUNCTION(name) switch_status_t name SWITCH_MODULE_RUNTIME_ARGS
2431 #define SWITCH_MODULE_SHUTDOWN_FUNCTION(name) switch_status_t name SWITCH_MODULE_SHUTDOWN_ARGS
2432 
2433 typedef enum {
2439 
2440 typedef enum {
2444 typedef uint32_t switch_module_flag_t;
2445 
2448  switch_module_load_t load;
2449  switch_module_shutdown_t shutdown;
2450  switch_module_runtime_t runtime;
2451  switch_module_flag_t flags;
2453 
2454 typedef int (*switch_modulename_callback_func_t) (void *user_data, const char *module_name);
2455 
2457 
2458 #define SWITCH_MODULE_DEFINITION_EX(name, load, shutdown, runtime, flags) \
2459 static const char modname[] = #name ; \
2460 SWITCH_MOD_DECLARE_DATA switch_loadable_module_function_table_t name##_module_interface = { \
2461  SWITCH_API_VERSION, \
2462  load, \
2463  shutdown, \
2464  runtime, \
2465  flags \
2466 }
2467 
2468 #define SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) \
2469  SWITCH_MODULE_DEFINITION_EX(name, load, shutdown, runtime, SMODF_NONE)
2470 
2471 /* things we don't deserve to know about */
2472 /*! \brief A channel */
2473 struct switch_channel;
2474 /*! \brief A core session representing a call and all of it's resources */
2475 struct switch_core_session;
2476 /*! \brief An audio bug */
2477 struct switch_media_bug;
2478 /*! \brief A digit stream parser object */
2480 struct sql_queue_manager;
2481 
2482 struct switch_media_handle_s;
2484 
2485 typedef uint32_t switch_event_channel_id_t;
2486 typedef void (*switch_event_channel_func_t)(const char *event_channel, cJSON *json, const char *key, switch_event_channel_id_t id);
2487 
2488 struct switch_live_array_s;
2490 
2491 typedef enum {
2495 
2496 
2497 typedef enum {
2509 
2510 typedef struct payload_map_s {
2513  uint32_t ptime;
2514  uint32_t rate;
2515  uint8_t allocated;
2516  uint8_t negotiated;
2517  uint8_t current;
2518  unsigned long hash;
2519 
2521  char *iananame;
2522  char *modname;
2523  switch_payload_t pt;
2524  unsigned long rm_rate;
2525  unsigned long adv_rm_rate;
2526  uint32_t codec_ms;
2527  uint32_t bitrate;
2528 
2529  char *rm_fmtp;
2530 
2531  switch_payload_t agreed_pt;
2532  switch_payload_t recv_pt;
2533 
2534  char *fmtp_out;
2535 
2537  switch_port_t remote_sdp_port;
2538 
2541 
2543 
2544 } payload_map_t;
2545 
2546 typedef enum {
2553 
2554 typedef enum {
2555  ICE_GOOGLE_JINGLE = (1 << 0),
2556  ICE_VANILLA = (1 << 1),
2557  ICE_CONTROLLED = (1 << 2)
2559 
2560 typedef enum {
2561  SWITCH_POLL_READ = (1 << 0),
2562  SWITCH_POLL_WRITE = (1 << 1),
2563  SWITCH_POLL_ERROR = (1 << 2),
2564  SWITCH_POLL_HUP = (1 << 3),
2567  SWITCH_POLL_PRI = (1 << 6),
2569 } switch_poll_t;
2570 
2571 typedef struct switch_waitlist_s {
2572  switch_os_socket_t sock;
2573  uint32_t events;
2574  uint32_t revents;
2576 
2577 struct switch_jb_s;
2578 typedef struct switch_jb_s switch_jb_t;
2579 
2582 
2583 struct switch_frame_buffer_s;
2585 
2586 typedef enum {
2587  SVR_BLOCK = (1 << 0),
2588  SVR_FLUSH = (1 << 1),
2589  SVR_CHECK = (1 << 2)
2591 
2592 typedef enum {
2597 
2598 typedef enum {
2602 
2604 #endif
2605 /* For Emacs:
2606  * Local Variables:
2607  * mode:c
2608  * indent-tabs-mode:t
2609  * tab-width:4
2610  * c-basic-offset:4
2611  * End:
2612  * For VIM:
2613  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
2614  */
uint32_t switch_bind_flag_t
Definition: switch_types.h:308
switch_size_t flaws
Definition: switch_types.h:657
A module interface to implement an application.
switch_status_t(* switch_read_frame_callback_function_t)(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
switch_status_t switch_module_load_t SWITCH_MODULE_LOAD_ARGS
switch_caller_profile_flag_enum_t
Definition: switch_types.h:570
struct switch_waitlist_s switch_waitlist_t
uint8_t allocated
switch_size_t period_packet_count
Definition: switch_types.h:630
switch_bind_flag_enum_t
Definition: switch_types.h:298
An Abstract Representation of a dialplan extension.
uint32_t switch_ivr_option_t
switch_say_type_t type
switch_thread_priority_t
Call Specific Data.
Definition: switch_caller.h:73
switch_unicast_flag_enum_t
Definition: switch_types.h:397
switch_rtp_numbers_t inbound
Definition: switch_types.h:690
switch_abc_type_t
Definition: switch_types.h:484
Abstract interface to a limit module.
switch_text_channel_t
A target to write log/debug info to.
switch_codec_type_t
Codec types.
switch_rtp_crypto_key_type_t
struct payload_map_s payload_map_t
uint32_t switch_event_channel_id_t
switch_status_t(* switch_api_function_t)(_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream)
struct switch_odbc_handle switch_odbc_handle_t
void(* switch_media_bug_exec_cb_t)(switch_media_bug_t *bug, void *user_data)
switch_rtp_flush_t
Definition: switch_types.h:696
switch_os_socket_t sock
void(* switch_video_function_t)(switch_core_session_t *session, void *user_data)
Abstraction of an module endpoint interface This is the glue between the abstract idea of a "channel"...
uint32_t switch_chat_application_flag_t
struct switch_loadable_module_function_table switch_loadable_module_function_table_t
uint32_t switch_io_flag_t
uint32_t switch_application_flag_t
switch_status_t(* switch_core_video_thread_callback_func_t)(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
#define SWITCH_END_EXTERN_C
Definition: switch.h:43
unsigned long rm_rate
switch_ring_ready_t
switch_event_types_t
Built-in Events.
switch_io_flag_enum_t
switch_call_direction_t
Definition: switch_types.h:293
switch_byte_t frame_bits
Definition: switch_types.h:508
uint32_t switch_speech_flag_t
unsigned long adv_rm_rate
switch_pvt_class_t
Definition: switch_types.h:248
switch_xml_t(* switch_xml_open_root_function_t)(uint8_t reload, const char **err, void *user_data)
switch_bool_t
Definition: switch_types.h:405
switch_audio_col_t
Definition: switch_types.h:578
switch_ivr_dmachine_t * dmachine
switch_size_t largest_jb_size
Definition: switch_types.h:637
struct switch_pgsql_handle switch_pgsql_handle_t
struct error_period * next
Definition: switch_types.h:622
char * remote_sdp_ip
switch_priority_t
Priority Indication.
Definition: switch_types.h:991
struct switch_xml * switch_xml_t
unsigned long hash
switch_status_t(* switch_console_complete_callback_t)(const char *, const char *, switch_console_callback_match_t **matches)
switch_status_t(* switch_new_say_callback_t)(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args)
switch_channel_flag_t
Channel Flags.
switch_say_method_t method
switch_timer_flag_enum_t
Representation of an event.
Definition: switch_event.h:80
switch_status_t(* switch_chat_application_function_t)(switch_event_t *, const char *)
A module interface to implement a chat application.
const char * cc
Definition: cc.h:2
An event Header.
Definition: switch_event.h:65
An Abstract Representation of a dialplan Application.
switch_core_session_message_flag_enum_t
switch_core_session_message_types_t
Possible types of messages for inter-session communication.
switch_bitpack_mode_t mode
Definition: switch_types.h:513
switch_digit_action_target_t
Definition: switch_types.h:273
switch_bool_t T38FaxTranscodingMMR
const char * T38FaxRateManagement
switch_status_t(* switch_say_string_callback_t)(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, char **rstr)
switch_bitpack_mode_t
Definition: switch_types.h:479
switch_channel_cap_t
Abstract interface to a chat module.
switch_core_flag_enum_t
Definition: switch_types.h:347
struct switch_console_callback_match_node * head
switch_size_t last_flaw
Definition: switch_types.h:658
#define SWITCH_DECLARE_DATA
uint32_t switch_scheduler_flag_t
Definition: switch_types.h:461
A representation of an XML tree.
Definition: switch_xml.h:76
switch_eavesdrop_flag_enum_t
Definition: switch_types.h:336
switch_xml_section_enum_t
Definition: switch_types.h:587
Abstract interface to a dialplan module.
switch_status_t(* switch_say_callback_t)(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
switch_bool_t(* switch_media_bug_callback_t)(switch_media_bug_t *, void *, switch_abc_type_t)
uint32_t switch_originate_flag_t
Definition: switch_types.h:325
switch_bool_t T38FaxTranscodingJBIG
A table of functions that a timer module implements.
switch_size_t media_bytes
Definition: switch_types.h:628
uint32_t duration
Definition: switch_types.h:288
A node to store binded events.
Definition: switch_event.c:46
A table of i/o routines that an endpoint interface can implement.
struct switch_console_callback_match_node * end
Abstract handler to a timer module.
switch_size_t dtmf_packet_count
Definition: switch_types.h:634
uint32_t switch_core_flag_t
Definition: switch_types.h:376
switch_vad_flag_enum_t
Definition: switch_types.h:610
switch_status_t(* switch_core_codec_video_encode_func_t)(switch_codec_t *codec, switch_frame_t *frame)
dtmf_flag_t
Definition: switch_types.h:281
switch_input_type_t
uint32_t switch_module_flag_t
Abstract interface to an asr module.
A message object designed to allow unlike technologies to exchange data.
Definition: switch_core.h:177
uint32_t switch_core_session_message_flag_t
uint8_t switch_byte_t
Definition: switch_types.h:246
Abstract interface to a file format module.
struct payload_map_s * next
uint32_t switch_codec_flag_t
int(* switch_modulename_callback_func_t)(void *user_data, const char *module_name)
switch_video_read_flag_t
#define LOST_BURST_CAPTURE
Definition: switch_types.h:244
switch_codec_control_command_t
uint32_t switch_vad_flag_t
Definition: switch_types.h:616
switch_status_t(* switch_core_codec_encode_func_t)(switch_codec_t *codec, switch_codec_t *other_codec, void *decoded_data, uint32_t decoded_data_len, uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
void(* switch_application_function_t)(switch_core_session_t *, const char *)
switch_rw_t
Definition: switch_types.h:565
switch_codec_control_type_t
struct switch_pgsql_result switch_pgsql_result_t
Abstract interface to a speech module.
switch_rtcp_numbers_t rtcp
Definition: switch_types.h:692
switch_byte_t switch_byte_t * buf
int64_t stop
Definition: switch_types.h:621
switch_byte_t bits_cur
Definition: switch_types.h:506
switch_chat_application_flag_enum_t
dm_match_type_t
switch_size_t raw_bytes
Definition: switch_types.h:627
A module interface to implement an api function.
switch_asr_flag_enum_t
uint32_t switch_file_flag_t
Abstract interface to a say module.
switch_status_t(* switch_input_callback_function_t)(switch_core_session_t *session, void *input, switch_input_type_t input_type, void *buf, unsigned int buflen)
switch_rtp_bug_flag_t
Definition: switch_types.h:771
Abstract interface to a management module.
switch_byte_t * buf
Definition: switch_types.h:501
switch_session_ctl_t
switch_byte_t this_byte
Definition: switch_types.h:510
uint32_t switch_xml_section_t
Definition: switch_types.h:598
switch_status_t(* switch_state_handler_t)(switch_core_session_t *)
switch_say_gender_t
Definition: switch_types.h:442
switch_rtp_numbers_t outbound
Definition: switch_types.h:691
uint32_t switch_timer_flag_t
switch_directory_flag_enum_t
switch_input_callback_function_t input_callback
int switch_os_socket_t
Top level module interface to implement a series of codec implementations.
switch_file_flag_enum_t
switch_application_flag_enum_t
switch_status_t(* switch_core_codec_destroy_func_t)(switch_codec_t *)
#define _In_opt_
switch_status_t(* switch_core_codec_init_func_t)(switch_codec_t *, switch_codec_flag_t, const switch_codec_settings_t *codec_settings)
switch_status_t switch_module_runtime_t SWITCH_MODULE_RUNTIME_ARGS
switch_sdp_type_t sdp_type
switch_module_interface_name_t
Definition: switch_types.h:378
switch_state_handler_flag_t
An abstraction of a data frame.
Definition: switch_frame.h:43
uintptr_t switch_size_t
struct switch_rtcp switch_rtcp_t
uint8_t negotiated
switch_status_t(* switch_core_codec_control_func_t)(switch_codec_t *codec, switch_codec_control_command_t cmd, switch_codec_control_type_t ctype, void *cmd_data, switch_codec_control_type_t atype, void *cmd_arg, switch_codec_control_type_t *rtype, void **ret_data)
struct switch_rtcp_hdr_s switch_rtcp_hdr_t
switch_dtmf_source_t
DTMF sources.
Definition: switch_types.h:265
switch_sdp_type_t
switch_payload_t pt
uint16_t switch_port_t
uint32_t switch_asr_flag_t
const char * T38VendorInfo
uint32_t ptime
switch_filenames SWITCH_GLOBAL_filenames
Definition: switch_core.c:61
switch_byte_t switch_byte_t uint32_t buflen
switch_byte_t under
Definition: switch_types.h:511
void(* switch_scheduler_func_t)(switch_scheduler_task_t *task)
uint32_t switch_eavesdrop_flag_t
Definition: switch_types.h:345
switch_speech_flag_enum_t
switch_status_t(* switch_core_codec_decode_func_t)(switch_codec_t *codec, switch_codec_t *other_codec, void *encoded_data, uint32_t encoded_data_len, uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
int64_t start
Definition: switch_types.h:620
switch_channel_callstate_t
switch_say_gender_t gender
switch_size_t packet_count
Definition: switch_types.h:629
const char * T38FaxUdpEC
uint32_t bitrate
switch_call_cause_t
switch_dtmf_direction_t
Definition: switch_types.h:310
uint32_t switch_frame_flag_t
switch_device_state_t
switch_media_type_t type
switch_directories SWITCH_GLOBAL_dirs
Definition: switch_core.c:60
switch_size_t jb_packet_count
Definition: switch_types.h:633
switch_read_frame_callback_function_t read_frame_callback
switch_media_bug_flag_enum_t
switch_size_t skip_packet_count
Definition: switch_types.h:632
void(* switch_event_callback_t)(switch_event_t *)
void(* switch_event_channel_func_t)(const char *event_channel, cJSON *json, const char *key, switch_event_channel_id_t id)
struct switch_vid_params_s switch_vid_params_t
switch_channel_state_t
Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are ...