71 "%s Call statistics:\n"
73 "in_media_bytes: %d\n"
74 "in_packet_count: %d\n"
75 "in_media_packet_count: %d\n"
76 "in_skip_packet_count: %d\n"
77 "in_jitter_packet_count: %d\n"
78 "in_dtmf_packet_count: %d\n"
79 "in_cng_packet_count: %d\n"
80 "in_flush_packet_count: %d\n"
81 "in_largest_jb_size: %d\n\n"
82 "in_jitter_min_variance: %lf\n"
83 "in_jitter_max_variance: %lf\n"
84 "in_jitter_loss_rate: %lf\n"
85 "in_jitter_burst_rate: %lf\n"
86 "in_mean_interval: %lf\n\n"
88 "in_quality_percentage: %lf\n"
91 "out_media_bytes: %d\n"
92 "out_packet_count: %d\n"
93 "out_media_packet_count: %d\n"
94 "out_skip_packet_count: %d\n"
95 "out_dtmf_packet_count: %d\n"
96 "out_cng_packet_count: %d\n\n"
97 "rtcp_packet_count: %d\n"
98 "rtcp_octet_count: %d\n",
199 for (x = 0; other_session == NULL && x < 20; x++) {
233 char *expanded = NULL;
252 int argc, x, count = 0;
264 for (x = 0; x < argc; x++) {
265 char *dpname = dp[x];
269 if ((dparg = strchr(dpname,
':'))) {
281 extension = dialplan_interface->
hunt_function(session, dparg, NULL);
297 "No Dialplan on answered channel, changing state to HANGUP\n");
318 if (expanded && dpstr && expanded != dpstr) {
428 #define STATE_MACRO(__STATE, __STATE_STR) do { \
430 switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) State %s\n", switch_channel_get_name(session->channel), __STATE_STR); \
431 if (state < CS_HANGUP && switch_channel_get_callstate(session->channel) == CCS_UNHELD) { \
432 switch_channel_set_callstate(session->channel, CCS_ACTIVE); \
434 switch_core_session_request_video_refresh(session); \
435 switch_core_media_gen_key_frame(session); \
436 if (!driver_state_handler->on_##__STATE || (driver_state_handler->on_##__STATE(session) == SWITCH_STATUS_SUCCESS \
438 while (do_extra_handlers && (application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { \
439 if (!application_state_handler || !application_state_handler->on_##__STATE \
440 || (application_state_handler->on_##__STATE \
441 && application_state_handler->on_##__STATE(session) == SWITCH_STATUS_SUCCESS \
451 if (!proceed) global_proceed = 0; \
453 while (do_extra_handlers && proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) { \
454 if (!application_state_handler || !application_state_handler->on_##__STATE || \
455 (application_state_handler->on_##__STATE && \
456 application_state_handler->on_##__STATE(session) == SWITCH_STATUS_SUCCESS \
465 if (!proceed || midstate != switch_channel_get_state(session->channel)) global_proceed = 0; \
466 if (global_proceed) { \
467 switch_core_standard_on_##__STATE(session); \
470 switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) State %s going to sleep\n", switch_channel_get_name(session->channel), __STATE_STR); \
497 uint32_t new_loops = 500;
517 endpoint_interface = session->endpoint_interface;
538 int global_proceed = 1;
539 int do_extra_handlers = 1;
548 if (session->endpoint_interface->io_routines->state_run) {
549 rstatus = session->endpoint_interface->io_routines->state_run(session);
553 for (ptr = session->event_hooks.
state_run; ptr; ptr = ptr->
next) {
692 int global_proceed = 1;
693 int do_extra_handlers = 1;
704 endpoint_interface = session->endpoint_interface;
719 if (!
zstr(hook_var)) {
721 char *cmd = strdup(hook_var);
723 char *expanded = NULL;
725 if ((arg = strchr(cmd,
':')) && *(arg + 1) ==
':') {
729 if ((arg = strchr(cmd,
' '))) {
743 use_session ?
"with Session" :
"with no Session", cmd,
switch_str_nil(expanded),
746 if (expanded != arg) {
763 int global_proceed = 1;
764 int do_extra_handlers = 1;
771 const char *hook_var;
792 endpoint_interface = session->endpoint_interface;
821 api_hook(session, hook_var, use_session);
837 int global_proceed = 1;
838 int do_extra_handlers = 1;
843 const char *hook_var;
856 endpoint_interface = session->endpoint_interface;
863 if (!strcasecmp(var,
"a_only")) {
865 do_extra_handlers = 0;
867 }
else if (!strcasecmp(var,
"b_only")) {
869 do_extra_handlers = 0;
872 do_extra_handlers = 0;
877 if (!
zstr(skip_var)) {
879 char *list[128] = { 0 };
884 for(x = 0; x < ttl; x++) {
886 do_extra_handlers = 0;
893 do_extra_handlers = 0;
905 api_hook(session, hook_var, use_session);
switch_status_t switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt,...)
void switch_core_session_hangup_state(switch_core_session_t *session, switch_bool_t force)
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_xml_free(_In_opt_ switch_xml_t xml)
frees the memory allocated for an switch_xml structure
switch_caller_extension_t * switch_channel_get_caller_extension(switch_channel_t *channel)
Retrieve caller extension from a given channel.
switch_event_t * param_event
#define SWITCH_CHANNEL_SESSION_LOG(x)
#define switch_event_expand_headers(_event, _in)
An Abstract Representation of a dialplan extension.
void switch_core_session_reporting_state(switch_core_session_t *session)
char * switch_xml_toxml(_In_ switch_xml_t xml, _In_ switch_bool_t prn_header)
Converts an switch_xml structure back to xml in html format. Returns a string of html data that \ mus...
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
switch_rtp_numbers_t inbound
switch_status_t switch_channel_set_timestamps(_In_ switch_channel_t *channel)
switch_core_session_message_types_t message_id
void switch_core_session_reset(_In_ switch_core_session_t *session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec)
Reset the buffers and resampler on a session.
void switch_channel_set_hangup_time(switch_channel_t *channel)
Abstraction of an module endpoint interface This is the glue between the abstract idea of a "channel"...
const char * switch_channel_get_partner_uuid(switch_channel_t *channel)
#define switch_channel_set_state(channel, state)
Set the current state of a channel.
const char * switch_channel_cause2str(_In_ switch_call_cause_t cause)
return a cause string for a given cause
static void switch_core_standard_on_hibernate(switch_core_session_t *session)
#define switch_channel_stop_broadcast(_channel)
#define switch_channel_up(_channel)
void switch_channel_state_thread_lock(switch_channel_t *channel)
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.
#define switch_channel_presence(_a, _b, _c, _d)
static void switch_core_standard_on_destroy(switch_core_session_t *session)
switch_size_t largest_jb_size
#define switch_split(_data, _delim, _array)
static void check_presence(switch_core_session_t *session)
switch_status_t switch_api_execute(const char *cmd, const char *arg, switch_core_session_t *session, switch_stream_handle_t *stream)
Execute a registered API command.
switch_memory_pool_t * pool
Representation of an event.
#define switch_channel_ready(_channel)
switch_status_t switch_event_add_body(switch_event_t *event, const char *fmt,...) PRINTF_FUNCTION(2
Add a body to an event.
An Abstract Representation of a dialplan Application.
static void switch_core_standard_on_execute(switch_core_session_t *session)
switch_status_t switch_ivr_park(switch_core_session_t *session, switch_input_args_t *args)
switch_channel_state_t switch_channel_get_running_state(switch_channel_t *channel)
A representation of an XML tree.
void switch_channel_clear_device_record(switch_channel_t *channel)
Abstract interface to a dialplan module.
switch_status_t switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex)
const char * switch_channel_state_name(_In_ switch_channel_state_t state)
Render the name of the provided state enum.
#define switch_core_session_get_name(_s)
static void switch_core_standard_on_exchange_media(switch_core_session_t *session)
switch_size_t media_bytes
switch_status_t switch_ivr_parse_all_events(switch_core_session_t *session)
Parse all commands from an event.
void switch_channel_process_device_hangup(switch_channel_t *channel)
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_size_t dtmf_packet_count
struct switch_runtime runtime
static int switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
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.
struct switch_io_event_hook_state_run * next
#define SWITCH_SKIP_CDR_CAUSES_VARIABLE
A message object designed to allow unlike technologies to exchange data.
switch_caller_profile_t * switch_channel_get_originatee_caller_profile(switch_channel_t *channel)
Retrieve the given channel's originatee caller profile.
struct switch_caller_application * next
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
#define switch_core_session_execute_application(_a, _b, _c)
Execute an application on a session.
_Ret_ switch_channel_t * switch_core_session_get_channel(_In_ switch_core_session_t *session)
Retrieve a pointer to the channel object associated with a given session.
#define UNPROTECT_INTERFACE(_it)
switch_state_handler_table_t * state_handler
#define switch_clear_flag(obj, flag)
Clear a flag on an arbitrary object while locked.
static void switch_core_standard_on_consume_media(switch_core_session_t *session)
switch_rtcp_numbers_t rtcp
#define SWITCH_PROCESS_CDR_VARIABLE
#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
static void switch_core_standard_on_init(switch_core_session_t *session)
switch_dialplan_hunt_function_t hunt_function
void switch_core_recovery_untrack(switch_core_session_t *session, switch_bool_t force)
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
#define SWITCH_API_REPORTING_HOOK_VARIABLE
#define switch_channel_get_variable(_c, _v)
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.
#define switch_channel_set_running_state(channel, state)
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
switch_rtp_numbers_t outbound
switch_status_t switch_ivr_uuid_bridge(const char *originator_uuid, const char *originatee_uuid)
Bridge two existing sessions.
switch_status_t switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event)
#define SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE
Node in which to store state run callback hooks.
static void switch_core_standard_on_park(switch_core_session_t *session)
switch_call_cause_t switch_channel_str2cause(_In_ const char *str)
return a cause code for a given string
void switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension)
Assign a caller extension to a given channel.
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1]
#define SWITCH_STANDARD_STREAM(s)
void switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout)
switch_size_t packet_count
switch_caller_application_t * current_application
#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)
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
switch_size_t jb_packet_count
static void switch_core_standard_on_soft_execute(switch_core_session_t *session)
switch_size_t skip_packet_count
#define switch_str_nil(s)
Make a null string a blank string instead.
static void switch_core_standard_on_reset(switch_core_session_t *session)
switch_caller_extension_t * switch_channel_get_queued_extension(switch_channel_t *channel)
static void switch_core_standard_on_reporting(switch_core_session_t *session)
switch_channel_state_t
Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are ...
#define switch_channel_expand_variables(_channel, _in)
void switch_core_session_run(switch_core_session_t *session)
#define switch_channel_set_callstate(channel, state)
switch_status_t
Common return values.
switch_dialplan_interface_t * switch_loadable_module_get_dialplan_interface(const char *name)
Retrieve the dialplan interface by it's registered name.
#define switch_core_session_locate(uuid_str)
Locate a session based on it's uuid.
#define switch_core_media_bug_remove_all(_s)
switch_call_cause_t switch_channel_get_cause_q850(switch_channel_t *channel)
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
switch_size_t flush_packet_count
#define switch_channel_set_flag(_c, _f)
switch_size_t media_packet_count
switch_call_direction_t switch_channel_direction(switch_channel_t *channel)
static void switch_core_standard_on_hangup(switch_core_session_t *session)
static void switch_core_standard_on_routing(switch_core_session_t *session)
static void api_hook(switch_core_session_t *session, const char *hook_var, int use_session)
struct apr_pool_t switch_memory_pool_t
switch_state_run_hook_t state_run
#define STATE_MACRO(__STATE, __STATE_STR)
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
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.
#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)
void switch_channel_state_thread_unlock(switch_channel_t *channel)
switch_status_t switch_channel_wait_for_flag(switch_channel_t *channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint32_t to, switch_channel_t *super_channel)
void switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Clear given flag(s) from a channel.
switch_status_t switch_ivr_signal_bridge(switch_core_session_t *session, switch_core_session_t *peer_session)
Bridge Signalling from one session to another.
#define switch_channel_set_variable(_channel, _var, _val)
switch_status_t switch_ivr_generate_xml_cdr(switch_core_session_t *session, switch_xml_t *xml_cdr)
Generate an XML CDR report.
#define SWITCH_API_HANGUP_HOOK_VARIABLE
switch_caller_profile_t * switch_channel_get_caller_profile(switch_channel_t *channel)
Retrieve the given channel's caller profile.
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.
switch_memory_pool_t * switch_core_session_get_pool(_In_ switch_core_session_t *session)
Retrieve the memory pool from a session.
void switch_core_session_destroy_state(switch_core_session_t *session)
switch_call_cause_t switch_channel_get_cause(_In_ switch_channel_t *channel)
return the cause code for a given channel
switch_caller_profile_t * switch_channel_get_originator_caller_profile(switch_channel_t *channel)
Retrieve the given channel's originator caller profile.
void switch_core_state_machine_init(switch_memory_pool_t *pool)
switch_size_t cng_packet_count
switch_status_t switch_ivr_parse_all_messages(switch_core_session_t *session)