40 #define DEBUG_THREAD_POOL 48 if (i == 0 || i == 1) {
60 if (i == 0 || i == 1) {
129 #ifdef SWITCH_DEBUG_RWLOCKS 131 #if EMACS_CC_MODE_IS_BUGGY 164 #ifdef SWITCH_DEBUG_RWLOCKS 170 #ifdef SWITCH_DEBUG_RWLOCKS 190 const char *file,
const char *func,
int line)
244 for(np = head; np; np = np->
next) {
246 const char *this_value;
252 const char *var_name = hp->
name;
253 const char *var_value = hp->
value;
279 if (!var_val || !var_name)
297 const char *like = NULL;
299 if (var_val && *var_val ==
'~') {
321 for(np = head; np; np = np->
next) {
323 const char *this_val;
326 (!var_val || (like &&
switch_stristr(like, var_val)) || !strcmp(this_val, var_val))) {
367 for(np = head; np; np = np->
next) {
405 for(np = head; np; np = np->
next) {
522 const char *endpoint_name,
533 const char *forwardvar;
552 if (!
zstr(forwardvar)) {
553 forwardval = atoi(forwardvar) - 1;
555 if (forwardval <= 0) {
559 if (caller_profile) {
560 const char *eani = NULL, *eaniii = NULL;
561 const char *ecaller_id_name = NULL, *ecaller_id_number = NULL;
579 if (eani || eaniii || ecaller_id_name || ecaller_id_number) {
583 outgoing_profile->
ani = eani;
586 outgoing_profile->
aniii = eaniii;
588 if (ecaller_id_name) {
591 if (ecaller_id_number) {
596 if (!outgoing_profile) {
609 for (ptr = session->
event_hooks.outgoing_channel; ptr; ptr = ptr->
next) {
618 "Outgoing method for endpoint: [%s] returned: [%s] but there is no new session!\n", endpoint_name,
626 const char *use_uuid;
627 const char *use_external_id;
633 (*new_session)->loglevel = session->
loglevel;
660 if (!channel && var_event) {
661 const char *other_uuid;
665 session = other_session;
683 char rc[80] =
"", vrc[80] =
"", tmp[160] =
"";
803 "TRANSCODING_NECESSARY",
806 "REQUEST_IMAGE_MEDIA",
812 "APPLICATION_EXEC_COMPLETE",
823 "BLIND_TRANSFER_RESPONSE",
831 "CODEC_SPECIFIC_REQ",
845 const char *file,
const char *func,
int line)
865 if (!message->
_file) {
866 message->
_file = file;
869 if (!message->
_func) {
870 message->
_func = func;
873 if (!message->
_line) {
874 message->
_line = line;
937 for (ptr = session->
event_hooks.receive_message; ptr; ptr = ptr->
next) {
963 message->
_file = NULL;
964 message->
_func = NULL;
1020 msg.
from = __FILE__;
1034 if ((msg = malloc(
sizeof(*msg)))) {
1035 memset(msg, 0,
sizeof(*msg));
1037 msg->
from = __FILE__;
1182 for (ptr = session->
event_hooks.receive_event; ptr; ptr = ptr->
next) {
1285 #define check_media(session) \ 1287 if (switch_channel_test_flag(session->channel, CF_BROADCAST_DROP_MEDIA)) { \ 1288 switch_channel_clear_flag(session->channel, CF_BROADCAST_DROP_MEDIA); \ 1289 switch_ivr_nomedia(session->uuid_str, SMF_REBRIDGE); \ 1395 if (reset_read_codec) {
1439 return session->
mutex;
1541 "Cowardly ignoring an attempt to call destroy on a running session.\n");
1548 if ((*session)->text_buffer) {
1552 if ((*session)->text_line_buffer) {
1565 if ((*session)->external_id) {
1579 if ((*session)->plc) {
1581 (*session)->plc = NULL;
1596 for (i = 0; i < 2; i++) {
1597 if ((*session)->dmachine[i]) {
1602 if ((*session)->event_queue) {
1612 pool = (*session)->pool;
1628 char *uuid = task->cmd_arg;
1721 char *event_str = NULL;
1731 uint32_t loops = session->
soft_lock * 10;
1734 "Waiting %u for external entities\n",
1737 while(--loops > 0) {
1778 #ifdef DEBUG_THREAD_POOL 1787 #ifdef DEBUG_THREAD_POOL 1798 }
else if (td->
alloc) {
1801 #ifdef DEBUG_THREAD_POOL 1819 #ifdef DEBUG_THREAD_POOL 1828 uint32_t sess_count;
1834 if (sess_count > 110) {
1839 "LUKE'S VOICE: Artoo, see what you can do with it. Hang on back there....\n" 1840 "Green laserfire moves past the beeping little robot as his head turns. " 1841 "After a few beeps and a twist of his mechanical arm,\n" 1842 "Artoo reduces the max sessions to %d thus, saving the switch from certain doom.\n", sess_count - 10);
1911 while(!td->
running && --ms > 0) {
1992 const char *
buf = NULL;
2026 if (!strcmp(use_uuid, session->
uuid_str)) {
2108 char *p, *v, *dup, *
next = NULL;
2118 if ((next = strchr(p,
';'))) {
2122 if ((v = strchr(p,
'='))) {
2132 if (x < array_len) {
2151 char *flag_str = NULL, *cap_str = NULL, *direction_s = NULL, *uuid = NULL;
2252 char *p = strdup(tag->
txt);
2256 if (!strcasecmp(tag->
name,
"channel_name")) {
2297 if (tag3->
name && tag3->
txt) {
2298 v = atoll(tag3->
txt);
2299 if (!strcmp(tag3->
name,
"created_time")) {
2301 }
else if (!strcmp(tag3->
name,
"profile_created_time")) {
2303 }
else if (!strcmp(tag3->
name,
"progress_time")) {
2305 }
else if (!strcmp(tag3->
name,
"progress_media_time")) {
2307 }
else if (!strcmp(tag3->
name,
"answered_time")) {
2309 }
else if (!strcmp(tag3->
name,
"hangup_time")) {
2311 }
else if (!strcmp(tag3->
name,
"transfer_time")) {
2372 *endpoint_interface,
2436 if (pool && *pool) {
2444 session->
pool = usepool;
2560 #ifndef SWITCH_PREFIX_DIR 2561 #define SWITCH_PREFIX_DIR "." 2582 if (!session)
return NULL;
2588 if (!session)
return NULL;
2603 if (new_limit >= 0) {
2664 }
else if (application_interface->
flags) {
2665 *flags = application_interface->
flags;
2682 if (!arg && strstr(app,
"::")) {
2686 if ((arp = strstr(ap,
"::"))) {
2725 const char *arg, int32_t *flags)
2735 if (!arg && (p = strstr(app,
"::"))) {
2755 "%s Channel is hungup and application '%s' does not have the zombie_exec flag.\n",
2761 if (!arg && strstr(app,
"::")) {
2777 if (flags && application_interface->
flags) {
2778 *flags = application_interface->
flags;
2798 uint32_t ready = 0, sanity = 2000;
2804 }
while(!ready && sanity);
2808 "Cannot execute app '%s' media required on an outbound channel that does not have media established\n", app);
2841 char *expanded = NULL;
2842 const char *app, *app_uuid_var, *app_uuid_name;
2847 char *app_uuid = uuid_str;
2851 app_uuid = (
char *)app_uuid_var;
2866 if (expand_variables) {
2869 expanded = (
char *)arg;
2873 if (expand_variables && expanded && *expanded ==
'%' && (*(expanded+1) ==
'[' || *(expanded+2) ==
'[')) {
2886 if (expanded != arg) {
2910 }
else if (!
zstr(arg)) {
2959 msg.
from = __FILE__;
2981 if (expanded != arg) {
2994 uint32_t stack_count = 0;
3005 const char *context)
3010 uint32_t stack_count = 0;
3035 if (!
zstr(dialplan)) {
3039 if (!
zstr(context)) {
3047 for (x = 0; x < argc; x++) {
3048 char *dpname = dp[x];
3052 if ((dparg = strchr(dpname,
':'))) {
3063 extension = dialplan_interface->
hunt_function(session, dparg, new_profile);
3082 pp->
next = new_profile;
3124 stream->
write_function(stream,
"Thread pool: running:%d busy:%d popping:%d\n",
3130 if (session->
sdata) {
switch_status_t switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt,...)
switch_mutex_t * codec_init_mutex
void switch_channel_set_cap_value(switch_channel_t *channel, switch_channel_cap_t cap, uint32_t value)
switch_console_callback_match_t * switch_core_session_findall(void)
uint32_t switch_core_sessions_per_second(uint32_t new_limit)
switch_channel_state_t switch_channel_get_state(switch_channel_t *channel)
Get the current state of a channel in the state engine.
#define switch_event_fire(event)
Fire an event filling in most of the arguements with obvious values.
#define switch_channel_hangup(channel, hangup_cause)
Hangup a channel flagging it's state machine to end.
void switch_time_sync(void)
unsigned int switch_queue_size(switch_queue_t *queue)
void switch_core_session_set_dmachine(switch_core_session_t *session, switch_ivr_dmachine_t *dmachine, switch_digit_action_target_t target)
#define SWITCH_MUTEX_DEFAULT
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
switch_io_get_jb_t get_jb
A module interface to implement an application.
switch_core_session_t * switch_core_session_request_uuid(switch_endpoint_interface_t *endpoint_interface, switch_call_direction_t direction, switch_originate_flag_t originate_flags, switch_memory_pool_t **pool, const char *use_uuid)
struct switch_session_manager session_manager
char * switch_core_session_sprintf(_In_ switch_core_session_t *session, _In_z_ _Printf_format_string_ const char *fmt,...)
printf-style style printing routine. The data is output to a string allocated from the session ...
switch_status_t switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool)
switch_audio_resampler_t * write_resampler
void * switch_core_session_get_private_class(switch_core_session_t *session, switch_pvt_class_t index)
static switch_bool_t switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
#define SWITCH_CHANNEL_SESSION_LOG(x)
An Abstract Representation of a dialplan extension.
switch_queue_t * event_queue
switch_thread_rwlock_t * bug_rwlock
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
uint32_t switch_scheduler_del_task_group(const char *group)
Delete a scheduled task based on the group name.
switch_status_t switch_core_session_dequeue_event(switch_core_session_t *session, switch_event_t **event, switch_bool_t force)
#define SWITCH_ORIGINATOR_VARIABLE
int switch_core_session_add_stream(switch_core_session_t *session, void *private_info)
switch_core_session_message_types_t message_id
switch_status_t switch_channel_alloc(_In_ switch_channel_t **channel, _In_ switch_call_direction_t direction, _In_ switch_memory_pool_t *pool)
Allocate a new channel.
switch_status_t switch_core_session_set_codec_slin(switch_core_session_t *session, switch_slin_data_t *data)
#define SWITCH_CHANNEL_LOG
struct switch_io_event_hook_outgoing_channel * next
switch_status_t switch_mutex_trylock(switch_mutex_t *lock)
switch_status_t switch_core_hash_destroy(_Inout_ switch_hash_t **hash)
Destroy an existing hash table.
void * switch_core_hash_find(_In_ switch_hash_t *hash, _In_z_ const char *key)
Retrieve data from a given hash.
uint8_t raw_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]
switch_status_t switch_core_session_pass_indication(switch_core_session_t *session, switch_core_session_message_types_t indication)
#define switch_event_del_header(_e, _h)
static const char * message_names[]
Abstraction of an module endpoint interface This is the glue between the abstract idea of a "channel"...
const char * switch_core_session_get_external_id(switch_core_session_t *session)
switch_mutex_t * codec_write_mutex
switch_status_t switch_ivr_process_indications(switch_core_session_t *session, switch_core_session_message_t *message)
const char * switch_channel_get_partner_uuid(switch_channel_t *channel)
int switch_core_test_flag(int flag)
#define switch_core_hash_init(_hash)
const char * switch_channel_cause2str(_In_ switch_call_cause_t cause)
return a cause string for a given cause
switch_frame_t enc_read_frame
#define SWITCH_MAX_STACKS
const char * switch_channel_get_partner_uuid_copy(switch_channel_t *channel, char *buf, switch_size_t blen)
void switch_channel_flush_dtmf(_In_ switch_channel_t *channel)
switch_queue_t * thread_queue
switch_buffer_t * raw_write_buffer
#define MESSAGE_STRING_ARG_MAX
switch_mutex_t * stack_count_mutex
switch_status_t switch_queue_pop_timeout(switch_queue_t *queue, void **data, switch_interval_time_t timeout)
switch_mutex_t * codec_read_mutex
void switch_core_session_unsched_heartbeat(switch_core_session_t *session)
void switch_channel_event_set_data(_In_ switch_channel_t *channel, _In_ switch_event_t *event)
Add information about a given channel to an event object.
switch_codec_t * switch_core_session_get_video_read_codec(_In_ switch_core_session_t *session)
Retrieve the video_read codec from a given session.
switch_mutex_t * switch_core_session_get_mutex(switch_core_session_t *session)
Signal a session's state machine thread that a state change has occured.
Node in which to store state change callback hooks.
switch_status_t switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data, switch_bool_t dup)
#define switch_channel_presence(_a, _b, _c, _d)
switch_status_t switch_core_session_message_send(const char *uuid_str, switch_core_session_message_t *message)
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
switch_status_t switch_core_session_set_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec)
Assign the read codec to a given session.
Node in which to store custom receive message callback hooks.
void switch_core_session_init(switch_memory_pool_t *pool)
uint8_t switch_core_session_check_interface(switch_core_session_t *session, const switch_endpoint_interface_t *endpoint_interface)
Checks if a session is using a specific endpoint.
int switch_core_session_sync_clock(void)
switch_status_t switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
void switch_core_session_raw_read(switch_core_session_t *session)
switch_status_t switch_core_media_bug_flush_all(_In_ switch_core_session_t *session)
Flush the read/write buffers for all media bugs on the session.
struct switch_io_event_hook_receive_event * next
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
switch_memory_pool_t * pool
void switch_ivr_dmachine_set_target(switch_ivr_dmachine_t *dmachine, switch_digit_action_target_t target)
Representation of an event.
#define switch_codec2str(codec, buf, len)
#define switch_channel_ready(_channel)
switch_io_routines_t * io_routines
void * streams[SWITCH_MAX_STREAMS]
switch_core_session_t * switch_core_session_request_xml(switch_endpoint_interface_t *endpoint_interface, switch_memory_pool_t **pool, switch_xml_t xml)
switch_core_session_t * switch_core_session_request_by_name(const char *endpoint_name, switch_call_direction_t direction, switch_memory_pool_t **pool)
switch_status_t switch_core_session_read_lock(_In_ switch_core_session_t *session)
Acquire a read lock on the session.
void switch_core_session_free_message(switch_core_session_message_t **message)
switch_status_t switch_queue_trypop(switch_queue_t *queue, void **data)
switch_core_session_message_types_t
Possible types of messages for inter-session communication.
switch_caller_profile_t * switch_caller_profile_clone(_In_ switch_core_session_t *session, _In_ switch_caller_profile_t *tocopy)
Clone an existing caller profile object.
switch_digit_action_target_t
void switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel's caller profile.
switch_io_receive_event_t receive_event
switch_status_t switch_core_session_set_private_class(switch_core_session_t *session, void *private_info, switch_pvt_class_t index)
#define switch_channel_media_ready(_channel)
switch_status_t switch_thread_pool_wait(switch_thread_data_t *td, int ms)
static void parse_array(const char *str, uint32_t *array, int32_t array_len)
switch_status_t switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout)
switch_status_t switch_core_session_perform_receive_message(switch_core_session_t *session, switch_core_session_message_t *message, const char *file, const char *func, int line)
static switch_status_t check_queue(void)
switch_receive_event_hook_t receive_event
switch_status_t switch_core_session_queue_indication(switch_core_session_t *session, switch_core_session_message_types_t indication)
switch_status_t switch_core_session_wake_session_thread(switch_core_session_t *session)
void switch_core_session_debug_pool(switch_stream_handle_t *stream)
switch_codec_implementation_t read_impl
A representation of an XML tree.
switch_memory_pool_t * pool
switch_status_t switch_core_codec_destroy(switch_codec_t *codec)
Destroy an initalized codec handle.
struct switch_caller_profile * next
Abstract interface to a dialplan module.
switch_mutex_t * throttle_mutex
const char * switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup, int idx)
Retrieve a variable from a given channel.
const char * string_array_arg[MESSAGE_STRING_ARG_MAX]
static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t *thread, void *obj)
const char * switch_channel_state_name(_In_ switch_channel_state_t state)
Render the name of the provided state enum.
switch_app_log_t * switch_core_session_get_app_log(switch_core_session_t *session)
uint32_t switch_originate_flag_t
switch_queue_t * signal_data_queue
switch_caller_profile_t * switch_caller_profile_new(_In_ switch_memory_pool_t *pool, _In_opt_z_ const char *username, _In_opt_z_ const char *dialplan, _In_opt_z_ const char *caller_id_name, _In_opt_z_ const char *caller_id_number, _In_opt_z_ const char *network_addr, _In_opt_z_ const char *ani, _In_opt_z_ const char *aniii, _In_opt_z_ const char *rdnis, _In_opt_z_ const char *source, _In_opt_z_ const char *context, _In_opt_z_ const char *destination_number)
Create a new caller profile object.
switch_status_t switch_core_session_execute_exten(switch_core_session_t *session, const char *exten, const char *dialplan, const char *context)
switch_status_t switch_core_session_set_external_id(switch_core_session_t *session, const char *use_external_id)
A table of i/o routines that an endpoint interface can implement.
switch_status_t switch_ivr_media(const char *uuid, switch_media_flag_t flags)
Signal a session to request direct media access to it's remote end.
switch_status_t switch_core_session_execute_application_async(switch_core_session_t *session, const char *app, const char *arg)
void switch_resample_destroy(switch_audio_resampler_t **resampler)
Destroy an existing resampler handle.
static switch_thread_t * thread
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
struct switch_runtime runtime
unsigned int switch_core_session_started(switch_core_session_t *session)
uint32_t switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Test for presence of given flag on a given channel.
void switch_core_session_hupall(switch_call_cause_t cause)
uint32_t switch_scheduler_add_task(time_t task_runtime, switch_scheduler_func_t func, const char *desc, const char *group, uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags)
Schedule a task in the future.
void switch_core_session_soft_lock(switch_core_session_t *session, uint32_t sec)
Node in which to store custom receive message callback hooks.
switch_thread_cond_t * cond
void switch_channel_set_scope_variables(switch_channel_t *channel, switch_event_t **event)
switch_core_session_t * session
SWITCH_BEGIN_EXTERN_C int switch_status_is_timeup(int status)
switch_buffer_t * text_buffer
const char * interface_name
A message object designed to allow unlike technologies to exchange data.
void switch_channel_set_origination_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel's origination caller profile.
switch_console_callback_match_t * switch_core_session_findall_matching_var(const char *var_name, const char *var_val)
#define SWITCH_DISABLE_APP_LOG_VARIABLE
switch_media_handle_t * media_handle
#define SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE
switch_codec_t * switch_core_session_get_read_codec(_In_ switch_core_session_t *session)
Retrieve the read codec from a given session.
switch_size_t switch_core_session_id(void)
Provide the current session_id.
struct switch_caller_application * next
switch_status_t switch_core_session_perform_get_partner(switch_core_session_t *session, switch_core_session_t **partner, const char *file, const char *func, int line)
Get the session's partner (the session its bridged to)
uint32_t switch_core_session_hupall_matching_var_ans(const char *var_name, const char *var_val, switch_call_cause_t cause, switch_hup_type_t type)
switch_channel_t * switch_core_session_get_channel(switch_core_session_t *session)
switch_io_event_hooks_t event_hooks
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
#define SWITCH_MESSAGE_QUEUE_LEN
switch_status_t switch_core_session_get_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
#define switch_core_session_execute_application(_a, _b, _c)
Execute an application on a session.
void switch_core_recovery_track(switch_core_session_t *session)
uint8_t switch_core_session_compare(switch_core_session_t *a, switch_core_session_t *b)
Checks if 2 sessions are using the same endpoint module.
#define UNPROTECT_INTERFACE(_it)
#define SWITCH_ORIGINATOR_CODEC_VARIABLE
#define switch_clear_flag(obj, flag)
Clear a flag on an arbitrary object while locked.
switch_receive_message_hook_t receive_message
#define SWITCH_MUTEX_NESTED
void switch_core_session_reset(switch_core_session_t *session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec)
int switch_plc_free(switch_plc_state_t *s)
switch_queue_t * private_event_queue
static char * xml_find_var(switch_xml_t vars, const char *name)
void switch_core_session_enable_heartbeat(switch_core_session_t *session, uint32_t seconds)
switch_status_t switch_core_session_get_app_flags(const char *app, int32_t *flags)
switch_status_t switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on)
const switch_codec_implementation_t * implementation
double switch_core_idle_cpu(void)
void * private_info[SWITCH_CORE_SESSION_MAX_PRIVATES]
int32_t sessions_peak_fivemin
switch_byte_t switch_byte_t * buf
#define SWITCH_PROCESS_CDR_VARIABLE
uint32_t switch_core_session_private_event_count(switch_core_session_t *session)
#define switch_yield(ms)
Wait a desired number of microseconds and yield the CPU.
unsigned int switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen)
Separate a string into an array based on a character delimiter.
switch_channel_t * channel
switch_status_t switch_core_session_thread_pool_launch(switch_core_session_t *session)
switch_audio_resampler_t * read_resampler
switch_dialplan_hunt_function_t hunt_function
switch_core_session_t * switch_core_session_perform_force_locate(const char *uuid_str, const char *file, const char *func, int line)
switch_mutex_t * frame_read_mutex
switch_status_t switch_core_session_queue_event(switch_core_session_t *session, switch_event_t **event)
void switch_core_session_disable_heartbeat(switch_core_session_t *session)
switch_application_interface_t * switch_loadable_module_get_application_interface(const char *name)
Retrieve the application interface by it's registered name.
switch_core_session_t * switch_core_session_perform_locate(const char *uuid_str, const char *file, const char *func, int line)
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
const char * callee_id_number
uint8_t enc_write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]
switch_status_t switch_core_session_dequeue_signal_data(switch_core_session_t *session, void **signal_data)
switch_status_t switch_core_session_thread_launch(switch_core_session_t *session)
#define switch_core_session_request_video_refresh(_s)
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
uint32_t actual_samples_per_second
uint32_t switch_scheduler_del_task_id(uint32_t task_id)
Delete a scheduled task.
#define switch_channel_get_variable(_c, _v)
#define SWITCH_THREAD_STACKSIZE
uint32_t switch_core_session_messages_waiting(switch_core_session_t *session)
switch_status_t switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
Add a string header to an event.
void switch_core_session_perform_destroy(switch_core_session_t **session, const char *file, const char *func, int line)
void switch_core_session_sched_heartbeat(switch_core_session_t *session, uint32_t seconds)
const char * caller_id_name
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
switch_status_t switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock)
switch_thread_start_t func
struct switch_caller_profile * children
uint32_t switch_core_session_flush_private_events(switch_core_session_t *session)
Flush the private event queue of a session.
static void *SWITCH_THREAD_FUNC switch_core_session_thread_pool_worker(switch_thread_t *thread, void *obj)
switch_status_t switch_channel_pass_sdp(switch_channel_t *from_channel, switch_channel_t *to_channel, const char *sdp)
void switch_console_push_match(switch_console_callback_match_t **matches, const char *new_val)
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
SWITCH_STANDARD_SCHED_FUNC(sch_heartbeat_callback)
switch_application_function_t application_function
void switch_channel_set_flag_value(switch_channel_t *channel, switch_channel_flag_t flag, uint32_t value)
Set given flag(s) on a given channel.
#define SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE
void switch_core_session_launch_thread(switch_core_session_t *session, switch_thread_start_t func, void *obj)
switch_status_t switch_core_session_exec(switch_core_session_t *session, const switch_application_interface_t *application_interface, const char *arg)
switch_status_t switch_core_session_receive_event(switch_core_session_t *session, switch_event_t **event)
#define switch_channel_text_only(_channel)
switch_mutex_t * resample_mutex
#define switch_channel_down_nosig(_channel)
switch_queue_t * message_queue
#define SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE
void switch_core_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen) const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val)
Gets the key and value of the current hash element.
#define SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE
switch_mutex_t * text_mutex
switch_io_routines_t * io_override
switch_thread_cond_t * cond
#define switch_core_session_destroy(session)
Destroy a session and return the memory pool to the core.
switch_hash_index_t * switch_core_hash_next(_In_ switch_hash_index_t **hi)
Gets the next element of a hashtable.
#define switch_core_session_request(_ep, _d, _f, _p)
void switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel's originator caller profile.
#define switch_core_codec_init(_codec, _codec_name, _modname, _fmtp, _rate, _ms, _channels, _flags, _codec_settings, _pool)
Initialize a codec handle.
switch_io_state_change_t state_change
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1]
switch_thread_rwlock_t * io_rwlock
char * switch_url_decode(char *s)
switch_mutex_t * session_hash_mutex
void switch_cond_next(void)
struct switch_io_event_hook_receive_message * next
switch_size_t switch_core_session_id_dec(void)
int microseconds_per_packet
uint32_t switch_core_session_count(void)
Provide the total number of sessions.
#define SWITCH_CURRENT_APPLICATION_DATA_VARIABLE
double switch_core_min_idle_cpu(double new_limit)
switch_buffer_t * raw_read_buffer
switch_memory_pool_t * memory_pool
void switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
switch_caller_application_t * current_application
char frame_data[SWITCH_RECOMMENDED_BUFFER_SIZE]
void * switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_ const char *key)
Delete data from a hash based on desired key.
switch_status_t switch_core_session_override_io_routines(switch_core_session_t *session, switch_io_routines_t *ior)
switch_frame_t write_frame
#define switch_core_session_receive_message(_session, _message)
void switch_core_session_rwunlock(_In_ switch_core_session_t *session)
Unlock a read or write lock on as given session.
void switch_core_session_video_reset(switch_core_session_t *session)
switch_status_t switch_core_session_flush_message(switch_core_session_t *session)
switch_status_t switch_channel_set_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check)
uint32_t switch_channel_test_cap(switch_channel_t *channel, switch_channel_cap_t cap)
switch_state_change_hook_t state_change
#define switch_str_nil(s)
Make a null string a blank string instead.
#define SWITCH_CORE_SESSION_MAX_PRIVATES
struct fspr_thread_mutex_t switch_mutex_t
switch_frame_t raw_read_frame
#define SWITCH_CHANNEL_SESSION_LOG_CLEAN(x)
switch_status_t switch_thread_cond_signal(switch_thread_cond_t *cond)
int switch_thread_equal(switch_thread_id_t tid1, switch_thread_id_t tid2)
Compare two thread ids.
void *(SWITCH_THREAD_FUNC * switch_thread_start_t)(switch_thread_t *, void *)
switch_status_t switch_core_session_execute_application_get_flags(switch_core_session_t *session, const char *app, const char *arg, int32_t *flags)
switch_status_t switch_core_session_dequeue_message(switch_core_session_t *session, switch_core_session_message_t **message)
void switch_core_session_run(_In_ switch_core_session_t *session)
Start the session's state machine.
void switch_uuid_format(char *buffer, const switch_uuid_t *uuid)
#define switch_channel_expand_variables(_channel, _in)
#define SWITCH_R_SDP_VARIABLE
switch_queue_t * private_event_queue_pri
uint32_t samples_per_packet
struct switch_io_event_hook_state_change * next
switch_stream_handle_write_function_t write_function
uint32_t switch_core_session_event_count(switch_core_session_t *session)
int switch_core_session_get_stream_count(switch_core_session_t *session)
#define SWITCH_EVENT_QUEUE_LEN
uint8_t number_of_channels
uint32_t samples_per_second
switch_memory_pool_t * pool
void switch_channel_uninit(switch_channel_t *channel)
Uninitalize a channel.
switch_status_t
Common return values.
unsigned int switch_core_session_running(switch_core_session_t *session)
#define switch_goto_status(_status, _label)
void * switch_core_session_get_stream(switch_core_session_t *session, int index)
switch_status_t switch_core_session_read_lock_hangup(_In_ switch_core_session_t *session)
Acquire a read lock on the session.
switch_dialplan_interface_t * switch_loadable_module_get_dialplan_interface(const char *name)
Retrieve the dialplan interface by it's registered name.
const cJSON *const target
Node in which to store custom receive message callback hooks.
switch_endpoint_interface_t * switch_loadable_module_get_endpoint_interface(const char *name)
Retrieve the endpoint interface by it's registered name.
switch_memory_pool_t * pool
char * switch_uuid_str(char *buf, switch_size_t len)
void switch_core_session_write_lock(_In_ switch_core_session_t *session)
Acquire a write lock on the session.
uint8_t enc_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]
#define SWITCH_SIGNAL_BOND_VARIABLE
#define check_media(session)
char * destination_number
void switch_core_session_signal_state_change(switch_core_session_t *session)
void switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel's originatee caller profile.
switch_hash_t * session_table
switch_size_t switch_channel_has_dtmf(_In_ switch_channel_t *channel)
Test for presence of DTMF on a given channel.
void switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data)
#define switch_core_hash_insert(_h, _k, _d)
#define switch_core_session_locate(uuid_str)
Locate a session based on it's uuid.
#define switch_core_media_bug_remove_all(_s)
switch_ivr_dmachine_t * switch_core_session_get_dmachine(switch_core_session_t *session, switch_digit_action_target_t target)
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
switch_bool_t switch_core_ready_outbound(void)
Determines if the core is ready to place outbound calls.
switch_frame_t enc_write_frame
void switch_uuid_get(switch_uuid_t *uuid)
switch_size_t switch_core_session_get_id(switch_core_session_t *session)
#define switch_event_get_header(_e, _h)
#define switch_channel_set_flag(_c, _f)
switch_xml_t switch_xml_child(_In_ switch_xml_t xml, _In_z_ const char *name)
returns the first child tag (one level deeper) with the given name or NULL \ if not found ...
switch_status_t switch_channel_set_name(switch_channel_t *channel, const char *name)
Assign a name to a given channel.
switch_io_receive_message_t receive_message
switch_call_direction_t switch_channel_direction(switch_channel_t *channel)
#define switch_set_string(_dst, _src)
switch_status_t switch_queue_trypush(switch_queue_t *queue, void *data)
struct switch_channel_timetable * times
switch_status_t switch_channel_state_thread_trylock(switch_channel_t *channel)
void switch_core_memory_pool_tag(switch_memory_pool_t *pool, const char *tag)
uint32_t switch_core_session_hupall_matching_vars_ans(switch_event_t *vars, switch_call_cause_t cause, switch_hup_type_t type)
switch_io_outgoing_channel_t outgoing_channel
void switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause)
Hangup all sessions that belong to an endpoint.
void switch_core_session_soft_unlock(switch_core_session_t *session)
time_t switch_epoch_time_now(time_t *t)
Get the current epoch time.
const char * caller_id_number
switch_status_t switch_queue_term(switch_queue_t *queue)
#define switch_core_session_alloc(_session, _memory)
Allocate memory from a session's pool.
switch_ivr_dmachine_t * dmachine[2]
switch_status_t switch_queue_push(switch_queue_t *queue, void *data)
const char * switch_core_session_get_text_buffer(switch_core_session_t *session)
switch_status_t switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, switch_memory_pool_t *pool)
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
switch_status_t switch_core_session_try_reset(switch_core_session_t *session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec)
Reset the buffers and resampler on a session, fail if can not lock codec mutexes. ...
static switch_bool_t switch_core_codec_ready(switch_codec_t *codec)
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
const char * switch_stristr(const char *instr, const char *str)
#define SWITCH_CURRENT_APPLICATION_VARIABLE
switch_status_t switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool)
switch_status_t switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr, switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
A table of settings and callbacks that define a paticular implementation of a codec.
#define PROTECT_INTERFACE(_it)
switch_endpoint_interface_t * endpoint_interface
struct switch_thread_pool_node_s switch_thread_pool_node_t
struct fspr_pool_t switch_memory_pool_t
#define switch_channel_up_nosig(_channel)
switch_status_t switch_core_session_queue_signal_data(switch_core_session_t *session, void *signal_data)
switch_status_t switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool)
#define switch_core_session_strdup(_session, _todup)
Copy a string using memory allocation from a session's pool.
switch_log_level_t loglevel
switch_thread_id_t switch_thread_self(void)
switch_status_t switch_ivr_deactivate_unicast(switch_core_session_t *session)
static void thread_launch_failure(void)
void switch_event_destroy(switch_event_t **event)
Destroy an event.
uint8_t raw_write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]
void switch_channel_state_thread_unlock(switch_channel_t *channel)
switch_status_t switch_core_session_event_send(const char *uuid_str, switch_event_t **event)
switch_status_t switch_core_session_queue_message(switch_core_session_t *session, switch_core_session_message_t *message)
switch_log_level_t switch_core_session_get_loglevel(switch_core_session_t *session)
Get the log level for a session.
void switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Clear given flag(s) from a channel.
switch_slin_data_t * sdata
switch_thread_id_t thread_id
struct fspr_thread_t switch_thread_t
#define SWITCH_MAX_FORWARDS_VARIABLE
#define switch_channel_set_variable(_channel, _var, _val)
switch_time_t switch_time_now(void)
switch_frame_t raw_write_frame
switch_status_t switch_channel_init(switch_channel_t *channel, switch_core_session_t *session, switch_channel_state_t state, switch_channel_flag_t flag)
Connect a newly allocated channel to a session object and setup it's initial state.
switch_status_t switch_core_session_set_loglevel(switch_core_session_t *session, switch_log_level_t loglevel)
Sets the log level for a session.
#define switch_channel_pre_answer(channel)
Indicate progress on a channel to attempt early media.
switch_bool_t switch_core_session_in_thread(switch_core_session_t *session)
switch_caller_profile_t * switch_channel_get_caller_profile(switch_channel_t *channel)
Retrieve the given channel's caller profile.
#define switch_core_session_kill_channel(session, sig)
Send a signal to a channel.
switch_status_t switch_event_serialize(switch_event_t *event, char **str, switch_bool_t encode)
switch_bool_t switch_core_ready_inbound(void)
Determines if the core is ready to take inbound calls.
void switch_buffer_destroy(switch_buffer_t **buffer)
Destroy the buffer.
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.
#define switch_core_hash_first(_h)
switch_bool_t switch_core_ready(void)
Determines if the core is ready to take calls.
switch_thread_rwlock_t * rwlock
SWITCH_BEGIN_EXTERN_C char * switch_mprintf(const char *zFormat,...)
#define switch_channel_media_up(_channel)
uint32_t switch_core_session_limit(uint32_t new_limit)
void * switch_buffer_get_head_pointer(switch_buffer_t *buffer)
const char * callee_id_name
switch_memory_pool_t * switch_core_session_get_pool(_In_ switch_core_session_t *session)
Retrieve the memory pool from a session.
switch_app_log_t * app_log
switch_call_cause_t switch_core_session_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, const char *endpoint_name, switch_caller_profile_t *caller_profile, switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
switch_log_level_t
Log Level Enumeration.
void switch_core_session_destroy_state(switch_core_session_t *session)
#define SWITCH_UUID_FORMATTED_LENGTH
switch_event_header_t * headers
switch_outgoing_channel_hook_t outgoing_channel
struct switch_app_log * next
uint32_t read_frame_count
struct switch_caller_extension * caller_extension
switch_status_t switch_core_session_dequeue_private_event(switch_core_session_t *session, switch_event_t **event)
void switch_ivr_clear_speech_cache(switch_core_session_t *session)
void switch_core_session_uninit(void)
char * switch_core_session_get_uuid(switch_core_session_t *session)
switch_status_t switch_core_session_set_uuid(switch_core_session_t *session, const char *use_uuid)
switch_status_t switch_core_session_queue_private_event(switch_core_session_t *session, switch_event_t **event, switch_bool_t priority)
switch_status_t switch_thread_pool_launch_thread(switch_thread_data_t **tdp)
switch_memory_pool_t * pool
uint32_t switch_core_session_stack_count(switch_core_session_t *session, int x)
switch_jb_t * switch_core_session_get_jb(switch_core_session_t *session, switch_media_type_t type)
switch_status_t switch_threadattr_priority_set(switch_threadattr_t *attr, switch_thread_priority_t priority)