40 #define DEBUG_THREAD_POOL
48 if (i == 0 || i == 1) {
52 session->dmachine[i] = dmachine;
60 if (i == 0 || i == 1) {
61 return session->dmachine[i];
70 if (session->endpoint_interface->io_routines->get_jb) {
71 return session->endpoint_interface->io_routines->get_jb(session, type);
79 session->soft_lock = sec;
84 session->soft_lock = 0;
95 data->session = session;
107 memset(&data->write_frame, 0,
sizeof(data->write_frame));
109 data->write_frame.codec = &data->codec;
110 data->write_frame.data = data->frame_data;
111 data->write_frame.buflen =
sizeof(data->frame_data);
112 data->write_frame.datalen = 0;
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_val;
270 const char *like = NULL;
272 if (var_val && *var_val ==
'~') {
294 for(np = head; np; np = np->
next) {
296 const char *this_val;
299 (!var_val || (like &&
switch_stristr(like, var_val)) || !strcmp(this_val, var_val))) {
340 for(np = head; np; np = np->
next) {
378 for(np = head; np; np = np->
next) {
461 return session->private_info[index];
473 session->private_info[index] = private_info;
479 session->streams[session->stream_count++] = private_info;
480 return session->stream_count - 1;
485 return session->streams[index];
491 return session->stream_count;
495 const
char *endpoint_name,
507 const char *forwardvar;
526 if (!
zstr(forwardvar)) {
527 forwardval = atoi(forwardvar) - 1;
529 if (forwardval <= 0) {
533 if (caller_profile) {
534 const char *eani = NULL, *eaniii = NULL;
535 const char *ecaller_id_name = NULL, *ecaller_id_number = NULL;
553 if (eani || eaniii || ecaller_id_name || ecaller_id_number) {
557 outgoing_profile->
ani = eani;
560 outgoing_profile->
aniii = eaniii;
562 if (ecaller_id_name) {
565 if (ecaller_id_number) {
570 if (!outgoing_profile) {
592 "Outgoing method for endpoint: [%s] returned: [%s] but there is no new session!\n", endpoint_name,
600 const char *use_uuid;
605 (*new_session)->loglevel = session->loglevel;
633 char rc[80] =
"", vrc[80] =
"", tmp[160] =
"";
735 "TRANSCODING_NECESSARY",
738 "REQUEST_IMAGE_MEDIA",
744 "APPLICATION_EXEC_COMPLETE",
755 "BLIND_TRANSFER_RESPONSE",
763 "CODEC_SPECIFIC_REQ",
775 const
char *file, const
char *func,
int line)
783 if (session->endpoint_interface->io_routines->receive_message) {
784 status = session->endpoint_interface->io_routines->receive_message(session, message);
795 if (!message->_file) {
796 message->_file = file;
799 if (!message->_func) {
800 message->_func = func;
803 if (!message->_line) {
804 message->_line = line;
827 if (
zstr(message->string_array_arg[0]) && !
zstr(message->string_arg)) {
832 if (!
zstr(message->string_array_arg[0])) {
836 if (!
zstr(message->string_array_arg[1])) {
856 if (session->media_handle) {
860 if (session->endpoint_interface->io_routines->receive_message) {
861 status = session->endpoint_interface->io_routines->receive_message(session, message);
893 message->_file = NULL;
894 message->_func = NULL;
903 switch (message->message_id) {
964 if ((msg = malloc(
sizeof(*msg)))) {
965 memset(msg, 0,
sizeof(*msg));
967 msg->
from = __FILE__;
982 if (session->message_queue) {
1025 if (session->message_queue) {
1048 if (session->message_queue) {
1065 if (session->signal_data_queue) {
1086 if (session->signal_data_queue) {
1105 if (session->endpoint_interface->io_routines->receive_event) {
1106 status = session->endpoint_interface->io_routines->receive_event(session, *event);
1139 if (session->event_queue) {
1155 if (session->private_event_queue) {
1159 if (session->message_queue) {
1168 if (session->event_queue) {
1199 if (session->private_event_queue) {
1200 queue = priority ? session->private_event_queue_pri : session->private_event_queue;
1213 #define check_media(session) \
1215 if (switch_channel_test_flag(session->channel, CF_BROADCAST_DROP_MEDIA)) { \
1216 switch_channel_clear_flag(session->channel, CF_BROADCAST_DROP_MEDIA); \
1217 switch_ivr_nomedia(session->uuid_str, SMF_REBRIDGE); \
1226 if (session->private_event_queue) {
1251 if (session->private_event_queue) {
1253 queue = session->private_event_queue_pri;
1259 queue = session->private_event_queue;
1282 if (session->private_event_queue) {
1308 if (reset_read_codec) {
1358 return session->channel;
1363 return session->mutex;
1408 if (session->endpoint_interface->io_routines->state_change) {
1409 status = session->endpoint_interface->io_routines->state_change(session);
1464 "Cowardly ignoring an attempt to call destroy on a running session.\n");
1491 if ((*session)->plc) {
1492 plc_free((*session)->plc);
1493 (*session)->plc = NULL;
1508 for (i = 0; i < 2; i++) {
1509 if ((*session)->dmachine[i]) {
1514 pool = (*session)->pool;
1530 char *uuid = task->cmd_arg;
1551 if (session->track_id) {
1553 session->track_id = 0;
1580 session->track_duration = seconds;
1593 session->read_frame_count = 0;
1595 session->read_frame_count = (session->read_impl.samples_per_second / session->read_impl.samples_per_packet) * seconds;
1609 session->read_frame_count = 0;
1610 session->track_duration = 0;
1623 char *event_str = NULL;
1633 uint32_t loops = session->
soft_lock * 10;
1636 "Waiting %u for external entities\n",
1639 while(--loops > 0) {
1680 #ifdef DEBUG_THREAD_POOL
1689 #ifdef DEBUG_THREAD_POOL
1698 }
else if (td->
alloc) {
1701 #ifdef DEBUG_THREAD_POOL
1719 #ifdef DEBUG_THREAD_POOL
1728 uint32_t sess_count;
1734 if (sess_count > 110) {
1739 "LUKE'S VOICE: Artoo, see what you can do with it. Hang on back there....\n"
1740 "Green laserfire moves past the beeping little robot as his head turns. "
1741 "After a few beeps and a twist of his mechanical arm,\n"
1742 "Artoo reduces the max sessions to %d thus, saving the switch from certain doom.\n", sess_count - 10);
1905 if (!strcmp(use_uuid, session->uuid_str)) {
1953 static void parse_array(
const char *str, uint32_t *array, int32_t array_len)
1955 char *p, *v, *dup, *next = NULL;
1965 if ((next = strchr(p,
';'))) {
1969 if ((v = strchr(p,
'='))) {
1979 if (x < array_len) {
1998 char *flag_str = NULL, *cap_str = NULL, *direction_s = NULL, *uuid = NULL;
2099 char *p = strdup(tag->
txt);
2103 if (!strcasecmp(tag->
name,
"channel_name")) {
2144 if (tag3->
name && tag3->
txt) {
2145 v = atoll(tag3->
txt);
2146 if (!strcmp(tag3->
name,
"created_time")) {
2148 }
else if (!strcmp(tag3->
name,
"profile_created_time")) {
2150 }
else if (!strcmp(tag3->
name,
"progress_time")) {
2152 }
else if (!strcmp(tag3->
name,
"progress_media_time")) {
2154 }
else if (!strcmp(tag3->
name,
"answered_time")) {
2156 }
else if (!strcmp(tag3->
name,
"hangup_time")) {
2158 }
else if (!strcmp(tag3->
name,
"transfer_time")) {
2219 *endpoint_interface,
2277 if (pool && *pool) {
2285 session->
pool = usepool;
2402 #ifndef SWITCH_PREFIX_DIR
2403 #define SWITCH_PREFIX_DIR "."
2411 return (uint8_t) (a->endpoint_interface == b->endpoint_interface);
2419 return (uint8_t) (session->endpoint_interface == endpoint_interface);
2424 if (!session)
return NULL;
2425 return session->uuid_str;
2440 if (new_limit >= 0) {
2486 return session->app_log;
2501 }
else if (application_interface->
flags) {
2502 *flags = application_interface->
flags;
2519 if (!arg && strstr(app,
"::")) {
2523 if ((arp = strstr(ap,
"::"))) {
2562 const
char *arg, int32_t *flags)
2572 if (!arg && (p = strstr(app,
"::"))) {
2592 "%s Channel is hungup and application '%s' does not have the zombie_exec flag.\n",
2598 if (!arg && strstr(app,
"::")) {
2614 if (flags && application_interface->
flags) {
2615 *flags = application_interface->
flags;
2635 uint32_t ready = 0, sanity = 2000;
2641 }
while(!ready && sanity);
2645 "Cannot execute app '%s' media required on an outbound channel that does not have media established\n", app);
2669 char *expanded = NULL;
2670 const char *app, *app_uuid_var;
2675 char *app_uuid = uuid_str;
2678 app_uuid = (
char *)app_uuid_var;
2686 app = application_interface->interface_name;
2692 if (expanded && *expanded ==
'%' && (*(expanded+1) ==
'[' || *(expanded+2) ==
'[')) {
2705 if (expanded != arg) {
2729 }
else if (!
zstr(arg)) {
2750 for (lp = session->app_log; lp && lp->
next; lp = lp->
next);
2755 session->app_log = log;
2777 msg.
from = __FILE__;
2783 application_interface->application_function(session, expanded);
2798 if (expanded != arg) {
2810 const
char *context)
2814 int argc, x, count = 0;
2831 session->stack_count++;
2839 if (!
zstr(dialplan)) {
2843 if (!
zstr(context)) {
2851 for (x = 0; x < argc; x++) {
2852 char *dpname = dp[x];
2856 if ((dparg = strchr(dpname,
':'))) {
2869 extension = dialplan_interface->
hunt_function(session, dparg, new_profile);
2888 pp->
next = new_profile;
2910 session->stack_count--;
2917 session->loglevel = loglevel;
2924 return session->loglevel;
2929 stream->write_function(stream,
"Thread pool: running:%d busy:%d popping:%d\n",
2935 if (session->sdata) {
2939 memset(session->sdata, 0,
sizeof(*session->sdata));
struct apr_queue_t switch_queue_t
switch_status_t switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt,...)
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.
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)
void * switch_core_session_get_private_class(switch_core_session_t *session, switch_pvt_class_t index)
#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"...
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
void switch_channel_flush_dtmf(_In_ switch_channel_t *channel)
switch_queue_t * thread_queue
#define MESSAGE_STRING_ARG_MAX
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
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_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)
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)
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_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
static int switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
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_BEGIN_EXTERN_C int switch_status_is_timeup(int status)
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
#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_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)
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)
int32_t sessions_peak_fivemin
#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_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_mutex_t * video_codec_write_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_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
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.
uint32_t switch_core_session_messages_waiting(switch_core_session_t *session)
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)
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_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.
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_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
void * switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_ const char *key)
Delete data from a hash based on desired key.
#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
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.
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_mutex_t * video_codec_read_mutex
switch_queue_t * private_event_queue_pri
switch_status_t switch_core_session_request_video_refresh(switch_core_session_t *session)
struct switch_io_event_hook_state_change * next
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
struct apr_thread_mutex_t switch_mutex_t
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.
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.
void *SWITCH_THREAD_FUNC * switch_thread_start_t(switch_thread_t *, void *)
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)
struct apr_thread_t switch_thread_t
#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_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)
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_status_t switch_queue_push(switch_queue_t *queue, void *data)
struct apr_pool_t switch_memory_pool_t
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.
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
#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_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_thread_id_t thread_id
#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)
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.
#define SWITCH_SIZE_T_FMT
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_outgoing_channel_hook_t outgoing_channel
struct switch_app_log * next
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
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)