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 * Andrey Volk <andywolk@gmail.com> 32 * 33 * switch_types.h -- Data Types 34 * 35 */ 36 /*! \file switch_types.h 37 \brief Data Types 38 */ 39 #ifndef SWITCH_TYPES_H 40 #define SWITCH_TYPES_H 41 42 #include <switch.h> 43 #include <switch_json.h> 44 #include <switch_vpx.h> 45 46 SWITCH_BEGIN_EXTERN_C 47 #define SWITCH_ENT_ORIGINATE_DELIM ":_:" 48 #define SWITCH_BLANK_STRING "" 49 #define SWITCH_TON_UNDEF 255 50 #define SWITCH_NUMPLAN_UNDEF 255 51 #ifdef WIN32 52 #define SWITCH_SEQ_FWHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY 53 #define SWITCH_SEQ_FRED FOREGROUND_RED | FOREGROUND_INTENSITY 54 #define SWITCH_SEQ_FMAGEN FOREGROUND_BLUE | FOREGROUND_RED 55 #define SWITCH_SEQ_FCYAN FOREGROUND_GREEN | FOREGROUND_BLUE 56 #define SWITCH_SEQ_FGREEN FOREGROUND_GREEN 57 #define SWITCH_SEQ_FYELLOW FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY 58 #define SWITCH_SEQ_DEFAULT_COLOR SWITCH_SEQ_FWHITE 59 #else 60 #define SWITCH_SEQ_ESC "\033[" 61 /* Ansi Control character suffixes */ 62 #define SWITCH_SEQ_HOME_CHAR 'H' 63 #define SWITCH_SEQ_HOME_CHAR_STR "H" 64 #define SWITCH_SEQ_CLEARLINE_CHAR '1' 65 #define SWITCH_SEQ_CLEARLINE_CHAR_STR "1" 66 #define SWITCH_SEQ_CLEARLINEEND_CHAR "K" 67 #define SWITCH_SEQ_CLEARSCR_CHAR0 '2' 68 #define SWITCH_SEQ_CLEARSCR_CHAR1 'J' 69 #define SWITCH_SEQ_CLEARSCR_CHAR "2J" 70 #define SWITCH_SEQ_DEFAULT_COLOR SWITCH_SEQ_ESC SWITCH_SEQ_END_COLOR /* Reset to Default fg/bg color */ 71 #define SWITCH_SEQ_AND_COLOR ";" /* To add multiple color definitions */ 72 #define SWITCH_SEQ_END_COLOR "m" /* To end color definitions */ 73 /* Foreground colors values */ 74 #define SWITCH_SEQ_F_BLACK "30" 75 #define SWITCH_SEQ_F_RED "31" 76 #define SWITCH_SEQ_F_GREEN "32" 77 #define SWITCH_SEQ_F_YELLOW "33" 78 #define SWITCH_SEQ_F_BLUE "34" 79 #define SWITCH_SEQ_F_MAGEN "35" 80 #define SWITCH_SEQ_F_CYAN "36" 81 #define SWITCH_SEQ_F_WHITE "37" 82 /* Background colors values */ 83 #define SWITCH_SEQ_B_BLACK "40" 84 #define SWITCH_SEQ_B_RED "41" 85 #define SWITCH_SEQ_B_GREEN "42" 86 #define SWITCH_SEQ_B_YELLOW "43" 87 #define SWITCH_SEQ_B_BLUE "44" 88 #define SWITCH_SEQ_B_MAGEN "45" 89 #define SWITCH_SEQ_B_CYAN "46" 90 #define SWITCH_SEQ_B_WHITE "47" 91 /* Preset escape sequences - Change foreground colors only */ 92 #define SWITCH_SEQ_FBLACK SWITCH_SEQ_ESC SWITCH_SEQ_F_BLACK SWITCH_SEQ_END_COLOR 93 #define SWITCH_SEQ_FRED SWITCH_SEQ_ESC SWITCH_SEQ_F_RED SWITCH_SEQ_END_COLOR 94 #define SWITCH_SEQ_FGREEN SWITCH_SEQ_ESC SWITCH_SEQ_F_GREEN SWITCH_SEQ_END_COLOR 95 #define SWITCH_SEQ_FYELLOW SWITCH_SEQ_ESC SWITCH_SEQ_F_YELLOW SWITCH_SEQ_END_COLOR 96 #define SWITCH_SEQ_FBLUE SWITCH_SEQ_ESC SWITCH_SEQ_F_BLUE SWITCH_SEQ_END_COLOR 97 #define SWITCH_SEQ_FMAGEN SWITCH_SEQ_ESC SWITCH_SEQ_F_MAGEN SWITCH_SEQ_END_COLOR 98 #define SWITCH_SEQ_FCYAN SWITCH_SEQ_ESC SWITCH_SEQ_F_CYAN SWITCH_SEQ_END_COLOR 99 #define SWITCH_SEQ_FWHITE SWITCH_SEQ_ESC SWITCH_SEQ_F_WHITE SWITCH_SEQ_END_COLOR 100 #define SWITCH_SEQ_BBLACK SWITCH_SEQ_ESC SWITCH_SEQ_B_BLACK SWITCH_SEQ_END_COLOR 101 #define SWITCH_SEQ_BRED SWITCH_SEQ_ESC SWITCH_SEQ_B_RED SWITCH_SEQ_END_COLOR 102 #define SWITCH_SEQ_BGREEN SWITCH_SEQ_ESC SWITCH_SEQ_B_GREEN SWITCH_SEQ_END_COLOR 103 #define SWITCH_SEQ_BYELLOW SWITCH_SEQ_ESC SWITCH_SEQ_B_YELLOW SWITCH_SEQ_END_COLOR 104 #define SWITCH_SEQ_BBLUE SWITCH_SEQ_ESC SWITCH_SEQ_B_BLUE SWITCH_SEQ_END_COLOR 105 #define SWITCH_SEQ_BMAGEN SWITCH_SEQ_ESC SWITCH_SEQ_B_MAGEN SWITCH_SEQ_END_COLOR 106 #define SWITCH_SEQ_BCYAN SWITCH_SEQ_ESC SWITCH_SEQ_B_CYAN SWITCH_SEQ_END_COLOR 107 #define SWITCH_SEQ_BWHITE SWITCH_SEQ_ESC SWITCH_SEQ_B_WHITE SWITCH_SEQ_END_COLOR 108 /* Preset escape sequences */ 109 #define SWITCH_SEQ_HOME SWITCH_SEQ_ESC SWITCH_SEQ_HOME_CHAR_STR 110 #define SWITCH_SEQ_CLEARLINE SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINE_CHAR_STR 111 #define SWITCH_SEQ_CLEARLINEEND SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINEEND_CHAR 112 #define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME 113 #endif 114 #define SWITCH_DEFAULT_CLID_NAME "" 115 #define SWITCH_DEFAULT_CLID_NUMBER "0000000000" 116 #define SWITCH_DEFAULT_DTMF_DURATION 2000 117 #define SWITCH_DEFAULT_TIMEOUT 60 118 #define SWITCH_MIN_DTMF_DURATION 400 119 #define SWITCH_MAX_DTMF_DURATION 192000 120 #define SWITCH_DEFAULT_DIR_PERMS SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE 121 #ifdef WIN32 122 #define SWITCH_PATH_SEPARATOR "/" 123 #else 124 #define SWITCH_PATH_SEPARATOR "/" 125 #endif 126 #define SWITCH_URL_SEPARATOR "://" 127 #define SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE "ignore_display_updates" 128 #define SWITCH_AUDIO_SPOOL_PATH_VARIABLE "audio_spool_path" 129 #define SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE "bridge_hangup_cause" 130 #define SWITCH_READ_TERMINATOR_USED_VARIABLE "read_terminator_used" 131 #define SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE "send_silence_when_idle" 132 #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application" 133 #define SWITCH_CURRENT_APPLICATION_DATA_VARIABLE "current_application_data" 134 #define SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE "current_application_response" 135 #define SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE "passthru_ptime_mismatch" 136 #define SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE "enable_heartbeat_events" 137 #define SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE "bypass_media_after_bridge" 138 #define SWITCH_READ_RESULT_VARIABLE "read_result" 139 #define SWITCH_ATT_XFER_RESULT_VARIABLE "att_xfer_result" 140 #define SWITCH_COPY_XML_CDR_VARIABLE "copy_xml_cdr" 141 #define SWITCH_COPY_JSON_CDR_VARIABLE "copy_json_cdr" 142 #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application" 143 #define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause" 144 #define SWITCH_TRANSFER_HISTORY_VARIABLE "transfer_history" 145 #define SWITCH_TRANSFER_SOURCE_VARIABLE "transfer_source" 146 #define SWITCH_SENSITIVE_DTMF_VARIABLE "sensitive_dtmf" 147 #define SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE "record_post_process_exec_app" 148 #define SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE "record_post_process_exec_api" 149 150 #define SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE "execute_on_answer" 151 #define SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE "execute_on_pre_answer" 152 #define SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE "execute_on_media" 153 #define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring" 154 #define SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE "execute_on_tone_detect" 155 #define SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE "execute_on_originate" 156 #define SWITCH_CHANNEL_EXECUTE_ON_POST_ORIGINATE_VARIABLE "execute_on_post_originate" 157 #define SWITCH_CHANNEL_EXECUTE_ON_PRE_ORIGINATE_VARIABLE "execute_on_pre_originate" 158 159 #define SWITCH_CHANNEL_EXECUTE_ON_PRE_BRIDGE_VARIABLE "execute_on_pre_bridge" 160 #define SWITCH_CHANNEL_EXECUTE_ON_POST_BRIDGE_VARIABLE "execute_on_post_bridge" 161 162 #define SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE "api_on_answer" 163 #define SWITCH_CHANNEL_API_ON_PRE_ANSWER_VARIABLE "api_on_pre_answer" 164 #define SWITCH_CHANNEL_API_ON_MEDIA_VARIABLE "api_on_media" 165 #define SWITCH_CHANNEL_API_ON_RING_VARIABLE "api_on_ring" 166 #define SWITCH_CHANNEL_API_ON_TONE_DETECT_VARIABLE "api_on_tone_detect" 167 #define SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE "api_on_originate" 168 #define SWITCH_CHANNEL_API_ON_POST_ORIGINATE_VARIABLE "api_on_post_originate" 169 #define SWITCH_CHANNEL_API_ON_PRE_ORIGINATE_VARIABLE "api_on_pre_originate" 170 171 #define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout" 172 #define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid" 173 #define SWITCH_SOFT_HOLDING_UUID_VARIABLE "soft_holding_uuid" 174 #define SWITCH_API_BRIDGE_END_VARIABLE "api_after_bridge" 175 #define SWITCH_API_BRIDGE_START_VARIABLE "api_before_bridge" 176 #define SWITCH_API_HANGUP_HOOK_VARIABLE "api_hangup_hook" 177 #define SWITCH_API_REPORTING_HOOK_VARIABLE "api_reporting_hook" 178 #define SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE "session_in_hangup_hook" 179 #define SWITCH_PROCESS_CDR_VARIABLE "process_cdr" 180 #define SWITCH_SKIP_CDR_CAUSES_VARIABLE "skip_cdr_causes" 181 #define SWITCH_FORCE_PROCESS_CDR_VARIABLE "force_process_cdr" 182 #define SWITCH_BRIDGE_CHANNEL_VARIABLE "bridge_channel" 183 #define SWITCH_CHANNEL_NAME_VARIABLE "channel_name" 184 #define SWITCH_BRIDGE_UUID_VARIABLE "bridge_uuid" 185 #define SWITCH_CONTINUE_ON_FAILURE_VARIABLE "continue_on_fail" 186 #define SWITCH_PLAYBACK_TERMINATORS_VARIABLE "playback_terminators" 187 #define SWITCH_PLAYBACK_TERMINATOR_USED "playback_terminator_used" 188 #define SWITCH_CACHE_SPEECH_HANDLES_VARIABLE "cache_speech_handles" 189 #define SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME "__cache_speech_handles_obj__" 190 #define SWITCH_BYPASS_MEDIA_VARIABLE "bypass_media" 191 #define SWITCH_PROXY_MEDIA_VARIABLE "proxy_media" 192 #define SWITCH_ZRTP_PASSTHRU_VARIABLE "zrtp_passthru" 193 #define SWITCH_ENDPOINT_DISPOSITION_VARIABLE "endpoint_disposition" 194 #define SWITCH_HOLD_MUSIC_VARIABLE "hold_music" 195 #define SWITCH_TEMP_HOLD_MUSIC_VARIABLE "temp_hold_music" 196 #define SWITCH_EXPORT_VARS_VARIABLE "export_vars" 197 #define SWITCH_BRIDGE_EXPORT_VARS_VARIABLE "bridge_export_vars" 198 #define SWITCH_R_SDP_VARIABLE "switch_r_sdp" 199 #define SWITCH_L_SDP_VARIABLE "switch_l_sdp" 200 #define SWITCH_B_SDP_VARIABLE "switch_m_sdp" 201 #define SWITCH_BRIDGE_VARIABLE "bridge_to" 202 #define SWITCH_LAST_BRIDGE_VARIABLE "last_bridge_to" 203 #define SWITCH_SIGNAL_BRIDGE_VARIABLE "signal_bridge_to" 204 #define SWITCH_SIGNAL_BOND_VARIABLE "signal_bond" 205 #define SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE "originate_signal_bond" 206 #define SWITCH_ORIGINATOR_VARIABLE "originator" 207 #define SWITCH_ORIGINATOR_CODEC_VARIABLE "originator_codec" 208 #define SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE "originator_video_codec" 209 #define SWITCH_LOCAL_MEDIA_IP_VARIABLE "local_media_ip" 210 #define SWITCH_LOCAL_MEDIA_PORT_VARIABLE "local_media_port" 211 #define SWITCH_ADVERTISED_MEDIA_IP_VARIABLE "advertised_media_ip" 212 #define SWITCH_REMOTE_MEDIA_IP_VARIABLE "remote_media_ip" 213 #define SWITCH_REMOTE_MEDIA_PORT_VARIABLE "remote_media_port" 214 #define SWITCH_REMOTE_VIDEO_IP_VARIABLE "remote_video_ip" 215 #define SWITCH_REMOTE_VIDEO_PORT_VARIABLE "remote_video_port" 216 #define SWITCH_LOCAL_VIDEO_IP_VARIABLE "local_video_ip" 217 #define SWITCH_LOCAL_VIDEO_PORT_VARIABLE "local_video_port" 218 #define SWITCH_LOCAL_TEXT_IP_VARIABLE "local_text_ip" 219 #define SWITCH_LOCAL_TEXT_PORT_VARIABLE "local_text_port" 220 #define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE "hangup_after_bridge" 221 #define SWITCH_PARK_AFTER_BRIDGE_VARIABLE "park_after_bridge" 222 #define SWITCH_PARK_AFTER_EARLY_BRIDGE_VARIABLE "park_after_early_bridge" 223 #define SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE "transfer_after_bridge" 224 #define SWITCH_TRANSFER_AFTER_EARLY_BRIDGE_VARIABLE "transfer_after_early_bridge" 225 #define SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE "exec_after_bridge_app" 226 #define SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE "exec_after_bridge_arg" 227 #define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards" 228 #define SWITCH_RFC7989_SESSION_ID_VARIABLE "session_uuid" 229 #define SWITCH_RFC7989_REMOTE_SESSION_ID_VARIABLE "remote_session_uuid" 230 #define SWITCH_RFC7989_APP_SESSION_ID_VARIABLE "app_session_uuid" 231 #define SWITCH_RFC7989_GENERIC_PARAM_VARIABLE "generic_param_session_uuid" 232 #define SWITCH_MAX_SESSION_TRANSFERS_VARIABLE "max_session_transfers" 233 #define SWITCH_DISABLE_APP_LOG_VARIABLE "disable_app_log" 234 #define SWITCH_SPEECH_KEY "speech" 235 #define SWITCH_UUID_BRIDGE "uuid_bridge" 236 #define SWITCH_BITS_PER_BYTE 8 237 #define SWITCH_DEFAULT_FILE_BUFFER_LEN 65536 238 #define SWITCH_DTMF_LOG_LEN 1000 239 #define SWITCH_MAX_TRANS 2000 240 #define SWITCH_CORE_SESSION_MAX_PRIVATES 2 241 #define SWITCH_DEFAULT_VIDEO_SIZE 1200 242 #define SWITCH_RTCP_AUDIO_INTERVAL_MSEC "1000" 243 #define SWITCH_RTCP_VIDEO_INTERVAL_MSEC "1000" 244 245 #define TEXT_UNICODE_LINEFEED {0xe2, 0x80, 0xa8} 246 #define MAX_FMTP_LEN 256 247 248 /* Jitter */ 249 #define JITTER_VARIANCE_THRESHOLD 400.0 250 /* IPDV */ 251 #define IPDV_THRESHOLD 1.0 252 /* Burst and Lost Rate */ 253 #define LOST_BURST_ANALYZE 500 254 /* Burst */ 255 #define LOST_BURST_CAPTURE 1024 256 257 typedef uint8_t switch_byte_t; 258 259 typedef enum { 260 SWITCH_PVT_PRIMARY = 0, 261 SWITCH_PVT_SECONDARY 262 } switch_pvt_class_t; 263 264 265 /*! 266 \enum switch_dtmf_source_t 267 \brief DTMF sources 268 <pre> 269 SWITCH_DTMF_UNKNOWN - Unknown source 270 SWITCH_DTMF_INBAND_AUDIO - From audio 271 SWITCH_DTMF_RTP - From RTP as a telephone event 272 SWITCH_DTMF_ENDPOINT - From endpoint signaling 273 SWITCH_DTMF_APP - From application 274 </pre> 275 */ 276 typedef enum { 277 SWITCH_DTMF_UNKNOWN, 278 SWITCH_DTMF_INBAND_AUDIO, 279 SWITCH_DTMF_RTP, 280 SWITCH_DTMF_ENDPOINT, 281 SWITCH_DTMF_APP 282 } switch_dtmf_source_t; 283 284 typedef enum { 285 DIGIT_TARGET_SELF, 286 DIGIT_TARGET_PEER, 287 DIGIT_TARGET_BOTH 288 } switch_digit_action_target_t; 289 290 291 292 typedef enum { 293 DTMF_FLAG_SKIP_PROCESS = (1 << 0), 294 DTMF_FLAG_SENSITIVE = (1 << 1) 295 } dtmf_flag_t; 296 297 typedef struct { 298 char digit; 299 uint32_t duration; 300 int32_t flags; 301 switch_dtmf_source_t source; 302 } switch_dtmf_t; 303 304 typedef enum { 305 SWITCH_CALL_DIRECTION_INBOUND, 306 SWITCH_CALL_DIRECTION_OUTBOUND 307 } switch_call_direction_t; 308 309 typedef enum { 310 SBF_DIAL_ALEG = (1 << 0), 311 SBF_EXEC_ALEG = (1 << 1), 312 SBF_DIAL_BLEG = (1 << 2), 313 SBF_EXEC_BLEG = (1 << 3), 314 SBF_EXEC_OPPOSITE = (1 << 4), 315 SBF_EXEC_SAME = (1 << 5), 316 SBF_ONCE = (1 << 6), 317 SBF_EXEC_INLINE = (1 << 7) 318 } switch_bind_flag_enum_t; 319 typedef uint32_t switch_bind_flag_t; 320 321 typedef enum { 322 SWITCH_DTMF_RECV = 0, 323 SWITCH_DTMF_SEND = 1 324 } switch_dtmf_direction_t; 325 326 typedef enum { 327 SOF_NONE = 0, 328 SOF_NOBLOCK = (1 << 0), 329 SOF_FORKED_DIAL = (1 << 1), 330 SOF_NO_EFFECTIVE_ANI = (1 << 2), 331 SOF_NO_EFFECTIVE_ANIII = (1 << 3), 332 SOF_NO_EFFECTIVE_CID_NUM = (1 << 4), 333 SOF_NO_EFFECTIVE_CID_NAME = (1 << 5), 334 SOF_NO_LIMITS = (1 << 6) 335 } switch_originate_flag_enum_t; 336 typedef uint32_t switch_originate_flag_t; 337 338 typedef enum { 339 SPF_NONE = 0, 340 SPF_ODD = (1 << 0), 341 SPF_EVEN = (1 << 1), 342 SPF_ROBUST_TCP = (1 << 2), 343 SPF_ROBUST_UDP = (1 << 3) 344 } switch_port_flag_enum_t; 345 typedef uint32_t switch_port_flag_t; 346 347 typedef enum { 348 ED_NONE = 0, 349 ED_MUX_READ = (1 << 0), 350 ED_MUX_WRITE = (1 << 1), 351 ED_DTMF = (1 << 2), 352 ED_COPY_DISPLAY = (1 << 3), 353 ED_BRIDGE_READ = (1 << 4), 354 ED_BRIDGE_WRITE = (1 << 5), 355 ED_TAP_READ = (1 << 6), 356 ED_TAP_WRITE = (1 << 7) 357 } switch_eavesdrop_flag_enum_t; 358 typedef uint32_t switch_eavesdrop_flag_t; 359 360 typedef enum { 361 SCF_NONE = 0, 362 SCF_USE_SQL = (1 << 0), 363 SCF_NO_NEW_OUTBOUND_SESSIONS = (1 << 1), 364 SCF_NO_NEW_INBOUND_SESSIONS = (1 << 2), 365 SCF_NO_NEW_SESSIONS = (SCF_NO_NEW_OUTBOUND_SESSIONS | SCF_NO_NEW_INBOUND_SESSIONS), 366 SCF_SHUTTING_DOWN = (1 << 3), 367 SCF_VG = (1 << 4), 368 SCF_RESTART = (1 << 5), 369 SCF_SHUTDOWN_REQUESTED = (1 << 6), 370 SCF_USE_AUTO_NAT = (1 << 7), 371 SCF_EARLY_HANGUP = (1 << 8), 372 SCF_CALIBRATE_CLOCK = (1 << 9), 373 SCF_USE_HEAVY_TIMING = (1 << 10), 374 SCF_USE_CLOCK_RT = (1 << 11), 375 SCF_VERBOSE_EVENTS = (1 << 12), 376 SCF_USE_WIN32_MONOTONIC = (1 << 13), 377 SCF_AUTO_SCHEMAS = (1 << 14), 378 SCF_MINIMAL = (1 << 15), 379 SCF_USE_NAT_MAPPING = (1 << 16), 380 SCF_CLEAR_SQL = (1 << 17), 381 SCF_THREADED_SYSTEM_EXEC = (1 << 18), 382 SCF_SYNC_CLOCK_REQUESTED = (1 << 19), 383 SCF_CORE_NON_SQLITE_DB_REQ = (1 << 20), 384 SCF_DEBUG_SQL = (1 << 21), 385 SCF_API_EXPANSION = (1 << 22), 386 SCF_SESSION_THREAD_POOL = (1 << 23), 387 SCF_DIALPLAN_TIMESTAMPS = (1 << 24), 388 SCF_CPF_SOFT_PREFIX = (1 << 25), 389 SCF_CPF_SOFT_LOOKUP = (1 << 26), 390 SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY = (1 << 27), 391 SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE = (1 << 28), 392 SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON = (1 << 29) 393 } switch_core_flag_enum_t; 394 typedef uint32_t switch_core_flag_t; 395 396 typedef enum { 397 SWITCH_ENDPOINT_INTERFACE, 398 SWITCH_TIMER_INTERFACE, 399 SWITCH_DIALPLAN_INTERFACE, 400 SWITCH_CODEC_INTERFACE, 401 SWITCH_APPLICATION_INTERFACE, 402 SWITCH_API_INTERFACE, 403 SWITCH_FILE_INTERFACE, 404 SWITCH_SPEECH_INTERFACE, 405 SWITCH_DIRECTORY_INTERFACE, 406 SWITCH_CHAT_INTERFACE, 407 SWITCH_SAY_INTERFACE, 408 SWITCH_ASR_INTERFACE, 409 SWITCH_MANAGEMENT_INTERFACE, 410 SWITCH_LIMIT_INTERFACE, 411 SWITCH_CHAT_APPLICATION_INTERFACE, 412 SWITCH_JSON_API_INTERFACE, 413 SWITCH_DATABASE_INTERFACE, 414 } switch_module_interface_name_t; 415 416 /*! 417 \enum switch_database_flag_t 418 \brief Database flags 419 <pre> 420 SWITCH_DATABASE_FLAG_ROW_SIZE_LIMIT = (1 << 0) - Indicates that database has got row-size limit for the combined sizes of all columns. 421 </pre> 422 */ 423 typedef enum { 424 SWITCH_DATABASE_FLAG_ROW_SIZE_LIMIT = (1 << 0) 425 } switch_database_flag_enum_t; 426 typedef uint32_t switch_database_flag_t; 427 428 typedef enum { 429 SUF_NONE = 0, 430 SUF_THREAD_RUNNING = (1 << 0), 431 SUF_READY = (1 << 1), 432 SUF_NATIVE = (1 << 2) 433 } switch_unicast_flag_enum_t; 434 typedef uint32_t switch_unicast_flag_t; 435 436 typedef enum { 437 SWITCH_FALSE = 0, 438 SWITCH_TRUE = 1 439 } switch_bool_t; 440 441 /* WARNING, Do not forget to update *SAY_METHOD_NAMES[] in src/switch_ivr_play_say.c */ 442 typedef enum { 443 SSM_NA, 444 SSM_PRONOUNCED, 445 SSM_ITERATED, 446 SSM_COUNTED, 447 SSM_PRONOUNCED_YEAR 448 } switch_say_method_t; 449 450 /* WARNING, Do not forget to update *SAY_TYPE_NAMES[] in src/switch_ivr_say.c */ 451 typedef enum { 452 SST_NUMBER, 453 SST_ITEMS, 454 SST_PERSONS, 455 SST_MESSAGES, 456 SST_CURRENCY, 457 SST_TIME_MEASUREMENT, 458 SST_CURRENT_DATE, 459 SST_CURRENT_TIME, 460 SST_CURRENT_DATE_TIME, 461 SST_TELEPHONE_NUMBER, 462 SST_TELEPHONE_EXTENSION, 463 SST_URL, 464 SST_IP_ADDRESS, 465 SST_EMAIL_ADDRESS, 466 SST_POSTAL_ADDRESS, 467 SST_ACCOUNT_NUMBER, 468 SST_NAME_SPELLED, 469 SST_NAME_PHONETIC, 470 SST_SHORT_DATE_TIME 471 } switch_say_type_t; 472 473 typedef enum { 474 SSG_MASCULINE, 475 SSG_FEMININE, 476 SSG_NEUTER, 477 SSG_UTRUM 478 } switch_say_gender_t; 479 480 typedef enum { 481 SMA_NONE, 482 SMA_GET, 483 SMA_SET 484 } switch_management_action_t; 485 486 typedef enum { 487 SSHF_NONE = 0, 488 SSHF_OWN_THREAD = (1 << 0), 489 SSHF_FREE_ARG = (1 << 1), 490 SSHF_NO_DEL = (1 << 2) 491 } switch_scheduler_flag_enum_t; 492 typedef uint32_t switch_scheduler_flag_t; 493 494 typedef enum { 495 SMF_NONE = 0, 496 SMF_REBRIDGE = (1 << 0), 497 SMF_ECHO_ALEG = (1 << 1), 498 SMF_ECHO_BLEG = (1 << 2), 499 SMF_FORCE = (1 << 3), 500 SMF_LOOP = (1 << 4), 501 SMF_HOLD_BLEG = (1 << 5), 502 SMF_IMMEDIATE = (1 << 6), 503 SMF_EXEC_INLINE = (1 << 7), 504 SMF_PRIORITY = (1 << 8), 505 SMF_REPLYONLY_A = (1 << 9), 506 SMF_REPLYONLY_B = (1 << 10) 507 } switch_media_flag_enum_t; 508 typedef uint32_t switch_media_flag_t; 509 510 typedef enum { 511 SWITCH_BITPACK_MODE_RFC3551, 512 SWITCH_BITPACK_MODE_AAL2 513 } switch_bitpack_mode_t; 514 515 typedef enum { 516 SWITCH_ABC_TYPE_INIT, 517 SWITCH_ABC_TYPE_READ, 518 SWITCH_ABC_TYPE_WRITE, 519 SWITCH_ABC_TYPE_WRITE_REPLACE, 520 SWITCH_ABC_TYPE_READ_REPLACE, 521 SWITCH_ABC_TYPE_READ_PING, 522 SWITCH_ABC_TYPE_TAP_NATIVE_READ, 523 SWITCH_ABC_TYPE_TAP_NATIVE_WRITE, 524 SWITCH_ABC_TYPE_CLOSE, 525 SWITCH_ABC_TYPE_READ_VIDEO_PING, 526 SWITCH_ABC_TYPE_WRITE_VIDEO_PING, 527 SWITCH_ABC_TYPE_STREAM_VIDEO_PING, 528 SWITCH_ABC_TYPE_VIDEO_PATCH, 529 SWITCH_ABC_TYPE_READ_TEXT 530 } switch_abc_type_t; 531 532 typedef struct { 533 switch_byte_t *buf; 534 uint32_t buflen; 535 switch_byte_t *cur; 536 uint32_t bytes; 537 uint32_t bits_tot; 538 switch_byte_t bits_cur; 539 switch_byte_t bits_rem; 540 switch_byte_t frame_bits; 541 switch_byte_t shiftby; 542 switch_byte_t this_byte; 543 switch_byte_t under; 544 switch_byte_t over; 545 switch_bitpack_mode_t mode; 546 } switch_bitpack_t; 547 548 549 struct switch_directories { 550 char *base_dir; 551 char *mod_dir; 552 char *conf_dir; 553 char *log_dir; 554 char *run_dir; 555 char *db_dir; 556 char *script_dir; 557 char *temp_dir; 558 char *htdocs_dir; 559 char *grammar_dir; 560 char *storage_dir; 561 char *cache_dir; 562 char *recordings_dir; 563 char *sounds_dir; 564 char *lib_dir; 565 char *certs_dir; 566 char *fonts_dir; 567 char *images_dir; 568 char *data_dir; 569 char *localstate_dir; 570 }; 571 572 typedef struct switch_directories switch_directories; 573 SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs; 574 575 struct switch_filenames { 576 char *conf_name; 577 }; 578 579 typedef struct switch_filenames switch_filenames; 580 SWITCH_DECLARE_DATA extern switch_filenames SWITCH_GLOBAL_filenames; 581 582 #define SWITCH_MAX_STACKS 32 583 #define SWITCH_THREAD_STACKSIZE 240 * 1024 584 #define SWITCH_SYSTEM_THREAD_STACKSIZE 8192 * 1024 585 #define SWITCH_MAX_INTERVAL 120 /* we only do up to 120ms */ 586 #define SWITCH_INTERVAL_PAD 10 /* A little extra buffer space to be safe */ 587 #define SWITCH_MAX_SAMPLE_LEN 48 588 #define SWITCH_BYTES_PER_SAMPLE 2 /* slin is 2 bytes per sample */ 589 #define SWITCH_RECOMMENDED_BUFFER_SIZE 8192 590 #define SWITCH_MAX_CODECS 50 591 #define SWITCH_MAX_STATE_HANDLERS 30 592 #define SWITCH_CORE_QUEUE_LEN 100000 593 #define SWITCH_MAX_MANAGEMENT_BUFFER_LEN 1024 * 8 594 595 #define SWITCH_ACCEPTABLE_INTERVAL(_i) (_i && _i <= SWITCH_MAX_INTERVAL && (_i % 10) == 0) 596 597 typedef enum { 598 SWITCH_RW_READ, 599 SWITCH_RW_WRITE 600 } switch_rw_t; 601 602 typedef enum { 603 SWITCH_CPF_NONE = 0, 604 SWITCH_CPF_SCREEN = (1 << 0), 605 SWITCH_CPF_HIDE_NAME = (1 << 1), 606 SWITCH_CPF_HIDE_NUMBER = (1 << 2), 607 SWITCH_CPF_SOFT_PREFIX = (1 << 3), 608 SWITCH_CPF_SOFT_LOOKUP = (1 << 4) 609 } switch_caller_profile_flag_enum_t; 610 typedef uint32_t switch_caller_profile_flag_t; 611 612 typedef enum { 613 // flags matching libsndfile 614 SWITCH_AUDIO_COL_STR_TITLE = 0x01, 615 SWITCH_AUDIO_COL_STR_COPYRIGHT = 0x02, 616 SWITCH_AUDIO_COL_STR_SOFTWARE = 0x03, 617 SWITCH_AUDIO_COL_STR_ARTIST = 0x04, 618 SWITCH_AUDIO_COL_STR_COMMENT = 0x05, 619 SWITCH_AUDIO_COL_STR_DATE = 0x06, 620 SWITCH_AUDIO_COL_STR_ALBUM = 0x07, 621 SWITCH_AUDIO_COL_STR_LICENSE = 0x08, 622 SWITCH_AUDIO_COL_STR_TRACKNUMBER = 0x09, 623 SWITCH_AUDIO_COL_STR_GENRE = 0x10, 624 625 // custom flags 626 SWITCH_AUDIO_COL_STR_FILE_SIZE = 0xF0, 627 SWITCH_AUDIO_COL_STR_FILE_TRIMMED = 0xF1, 628 SWITCH_AUDIO_COL_STR_FILE_TRIMMED_MS = 0xF2 629 } switch_audio_col_t; 630 631 typedef enum { 632 SWITCH_XML_SECTION_RESULT = 0, 633 SWITCH_XML_SECTION_CONFIG = (1 << 0), 634 SWITCH_XML_SECTION_DIRECTORY = (1 << 1), 635 SWITCH_XML_SECTION_DIALPLAN = (1 << 2), 636 SWITCH_XML_SECTION_LANGUAGES = (1 << 3), 637 SWITCH_XML_SECTION_CHATPLAN = (1 << 4), 638 SWITCH_XML_SECTION_CHANNELS = (1 << 5), 639 /* Nothing after this line */ 640 SWITCH_XML_SECTION_MAX = (1 << 5) 641 } switch_xml_section_enum_t; 642 typedef uint32_t switch_xml_section_t; 643 644 /*! 645 \enum switch_vad_flag_t 646 \brief RTP Related Flags 647 <pre> 648 SWITCH_VAD_FLAG_TALKING - Currently Talking 649 SWITCH_VAD_FLAG_EVENTS_TALK - Fire events when talking is detected 650 SWITCH_VAD_FLAG_EVENTS_NOTALK - Fire events when not talking is detected 651 SWITCH_VAD_FLAG_CNG - Send CNG 652 </pre> 653 */ 654 typedef enum { 655 SWITCH_VAD_FLAG_TALKING = (1 << 0), 656 SWITCH_VAD_FLAG_EVENTS_TALK = (1 << 1), 657 SWITCH_VAD_FLAG_EVENTS_NOTALK = (1 << 2), 658 SWITCH_VAD_FLAG_CNG = (1 << 3) 659 } switch_vad_flag_enum_t; 660 typedef uint32_t switch_vad_flag_t; 661 662 typedef enum { 663 SWITCH_VAD_STATE_NONE, 664 SWITCH_VAD_STATE_START_TALKING, 665 SWITCH_VAD_STATE_TALKING, 666 SWITCH_VAD_STATE_STOP_TALKING, 667 SWITCH_VAD_STATE_ERROR 668 } switch_vad_state_t; 669 typedef struct switch_vad_s switch_vad_t; 670 671 typedef struct error_period { 672 int64_t start; 673 int64_t stop; 674 uint32_t flaws; 675 uint32_t consecutive_flaws; 676 struct error_period *next; 677 } switch_error_period_t; 678 679 680 typedef struct { 681 switch_size_t raw_bytes; 682 switch_size_t media_bytes; 683 switch_size_t packet_count; 684 switch_size_t period_packet_count; 685 switch_size_t media_packet_count; 686 switch_size_t skip_packet_count; 687 switch_size_t jb_packet_count; 688 switch_size_t dtmf_packet_count; 689 switch_size_t cng_packet_count; 690 switch_size_t flush_packet_count; 691 switch_size_t largest_jb_size; 692 /* Jitter */ 693 int64_t last_proc_time; 694 int64_t jitter_n; 695 int64_t jitter_add; 696 int64_t jitter_addsq; 697 698 double variance; 699 double min_variance; 700 double max_variance; 701 double std_deviation; 702 703 /* Burst and Packet Loss */ 704 double lossrate; 705 double burstrate; 706 double mean_interval; 707 int loss[LOST_BURST_CAPTURE]; 708 int last_loss; 709 int recved; 710 int last_processed_seq; 711 switch_size_t flaws; 712 switch_size_t last_flaw; 713 double R; 714 double mos; 715 struct error_period *error_log; 716 } switch_rtp_numbers_t; 717 718 typedef struct { 719 uint32_t packet_count; /* sent packet count */ 720 uint32_t octet_count; 721 uint32_t peer_ssrc; 722 uint32_t last_rpt_ts; /* RTP timestamp at which the last report was generated and sent */ 723 uint32_t ssrc; /* identifier of the source */ 724 uint32_t csrc; /* contributing source 0-15 32bit each */ 725 uint32_t last_pkt_tsdiff; /* Jitter calculation, timestamp difference between the two last received packet */ 726 double inter_jitter; /* Jitter calculation, Interarrival jitter */ 727 uint32_t last_rpt_ext_seq; /* Packet loss calculation, extended sequence number at the begining of this RTCP report interval */ 728 uint16_t last_rpt_cycle; /* Packet loss calculation, sequence number cycle at the begining of the current RTCP report interval */ 729 uint16_t period_pkt_count; /* Packet loss calculation, packet count received during this RTCP report interval */ 730 uint16_t pkt_count; /* Packet loss calculation, packet count received during this session */ 731 uint16_t sent_pkt_count; 732 uint32_t rtcp_rtp_count; /* RTCP report generated count */ 733 uint32_t high_ext_seq_recv; /* Packet loss calculation, highest extended sequence number received and processed for stats */ 734 uint16_t cycle; /* Packet loss calculation, sequence number cycle of the current RTCP report interval */ 735 uint32_t bad_seq; /* Bad SEQ found, used to detect reset on the other side */ 736 uint16_t base_seq; /* Packet loss calculation, first sequence number received */ 737 uint32_t cum_lost; /* Packet loss calculation, cumulative number of packet lost */ 738 uint32_t last_recv_lsr_local; /* RTT calculation, When receiving an SR we save our local timestamp in fraction of 65536 seconds */ 739 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 */ 740 uint32_t init; 741 } switch_rtcp_numbers_t; 742 743 typedef struct { 744 uint16_t nack_count; 745 uint16_t fir_count; 746 uint16_t pli_count; 747 uint16_t sr_count; 748 uint16_t rr_count; 749 } switch_rtcp_video_counters_t; 750 751 typedef struct { 752 /* counters and stats for the incoming video stream and outgoing RTCP*/ 753 switch_rtcp_video_counters_t video_in; 754 /* counters and stats for the outgoing video stream and incoming RTCP*/ 755 switch_rtcp_video_counters_t video_out; 756 } switch_rtcp_video_stats_t; 757 758 typedef struct { 759 switch_rtp_numbers_t inbound; 760 switch_rtp_numbers_t outbound; 761 switch_rtcp_numbers_t rtcp; 762 uint32_t read_count; 763 } switch_rtp_stats_t; 764 765 typedef enum { 766 SWITCH_RTP_FLUSH_ONCE, 767 SWITCH_RTP_FLUSH_STICK, 768 SWITCH_RTP_FLUSH_UNSTICK 769 } switch_rtp_flush_t; 770 771 #define SWITCH_RTP_CNG_PAYLOAD 13 772 773 /*! 774 \enum switch_rtp_flag_t 775 \brief RTP Related Flags 776 <pre> 777 SWITCH_RTP_FLAG_NOBLOCK - Do not block 778 SWITCH_RTP_FLAG_IO - IO is ready 779 SWITCH_RTP_FLAG_USE_TIMER - Timeout Reads and replace with a CNG Frame 780 SWITCH_RTP_FLAG_SECURE - Secure RTP 781 SWITCH_RTP_FLAG_AUTOADJ - Auto-Adjust the dest based on the source 782 SWITCH_RTP_FLAG_RAW_WRITE - Try to forward packets unscathed 783 SWITCH_RTP_FLAG_GOOGLEHACK - Convert payload from 102 to 97 784 SWITCH_RTP_FLAG_VAD - Enable VAD 785 SWITCH_RTP_FLAG_BREAK - Stop what you are doing and return SWITCH_STATUS_BREAK 786 SWITCH_RTP_FLAG_DATAWAIT - Do not return from reads unless there is data even when non blocking 787 SWITCH_RTP_FLAG_BUGGY_2833 - Emulate the bug in cisco equipment to allow interop 788 SWITCH_RTP_FLAG_PASS_RFC2833 - Pass 2833 (ignore it) 789 SWITCH_RTP_FLAG_AUTO_CNG - Generate outbound CNG frames when idle 790 </pre> 791 */ 792 typedef enum { 793 SWITCH_RTP_FLAG_NOBLOCK = 0, 794 SWITCH_RTP_FLAG_DTMF_ON, 795 SWITCH_RTP_FLAG_IO, 796 SWITCH_RTP_FLAG_USE_TIMER, 797 SWITCH_RTP_FLAG_RTCP_PASSTHRU, 798 SWITCH_RTP_FLAG_SECURE_SEND, 799 SWITCH_RTP_FLAG_SECURE_RECV, 800 SWITCH_RTP_FLAG_AUTOADJ, 801 SWITCH_RTP_FLAG_RTCP_AUTOADJ, 802 SWITCH_RTP_FLAG_RAW_WRITE, 803 SWITCH_RTP_FLAG_GOOGLEHACK, 804 SWITCH_RTP_FLAG_VAD, 805 SWITCH_RTP_FLAG_BREAK, 806 SWITCH_RTP_FLAG_UDPTL, 807 SWITCH_RTP_FLAG_DATAWAIT, 808 SWITCH_RTP_FLAG_BYTESWAP, 809 SWITCH_RTP_FLAG_PASS_RFC2833, 810 SWITCH_RTP_FLAG_AUTO_CNG, 811 SWITCH_RTP_FLAG_SECURE_SEND_RESET, 812 SWITCH_RTP_FLAG_SECURE_RECV_RESET, 813 SWITCH_RTP_FLAG_PROXY_MEDIA, 814 SWITCH_RTP_FLAG_SHUTDOWN, 815 SWITCH_RTP_FLAG_FLUSH, 816 SWITCH_RTP_FLAG_AUTOFLUSH, 817 SWITCH_RTP_FLAG_STICKY_FLUSH, 818 SWITCH_ZRTP_FLAG_SECURE_SEND, 819 SWITCH_ZRTP_FLAG_SECURE_RECV, 820 SWITCH_ZRTP_FLAG_SECURE_MITM_SEND, 821 SWITCH_ZRTP_FLAG_SECURE_MITM_RECV, 822 SWITCH_RTP_FLAG_DEBUG_RTP_READ, 823 SWITCH_RTP_FLAG_DEBUG_RTP_WRITE, 824 SWITCH_RTP_FLAG_ESTIMATORS, 825 SWITCH_RTP_FLAG_ADJ_BITRATE_CAP, 826 SWITCH_RTP_FLAG_VIDEO, 827 SWITCH_RTP_FLAG_ENABLE_RTCP, 828 SWITCH_RTP_FLAG_RTCP_MUX, 829 SWITCH_RTP_FLAG_KILL_JB, 830 SWITCH_RTP_FLAG_VIDEO_BREAK, 831 SWITCH_RTP_FLAG_PAUSE, 832 SWITCH_RTP_FLAG_FIR, 833 SWITCH_RTP_FLAG_PLI, 834 SWITCH_RTP_FLAG_RESET, 835 SWITCH_RTP_FLAG_MUTE, 836 SWITCH_RTP_FLAG_NACK, 837 SWITCH_RTP_FLAG_TMMBR, 838 SWITCH_RTP_FLAG_DETECT_SSRC, 839 SWITCH_RTP_FLAG_TEXT, 840 SWITCH_RTP_FLAG_OLD_FIR, 841 SWITCH_RTP_FLAG_PASSTHRU, 842 SWITCH_RTP_FLAG_SECURE_SEND_MKI, 843 SWITCH_RTP_FLAG_SECURE_RECV_MKI, 844 SWITCH_RTP_FLAG_INVALID 845 } switch_rtp_flag_t; 846 847 848 typedef enum { 849 RTP_BUG_NONE = 0, /* won't be using this one much ;) */ 850 851 RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0), 852 /* Some Cisco devices get mad when you send the mark bit on new 2833 because it makes 853 them flush their jitterbuffer and the dtmf along with it. 854 855 This flag will disable the sending of the mark bit on the first DTMF packet. 856 */ 857 858 859 RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1), 860 /* 861 Sonus wrongly expects that, when sending a multi-packet 2833 DTMF event, The sender 862 should increment the RTP timestamp in each packet when, in reality, the sender should 863 send the same exact timestamp and increment the duration field in the 2833 payload. 864 This allows a reconstruction of the duration if any of the packets are lost. 865 866 final_duration - initial_timestamp = total_samples 867 868 However, if the duration value exceeds the space allocated (16 bits), The sender should increment 869 the timestamp one unit and reset the duration to 0. 870 871 Always sending a duration of 0 with a new timestamp should be tolerated but is rarely intentional 872 and is mistakenly done by many devices. 873 The issue is that the Sonus expects everyone to do it this way instead of tolerating either way. 874 Sonus will actually ignore every packet with the same timestamp before concluding if it's DTMF. 875 876 This flag will cause each packet to have a new timestamp. 877 */ 878 879 880 RTP_BUG_IGNORE_MARK_BIT = (1 << 2), 881 882 /* 883 A Huawei SBC has been discovered that sends the mark bit on every single RTP packet. 884 Since this causes the RTP stack to flush it's buffers, it horribly messes up the timing on the channel. 885 886 This flag will do nothing when an inbound packet contains the mark bit. 887 888 */ 889 890 891 RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3), 892 893 /* 894 Our friends at Sonus get real mad when the timestamps are not in perfect sequence even during periods of silence. 895 With this flag, we will only increment the timestamp when write packets even if they are eons apart. 896 897 */ 898 899 RTP_BUG_START_SEQ_AT_ZERO = (1 << 4), 900 901 /* 902 Our friends at Sonus also get real mad if the sequence number does not start at 0. 903 Typically, we set this to a random starting value for your saftey. 904 This is a security risk you take upon yourself when you enable this flag. 905 */ 906 907 908 RTP_BUG_NEVER_SEND_MARKER = (1 << 5), 909 910 /* 911 Our friends at Sonus are on a roll, They also get easily dumbfounded by marker bits. 912 This flag will never send any. Sheesh.... 913 */ 914 915 RTP_BUG_IGNORE_DTMF_DURATION = (1 << 6), 916 917 /* 918 Guess Who? ... Yep, Sonus (and who know's who else) likes to interweave DTMF with the audio stream making it take 919 2X as long as it should and sending an incorrect duration making the DTMF very delayed. 920 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. 921 */ 922 923 924 RTP_BUG_ACCEPT_ANY_PACKETS = (1 << 7), 925 926 /* 927 Oracle's Contact Center Anywhere (CCA) likes to use a single RTP socket to send all its outbound audio. 928 This messes up our ability to auto adjust to NATTED RTP and causes us to ignore its audio packets. 929 This flag will allow compatibility with this dying product. 930 */ 931 932 933 RTP_BUG_GEN_ONE_GEN_ALL = (1 << 8), 934 935 /* 936 Some RTP endpoints (and by some we mean *cough* _SONUS_!) do not like it when the timestamps jump forward or backwards in time. 937 So say you are generating a file that says "please wait for me to complete your call, or generating ringback" 938 Now you place and outbound call and you are bridging. Well, while you were playing the file, you were generating your own RTP timestamps. 939 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...... 940 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. 941 942 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 943 actual timestamps in the frames. 944 945 */ 946 947 RTP_BUG_CHANGE_SSRC_ON_MARKER = (1 << 9), 948 949 /* 950 By default FS will change the SSRC when the marker is set and it detects a timestamp reset. 951 If this setting is enabled it will NOT do this (old behaviour). 952 */ 953 954 RTP_BUG_FLUSH_JB_ON_DTMF = (1 << 10), 955 956 /* FLUSH JITTERBUFFER When getting RFC2833 to reduce bleed through */ 957 958 RTP_BUG_ACCEPT_ANY_PAYLOAD = (1 << 11), 959 960 /* 961 Make FS accept any payload type instead of dropping and returning CNG frame. Workaround while FS only supports a single payload per rtp session. 962 This can be used by endpoint modules to detect payload changes and act appropriately (ex: sofia could send a reINVITE with single codec). 963 This should probably be a flag, but flag enum is already full! 964 */ 965 966 967 RTP_BUG_ALWAYS_AUTO_ADJUST = (1 << 12) 968 969 /* 970 Leave the auto-adjust behavior enableed permenantly rather than only at appropriate times. (IMPLICITLY sets RTP_BUG_ACCEPT_ANY_PACKETS) 971 972 */ 973 974 } switch_rtp_bug_flag_t; 975 976 #ifdef _MSC_VER 977 #pragma pack(push, r1, 1) 978 #endif 979 980 #if SWITCH_BYTE_ORDER == __BIG_ENDIAN 981 typedef struct { 982 unsigned version:2; /* protocol version */ 983 unsigned p:1; /* padding flag */ 984 unsigned x:1; /* header extension flag */ 985 unsigned cc:4; /* CSRC count */ 986 unsigned m:1; /* marker bit */ 987 unsigned pt:7; /* payload type */ 988 unsigned seq:16; /* sequence number */ 989 unsigned ts:32; /* timestamp */ 990 unsigned ssrc:32; /* synchronization source */ 991 } switch_rtp_hdr_t; 992 993 typedef struct { 994 unsigned length:16; /* length */ 995 unsigned profile:16; /* defined by profile */ 996 } switch_rtp_hdr_ext_t; 997 998 #else /* BIG_ENDIAN */ 999 1000 typedef struct { 1001 unsigned cc:4; /* CSRC count */ 1002 unsigned x:1; /* header extension flag */ 1003 unsigned p:1; /* padding flag */ 1004 unsigned version:2; /* protocol version */ 1005 unsigned pt:7; /* payload type */ 1006 unsigned m:1; /* marker bit */ 1007 unsigned seq:16; /* sequence number */ 1008 unsigned ts:32; /* timestamp */ 1009 unsigned ssrc:32; /* synchronization source */ 1010 } switch_rtp_hdr_t; 1011 1012 typedef struct { 1013 unsigned profile:16; /* defined by profile */ 1014 unsigned length:16; /* length */ 1015 } switch_rtp_hdr_ext_t; 1016 1017 #endif 1018 1019 #ifdef _MSC_VER 1020 #pragma pack(pop, r1) 1021 #endif 1022 1023 #ifdef _MSC_VER 1024 #pragma pack(push, r1, 1) 1025 #endif 1026 1027 #if SWITCH_BYTE_ORDER == __BIG_ENDIAN 1028 typedef struct switch_rtcp_hdr_s { 1029 unsigned version:2; /* protocol version */ 1030 unsigned p:1; /* padding flag */ 1031 unsigned count:5; /* number of reception report blocks */ 1032 unsigned type:8; /* packet type */ 1033 unsigned length:16; /* length in 32-bit words - 1 */ 1034 } switch_rtcp_hdr_t; 1035 1036 #else /* BIG_ENDIAN */ 1037 1038 typedef struct switch_rtcp_hdr_s { 1039 unsigned count:5; /* number of reception report blocks */ 1040 unsigned p:1; /* padding flag */ 1041 unsigned version:2; /* protocol version */ 1042 unsigned type:8; /* packet type */ 1043 unsigned length:16; /* length in 32-bit words - 1 */ 1044 } switch_rtcp_hdr_t; 1045 1046 #endif 1047 1048 #ifdef _MSC_VER 1049 #pragma pack(pop, r1) 1050 #endif 1051 1052 typedef struct audio_buffer_header_s { 1053 uint32_t ts; 1054 uint32_t len; 1055 } audio_buffer_header_t; 1056 1057 1058 /*! 1059 \enum switch_priority_t 1060 \brief Priority Indication 1061 <pre> 1062 SWITCH_PRIORITY_NORMAL - Normal Priority 1063 SWITCH_PRIORITY_LOW - Low Priority 1064 SWITCH_PRIORITY_HIGH - High Priority 1065 </pre> 1066 */ 1067 typedef enum { 1068 SWITCH_PRIORITY_NORMAL, 1069 SWITCH_PRIORITY_LOW, 1070 SWITCH_PRIORITY_HIGH 1071 } switch_priority_t; 1072 1073 /*! 1074 \enum switch_ivr_option_t 1075 \brief Possible options related to ivr functions 1076 <pre> 1077 SWITCH_IVR_OPTION_NONE - nothing whatsoever 1078 SWITCH_IVR_OPTION_ASYNC - Asynchronous (do things in the background when applicable) 1079 SWITCH_IVR_OPTION_FILE - string argument implies a filename 1080 </pre> 1081 */ 1082 typedef enum { 1083 SWITCH_IVR_OPTION_NONE = 0, 1084 SWITCH_IVR_OPTION_ASYNC = (1 << 0), 1085 SWITCH_IVR_OPTION_FILE = (1 << 1) 1086 } switch_ivr_option_enum_t; 1087 typedef uint32_t switch_ivr_option_t; 1088 1089 /*! 1090 \enum switch_core_session_message_types_t 1091 \brief Possible types of messages for inter-session communication 1092 <pre> 1093 SWITCH_MESSAGE_REDIRECT_AUDIO - Indication to redirect audio to another location if possible 1094 SWITCH_MESSAGE_TRANSMIT_TEXT - A text message 1095 SWITCH_MESSAGE_INDICATE_ANSWER - indicate answer 1096 SWITCH_MESSAGE_INDICATE_PROGRESS - indicate progress 1097 SWITCH_MESSAGE_INDICATE_BRIDGE - indicate a bridge starting 1098 SWITCH_MESSAGE_INDICATE_UNBRIDGE - indicate a bridge ending 1099 SWITCH_MESSAGE_INDICATE_TRANSFER - indicate a transfer is taking place 1100 SWITCH_MESSAGE_INDICATE_MEDIA - indicate media is required 1101 SWITCH_MESSAGE_INDICATE_NOMEDIA - indicate no-media is required 1102 SWITCH_MESSAGE_INDICATE_HOLD - indicate hold 1103 SWITCH_MESSAGE_INDICATE_UNHOLD - indicate unhold 1104 SWITCH_MESSAGE_INDICATE_REDIRECT - indicate redirect 1105 SWITCH_MESSAGE_INDICATE_RESPOND - indicate reject 1106 SWITCH_MESSAGE_INDICATE_BROADCAST - indicate media broadcast 1107 SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT - indicate media broadcast 1108 SWITCH_MESSAGE_INDICATE_DEFLECT - indicate deflect 1109 SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ - indicate video refresh request 1110 </pre> 1111 */ 1112 typedef enum { 1113 SWITCH_MESSAGE_REDIRECT_AUDIO, 1114 SWITCH_MESSAGE_TRANSMIT_TEXT, 1115 SWITCH_MESSAGE_INDICATE_ANSWER, 1116 SWITCH_MESSAGE_INDICATE_ACKNOWLEDGE_CALL, 1117 SWITCH_MESSAGE_INDICATE_PROGRESS, 1118 SWITCH_MESSAGE_INDICATE_BRIDGE, 1119 SWITCH_MESSAGE_INDICATE_UNBRIDGE, 1120 SWITCH_MESSAGE_INDICATE_TRANSFER, 1121 SWITCH_MESSAGE_INDICATE_RINGING, 1122 SWITCH_MESSAGE_INDICATE_ALERTING, 1123 SWITCH_MESSAGE_INDICATE_MEDIA, 1124 SWITCH_MESSAGE_INDICATE_3P_MEDIA, 1125 SWITCH_MESSAGE_INDICATE_NOMEDIA, 1126 SWITCH_MESSAGE_INDICATE_3P_NOMEDIA, 1127 SWITCH_MESSAGE_INDICATE_HOLD, 1128 SWITCH_MESSAGE_INDICATE_UNHOLD, 1129 SWITCH_MESSAGE_INDICATE_REDIRECT, 1130 SWITCH_MESSAGE_INDICATE_RESPOND, 1131 SWITCH_MESSAGE_INDICATE_BROADCAST, 1132 SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT, 1133 SWITCH_MESSAGE_INDICATE_DEFLECT, 1134 SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ, 1135 SWITCH_MESSAGE_INDICATE_DISPLAY, 1136 SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY, 1137 SWITCH_MESSAGE_INDICATE_AUDIO_SYNC, 1138 SWITCH_MESSAGE_INDICATE_VIDEO_SYNC, 1139 SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA, 1140 SWITCH_MESSAGE_INDICATE_UUID_CHANGE, 1141 SWITCH_MESSAGE_INDICATE_SIMPLIFY, 1142 SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA, 1143 SWITCH_MESSAGE_INDICATE_PROXY_MEDIA, 1144 SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC, 1145 SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE, 1146 SWITCH_MESSAGE_INDICATE_PHONE_EVENT, 1147 SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION, 1148 SWITCH_MESSAGE_INDICATE_UDPTL_MODE, 1149 SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS, 1150 SWITCH_MESSAGE_INDICATE_JITTER_BUFFER, 1151 SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH, 1152 SWITCH_MESSAGE_INDICATE_SIGNAL_DATA, 1153 SWITCH_MESSAGE_INDICATE_MESSAGE, 1154 SWITCH_MESSAGE_INDICATE_INFO, 1155 SWITCH_MESSAGE_INDICATE_AUDIO_DATA, 1156 SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE, 1157 SWITCH_MESSAGE_INDICATE_STUN_ERROR, 1158 SWITCH_MESSAGE_INDICATE_MEDIA_RENEG, 1159 SWITCH_MESSAGE_INDICATE_KEEPALIVE, 1160 SWITCH_MESSAGE_INDICATE_HARD_MUTE, 1161 SWITCH_MESSAGE_INDICATE_BITRATE_REQ, 1162 SWITCH_MESSAGE_INDICATE_BITRATE_ACK, 1163 SWITCH_MESSAGE_INDICATE_CODEC_DEBUG_REQ, 1164 SWITCH_MESSAGE_INDICATE_CODEC_SPECIFIC_REQ, 1165 SWITCH_MESSAGE_REFER_EVENT, 1166 SWITCH_MESSAGE_ANSWER_EVENT, 1167 SWITCH_MESSAGE_PROGRESS_EVENT, 1168 SWITCH_MESSAGE_RING_EVENT, 1169 SWITCH_MESSAGE_RESAMPLE_EVENT, 1170 SWITCH_MESSAGE_HEARTBEAT_EVENT, 1171 SWITCH_MESSAGE_INDICATE_SESSION_ID, 1172 SWITCH_MESSAGE_INVALID 1173 } switch_core_session_message_types_t; 1174 1175 typedef struct { 1176 uint16_t T38FaxVersion; 1177 uint32_t T38MaxBitRate; 1178 switch_bool_t T38FaxFillBitRemoval; 1179 switch_bool_t T38FaxTranscodingMMR; 1180 switch_bool_t T38FaxTranscodingJBIG; 1181 const char *T38FaxRateManagement; 1182 uint32_t T38FaxMaxBuffer; 1183 uint32_t T38FaxMaxDatagram; 1184 const char *T38FaxUdpEC; 1185 const char *T38VendorInfo; 1186 const char *remote_ip; 1187 uint16_t remote_port; 1188 const char *local_ip; 1189 uint16_t local_port; 1190 const char *sdp_o_line; 1191 } switch_t38_options_t; 1192 1193 /*! 1194 \enum switch_stack_t 1195 \brief Expression of how to stack a list 1196 <pre> 1197 SWITCH_STACK_BOTTOM - Stack on the bottom 1198 SWITCH_STACK_TOP - Stack on the top 1199 </pre> 1200 */ 1201 typedef enum { 1202 SWITCH_STACK_BOTTOM = (1 << 0), 1203 SWITCH_STACK_TOP = (1 << 1), 1204 SWITCH_STACK_NODUP = (1 << 2), 1205 SWITCH_STACK_UNSHIFT = (1 << 3), 1206 SWITCH_STACK_PUSH = (1 << 4), 1207 } switch_stack_t; 1208 1209 /*! 1210 \enum switch_status_t 1211 \brief Common return values 1212 <pre> 1213 SWITCH_STATUS_SUCCESS - General Success (common return value for most functions) 1214 SWITCH_STATUS_FALSE - General Falsehood 1215 SWITCH_STATUS_TIMEOUT - A Timeout has occured 1216 SWITCH_STATUS_RESTART - An indication to restart the previous operation 1217 SWITCH_STATUS_TERM - An indication to terminate 1218 SWITCH_STATUS_NOTIMPL - An indication that requested resource is not impelemented 1219 SWITCH_STATUS_MEMERR - General memory error 1220 SWITCH_STATUS_NOOP - NOTHING 1221 SWITCH_STATUS_RESAMPLE - An indication that a resample has occured 1222 SWITCH_STATUS_GENERR - A general Error 1223 SWITCH_STATUS_INUSE - An indication that requested resource is in use 1224 SWITCH_STATUS_BREAK - A non-fatal break of an operation 1225 SWITCH_STATUS_SOCKERR - A socket error 1226 SWITCH_STATUS_MORE_DATA - Need More Data 1227 SWITCH_STATUS_NOTFOUND - Not Found 1228 SWITCH_STATUS_UNLOAD - Unload 1229 SWITCH_STATUS_NOUNLOAD - Never Unload 1230 </pre> 1231 */ 1232 typedef enum { 1233 SWITCH_STATUS_SUCCESS, 1234 SWITCH_STATUS_FALSE, 1235 SWITCH_STATUS_TIMEOUT, 1236 SWITCH_STATUS_RESTART, 1237 SWITCH_STATUS_INTR, 1238 SWITCH_STATUS_NOTIMPL, 1239 SWITCH_STATUS_MEMERR, 1240 SWITCH_STATUS_NOOP, 1241 SWITCH_STATUS_RESAMPLE, 1242 SWITCH_STATUS_GENERR, 1243 SWITCH_STATUS_INUSE, 1244 SWITCH_STATUS_BREAK, 1245 SWITCH_STATUS_SOCKERR, 1246 SWITCH_STATUS_MORE_DATA, 1247 SWITCH_STATUS_NOTFOUND, 1248 SWITCH_STATUS_UNLOAD, 1249 SWITCH_STATUS_NOUNLOAD, 1250 SWITCH_STATUS_IGNORE, 1251 SWITCH_STATUS_TOO_SMALL, 1252 SWITCH_STATUS_FOUND, 1253 SWITCH_STATUS_CONTINUE, 1254 SWITCH_STATUS_TERM, 1255 SWITCH_STATUS_NOT_INITALIZED, 1256 SWITCH_STATUS_TOO_LATE, 1257 SWITCH_STATUS_XBREAK = 35, 1258 SWITCH_STATUS_WINBREAK = 730035 1259 } switch_status_t; 1260 1261 1262 1263 /*! 1264 \enum switch_log_level_t 1265 \brief Log Level Enumeration 1266 <pre> 1267 SWITCH_LOG_DEBUG - Debug 1268 SWITCH_LOG_INFO - Info 1269 SWITCH_LOG_NOTICE - Notice 1270 SWITCH_LOG_WARNING - Warning 1271 SWITCH_LOG_ERROR - Error 1272 SWITCH_LOG_CRIT - Critical 1273 SWITCH_LOG_ALERT - Alert 1274 SWITCH_LOG_CONSOLE - Console 1275 </pre> 1276 */ 1277 typedef enum { 1278 SWITCH_LOG_DEBUG10 = 110, 1279 SWITCH_LOG_DEBUG9 = 109, 1280 SWITCH_LOG_DEBUG8 = 108, 1281 SWITCH_LOG_DEBUG7 = 107, 1282 SWITCH_LOG_DEBUG6 = 106, 1283 SWITCH_LOG_DEBUG5 = 105, 1284 SWITCH_LOG_DEBUG4 = 104, 1285 SWITCH_LOG_DEBUG3 = 103, 1286 SWITCH_LOG_DEBUG2 = 102, 1287 SWITCH_LOG_DEBUG1 = 101, 1288 SWITCH_LOG_DEBUG = 7, 1289 SWITCH_LOG_INFO = 6, 1290 SWITCH_LOG_NOTICE = 5, 1291 SWITCH_LOG_WARNING = 4, 1292 SWITCH_LOG_ERROR = 3, 1293 SWITCH_LOG_CRIT = 2, 1294 SWITCH_LOG_ALERT = 1, 1295 SWITCH_LOG_CONSOLE = 0, 1296 SWITCH_LOG_INVALID = 64, 1297 SWITCH_LOG_UNINIT = 1000, 1298 } switch_log_level_t; 1299 1300 1301 /*! 1302 \enum switch_text_channel_t 1303 \brief A target to write log/debug info to 1304 <pre> 1305 SWITCH_CHANNEL_ID_LOG - Write to the currently defined log 1306 SWITCH_CHANNEL_ID_LOG_CLEAN - Write to the currently defined log with no extra file/line/date information 1307 SWITCH_CHANNEL_ID_EVENT - Write to the event engine as a LOG event 1308 </pre> 1309 */ 1310 typedef enum { 1311 SWITCH_CHANNEL_ID_LOG, 1312 SWITCH_CHANNEL_ID_LOG_CLEAN, 1313 SWITCH_CHANNEL_ID_EVENT, 1314 SWITCH_CHANNEL_ID_SESSION 1315 } switch_text_channel_t; 1316 1317 typedef enum { 1318 SCSMF_DYNAMIC = (1 << 0), 1319 SCSMF_FREE_STRING_REPLY = (1 << 1), 1320 SCSMF_FREE_POINTER_REPLY = (1 << 2) 1321 } switch_core_session_message_flag_enum_t; 1322 typedef uint32_t switch_core_session_message_flag_t; 1323 1324 #define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL 1325 #define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL 1326 #define SWITCH_CHANNEL_SESSION_LOG_CLEAN(x) SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, switch_core_session_get_uuid((x)) 1327 #define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__, NULL 1328 #define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)(x) 1329 #define SWITCH_CHANNEL_CHANNEL_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)switch_channel_get_session(x) 1330 #define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, (x) 1331 1332 typedef enum { 1333 CCS_DOWN, 1334 CCS_DIALING, 1335 CCS_RINGING, 1336 CCS_EARLY, 1337 CCS_ACTIVE, 1338 CCS_HELD, 1339 CCS_RING_WAIT, 1340 CCS_HANGUP, 1341 CCS_UNHELD 1342 } switch_channel_callstate_t; 1343 1344 typedef enum { 1345 SDS_DOWN, 1346 SDS_RINGING, 1347 SDS_ACTIVE, 1348 SDS_ACTIVE_MULTI, 1349 SDS_HELD, 1350 SDS_UNHELD, 1351 SDS_HANGUP 1352 } switch_device_state_t; 1353 1354 1355 /*! 1356 \enum switch_channel_state_t 1357 \brief Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are often overridden by specific apps) 1358 <pre> 1359 CS_NEW - Channel is newly created. 1360 CS_INIT - Channel has been initialized. 1361 CS_ROUTING - Channel is looking for an extension to execute. 1362 CS_SOFT_EXECUTE - Channel is ready to execute from 3rd party control. 1363 CS_EXECUTE - Channel is executing it's dialplan. 1364 CS_EXCHANGE_MEDIA - Channel is exchanging media with another channel. 1365 CS_PARK - Channel is accepting media awaiting commands. 1366 CS_CONSUME_MEDIA - Channel is consuming all media and dropping it. 1367 CS_HIBERNATE - Channel is in a sleep state. 1368 CS_RESET - Channel is in a reset state. 1369 CS_HANGUP - Channel is flagged for hangup and ready to end. 1370 CS_REPORTING - Channel is ready to collect call detail. 1371 CS_DESTROY - Channel is ready to be destroyed and out of the state machine. 1372 </pre> 1373 */ 1374 typedef enum { 1375 CS_NEW, 1376 CS_INIT, 1377 CS_ROUTING, 1378 CS_SOFT_EXECUTE, 1379 CS_EXECUTE, 1380 CS_EXCHANGE_MEDIA, 1381 CS_PARK, 1382 CS_CONSUME_MEDIA, 1383 CS_HIBERNATE, 1384 CS_RESET, 1385 CS_HANGUP, 1386 CS_REPORTING, 1387 CS_DESTROY, 1388 CS_NONE 1389 } switch_channel_state_t; 1390 1391 typedef enum { 1392 SWITCH_RING_READY_NONE, 1393 SWITCH_RING_READY_RINGING, 1394 SWITCH_RING_READY_QUEUED 1395 } switch_ring_ready_t; 1396 1397 1398 /*! 1399 \enum switch_channel_flag_t 1400 \brief Channel Flags 1401 1402 <pre> 1403 CF_ANSWERED - Channel is answered 1404 CF_OUTBOUND - Channel is an outbound channel 1405 CF_EARLY_MEDIA - Channel is ready for audio before answer 1406 CF_ORIGINATOR - Channel is an originator 1407 CF_TRANSFER - Channel is being transfered 1408 CF_ACCEPT_CNG - Channel will accept CNG frames 1409 CF_REDIRECT - Channel is being redirected 1410 CF_BRIDGED - Channel in a bridge 1411 CF_HOLD - Channel is on hold 1412 CF_HOLD_BLEG - B leg is on hold 1413 CF_SERVICE - Channel has a service thread 1414 CF_TAGGED - Channel is tagged 1415 CF_WINNER - Channel is the winner 1416 CF_CONTROLLED - Channel is under control 1417 CF_PROXY_MODE - Channel has no media 1418 CF_SUSPEND - Suspend i/o 1419 CF_EVENT_PARSE - Suspend control events 1420 CF_GEN_RINGBACK - Channel is generating it's own ringback 1421 CF_RING_READY - Channel is ready to send ringback 1422 CF_BREAK - Channel should stop what it's doing 1423 CF_BROADCAST - Channel is broadcasting 1424 CF_UNICAST - Channel has a unicast connection 1425 CF_VIDEO - Channel has video 1426 CF_EVENT_LOCK - Don't parse events 1427 CF_RESET - Tell extension parser to reset 1428 CF_ORIGINATING - Channel is originating 1429 CF_STOP_BROADCAST - Signal to stop broadcast 1430 1431 CF_AUDIO_PAUSE - Audio is not ready to read/write 1432 CF_VIDEO_PAUSE - Video is not ready to read/write 1433 1434 CF_MEDIA_SET - Session has read codec assigned 1435 1436 </pre> 1437 */ 1438 1439 typedef enum { 1440 CC_MEDIA_ACK = 1, 1441 CC_BYPASS_MEDIA, 1442 CC_PROXY_MEDIA, 1443 CC_JITTERBUFFER, 1444 CC_FS_RTP, 1445 CC_QUEUEABLE_DTMF_DELAY, 1446 CC_IO_OVERRIDE, 1447 CC_RTP_RTT, 1448 CC_MSRP, 1449 /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ 1450 CC_FLAG_MAX 1451 } switch_channel_cap_t; 1452 1453 typedef enum { 1454 CF_ANSWERED = 1, 1455 CF_OUTBOUND, 1456 CF_EARLY_MEDIA, 1457 CF_BRIDGE_ORIGINATOR, 1458 CF_UUID_BRIDGE_ORIGINATOR, 1459 CF_TRANSFER, 1460 CF_ACCEPT_CNG, 1461 CF_REDIRECT, 1462 CF_BRIDGED, 1463 CF_HOLD, 1464 CF_HOLD_BLEG, 1465 CF_SERVICE, 1466 CF_TAGGED, 1467 CF_WINNER, 1468 CF_CONTROLLED, 1469 CF_PROXY_MODE, 1470 CF_PROXY_OFF, 1471 CF_SUSPEND, 1472 CF_EVENT_PARSE, 1473 CF_GEN_RINGBACK, 1474 CF_RING_READY, 1475 CF_BREAK, 1476 CF_BROADCAST, 1477 CF_UNICAST, 1478 CF_VIDEO, 1479 CF_EVENT_LOCK, 1480 CF_EVENT_LOCK_PRI, 1481 CF_RESET, 1482 CF_ORIGINATING, 1483 CF_STOP_BROADCAST, 1484 CF_PROXY_MEDIA, 1485 CF_INNER_BRIDGE, 1486 CF_REQ_MEDIA, 1487 CF_VERBOSE_EVENTS, 1488 CF_PAUSE_BUGS, 1489 CF_DIVERT_EVENTS, 1490 CF_BLOCK_STATE, 1491 CF_FS_RTP, 1492 CF_REPORTING, 1493 CF_PARK, 1494 CF_TIMESTAMP_SET, 1495 CF_ORIGINATOR, 1496 CF_XFER_ZOMBIE, 1497 CF_MEDIA_ACK, 1498 CF_THREAD_SLEEPING, 1499 CF_DISABLE_RINGBACK, 1500 CF_NOT_READY, 1501 CF_SIGNAL_BRIDGE_TTL, 1502 CF_MEDIA_BRIDGE_TTL, 1503 CF_BYPASS_MEDIA_AFTER_BRIDGE, 1504 CF_LEG_HOLDING, 1505 CF_BROADCAST_DROP_MEDIA, 1506 CF_EARLY_HANGUP, 1507 CF_MEDIA_SET, 1508 CF_CONSUME_ON_ORIGINATE, 1509 CF_PASSTHRU_PTIME_MISMATCH, 1510 CF_BRIDGE_NOWRITE, 1511 CF_RECOVERED, 1512 CF_JITTERBUFFER, 1513 CF_JITTERBUFFER_PLC, 1514 CF_DIALPLAN, 1515 CF_BLEG, 1516 CF_BLOCK_BROADCAST_UNTIL_MEDIA, 1517 CF_CNG_PLC, 1518 CF_ATTENDED_TRANSFER, 1519 CF_LAZY_ATTENDED_TRANSFER, 1520 CF_SIGNAL_DATA, 1521 CF_SIMPLIFY, 1522 CF_ZOMBIE_EXEC, 1523 CF_INTERCEPT, 1524 CF_INTERCEPTED, 1525 CF_VIDEO_REFRESH_REQ, 1526 CF_MANUAL_VID_REFRESH, 1527 CF_SERVICE_AUDIO, 1528 CF_SERVICE_VIDEO, 1529 CF_ZRTP_PASSTHRU_REQ, 1530 CF_ZRTP_PASSTHRU, 1531 CF_ZRTP_HASH, 1532 CF_CHANNEL_SWAP, 1533 CF_DEVICE_LEG, 1534 CF_FINAL_DEVICE_LEG, 1535 CF_PICKUP, 1536 CF_CONFIRM_BLIND_TRANSFER, 1537 CF_NO_PRESENCE, 1538 CF_CONFERENCE, 1539 CF_CONFERENCE_ADV, 1540 CF_RECOVERING, 1541 CF_RECOVERING_BRIDGE, 1542 CF_TRACKED, 1543 CF_TRACKABLE, 1544 CF_NO_CDR, 1545 CF_EARLY_OK, 1546 CF_MEDIA_TRANS, 1547 CF_HOLD_ON_BRIDGE, 1548 CF_SECURE, 1549 CF_LIBERAL_DTMF, 1550 CF_SLA_BARGE, 1551 CF_SLA_BARGING, 1552 CF_PROTO_HOLD, //TFLAG_SIP_HOLD 1553 CF_HOLD_LOCK, 1554 CF_VIDEO_POSSIBLE,//TFLAG_VIDEO 1555 CF_NOTIMER_DURING_BRIDGE, 1556 CF_PASS_RFC2833, 1557 CF_T38_PASSTHRU, 1558 CF_DROP_DTMF, 1559 CF_REINVITE, 1560 CF_AUTOFLUSH_DURING_BRIDGE, 1561 CF_RTP_NOTIMER_DURING_BRIDGE, 1562 CF_AVPF, 1563 CF_AVPF_MOZ, 1564 CF_ICE, 1565 CF_DTLS, 1566 CF_VERBOSE_SDP, 1567 CF_DTLS_OK, 1568 CF_3PCC, 1569 CF_VIDEO_PASSIVE, 1570 CF_NOVIDEO, 1571 CF_VIDEO_BITRATE_UNMANAGABLE, 1572 CF_VIDEO_ECHO, 1573 CF_VIDEO_BLANK, 1574 CF_VIDEO_WRITING, 1575 CF_SLA_INTERCEPT, 1576 CF_VIDEO_BREAK, 1577 CF_AUDIO_PAUSE_READ, 1578 CF_AUDIO_PAUSE_WRITE, 1579 CF_VIDEO_PAUSE_READ, 1580 CF_VIDEO_PAUSE_WRITE, 1581 CF_BYPASS_MEDIA_AFTER_HOLD, 1582 CF_HANGUP_HELD, 1583 CF_CONFERENCE_RESET_MEDIA, 1584 CF_VIDEO_DECODED_READ, 1585 CF_VIDEO_DEBUG_READ, 1586 CF_VIDEO_DEBUG_WRITE, 1587 CF_VIDEO_ONLY, 1588 CF_VIDEO_READY, 1589 CF_VIDEO_MIRROR_INPUT, 1590 CF_VIDEO_READ_FILE_ATTACHED, 1591 CF_VIDEO_WRITE_FILE_ATTACHED, 1592 CF_3P_MEDIA_REQUESTED, 1593 CF_3P_NOMEDIA_REQUESTED, 1594 CF_3P_NOMEDIA_REQUESTED_BLEG, 1595 CF_IMAGE_SDP, 1596 CF_VIDEO_SDP_RECVD, 1597 CF_TEXT_SDP_RECVD, 1598 CF_HAS_TEXT, 1599 CF_TEXT_POSSIBLE, 1600 CF_TEXT_PASSIVE, 1601 CF_TEXT_ECHO, 1602 CF_TEXT_ACTIVE, 1603 CF_TEXT_IDLE, 1604 CF_TEXT_LINE_BASED, 1605 CF_QUEUE_TEXT_EVENTS, 1606 CF_FIRE_TEXT_EVENTS, 1607 CF_MSRP, 1608 CF_MSRPS, 1609 CF_WANT_MSRP, 1610 CF_WANT_MSRPS, 1611 CF_RTT, 1612 CF_WANT_RTT, 1613 CF_AUDIO, 1614 CF_AWAITING_STREAM_CHANGE, 1615 CF_PROCESSING_STREAM_CHANGE, 1616 CF_STREAM_CHANGED, 1617 CF_ARRANGED_BRIDGE, 1618 CF_STATE_REPEAT, 1619 CF_WANT_DTLSv1_2, 1620 CF_RFC7329_COMPAT, 1621 /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ 1622 /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ 1623 CF_FLAG_MAX 1624 } switch_channel_flag_t; 1625 1626 typedef struct switch_vid_params_s { 1627 uint32_t width; 1628 uint32_t height; 1629 uint32_t fps; 1630 uint32_t d_width; 1631 uint32_t d_height; 1632 } switch_vid_params_t; 1633 1634 typedef struct switch_fps_s { 1635 float fps; 1636 int ms; 1637 int samples; 1638 } switch_fps_t; 1639 1640 1641 typedef enum { 1642 CF_APP_TAGGED = (1 << 0), 1643 CF_APP_T38 = (1 << 1), 1644 CF_APP_T38_REQ = (1 << 2), 1645 CF_APP_T38_FAIL = (1 << 3), 1646 CF_APP_T38_NEGOTIATED = (1 << 4), 1647 CF_APP_T38_POSSIBLE = (1 << 5) 1648 } switch_channel_app_flag_t; 1649 1650 1651 /*! 1652 \enum switch_frame_flag_t 1653 \brief Frame Flags 1654 1655 <pre> 1656 SFF_CNG = (1 << 0) - Frame represents comfort noise 1657 SFF_RAW_RTP = (1 << 1) - Frame has raw rtp accessible 1658 SFF_RTP_HEADER = (1 << 2) - Get the rtp header from the frame header 1659 SFF_PLC = (1 << 3) - Frame has generated PLC data 1660 SFF_RFC2833 = (1 << 4) - Frame has rfc2833 dtmf data 1661 SFF_DYNAMIC = (1 << 5) - Frame is dynamic and should be freed 1662 SFF_MARKER = (1 << 11) - Frame flag has Marker set, only set by encoder 1663 SFF_WAIT_KEY_FRAME = (1 << 12) - Need a key from before could decode, or force generate a key frame on encode 1664 </pre> 1665 */ 1666 typedef enum { 1667 SFF_NONE = 0, 1668 SFF_CNG = (1 << 0), 1669 SFF_RAW_RTP = (1 << 1), 1670 SFF_RTP_HEADER = (1 << 2), 1671 SFF_PLC = (1 << 3), 1672 SFF_RFC2833 = (1 << 4), 1673 SFF_PROXY_PACKET = (1 << 5), 1674 SFF_DYNAMIC = (1 << 6), 1675 SFF_ZRTP = (1 << 7), 1676 SFF_UDPTL_PACKET = (1 << 8), 1677 SFF_NOT_AUDIO = (1 << 9), 1678 SFF_RTCP = (1 << 10), 1679 SFF_MARKER = (1 << 11), 1680 SFF_WAIT_KEY_FRAME = (1 << 12), 1681 SFF_RAW_RTP_PARSE_FRAME = (1 << 13), 1682 SFF_PICTURE_RESET = (1 << 14), 1683 SFF_SAME_IMAGE = (1 << 15), 1684 SFF_USE_VIDEO_TIMESTAMP = (1 << 16), 1685 SFF_ENCODED = (1 << 17), 1686 SFF_TEXT_LINE_BREAK = (1 << 18), 1687 SFF_IS_KEYFRAME = (1 << 19), 1688 SFF_EXTERNAL = (1 << 20) 1689 } switch_frame_flag_enum_t; 1690 typedef uint32_t switch_frame_flag_t; 1691 1692 1693 typedef enum { 1694 SAF_NONE = 0, 1695 SAF_SUPPORT_NOMEDIA = (1 << 0), 1696 SAF_ROUTING_EXEC = (1 << 1), 1697 SAF_MEDIA_TAP = (1 << 2), 1698 SAF_ZOMBIE_EXEC = (1 << 3), 1699 SAF_NO_LOOPBACK = (1 << 4), 1700 SAF_SUPPORT_TEXT_ONLY = (1 << 5) 1701 } switch_application_flag_enum_t; 1702 typedef uint32_t switch_application_flag_t; 1703 1704 typedef enum { 1705 SCAF_NONE = 0 1706 } switch_chat_application_flag_enum_t; 1707 typedef uint32_t switch_chat_application_flag_t; 1708 1709 1710 /*! 1711 \enum switch_signal_t 1712 \brief Signals to send to channels 1713 <pre> 1714 SWITCH_SIG_KILL - Kill the channel 1715 SWITCH_SIG_XFER - Stop the current io but leave it viable 1716 </pre> 1717 */ 1718 1719 typedef enum { 1720 SWITCH_SIG_NONE, 1721 SWITCH_SIG_KILL, 1722 SWITCH_SIG_XFER, 1723 SWITCH_SIG_BREAK 1724 } switch_signal_t; 1725 1726 /*! 1727 \enum switch_codec_flag_t 1728 \brief Codec related flags 1729 <pre> 1730 SWITCH_CODEC_FLAG_ENCODE = (1 << 0) - Codec can encode 1731 SWITCH_CODEC_FLAG_DECODE = (1 << 1) - Codec can decode 1732 SWITCH_CODEC_FLAG_SILENCE_START = (1 << 2) - Start period of silence 1733 SWITCH_CODEC_FLAG_SILENCE_STOP = (1 << 3) - End period of silence 1734 SWITCH_CODEC_FLAG_SILENCE = (1 << 4) - Silence 1735 SWITCH_CODEC_FLAG_FREE_POOL = (1 << 5) - Free codec's pool on destruction 1736 SWITCH_CODEC_FLAG_AAL2 = (1 << 6) - USE AAL2 Bitpacking 1737 SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7) - Passthrough only 1738 </pre> 1739 */ 1740 typedef enum { 1741 SWITCH_CODEC_FLAG_ENCODE = (1 << 0), 1742 SWITCH_CODEC_FLAG_DECODE = (1 << 1), 1743 SWITCH_CODEC_FLAG_SILENCE_START = (1 << 2), 1744 SWITCH_CODEC_FLAG_SILENCE_STOP = (1 << 3), 1745 SWITCH_CODEC_FLAG_SILENCE = (1 << 4), 1746 SWITCH_CODEC_FLAG_FREE_POOL = (1 << 5), 1747 SWITCH_CODEC_FLAG_AAL2 = (1 << 6), 1748 SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7), 1749 SWITCH_CODEC_FLAG_READY = (1 << 8), 1750 SWITCH_CODEC_FLAG_HAS_ADJ_BITRATE = (1 << 14), 1751 SWITCH_CODEC_FLAG_HAS_PLC = (1 << 15), 1752 SWITCH_CODEC_FLAG_VIDEO_PATCHING = (1 << 16) 1753 } switch_codec_flag_enum_t; 1754 typedef uint32_t switch_codec_flag_t; 1755 1756 1757 /*! 1758 \enum switch_speech_flag_t 1759 \brief Speech related flags 1760 <pre> 1761 SWITCH_SPEECH_FLAG_HASTEXT = (1 << 0) - Interface is has text to read. 1762 SWITCH_SPEECH_FLAG_PEEK = (1 << 1) - Read data but do not erase it. 1763 SWITCH_SPEECH_FLAG_FREE_POOL = (1 << 2) - Free interface's pool on destruction. 1764 SWITCH_SPEECH_FLAG_BLOCKING = (1 << 3) - Indicate that a blocking call is desired 1765 SWITCH_SPEECH_FLAG_PAUSE = (1 << 4) - Pause toggle for playback 1766 </pre> 1767 */ 1768 typedef enum { 1769 SWITCH_SPEECH_FLAG_NONE = 0, 1770 SWITCH_SPEECH_FLAG_HASTEXT = (1 << 0), 1771 SWITCH_SPEECH_FLAG_PEEK = (1 << 1), 1772 SWITCH_SPEECH_FLAG_FREE_POOL = (1 << 2), 1773 SWITCH_SPEECH_FLAG_BLOCKING = (1 << 3), 1774 SWITCH_SPEECH_FLAG_PAUSE = (1 << 4), 1775 SWITCH_SPEECH_FLAG_OPEN = (1 << 5), 1776 SWITCH_SPEECH_FLAG_DONE = (1 << 6) 1777 } switch_speech_flag_enum_t; 1778 typedef uint32_t switch_speech_flag_t; 1779 1780 /*! 1781 \enum switch_asr_flag_t 1782 \brief Asr related flags 1783 <pre> 1784 SWITCH_ASR_FLAG_DATA = (1 << 0) - Interface has data 1785 SWITCH_ASR_FLAG_FREE_POOL = (1 << 1) - Pool needs to be freed 1786 SWITCH_ASR_FLAG_CLOSED = (1 << 2) - Interface has been closed 1787 SWITCH_ASR_FLAG_FIRE_EVENTS = (1 << 3) - Fire all speech events 1788 SWITCH_ASR_FLAG_AUTO_RESUME = (1 << 4) - Auto Resume 1789 </pre> 1790 */ 1791 typedef enum { 1792 SWITCH_ASR_FLAG_NONE = 0, 1793 SWITCH_ASR_FLAG_DATA = (1 << 0), 1794 SWITCH_ASR_FLAG_FREE_POOL = (1 << 1), 1795 SWITCH_ASR_FLAG_CLOSED = (1 << 2), 1796 SWITCH_ASR_FLAG_FIRE_EVENTS = (1 << 3), 1797 SWITCH_ASR_FLAG_AUTO_RESUME = (1 << 4) 1798 1799 } switch_asr_flag_enum_t; 1800 typedef uint32_t switch_asr_flag_t; 1801 1802 /*! 1803 \enum switch_directory_flag_t 1804 \brief Directory Handle related flags 1805 <pre> 1806 SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0) - Free interface's pool on destruction. 1807 </pre> 1808 */ 1809 typedef enum { 1810 SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0) 1811 1812 } switch_directory_flag_enum_t; 1813 typedef uint32_t switch_directory_flag_t; 1814 1815 /*! 1816 \enum switch_codec_type_t 1817 \brief Codec types 1818 <pre> 1819 SWITCH_CODEC_TYPE_AUDIO - Audio Codec 1820 SWITCH_CODEC_TYPE_VIDEO - Video Codec 1821 SWITCH_CODEC_TYPE_T38 - T38 Codec 1822 SWITCH_CODEC_TYPE_APP - Application Codec 1823 </pre> 1824 */ 1825 typedef enum { 1826 SWITCH_CODEC_TYPE_AUDIO, 1827 SWITCH_CODEC_TYPE_VIDEO, 1828 SWITCH_CODEC_TYPE_T38, 1829 SWITCH_CODEC_TYPE_APP 1830 } switch_codec_type_t; 1831 1832 typedef enum { 1833 SWITCH_MEDIA_TYPE_AUDIO, 1834 SWITCH_MEDIA_TYPE_VIDEO, 1835 SWITCH_MEDIA_TYPE_TEXT 1836 } switch_media_type_t; 1837 #define SWITCH_MEDIA_TYPE_TOTAL 3 1838 1839 1840 /*! 1841 \enum switch_timer_flag_t 1842 \brief Timer related flags 1843 <pre> 1844 SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0) - Free timer's pool on destruction 1845 </pre> 1846 */ 1847 typedef enum { 1848 SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0) 1849 } switch_timer_flag_enum_t; 1850 typedef uint32_t switch_timer_flag_t; 1851 1852 1853 /*! 1854 \enum switch_timer_flag_t 1855 \brief Timer related flags 1856 <pre> 1857 SMBF_READ_STREAM - Include the Read Stream 1858 SMBF_WRITE_STREAM - Include the Write Stream 1859 SMBF_WRITE_REPLACE - Replace the Write Stream 1860 SMBF_READ_REPLACE - Replace the Read Stream 1861 SMBF_STEREO - Record in stereo 1862 SMBF_ANSWER_REQ - Don't record until the channel is answered 1863 SMBF_BRIDGE_REQ - Don't record until the channel is bridged 1864 SMBF_THREAD_LOCK - Only let the same thread who created the bug remove it. 1865 SMBF_PRUNE - 1866 SMBF_NO_PAUSE - 1867 SMBF_STEREO_SWAP - Record in stereo: Write Stream - left channel, Read Stream - right channel 1868 </pre> 1869 */ 1870 typedef enum { 1871 SMBF_BOTH = 0, 1872 SMBF_READ_STREAM = (1 << 0), 1873 SMBF_WRITE_STREAM = (1 << 1), 1874 SMBF_WRITE_REPLACE = (1 << 2), 1875 SMBF_READ_REPLACE = (1 << 3), 1876 SMBF_READ_PING = (1 << 4), 1877 SMBF_STEREO = (1 << 5), 1878 SMBF_ANSWER_REQ = (1 << 6), 1879 SMBF_BRIDGE_REQ = (1 << 7), 1880 SMBF_THREAD_LOCK = (1 << 8), 1881 SMBF_PRUNE = (1 << 9), 1882 SMBF_NO_PAUSE = (1 << 10), 1883 SMBF_STEREO_SWAP = (1 << 11), 1884 SMBF_LOCK = (1 << 12), 1885 SMBF_TAP_NATIVE_READ = (1 << 13), 1886 SMBF_TAP_NATIVE_WRITE = (1 << 14), 1887 SMBF_ONE_ONLY = (1 << 15), 1888 SMBF_MASK = (1 << 16), 1889 SMBF_READ_VIDEO_PING = (1 << 17), 1890 SMBF_WRITE_VIDEO_PING = (1 << 18), 1891 SMBF_READ_VIDEO_STREAM = (1 << 19), 1892 SMBF_WRITE_VIDEO_STREAM = (1 << 20), 1893 SMBF_VIDEO_PATCH = (1 << 21), 1894 SMBF_SPY_VIDEO_STREAM = (1 << 22), 1895 SMBF_SPY_VIDEO_STREAM_BLEG = (1 << 23), 1896 SMBF_READ_VIDEO_PATCH = (1 << 24), 1897 SMBF_READ_TEXT_STREAM = (1 << 25), 1898 SMBF_FIRST = (1 << 26) 1899 } switch_media_bug_flag_enum_t; 1900 typedef uint32_t switch_media_bug_flag_t; 1901 1902 /*! 1903 \enum switch_file_flag_t 1904 \brief File flags 1905 <pre> 1906 SWITCH_FILE_FLAG_READ = (1 << 0) - Open for read 1907 SWITCH_FILE_FLAG_WRITE = (1 << 1) - Open for write 1908 SWITCH_FILE_FLAG_FREE_POOL = (1 << 2) - Free file handle's pool on destruction 1909 SWITCH_FILE_DATA_SHORT = (1 << 3) - Read data in shorts 1910 SWITCH_FILE_DATA_INT = (1 << 4) - Read data in ints 1911 SWITCH_FILE_DATA_FLOAT = (1 << 5) - Read data in floats 1912 SWITCH_FILE_DATA_DOUBLE = (1 << 6) - Read data in doubles 1913 SWITCH_FILE_DATA_RAW = (1 << 7) - Read data as is 1914 SWITCH_FILE_PAUSE = (1 << 8) - Pause 1915 SWITCH_FILE_NATIVE = (1 << 9) - File is in native format (no transcoding) 1916 SWITCH_FILE_SEEK = (1 << 10) - File has done a seek 1917 SWITCH_FILE_OPEN = (1 << 11) - File is open 1918 </pre> 1919 */ 1920 typedef enum { 1921 SWITCH_FILE_FLAG_READ = (1 << 0), 1922 SWITCH_FILE_FLAG_WRITE = (1 << 1), 1923 SWITCH_FILE_FLAG_FREE_POOL = (1 << 2), 1924 SWITCH_FILE_DATA_SHORT = (1 << 3), 1925 SWITCH_FILE_DATA_INT = (1 << 4), 1926 SWITCH_FILE_DATA_FLOAT = (1 << 5), 1927 SWITCH_FILE_DATA_DOUBLE = (1 << 6), 1928 SWITCH_FILE_DATA_RAW = (1 << 7), 1929 SWITCH_FILE_PAUSE = (1 << 8), 1930 SWITCH_FILE_NATIVE = (1 << 9), 1931 SWITCH_FILE_SEEK = (1 << 10), 1932 SWITCH_FILE_OPEN = (1 << 11), 1933 SWITCH_FILE_CALLBACK = (1 << 12), 1934 SWITCH_FILE_DONE = (1 << 13), 1935 SWITCH_FILE_BUFFER_DONE = (1 << 14), 1936 SWITCH_FILE_WRITE_APPEND = (1 << 15), 1937 SWITCH_FILE_WRITE_OVER = (1 << 16), 1938 SWITCH_FILE_NOMUX = (1 << 17), 1939 SWITCH_FILE_BREAK_ON_CHANGE = (1 << 18), 1940 SWITCH_FILE_FLAG_VIDEO = (1 << 19), 1941 SWITCH_FILE_FLAG_VIDEO_EOF = (1 << 20), 1942 SWITCH_FILE_PRE_CLOSED = (1 << 21) 1943 } switch_file_flag_enum_t; 1944 typedef uint32_t switch_file_flag_t; 1945 1946 typedef enum { 1947 SWITCH_IO_FLAG_NONE = 0, 1948 SWITCH_IO_FLAG_NOBLOCK = (1 << 0), 1949 SWITCH_IO_FLAG_SINGLE_READ = (1 << 1), 1950 SWITCH_IO_FLAG_FORCE = (1 << 2), 1951 SWITCH_IO_FLAG_QUEUED = (1 << 3) 1952 } switch_io_flag_enum_t; 1953 typedef uint32_t switch_io_flag_t; 1954 1955 /* make sure this is synced with the EVENT_NAMES array in switch_event.c 1956 also never put any new ones before EVENT_ALL 1957 */ 1958 /*! 1959 \enum switch_event_types_t 1960 \brief Built-in Events 1961 1962 <pre> 1963 SWITCH_EVENT_CUSTOM - A custom event 1964 SWITCH_EVENT_CLONE - A cloned event 1965 SWITCH_EVENT_CHANNEL_CREATE - A channel has been created 1966 SWITCH_EVENT_CHANNEL_DESTROY - A channel has been destroyed 1967 SWITCH_EVENT_CHANNEL_STATE - A channel has changed state 1968 SWITCH_EVENT_CHANNEL_CALLSTATE - A channel has changed call state 1969 SWITCH_EVENT_CHANNEL_ANSWER - A channel has been answered 1970 SWITCH_EVENT_CHANNEL_HANGUP - A channel has been hungup 1971 SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE - A channel has completed the hangup 1972 SWITCH_EVENT_CHANNEL_EXECUTE - A channel has executed a module's application 1973 SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE - A channel has finshed executing a module's application 1974 SWITCH_EVENT_CHANNEL_HOLD - A channel has been put on hold 1975 SWITCH_EVENT_CHANNEL_UNHOLD - A channel has been unheld 1976 SWITCH_EVENT_CHANNEL_BRIDGE - A channel has bridged to another channel 1977 SWITCH_EVENT_CHANNEL_UNBRIDGE - A channel has unbridged from another channel 1978 SWITCH_EVENT_CHANNEL_PROGRESS - A channel has started ringing 1979 SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA - A channel has started early media 1980 SWITCH_EVENT_CHANNEL_OUTGOING - A channel has been unparked 1981 SWITCH_EVENT_CHANNEL_PARK - A channel has been parked 1982 SWITCH_EVENT_CHANNEL_UNPARK - A channel has been unparked 1983 SWITCH_EVENT_CHANNEL_APPLICATION- A channel has called and event from an application 1984 SWITCH_EVENT_CHANNEL_ORIGINATE - A channel has been originated 1985 SWITCH_EVENT_CHANNEL_UUID - A channel has changed uuid 1986 SWITCH_EVENT_API - An API call has been executed 1987 SWITCH_EVENT_LOG - A LOG event has been triggered 1988 SWITCH_EVENT_INBOUND_CHAN - A new inbound channel has been created 1989 SWITCH_EVENT_OUTBOUND_CHAN - A new outbound channel has been created 1990 SWITCH_EVENT_STARTUP - The system has been started 1991 SWITCH_EVENT_SHUTDOWN - The system has been shutdown 1992 SWITCH_EVENT_PUBLISH - Publish 1993 SWITCH_EVENT_UNPUBLISH - UnPublish 1994 SWITCH_EVENT_TALK - Talking Detected 1995 SWITCH_EVENT_NOTALK - Not Talking Detected 1996 SWITCH_EVENT_SESSION_CRASH - Session Crashed 1997 SWITCH_EVENT_MODULE_LOAD - Module was loaded 1998 SWITCH_EVENT_MODULE_UNLOAD - Module was unloaded 1999 SWITCH_EVENT_DTMF - DTMF was sent 2000 SWITCH_EVENT_MESSAGE - A Basic Message 2001 SWITCH_EVENT_PRESENCE_IN - Presence in 2002 SWITCH_EVENT_NOTIFY_IN - Received incoming NOTIFY from gateway subscription 2003 SWITCH_EVENT_PRESENCE_OUT - Presence out 2004 SWITCH_EVENT_PRESENCE_PROBE - Presence probe 2005 SWITCH_EVENT_MESSAGE_WAITING - A message is waiting 2006 SWITCH_EVENT_MESSAGE_QUERY - A query for MESSAGE_WAITING events 2007 SWITCH_EVENT_ROSTER - ? 2008 SWITCH_EVENT_CODEC - Codec Change 2009 SWITCH_EVENT_BACKGROUND_JOB - Background Job 2010 SWITCH_EVENT_DETECTED_SPEECH - Detected Speech 2011 SWITCH_EVENT_DETECTED_TONE - Detected Tone 2012 SWITCH_EVENT_PRIVATE_COMMAND - A private command event 2013 SWITCH_EVENT_HEARTBEAT - Machine is alive 2014 SWITCH_EVENT_TRAP - Error Trap 2015 SWITCH_EVENT_ADD_SCHEDULE - Something has been scheduled 2016 SWITCH_EVENT_DEL_SCHEDULE - Something has been unscheduled 2017 SWITCH_EVENT_EXE_SCHEDULE - Something scheduled has been executed 2018 SWITCH_EVENT_RE_SCHEDULE - Something scheduled has been rescheduled 2019 SWITCH_EVENT_RELOADXML - XML registry has been reloaded 2020 SWITCH_EVENT_NOTIFY - Notification 2021 SWITCH_EVENT_PHONE_FEATURE - Notification (DND/CFWD/etc) 2022 SWITCH_EVENT_PHONE_FEATURE_SUBSCRIBE - Phone feature subscription 2023 SWITCH_EVENT_SEND_MESSAGE - Message 2024 SWITCH_EVENT_RECV_MESSAGE - Message 2025 SWITCH_EVENT_REQUEST_PARAMS 2026 SWITCH_EVENT_CHANNEL_DATA 2027 SWITCH_EVENT_GENERAL 2028 SWITCH_EVENT_COMMAND 2029 SWITCH_EVENT_SESSION_HEARTBEAT 2030 SWITCH_EVENT_CLIENT_DISCONNECTED 2031 SWITCH_EVENT_SERVER_DISCONNECTED 2032 SWITCH_EVENT_SEND_INFO 2033 SWITCH_EVENT_RECV_INFO 2034 SWITCH_EVENT_RECV_RTCP_MESSAGE 2035 SWITCH_EVENT_CALL_SECURE 2036 SWITCH_EVENT_NAT - NAT Management (new/del/status) 2037 SWITCH_EVENT_RECORD_START 2038 SWITCH_EVENT_RECORD_STOP 2039 SWITCH_EVENT_PLAYBACK_START 2040 SWITCH_EVENT_PLAYBACK_STOP 2041 SWITCH_EVENT_CALL_UPDATE 2042 SWITCH_EVENT_FAILURE - A failure occurred which might impact the normal functioning of the switch 2043 SWITCH_EVENT_SOCKET_DATA 2044 SWITCH_EVENT_MEDIA_BUG_START 2045 SWITCH_EVENT_MEDIA_BUG_STOP 2046 SWITCH_EVENT_CONFERENCE_DATA_QUERY 2047 SWITCH_EVENT_CONFERENCE_DATA 2048 SWITCH_EVENT_CALL_SETUP_REQ 2049 SWITCH_EVENT_CALL_SETUP_RESULT 2050 SWITCH_EVENT_CALL_DETAIL 2051 SWITCH_EVENT_DEVICE_STATE 2052 SWITCH_EVENT_SHUTDOWN_REQUESTED - Shutdown of the system has been requested 2053 SWITCH_EVENT_ALL - All events at once 2054 </pre> 2055 2056 */ 2057 typedef enum { 2058 SWITCH_EVENT_CUSTOM, 2059 SWITCH_EVENT_CLONE, 2060 SWITCH_EVENT_CHANNEL_CREATE, 2061 SWITCH_EVENT_CHANNEL_DESTROY, 2062 SWITCH_EVENT_CHANNEL_STATE, 2063 SWITCH_EVENT_CHANNEL_CALLSTATE, 2064 SWITCH_EVENT_CHANNEL_ANSWER, 2065 SWITCH_EVENT_CHANNEL_HANGUP, 2066 SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE, 2067 SWITCH_EVENT_CHANNEL_EXECUTE, 2068 SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE, 2069 SWITCH_EVENT_CHANNEL_HOLD, 2070 SWITCH_EVENT_CHANNEL_UNHOLD, 2071 SWITCH_EVENT_CHANNEL_BRIDGE, 2072 SWITCH_EVENT_CHANNEL_UNBRIDGE, 2073 SWITCH_EVENT_CHANNEL_PROGRESS, 2074 SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA, 2075 SWITCH_EVENT_CHANNEL_OUTGOING, 2076 SWITCH_EVENT_CHANNEL_PARK, 2077 SWITCH_EVENT_CHANNEL_UNPARK, 2078 SWITCH_EVENT_CHANNEL_APPLICATION, 2079 SWITCH_EVENT_CHANNEL_ORIGINATE, 2080 SWITCH_EVENT_CHANNEL_UUID, 2081 SWITCH_EVENT_API, 2082 SWITCH_EVENT_LOG, 2083 SWITCH_EVENT_INBOUND_CHAN, 2084 SWITCH_EVENT_OUTBOUND_CHAN, 2085 SWITCH_EVENT_STARTUP, 2086 SWITCH_EVENT_SHUTDOWN, 2087 SWITCH_EVENT_PUBLISH, 2088 SWITCH_EVENT_UNPUBLISH, 2089 SWITCH_EVENT_TALK, 2090 SWITCH_EVENT_NOTALK, 2091 SWITCH_EVENT_SESSION_CRASH, 2092 SWITCH_EVENT_MODULE_LOAD, 2093 SWITCH_EVENT_MODULE_UNLOAD, 2094 SWITCH_EVENT_DTMF, 2095 SWITCH_EVENT_MESSAGE, 2096 SWITCH_EVENT_PRESENCE_IN, 2097 SWITCH_EVENT_NOTIFY_IN, 2098 SWITCH_EVENT_PRESENCE_OUT, 2099 SWITCH_EVENT_PRESENCE_PROBE, 2100 SWITCH_EVENT_MESSAGE_WAITING, 2101 SWITCH_EVENT_MESSAGE_QUERY, 2102 SWITCH_EVENT_ROSTER, 2103 SWITCH_EVENT_CODEC, 2104 SWITCH_EVENT_BACKGROUND_JOB, 2105 SWITCH_EVENT_DETECTED_SPEECH, 2106 SWITCH_EVENT_DETECTED_TONE, 2107 SWITCH_EVENT_PRIVATE_COMMAND, 2108 SWITCH_EVENT_HEARTBEAT, 2109 SWITCH_EVENT_TRAP, 2110 SWITCH_EVENT_ADD_SCHEDULE, 2111 SWITCH_EVENT_DEL_SCHEDULE, 2112 SWITCH_EVENT_EXE_SCHEDULE, 2113 SWITCH_EVENT_RE_SCHEDULE, 2114 SWITCH_EVENT_RELOADXML, 2115 SWITCH_EVENT_NOTIFY, 2116 SWITCH_EVENT_PHONE_FEATURE, 2117 SWITCH_EVENT_PHONE_FEATURE_SUBSCRIBE, 2118 SWITCH_EVENT_SEND_MESSAGE, 2119 SWITCH_EVENT_RECV_MESSAGE, 2120 SWITCH_EVENT_REQUEST_PARAMS, 2121 SWITCH_EVENT_CHANNEL_DATA, 2122 SWITCH_EVENT_GENERAL, 2123 SWITCH_EVENT_COMMAND, 2124 SWITCH_EVENT_SESSION_HEARTBEAT, 2125 SWITCH_EVENT_CLIENT_DISCONNECTED, 2126 SWITCH_EVENT_SERVER_DISCONNECTED, 2127 SWITCH_EVENT_SEND_INFO, 2128 SWITCH_EVENT_RECV_INFO, 2129 SWITCH_EVENT_RECV_RTCP_MESSAGE, 2130 SWITCH_EVENT_CALL_SECURE, 2131 SWITCH_EVENT_NAT, 2132 SWITCH_EVENT_RECORD_START, 2133 SWITCH_EVENT_RECORD_STOP, 2134 SWITCH_EVENT_PLAYBACK_START, 2135 SWITCH_EVENT_PLAYBACK_STOP, 2136 SWITCH_EVENT_CALL_UPDATE, 2137 SWITCH_EVENT_FAILURE, 2138 SWITCH_EVENT_SOCKET_DATA, 2139 SWITCH_EVENT_MEDIA_BUG_START, 2140 SWITCH_EVENT_MEDIA_BUG_STOP, 2141 SWITCH_EVENT_CONFERENCE_DATA_QUERY, 2142 SWITCH_EVENT_CONFERENCE_DATA, 2143 SWITCH_EVENT_CALL_SETUP_REQ, 2144 SWITCH_EVENT_CALL_SETUP_RESULT, 2145 SWITCH_EVENT_CALL_DETAIL, 2146 SWITCH_EVENT_DEVICE_STATE, 2147 SWITCH_EVENT_TEXT, 2148 SWITCH_EVENT_SHUTDOWN_REQUESTED, 2149 SWITCH_EVENT_ALL 2150 } switch_event_types_t; 2151 2152 typedef enum { 2153 SWITCH_INPUT_TYPE_DTMF, 2154 SWITCH_INPUT_TYPE_EVENT 2155 } switch_input_type_t; 2156 2157 typedef enum { 2158 SWITCH_CAUSE_NONE = 0, 2159 SWITCH_CAUSE_UNALLOCATED_NUMBER = 1, 2160 SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET = 2, 2161 SWITCH_CAUSE_NO_ROUTE_DESTINATION = 3, 2162 SWITCH_CAUSE_CHANNEL_UNACCEPTABLE = 6, 2163 SWITCH_CAUSE_CALL_AWARDED_DELIVERED = 7, 2164 SWITCH_CAUSE_NORMAL_CLEARING = 16, 2165 SWITCH_CAUSE_USER_BUSY = 17, 2166 SWITCH_CAUSE_NO_USER_RESPONSE = 18, 2167 SWITCH_CAUSE_NO_ANSWER = 19, 2168 SWITCH_CAUSE_SUBSCRIBER_ABSENT = 20, 2169 SWITCH_CAUSE_CALL_REJECTED = 21, 2170 SWITCH_CAUSE_NUMBER_CHANGED = 22, 2171 SWITCH_CAUSE_REDIRECTION_TO_NEW_DESTINATION = 23, 2172 SWITCH_CAUSE_EXCHANGE_ROUTING_ERROR = 25, 2173 SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER = 27, 2174 SWITCH_CAUSE_INVALID_NUMBER_FORMAT = 28, 2175 SWITCH_CAUSE_FACILITY_REJECTED = 29, 2176 SWITCH_CAUSE_RESPONSE_TO_STATUS_ENQUIRY = 30, 2177 SWITCH_CAUSE_NORMAL_UNSPECIFIED = 31, 2178 SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION = 34, 2179 SWITCH_CAUSE_NETWORK_OUT_OF_ORDER = 38, 2180 SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE = 41, 2181 SWITCH_CAUSE_SWITCH_CONGESTION = 42, 2182 SWITCH_CAUSE_ACCESS_INFO_DISCARDED = 43, 2183 SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL = 44, 2184 SWITCH_CAUSE_PRE_EMPTED = 45, 2185 SWITCH_CAUSE_FACILITY_NOT_SUBSCRIBED = 50, 2186 SWITCH_CAUSE_OUTGOING_CALL_BARRED = 52, 2187 SWITCH_CAUSE_INCOMING_CALL_BARRED = 54, 2188 SWITCH_CAUSE_BEARERCAPABILITY_NOTAUTH = 57, 2189 SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL = 58, 2190 SWITCH_CAUSE_SERVICE_UNAVAILABLE = 63, 2191 SWITCH_CAUSE_BEARERCAPABILITY_NOTIMPL = 65, 2192 SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED = 66, 2193 SWITCH_CAUSE_FACILITY_NOT_IMPLEMENTED = 69, 2194 SWITCH_CAUSE_SERVICE_NOT_IMPLEMENTED = 79, 2195 SWITCH_CAUSE_INVALID_CALL_REFERENCE = 81, 2196 SWITCH_CAUSE_INCOMPATIBLE_DESTINATION = 88, 2197 SWITCH_CAUSE_INVALID_MSG_UNSPECIFIED = 95, 2198 SWITCH_CAUSE_MANDATORY_IE_MISSING = 96, 2199 SWITCH_CAUSE_MESSAGE_TYPE_NONEXIST = 97, 2200 SWITCH_CAUSE_WRONG_MESSAGE = 98, 2201 SWITCH_CAUSE_IE_NONEXIST = 99, 2202 SWITCH_CAUSE_INVALID_IE_CONTENTS = 100, 2203 SWITCH_CAUSE_WRONG_CALL_STATE = 101, 2204 SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE = 102, 2205 SWITCH_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103, 2206 SWITCH_CAUSE_PROTOCOL_ERROR = 111, 2207 SWITCH_CAUSE_INTERWORKING = 127, 2208 SWITCH_CAUSE_SUCCESS = 142, 2209 SWITCH_CAUSE_ORIGINATOR_CANCEL = 487, 2210 SWITCH_CAUSE_CRASH = 500, 2211 SWITCH_CAUSE_SYSTEM_SHUTDOWN = 501, 2212 SWITCH_CAUSE_LOSE_RACE = 502, 2213 SWITCH_CAUSE_MANAGER_REQUEST = 503, 2214 SWITCH_CAUSE_BLIND_TRANSFER = 600, 2215 SWITCH_CAUSE_ATTENDED_TRANSFER = 601, 2216 SWITCH_CAUSE_ALLOTTED_TIMEOUT = 602, 2217 SWITCH_CAUSE_USER_CHALLENGE = 603, 2218 SWITCH_CAUSE_MEDIA_TIMEOUT = 604, 2219 SWITCH_CAUSE_PICKED_OFF = 605, 2220 SWITCH_CAUSE_USER_NOT_REGISTERED = 606, 2221 SWITCH_CAUSE_PROGRESS_TIMEOUT = 607, 2222 SWITCH_CAUSE_INVALID_GATEWAY = 608, 2223 SWITCH_CAUSE_GATEWAY_DOWN = 609, 2224 SWITCH_CAUSE_INVALID_URL = 610, 2225 SWITCH_CAUSE_INVALID_PROFILE = 611, 2226 SWITCH_CAUSE_NO_PICKUP = 612, 2227 SWITCH_CAUSE_SRTP_READ_ERROR = 613, 2228 SWITCH_CAUSE_BOWOUT = 614, 2229 SWITCH_CAUSE_BUSY_EVERYWHERE = 615, 2230 SWITCH_CAUSE_DECLINE = 616, 2231 SWITCH_CAUSE_DOES_NOT_EXIST_ANYWHERE = 617, 2232 SWITCH_CAUSE_NOT_ACCEPTABLE = 618, 2233 SWITCH_CAUSE_UNWANTED = 619 2234 } switch_call_cause_t; 2235 2236 typedef enum { 2237 SCSC_PAUSE_INBOUND, 2238 SCSC_PAUSE_OUTBOUND, 2239 SCSC_PAUSE_ALL, 2240 SCSC_HUPALL, 2241 SCSC_SHUTDOWN, 2242 SCSC_CHECK_RUNNING, 2243 SCSC_LOGLEVEL, 2244 SCSC_SPS, 2245 SCSC_LAST_SPS, 2246 SCSC_RECLAIM, 2247 SCSC_MAX_SESSIONS, 2248 SCSC_SYNC_CLOCK, 2249 SCSC_MAX_DTMF_DURATION, 2250 SCSC_MIN_DTMF_DURATION, 2251 SCSC_DEFAULT_DTMF_DURATION, 2252 SCSC_SHUTDOWN_ELEGANT, 2253 SCSC_SHUTDOWN_ASAP, 2254 SCSC_CANCEL_SHUTDOWN, 2255 SCSC_SEND_SIGHUP, 2256 SCSC_DEBUG_LEVEL, 2257 SCSC_FLUSH_DB_HANDLES, 2258 SCSC_SHUTDOWN_NOW, 2259 SCSC_REINCARNATE_NOW, 2260 SCSC_CALIBRATE_CLOCK, 2261 SCSC_SAVE_HISTORY, 2262 SCSC_CRASH, 2263 SCSC_MIN_IDLE_CPU, 2264 SCSC_VERBOSE_EVENTS, 2265 SCSC_SHUTDOWN_CHECK, 2266 SCSC_PAUSE_INBOUND_CHECK, 2267 SCSC_PAUSE_OUTBOUND_CHECK, 2268 SCSC_PAUSE_CHECK, 2269 SCSC_READY_CHECK, 2270 SCSC_THREADED_SYSTEM_EXEC, 2271 SCSC_SYNC_CLOCK_WHEN_IDLE, 2272 SCSC_DEBUG_SQL, 2273 SCSC_SQL, 2274 SCSC_API_EXPANSION, 2275 SCSC_RECOVER, 2276 SCSC_SPS_PEAK, 2277 SCSC_SPS_PEAK_FIVEMIN, 2278 SCSC_SESSIONS_PEAK, 2279 SCSC_SESSIONS_PEAK_FIVEMIN 2280 } switch_session_ctl_t; 2281 2282 typedef enum { 2283 SSH_FLAG_STICKY = (1 << 0), 2284 SSH_FLAG_PRE_EXEC = (1 << 1) 2285 } switch_state_handler_flag_t; 2286 2287 #ifdef WIN32 2288 typedef SOCKET switch_os_socket_t; 2289 #define SWITCH_SOCK_INVALID INVALID_SOCKET 2290 #else 2291 typedef int switch_os_socket_t; 2292 #define SWITCH_SOCK_INVALID -1 2293 #endif 2294 2295 typedef struct apr_pool_t switch_memory_pool_t; 2296 typedef uint16_t switch_port_t; 2297 typedef uint8_t switch_payload_t; 2298 typedef struct switch_app_log switch_app_log_t; 2299 typedef struct switch_rtp switch_rtp_t; 2300 typedef struct switch_rtcp switch_rtcp_t; 2301 typedef struct switch_core_session_message switch_core_session_message_t; 2302 typedef struct switch_event_header switch_event_header_t; 2303 typedef struct switch_event switch_event_t; 2304 typedef struct switch_event_subclass switch_event_subclass_t; 2305 typedef struct switch_event_node switch_event_node_t; 2306 typedef struct switch_loadable_module switch_loadable_module_t; 2307 typedef struct switch_frame switch_frame_t; 2308 typedef struct switch_rtcp_frame switch_rtcp_frame_t; 2309 typedef struct switch_channel switch_channel_t; 2310 typedef struct switch_sql_queue_manager switch_sql_queue_manager_t; 2311 typedef struct switch_file_handle switch_file_handle_t; 2312 typedef struct switch_core_session switch_core_session_t; 2313 typedef struct switch_caller_profile switch_caller_profile_t; 2314 typedef struct switch_caller_extension switch_caller_extension_t; 2315 typedef struct switch_caller_application switch_caller_application_t; 2316 typedef struct switch_state_handler_table switch_state_handler_table_t; 2317 typedef struct switch_timer switch_timer_t; 2318 typedef struct switch_codec switch_codec_t; 2319 typedef struct switch_core_thread_session switch_core_thread_session_t; 2320 typedef struct switch_codec_implementation switch_codec_implementation_t; 2321 typedef struct switch_buffer switch_buffer_t; 2322 typedef union switch_codec_settings switch_codec_settings_t; 2323 typedef struct switch_codec_fmtp switch_codec_fmtp_t; 2324 typedef struct switch_coredb_handle switch_coredb_handle_t; 2325 typedef struct switch_odbc_handle switch_odbc_handle_t; 2326 typedef struct switch_database_interface_handle switch_database_interface_handle_t; 2327 2328 typedef struct switch_io_routines switch_io_routines_t; 2329 typedef struct switch_speech_handle switch_speech_handle_t; 2330 typedef struct switch_asr_handle switch_asr_handle_t; 2331 typedef struct switch_directory_handle switch_directory_handle_t; 2332 typedef struct switch_loadable_module_interface switch_loadable_module_interface_t; 2333 typedef struct switch_endpoint_interface switch_endpoint_interface_t; 2334 typedef struct switch_timer_interface switch_timer_interface_t; 2335 typedef struct switch_dialplan_interface switch_dialplan_interface_t; 2336 typedef struct switch_codec_interface switch_codec_interface_t; 2337 typedef struct switch_application_interface switch_application_interface_t; 2338 typedef struct switch_chat_application_interface switch_chat_application_interface_t; 2339 typedef struct switch_api_interface switch_api_interface_t; 2340 typedef struct switch_json_api_interface switch_json_api_interface_t; 2341 typedef struct switch_file_interface switch_file_interface_t; 2342 typedef struct switch_speech_interface switch_speech_interface_t; 2343 typedef struct switch_asr_interface switch_asr_interface_t; 2344 typedef struct switch_directory_interface switch_directory_interface_t; 2345 typedef struct switch_chat_interface switch_chat_interface_t; 2346 typedef struct switch_management_interface switch_management_interface_t; 2347 typedef struct switch_core_port_allocator switch_core_port_allocator_t; 2348 typedef struct switch_media_bug switch_media_bug_t; 2349 typedef struct switch_limit_interface switch_limit_interface_t; 2350 typedef struct switch_database_interface switch_database_interface_t; 2351 2352 typedef void (*hashtable_destructor_t)(void *ptr); 2353 2354 struct switch_console_callback_match_node { 2355 char *val; 2356 struct switch_console_callback_match_node *next; 2357 }; 2358 typedef struct switch_console_callback_match_node switch_console_callback_match_node_t; 2359 2360 struct switch_console_callback_match { 2361 struct switch_console_callback_match_node *head; 2362 struct switch_console_callback_match_node *end; 2363 int count; 2364 int dynamic; 2365 }; 2366 typedef struct switch_console_callback_match switch_console_callback_match_t; 2367 2368 typedef void (*switch_media_bug_exec_cb_t)(switch_media_bug_t *bug, void *user_data); 2369 2370 typedef switch_status_t (*switch_core_video_thread_callback_func_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data); 2371 typedef switch_status_t (*switch_core_text_thread_callback_func_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data); 2372 typedef void (*switch_cap_callback_t) (const char *var, const char *val, void *user_data); 2373 typedef switch_status_t (*switch_console_complete_callback_t) (const char *, const char *, switch_console_callback_match_t **matches); 2374 typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t); 2375 typedef switch_bool_t (*switch_tone_detect_callback_t) (switch_core_session_t *, const char *, const char *); 2376 typedef struct switch_xml_binding switch_xml_binding_t; 2377 2378 typedef void (*switch_engine_function_t) (switch_core_session_t *session, void *user_data); 2379 2380 2381 typedef switch_status_t (*switch_core_codec_encode_func_t) (switch_codec_t *codec, 2382 switch_codec_t *other_codec, 2383 void *decoded_data, 2384 uint32_t decoded_data_len, 2385 uint32_t decoded_rate, 2386 void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag); 2387 2388 2389 typedef switch_status_t (*switch_core_codec_decode_func_t) (switch_codec_t *codec, 2390 switch_codec_t *other_codec, 2391 void *encoded_data, 2392 uint32_t encoded_data_len, 2393 uint32_t encoded_rate, 2394 void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag); 2395 2396 typedef switch_status_t (*switch_core_codec_video_encode_func_t) (switch_codec_t *codec, switch_frame_t *frame); 2397 2398 typedef switch_status_t (*switch_core_codec_video_decode_func_t) (switch_codec_t *codec, switch_frame_t *frame); 2399 2400 typedef enum { 2401 SCC_VIDEO_GEN_KEYFRAME = 0, 2402 SCC_VIDEO_BANDWIDTH, 2403 SCC_VIDEO_RESET, 2404 SCC_AUDIO_PACKET_LOSS, 2405 SCC_AUDIO_ADJUST_BITRATE, 2406 SCC_DEBUG, 2407 SCC_CODEC_SPECIFIC 2408 } switch_codec_control_command_t; 2409 2410 typedef enum { 2411 SCCT_NONE = 0, 2412 SCCT_STRING, 2413 SCCT_INT, 2414 } switch_codec_control_type_t; 2415 2416 typedef enum { 2417 SWITCH_IO_READ, 2418 SWITCH_IO_WRITE 2419 } switch_io_type_t; 2420 2421 typedef switch_status_t (*switch_core_codec_control_func_t) (switch_codec_t *codec, 2422 switch_codec_control_command_t cmd, 2423 switch_codec_control_type_t ctype, 2424 void *cmd_data, 2425 switch_codec_control_type_t atype, 2426 void *cmd_arg, 2427 switch_codec_control_type_t *rtype, 2428 void **ret_data); 2429 2430 2431 typedef switch_status_t (*switch_core_codec_init_func_t) (switch_codec_t *, switch_codec_flag_t, const switch_codec_settings_t *codec_settings); 2432 typedef switch_status_t (*switch_core_codec_fmtp_parse_func_t) (const char *fmtp, switch_codec_fmtp_t *codec_fmtp); 2433 typedef switch_status_t (*switch_core_codec_destroy_func_t) (switch_codec_t *); 2434 2435 2436 typedef switch_status_t (*switch_chat_application_function_t) (switch_event_t *, const char *); 2437 #define SWITCH_STANDARD_CHAT_APP(name) static switch_status_t name (switch_event_t *message, const char *data) 2438 2439 typedef void (*switch_application_function_t) (switch_core_session_t *, const char *); 2440 #define SWITCH_STANDARD_APP(name) static void name (switch_core_session_t *session, const char *data) 2441 2442 typedef int (*switch_core_recover_callback_t)(switch_core_session_t *session); 2443 typedef void (*switch_event_callback_t) (switch_event_t *); 2444 typedef switch_caller_extension_t *(*switch_dialplan_hunt_function_t) (switch_core_session_t *, void *, switch_caller_profile_t *); 2445 #define SWITCH_STANDARD_DIALPLAN(name) static switch_caller_extension_t *name (switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile) 2446 2447 typedef switch_bool_t (*switch_hash_delete_callback_t) (_In_ const void *key, _In_ const void *val, _In_opt_ void *pData); 2448 #define SWITCH_HASH_DELETE_FUNC(name) static switch_bool_t name (const void *key, const void *val, void *pData) 2449 2450 typedef struct switch_scheduler_task switch_scheduler_task_t; 2451 2452 typedef void (*switch_scheduler_func_t) (switch_scheduler_task_t *task); 2453 2454 #define SWITCH_STANDARD_SCHED_FUNC(name) static void name (switch_scheduler_task_t *task) 2455 2456 typedef switch_status_t (*switch_state_handler_t) (switch_core_session_t *); 2457 typedef struct switch_stream_handle switch_stream_handle_t; 2458 typedef uint8_t * (*switch_stream_handle_read_function_t) (switch_stream_handle_t *handle, int *len); 2459 typedef switch_status_t (*switch_stream_handle_write_function_t) (switch_stream_handle_t *handle, const char *fmt, ...); 2460 typedef switch_status_t (*switch_stream_handle_raw_write_function_t) (switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen); 2461 2462 typedef switch_status_t (*switch_api_function_t) (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, 2463 _In_ switch_stream_handle_t *stream); 2464 2465 2466 #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) 2467 2468 2469 typedef switch_status_t (*switch_json_api_function_t) (const cJSON *json, _In_opt_ switch_core_session_t *session, cJSON **json_reply); 2470 2471 2472 #define SWITCH_STANDARD_JSON_API(name) static switch_status_t name (const cJSON *json, _In_opt_ switch_core_session_t *session, cJSON **json_reply) 2473 2474 typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session_t *session, void *input, 2475 switch_input_type_t input_type, void *buf, unsigned int buflen); 2476 typedef switch_status_t (*switch_read_frame_callback_function_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data); 2477 typedef struct switch_say_interface switch_say_interface_t; 2478 2479 #define DMACHINE_MAX_DIGIT_LEN 512 2480 2481 typedef enum { 2482 DM_MATCH_POSITIVE, 2483 DM_MATCH_NEGATIVE 2484 } dm_match_type_t; 2485 2486 struct switch_ivr_dmachine; 2487 typedef struct switch_ivr_dmachine switch_ivr_dmachine_t; 2488 2489 struct switch_ivr_dmachine_match { 2490 switch_ivr_dmachine_t *dmachine; 2491 const char *match_digits; 2492 int32_t match_key; 2493 dm_match_type_t type; 2494 void *user_data; 2495 }; 2496 2497 typedef struct switch_ivr_dmachine_match switch_ivr_dmachine_match_t; 2498 typedef switch_status_t (*switch_ivr_dmachine_callback_t) (switch_ivr_dmachine_match_t *match); 2499 2500 #define MAX_ARG_RECURSION 25 2501 2502 #define arg_recursion_check_start(_args) if (_args) { \ 2503 if (_args->loops >= MAX_ARG_RECURSION) { \ 2504 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, \ 2505 "RECURSION ERROR! It's not the best idea to call things that collect input recursively from an input callback.\n"); \ 2506 return SWITCH_STATUS_GENERR; \ 2507 } else {_args->loops++;} \ 2508 } 2509 2510 2511 #define arg_recursion_check_stop(_args) if (_args) _args->loops-- 2512 2513 typedef struct { 2514 switch_input_callback_function_t input_callback; 2515 void *buf; 2516 uint32_t buflen; 2517 switch_read_frame_callback_function_t read_frame_callback; 2518 void *user_data; 2519 switch_ivr_dmachine_t *dmachine; 2520 int loops; 2521 } switch_input_args_t; 2522 2523 2524 typedef struct { 2525 switch_say_type_t type; 2526 switch_say_method_t method; 2527 switch_say_gender_t gender; 2528 const char *ext; 2529 } switch_say_args_t; 2530 2531 2532 typedef switch_status_t (*switch_say_callback_t) (switch_core_session_t *session, 2533 char *tosay, 2534 switch_say_args_t *say_args, 2535 switch_input_args_t *args); 2536 2537 typedef switch_status_t (*switch_say_string_callback_t) (switch_core_session_t *session, 2538 char *tosay, 2539 switch_say_args_t *say_args, char **rstr); 2540 2541 struct switch_say_file_handle; 2542 typedef struct switch_say_file_handle switch_say_file_handle_t; 2543 2544 typedef switch_status_t (*switch_new_say_callback_t) (switch_say_file_handle_t *sh, 2545 char *tosay, 2546 switch_say_args_t *say_args); 2547 2548 2549 typedef struct switch_xml *switch_xml_t; 2550 typedef struct switch_core_time_duration switch_core_time_duration_t; 2551 typedef switch_xml_t(*switch_xml_open_root_function_t) (uint8_t reload, const char **err, void *user_data); 2552 typedef switch_xml_t(*switch_xml_search_function_t) (const char *section, 2553 const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, 2554 void *user_data); 2555 2556 struct switch_hashtable; 2557 struct switch_hashtable_iterator; 2558 typedef struct switch_hashtable switch_hash_t; 2559 typedef struct switch_hashtable switch_inthash_t; 2560 typedef struct switch_hashtable_iterator switch_hash_index_t; 2561 2562 struct switch_network_list; 2563 typedef struct switch_network_list switch_network_list_t; 2564 2565 2566 #define SWITCH_API_VERSION 5 2567 #define SWITCH_MODULE_LOAD_ARGS (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) 2568 #define SWITCH_MODULE_RUNTIME_ARGS (void) 2569 #define SWITCH_MODULE_SHUTDOWN_ARGS (void) 2570 typedef switch_status_t (*switch_module_load_t) SWITCH_MODULE_LOAD_ARGS; 2571 typedef switch_status_t (*switch_module_runtime_t) SWITCH_MODULE_RUNTIME_ARGS; 2572 typedef switch_status_t (*switch_module_shutdown_t) SWITCH_MODULE_SHUTDOWN_ARGS; 2573 #define SWITCH_MODULE_LOAD_FUNCTION(name) switch_status_t name SWITCH_MODULE_LOAD_ARGS 2574 #define SWITCH_MODULE_RUNTIME_FUNCTION(name) switch_status_t name SWITCH_MODULE_RUNTIME_ARGS 2575 #define SWITCH_MODULE_SHUTDOWN_FUNCTION(name) switch_status_t name SWITCH_MODULE_SHUTDOWN_ARGS 2576 2577 typedef enum { 2578 SWITCH_PRI_LOW = 1, 2579 SWITCH_PRI_NORMAL = 10, 2580 SWITCH_PRI_IMPORTANT = 50, 2581 SWITCH_PRI_REALTIME = 99, 2582 } switch_thread_priority_t; 2583 2584 typedef enum { 2585 SMODF_NONE = 0, 2586 SMODF_GLOBAL_SYMBOLS = (1 << 0) 2587 } switch_module_flag_enum_t; 2588 typedef uint32_t switch_module_flag_t; 2589 2590 typedef struct switch_loadable_module_function_table { 2591 int switch_api_version; 2592 switch_module_load_t load; 2593 switch_module_shutdown_t shutdown; 2594 switch_module_runtime_t runtime; 2595 switch_module_flag_t flags; 2596 } switch_loadable_module_function_table_t; 2597 2598 typedef int (*switch_modulename_callback_func_t) (void *user_data, const char *module_name); 2599 2600 typedef struct switch_slin_data switch_slin_data_t; 2601 2602 #define SWITCH_MODULE_DEFINITION_EX(name, load, shutdown, runtime, flags) \ 2603 static const char modname[] = #name ; \ 2604 SWITCH_MOD_DECLARE_DATA switch_loadable_module_function_table_t name##_module_interface = { \ 2605 SWITCH_API_VERSION, \ 2606 load, \ 2607 shutdown, \ 2608 runtime, \ 2609 flags \ 2610 } 2611 2612 #define SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) \ 2613 SWITCH_MODULE_DEFINITION_EX(name, load, shutdown, runtime, SMODF_NONE) 2614 2615 /* things we don't deserve to know about */ 2616 /*! \brief A channel */ 2617 struct switch_channel; 2618 /*! \brief A core session representing a call and all of it's resources */ 2619 struct switch_core_session; 2620 /*! \brief An audio bug */ 2621 struct switch_media_bug; 2622 /*! \brief A digit stream parser object */ 2623 struct switch_ivr_digit_stream_parser; 2624 struct sql_queue_manager; 2625 2626 struct switch_media_handle_s; 2627 typedef struct switch_media_handle_s switch_media_handle_t; 2628 2629 typedef uint32_t switch_event_channel_id_t; 2630 typedef void (*switch_event_channel_func_t)(const char *event_channel, cJSON *json, const char *key, switch_event_channel_id_t id, void *user_data); 2631 2632 struct switch_live_array_s; 2633 typedef struct switch_live_array_s switch_live_array_t; 2634 2635 typedef enum { 2636 SDP_TYPE_REQUEST, 2637 SDP_TYPE_RESPONSE 2638 } switch_sdp_type_t; 2639 2640 2641 typedef enum { 2642 AEAD_AES_256_GCM_8, 2643 AEAD_AES_128_GCM_8, 2644 AES_CM_256_HMAC_SHA1_80, 2645 AES_CM_192_HMAC_SHA1_80, 2646 AES_CM_128_HMAC_SHA1_80, 2647 AES_CM_256_HMAC_SHA1_32, 2648 AES_CM_192_HMAC_SHA1_32, 2649 AES_CM_128_HMAC_SHA1_32, 2650 AES_CM_128_NULL_AUTH, 2651 CRYPTO_INVALID 2652 } switch_rtp_crypto_key_type_t; 2653 2654 /* Keep in sync with CRYPTO_KEY_PARAM_METHOD table. */ 2655 typedef enum { 2656 CRYPTO_KEY_PARAM_METHOD_INLINE, /* identified by "inline" chars in SRTP key parameter */ 2657 CRYPTO_KEY_PARAM_METHOD_INVALID 2658 } switch_rtp_crypto_key_param_method_type_t; 2659 2660 typedef struct payload_map_s { 2661 switch_media_type_t type; 2662 switch_sdp_type_t sdp_type; 2663 uint32_t ptime; 2664 uint32_t rate; 2665 uint8_t allocated; 2666 uint8_t negotiated; 2667 uint8_t current; 2668 unsigned long hash; 2669 2670 char *rm_encoding; 2671 char *iananame; 2672 char *modname; 2673 switch_payload_t pt; 2674 unsigned long rm_rate; 2675 unsigned long adv_rm_rate; 2676 uint32_t codec_ms; 2677 uint32_t bitrate; 2678 2679 char *rm_fmtp; 2680 2681 switch_payload_t recv_pt; 2682 2683 char *fmtp_out; 2684 2685 char *remote_sdp_ip; 2686 switch_port_t remote_sdp_port; 2687 2688 int channels; 2689 int adv_channels; 2690 2691 struct payload_map_s *next; 2692 2693 } payload_map_t; 2694 2695 typedef enum { 2696 SWITCH_MEDIA_FLOW_SENDRECV = 0, 2697 SWITCH_MEDIA_FLOW_SENDONLY, 2698 SWITCH_MEDIA_FLOW_RECVONLY, 2699 SWITCH_MEDIA_FLOW_INACTIVE, 2700 SWITCH_MEDIA_FLOW_DISABLED 2701 } switch_media_flow_t; 2702 2703 typedef enum { 2704 ICE_GOOGLE_JINGLE = (1 << 0), 2705 ICE_VANILLA = (1 << 1), 2706 ICE_CONTROLLED = (1 << 2), 2707 ICE_LITE = (1 << 3) 2708 } switch_core_media_ice_type_t; 2709 2710 typedef enum { 2711 SWITCH_POLL_READ = (1 << 0), 2712 SWITCH_POLL_WRITE = (1 << 1), 2713 SWITCH_POLL_ERROR = (1 << 2), 2714 SWITCH_POLL_HUP = (1 << 3), 2715 SWITCH_POLL_RDNORM = (1 << 4), 2716 SWITCH_POLL_RDBAND = (1 << 5), 2717 SWITCH_POLL_PRI = (1 << 6), 2718 SWITCH_POLL_INVALID = (1 << 7) 2719 } switch_poll_t; 2720 2721 typedef struct switch_waitlist_s { 2722 switch_os_socket_t sock; 2723 uint32_t events; 2724 uint32_t revents; 2725 } switch_waitlist_t; 2726 2727 struct switch_jb_s; 2728 typedef struct switch_jb_s switch_jb_t; 2729 2730 //struct kalman_estimator_s; 2731 //typedef struct kalman_estimator_s kalman_estimator_t; 2732 2733 //struct cusum_kalman_detector_s; 2734 //typedef struct cusum_kalman_detector_s cusum_kalman_detector_t; 2735 2736 struct switch_img_txt_handle_s; 2737 typedef struct switch_img_txt_handle_s switch_img_txt_handle_t; 2738 2739 struct switch_frame_buffer_s; 2740 typedef struct switch_frame_buffer_s switch_frame_buffer_t; 2741 2742 typedef enum { 2743 SVR_BLOCK = (1 << 0), 2744 SVR_FLUSH = (1 << 1), 2745 SVR_CHECK = (1 << 2) 2746 } switch_video_read_flag_t; 2747 2748 typedef enum { 2749 SPY_LOWER_RIGHT_SMALL, 2750 SPY_LOWER_RIGHT_LARGE, 2751 SPY_DUAL_CROP 2752 } switch_vid_spy_fmt_t; 2753 2754 typedef enum { 2755 SCFC_FLUSH_AUDIO, 2756 SCFC_PAUSE_READ, 2757 SCFC_PAUSE_WRITE, 2758 SCFC_RESUME_WRITE 2759 } switch_file_command_t; 2760 2761 2762 struct switch_rtp_text_factory_s; 2763 typedef struct switch_rtp_text_factory_s switch_rtp_text_factory_t; 2764 typedef struct switch_agc_s switch_agc_t; 2765 2766 struct switch_chromakey_s; 2767 typedef struct switch_chromakey_s switch_chromakey_t; 2768 2769 typedef enum { 2770 SWITCH_VIDEO_ENCODE_SPEED_DEFAULT = 0, 2771 SWITCH_VIDEO_ENCODE_SPEED_FAST = 0, 2772 SWITCH_VIDEO_ENCODE_SPEED_MEDIUM, 2773 SWITCH_VIDEO_ENCODE_SPEED_SLOW 2774 } switch_video_encode_speed_t; 2775 2776 typedef enum { 2777 SWITCH_VIDEO_PROFILE_BASELINE, 2778 SWITCH_VIDEO_PROFILE_MAIN, 2779 SWITCH_VIDEO_PROFILE_HIGH 2780 } switch_video_profile_t; 2781 2782 typedef struct switch_mm_s { 2783 int samplerate; 2784 int channels; 2785 int keyint; 2786 int ab; 2787 int vb; 2788 int vw; 2789 int vh; 2790 int cbr; 2791 float fps; 2792 float source_fps; 2793 int vbuf; 2794 switch_video_profile_t vprofile; 2795 switch_video_encode_speed_t vencspd; 2796 uint8_t try_hardware_encoder; 2797 int scale_w; 2798 int scale_h; 2799 switch_img_fmt_t fmt; 2800 char *auth_username; 2801 char *auth_password; 2802 } switch_mm_t; 2803 2804 #define SWITCH_RTP_MAX_CRYPTO_LEN 64 2805 2806 /* If MKI is used, then one or more key-materials are present in the <key-params> section of the crypto attribute. 2807 * This struct describes the single MKI entry (key-material) within <key-params> section of crypto attribute. 2808 * Key-material follows the format: 2809 * "inline:" <key||salt> ["|" lifetime] ["|" MKI ":" length] 2810 * which translates to 2811 * "inline: KEYSALT|MKI_ID:MKI_SZ" or "inline: KEYSALT|LIFETIME|MKI_ID:MKI_SZ" */ 2812 typedef struct switch_crypto_key_material_s { 2813 switch_rtp_crypto_key_param_method_type_t method; 2814 unsigned char raw_key[SWITCH_RTP_MAX_CRYPTO_LEN]; /* Key-salt. Master key appended with salt. Sizes determined by crypto suite. */ 2815 char *crypto_key; /* Complete key material string ("method:keysalt[|lifetime]|mki"). */ 2816 uint64_t lifetime; /* OPTIONAL. The lifetime value MAY be written as a non-zero, positive decimal integer or as a power of 2. Must be less than max lifetime of RTP and RTCP packets in given crypto suite. */ 2817 unsigned int mki_id; /* OPTIONAL. */ 2818 unsigned int mki_size; /* OPTIONAL. Byte length of the master key field in the RTP packet. */ 2819 struct switch_crypto_key_material_s *next; /* NULL if this is the last master key in crypto attribute set. */ 2820 } switch_crypto_key_material_t; 2821 2822 typedef struct secure_settings_s { 2823 int crypto_tag; 2824 unsigned char local_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN]; 2825 unsigned char remote_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN]; 2826 switch_rtp_crypto_key_type_t crypto_type; 2827 char *local_crypto_key; 2828 char *remote_crypto_key; 2829 2830 /* 2831 * MKI support (as per rfc4568). 2832 * Normally single crypto attribute contains one key-material in a <key-params> section, e.g. "inline: KEYSALT" or "inline: KEYSALT|2^LIFETIME_BITS". 2833 * But if MKI is used, then one or more key-materials are present in the <key-params> section of the crypto attribute. Each key-material follows the format: 2834 * 2835 * "inline:" <key||salt> ["|" lifetime] ["|" MKI ":" length] 2836 * 2837 * "inline: KEYSALT|MKI_ID:MKI_SZ" 2838 * or 2839 * "inline: KEYSALT|2^LIFETIME_BITS|MKI_ID:MKI_SZ" 2840 * 2841 * This points to singly linked list of key-material descriptions if there is more than one key-material present in this crypto attribute (this key is inserted as the head of the list in that case), or to NULL otherwise. 2842 */ 2843 struct switch_crypto_key_material_s *local_key_material_next; /* NULL if MKI not used for crypto set on outbound SRTP. */ 2844 unsigned long local_key_material_n; /* number of key_materials in the linked list for outbound SRTP */ 2845 struct switch_crypto_key_material_s *remote_key_material_next; /* NULL if MKI not used for crypto set on inbound SRTP. */ 2846 unsigned long remote_key_material_n; /* number of key_materials in the linked list for inbound SRTP */ 2847 } switch_secure_settings_t; 2848 2849 /* Default MKI index used for packets send from FS. We always use first key if multiple master keys are present in the crypto attribute. */ 2850 #define SWITCH_CRYPTO_MKI_INDEX 0 2851 2852 /* max number of MKI in a single crypto line supported */ 2853 #define SWITCH_CRYPTO_MKI_MAX 20 2854 2855 struct switch_dial_handle_s; 2856 typedef struct switch_dial_handle_s switch_dial_handle_t; 2857 2858 struct switch_dial_leg_s; 2859 typedef struct switch_dial_leg_s switch_dial_leg_t; 2860 2861 struct switch_dial_leg_list_s; 2862 typedef struct switch_dial_leg_list_s switch_dial_leg_list_t; 2863 2864 2865 SWITCH_END_EXTERN_C 2866 #endif 2867 /* For Emacs: 2868 * Local Variables: 2869 * mode:c 2870 * indent-tabs-mode:t 2871 * tab-width:4 2872 * c-basic-offset:4 2873 * End: 2874 * For VIM: 2875 * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: 2876 */ 2877