RTS API Documentation  1.10.11
Macros | Functions
switch_core_state_machine.c File Reference
#include <switch.h>
#include "private/switch_core_pvt.h"
+ Include dependency graph for switch_core_state_machine.c:

Go to the source code of this file.

Macros

#define STATE_MACRO(__STATE, __STATE_STR)
 

Functions

static void switch_core_standard_on_init (switch_core_session_t *session)
 
static void switch_core_standard_on_hangup (switch_core_session_t *session)
 
static void switch_core_standard_on_reporting (switch_core_session_t *session)
 
static void switch_core_standard_on_destroy (switch_core_session_t *session)
 
static void switch_core_standard_on_reset (switch_core_session_t *session)
 
static void switch_core_standard_on_routing (switch_core_session_t *session)
 
static void switch_core_standard_on_execute (switch_core_session_t *session)
 
static void switch_core_standard_on_exchange_media (switch_core_session_t *session)
 
static void switch_core_standard_on_soft_execute (switch_core_session_t *session)
 
static void switch_core_standard_on_park (switch_core_session_t *session)
 
static void switch_core_standard_on_consume_media (switch_core_session_t *session)
 
static void switch_core_standard_on_hibernate (switch_core_session_t *session)
 
void switch_core_state_machine_init (switch_memory_pool_t *pool)
 
static void check_presence (switch_core_session_t *session)
 
void switch_core_session_run (switch_core_session_t *session)
 
void switch_core_session_destroy_state (switch_core_session_t *session)
 
static void api_hook (switch_core_session_t *session, const char *hook_var, int use_session)
 
void switch_core_session_hangup_state (switch_core_session_t *session, switch_bool_t force)
 
void switch_core_session_reporting_state (switch_core_session_t *session)
 

Macro Definition Documentation

◆ STATE_MACRO

#define STATE_MACRO (   __STATE,
  __STATE_STR 
)

Function Documentation

◆ api_hook()

static void api_hook ( switch_core_session_t session,
const char *  hook_var,
int  use_session 
)
static

Definition at line 752 of file switch_core_state_machine.c.

References switch_core_session::channel, switch_stream_handle::data, switch_stream_handle::param_event, switch_api_execute(), switch_channel_event_set_data(), switch_channel_get_variables(), SWITCH_CHANNEL_SESSION_LOG, switch_event_expand_headers, SWITCH_LOG_DEBUG, switch_log_printf(), switch_safe_free, SWITCH_STANDARD_STREAM, switch_str_nil, and zstr.

Referenced by switch_core_session_hangup_state(), and switch_core_session_reporting_state().

753 {
754  if (!zstr(hook_var)) {
756  char *cmd = strdup(hook_var);
757  char *arg = NULL;
758  char *expanded = NULL;
759 
760  if ((arg = strchr(cmd, ':')) && *(arg + 1) == ':') {
761  *arg++ = '\0';
762  *arg++ = '\0';
763  } else {
764  if ((arg = strchr(cmd, ' '))) {
765  *arg++ = '\0';
766  }
767  }
768 
769  SWITCH_STANDARD_STREAM(stream);
770 
773  expanded = switch_event_expand_headers(stream.param_event, arg);
774 
775  switch_api_execute(cmd, expanded, use_session ? session : NULL, &stream);
776 
777  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Hangup Command %s %s(%s):\n%s\n",
778  use_session ? "with Session" : "with no Session", cmd, switch_str_nil(expanded),
779  switch_str_nil((char *) stream.data) );
780 
781  if (expanded != arg) {
782  switch_safe_free(expanded);
783  }
784 
785  switch_safe_free(cmd);
786 
787  switch_safe_free(stream.data);
788  }
789 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
#define switch_event_expand_headers(_event, _in)
Definition: switch_event.h:355
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_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.
#define zstr(x)
Definition: switch_utils.h:314
switch_channel_t * channel
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
Definition: switch_utils.h:885
switch_status_t switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event)
switch_stream_handle_t * stream
#define SWITCH_STANDARD_STREAM(s)
#define switch_str_nil(s)
Make a null string a blank string instead.
Definition: switch_utils.h:993
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.

◆ check_presence()

static void check_presence ( switch_core_session_t session)
static

Definition at line 512 of file switch_core_state_machine.c.

References switch_core_session::channel, CS_HANGUP, CS_ROUTING, SWITCH_CAUSE_LOSE_RACE, switch_channel_get_cause(), switch_channel_get_running_state(), switch_channel_presence, switch_channel_set_variable, and switch_channel_state_name().

Referenced by switch_core_session_run().

513 {
515 
516  if (state == CS_ROUTING || state == CS_HANGUP) {
518  switch_channel_presence(session->channel, "unknown", "cancelled", NULL);
519  switch_channel_set_variable(session->channel, "presence_call_info", NULL);
520  } else {
521  switch_channel_presence(session->channel, "unknown", switch_channel_state_name(state), NULL);
522  }
523  }
524 }
#define switch_channel_presence(_a, _b, _c, _d)
switch_channel_state_t switch_channel_get_running_state(switch_channel_t *channel)
const char * switch_channel_state_name(_In_ switch_channel_state_t state)
Render the name of the provided state enum.
switch_channel_t * channel
switch_channel_state_t
Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are ...
#define switch_channel_set_variable(_channel, _var, _val)
switch_call_cause_t switch_channel_get_cause(_In_ switch_channel_t *channel)
return the cause code for a given channel

◆ switch_core_session_run()

void switch_core_session_run ( switch_core_session_t session)

Definition at line 528 of file switch_core_state_machine.c.

References CF_BLOCK_STATE, CF_NO_CDR, CF_REDIRECT, CF_STATE_REPEAT, CF_THREAD_SLEEPING, CF_TRANSFER, CF_VIDEO, switch_core_session::channel, check_presence(), switch_core_session::cond, CS_CONSUME_MEDIA, CS_DESTROY, CS_EXCHANGE_MEDIA, CS_EXECUTE, CS_HANGUP, CS_HIBERNATE, CS_INIT, CS_NEW, CS_NONE, CS_PARK, CS_REPORTING, CS_RESET, CS_ROUTING, CS_SOFT_EXECUTE, switch_core_session::endpoint_interface, db_job::event, switch_core_session::event_hooks, index, switch_endpoint_interface::io_routines, switch_core_session::mutex, switch_io_event_hook_state_run::next, SSF_THREAD_RUNNING, switch_endpoint_interface::state_handler, STATE_MACRO, switch_io_event_hook_state_run::state_run, switch_io_routines::state_run, switch_assert, SWITCH_CALL_DIRECTION_OUTBOUND, SWITCH_CAUSE_WRONG_CALL_STATE, switch_channel_clear_flag(), switch_channel_direction(), switch_channel_event_set_data(), switch_channel_get_name(), switch_channel_get_running_state(), switch_channel_get_state(), switch_channel_hangup, SWITCH_CHANNEL_SESSION_LOG, switch_channel_set_flag, switch_channel_set_running_state, switch_channel_set_state, switch_channel_state_name(), switch_channel_state_thread_lock(), switch_channel_state_thread_unlock(), switch_channel_test_flag(), switch_channel_wait_for_flag(), switch_clear_flag, switch_core_session_get_name, switch_core_session_hangup_state(), switch_core_session_reporting_state(), switch_core_session_wake_video_thread(), SWITCH_EVENT_CHANNEL_CREATE, SWITCH_EVENT_CHANNEL_ORIGINATE, switch_event_create, switch_event_fire, SWITCH_FALSE, switch_ivr_parse_all_events(), switch_ivr_parse_all_messages(), SWITCH_LOG_DEBUG, SWITCH_LOG_DEBUG1, switch_log_printf(), SWITCH_LOG_WARNING, switch_mutex_lock(), switch_mutex_unlock(), switch_set_flag, SWITCH_STATUS_SUCCESS, switch_thread_cond_wait(), SWITCH_TRUE, switch_yield, and switch_core_session::uuid_str.

529 {
530  switch_channel_state_t state = CS_NEW, midstate = CS_DESTROY, endstate;
531  const switch_endpoint_interface_t *endpoint_interface;
532  const switch_state_handler_table_t *driver_state_handler = NULL;
533  const switch_state_handler_table_t *application_state_handler = NULL;
534  int silly = 0;
535  uint32_t new_loops = 500;
536 
537  /*
538  Life of the channel. you have channel and pool in your session
539  everywhere you go you use the session to malloc with
540  switch_core_session_alloc(session, <size>)
541 
542  The endpoint module gets the first crack at implementing the state
543  if it wants to, it can cancel the default behavior by returning SWITCH_STATUS_FALSE
544 
545  Next comes the channel's event handler table that can be set by an application
546  which also can veto the next behavior in line by returning SWITCH_STATUS_FALSE
547 
548  Finally the default state behavior is called.
549 
550 
551  */
552  switch_assert(session != NULL);
553 
555  endpoint_interface = session->endpoint_interface;
556  switch_assert(endpoint_interface != NULL);
557 
558  driver_state_handler = endpoint_interface->state_handler;
559  switch_assert(driver_state_handler != NULL);
560 
561  switch_mutex_lock(session->mutex);
562 
563  while ((state = switch_channel_get_state(session->channel)) != CS_DESTROY) {
564 
567  if ((state = switch_channel_get_state(session->channel)) == CS_DESTROY) {
568  break;
569  }
570  }
571 
572  midstate = state;
573  if (state != switch_channel_get_running_state(session->channel) || state >= CS_HANGUP) {
574  int index = 0;
575  int proceed = 1;
576  int global_proceed = 1;
577  int do_extra_handlers = 1;
580 
581  switch_channel_set_running_state(session->channel, state);
585 
586  if (session->endpoint_interface->io_routines->state_run) {
587  rstatus = session->endpoint_interface->io_routines->state_run(session);
588  }
589 
590  if (rstatus == SWITCH_STATUS_SUCCESS) {
591  for (ptr = session->event_hooks.state_run; ptr; ptr = ptr->next) {
592  if (ptr->state_run(session) != SWITCH_STATUS_SUCCESS) {
593  break;
594  }
595  }
596  }
597 
598  switch (state) {
599  case CS_NEW: /* Just created, Waiting for first instructions */
601  break;
602  case CS_DESTROY:
603  goto done;
604  case CS_REPORTING: /* Call Detail */
605  {
608  }
609  goto done;
610  case CS_HANGUP: /* Deactivate and end the thread */
611  {
613  if (switch_channel_test_flag(session->channel, CF_VIDEO)) {
615  }
617  }
618 
619  break;
620  case CS_INIT: /* Basic setup tasks */
621  {
622  switch_event_t *event;
623 
624  STATE_MACRO(init, "INIT");
625 
627  switch_channel_event_set_data(session->channel, event);
628  switch_event_fire(&event);
629  }
630 
633  switch_channel_event_set_data(session->channel, event);
634  switch_event_fire(&event);
635  }
636  }
637  }
638  break;
639  case CS_ROUTING: /* Look for a dialplan and find something to do */
640  STATE_MACRO(routing, "ROUTING");
641  break;
642  case CS_RESET: /* Reset */
643  STATE_MACRO(reset, "RESET");
644  break;
645  /* These other states are intended for prolonged durations so we do not signal lock for them */
646  case CS_EXECUTE: /* Execute an Operation */
647  STATE_MACRO(execute, "EXECUTE");
648  break;
649  case CS_EXCHANGE_MEDIA: /* loop all data back to source */
650  STATE_MACRO(exchange_media, "EXCHANGE_MEDIA");
651  break;
652  case CS_SOFT_EXECUTE: /* send/recieve data to/from another channel */
653  STATE_MACRO(soft_execute, "SOFT_EXECUTE");
654  break;
655  case CS_PARK: /* wait in limbo */
656  STATE_MACRO(park, "PARK");
657  break;
658  case CS_CONSUME_MEDIA: /* wait in limbo */
659  STATE_MACRO(consume_media, "CONSUME_MEDIA");
660  break;
661  case CS_HIBERNATE: /* sleep */
662  STATE_MACRO(hibernate, "HIBERNATE");
663  break;
664  case CS_NONE:
665  abort();
666  break;
667  }
668 
669  check_presence(session);
670 
671  if (midstate == CS_DESTROY) {
672  break;
673  }
674 
675  }
676 
677  endstate = switch_channel_get_state(session->channel);
678 
679  if (endstate == switch_channel_get_running_state(session->channel)) {
680  if (endstate == CS_NEW) {
681  switch_yield(20000);
683  if (!--new_loops) {
684  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s %s Abandoned\n",
685  session->uuid_str, switch_core_session_get_name(session));
688  }
689  } else {
691 
693 
696  } else if (switch_channel_get_state(session->channel) == switch_channel_get_running_state(session->channel)) {
698  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s session thread sleep state: %s!\n",
701  switch_thread_cond_wait(session->cond, session->mutex);
702  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s session thread wake state: %s!\n",
706  }
707 
709 
711  }
712  }
713  }
714  done:
715  switch_mutex_unlock(session->mutex);
716 
718 }
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.
Definition: switch_event.h:413
#define switch_channel_hangup(channel, hangup_cause)
Hangup a channel flagging it&#39;s state machine to end.
#define SWITCH_CHANNEL_SESSION_LOG(x)
void switch_core_session_reporting_state(switch_core_session_t *session)
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
Definition: switch_utils.h:700
switch_io_state_run_t state_run
Abstraction of an module endpoint interface This is the glue between the abstract idea of a "channel"...
#define switch_channel_set_state(channel, state)
Set the current state of a 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.
static void check_presence(switch_core_session_t *session)
Representation of an event.
Definition: switch_event.h:80
switch_io_routines_t * io_routines
switch_channel_state_t switch_channel_get_running_state(switch_channel_t *channel)
switch_status_t switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex)
Definition: switch_apr.c:378
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)
Definition: switch_core.h:265
switch_status_t switch_ivr_parse_all_events(switch_core_session_t *session)
Parse all commands from an event.
Definition: switch_ivr.c:913
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
switch_io_event_hooks_t event_hooks
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
Definition: switch_apr.c:313
switch_state_handler_table_t * state_handler
#define switch_clear_flag(obj, flag)
Clear a flag on an arbitrary object while locked.
Definition: switch_utils.h:724
#define switch_yield(ms)
Wait a desired number of microseconds and yield the CPU.
Definition: switch_utils.h:998
switch_channel_t * channel
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
Definition: switch_apr.c:308
int index
Definition: switch_cJSON.h:160
#define switch_channel_set_running_state(channel, state)
Node in which to store state run callback hooks.
switch_thread_cond_t * cond
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1]
switch_channel_state_t
Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are ...
switch_status_t
Common return values.
void switch_core_session_wake_video_thread(switch_core_session_t *session)
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
Definition: switch_event.h:384
#define switch_channel_set_flag(_c, _f)
switch_call_direction_t switch_channel_direction(switch_channel_t *channel)
switch_mutex_t * mutex
#define STATE_MACRO(__STATE, __STATE_STR)
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.
switch_endpoint_interface_t * endpoint_interface
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.
#define switch_assert(expr)
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.
switch_status_t switch_ivr_parse_all_messages(switch_core_session_t *session)
Definition: switch_ivr.c:847

◆ switch_core_standard_on_consume_media()

static void switch_core_standard_on_consume_media ( switch_core_session_t session)
static

Definition at line 408 of file switch_core_state_machine.c.

References switch_core_session::channel, switch_assert, switch_channel_get_name(), SWITCH_CHANNEL_SESSION_LOG, SWITCH_LOG_DEBUG, and switch_log_printf().

409 {
410  switch_assert(session != NULL);
411  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard CONSUME_MEDIA\n", switch_channel_get_name(session->channel));
412 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_channel_t * channel
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_assert(expr)
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.

◆ switch_core_standard_on_destroy()

static void switch_core_standard_on_destroy ( switch_core_session_t session)
static

Definition at line 172 of file switch_core_state_machine.c.

References switch_core_session::channel, switch_channel_get_name(), SWITCH_CHANNEL_SESSION_LOG, SWITCH_LOG_DEBUG, and switch_log_printf().

173 {
174 
176 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_channel_t * channel
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.
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.

◆ switch_core_standard_on_exchange_media()

static void switch_core_standard_on_exchange_media ( switch_core_session_t session)
static

Definition at line 388 of file switch_core_state_machine.c.

References switch_core_session::channel, switch_channel_get_name(), SWITCH_CHANNEL_SESSION_LOG, SWITCH_LOG_DEBUG, and switch_log_printf().

389 {
390 
391  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard EXCHANGE_MEDIA\n", switch_channel_get_name(session->channel));
392 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_channel_t * channel
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.
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.

◆ switch_core_standard_on_execute()

static void switch_core_standard_on_execute ( switch_core_session_t session)
static

Definition at line 318 of file switch_core_state_machine.c.

References switch_caller_application::application_data, switch_caller_application::application_name, CF_CONFIRM_BLIND_TRANSFER, CF_RECOVERED, CF_RECOVERING, CF_RESET, switch_core_session::channel, CS_EXECUTE, CS_PARK, switch_caller_extension::current_application, switch_core_session_message::from, switch_core_session_message::message_id, switch_caller_application::next, switch_core_session_message::numeric_arg, SWITCH_CAUSE_NORMAL_CLEARING, switch_channel_audio_sync, switch_channel_clear_flag(), switch_channel_get_caller_extension(), switch_channel_get_name(), switch_channel_get_state(), switch_channel_get_variable, switch_channel_hangup, switch_channel_ready, SWITCH_CHANNEL_SESSION_LOG, switch_channel_set_flag, switch_channel_set_state, switch_channel_set_variable, switch_channel_test_flag(), switch_channel_video_sync, switch_core_session_execute_application, switch_core_session_get_uuid(), switch_core_session_locate, switch_core_session_receive_message, switch_core_session_rwunlock(), switch_core_session_video_reset(), SWITCH_LOG_DEBUG, SWITCH_LOG_NOTICE, switch_log_printf(), SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE, and SWITCH_STATUS_SUCCESS.

319 {
320  switch_caller_extension_t *extension;
321  const char *uuid;
322 
324 
326 
327  switch_channel_set_variable(session->channel, "call_uuid", switch_core_session_get_uuid(session));
328 
329  if (switch_channel_get_variable(session->channel, "recovered") && !switch_channel_test_flag(session->channel, CF_RECOVERED)) {
331  }
332 
333  top:
335 
339 
340  if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {
342  return;
343  }
344 
345  while (switch_channel_get_state(session->channel) == CS_EXECUTE && extension->current_application) {
346  switch_caller_application_t *current_application = extension->current_application;
347 
348  extension->current_application = extension->current_application->next;
349 
351  current_application->application_name,
352  current_application->application_data) != SWITCH_STATUS_SUCCESS) {
353  return;
354  }
355 
356  if (switch_channel_test_flag(session->channel, CF_RESET)) {
357  goto top;
358  }
359 
360  }
361 
364  (uuid = switch_channel_get_variable(session->channel, "blind_transfer_uuid"))) {
365  switch_core_session_t *other_session;
366 
367  if ((other_session = switch_core_session_locate(uuid))) {
368  switch_core_session_message_t msg = { 0 };
370  msg.from = __FILE__;
371  msg.numeric_arg = 0;
372  switch_core_session_receive_message(other_session, &msg);
373  switch_core_session_rwunlock(other_session);
374 
375  switch_channel_set_variable(session->channel, "park_timeout", "10:blind_transfer");
378  }
379  }
380 
382  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "%s has executed the last dialplan instruction, hanging up.\n",
383  switch_channel_get_name(session->channel));
385  }
386 }
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_channel_hangup(channel, hangup_cause)
Hangup a channel flagging it&#39;s state machine to end.
switch_caller_extension_t * switch_channel_get_caller_extension(switch_channel_t *channel)
Retrieve caller extension from a given channel.
#define SWITCH_CHANNEL_SESSION_LOG(x)
An Abstract Representation of a dialplan extension.
switch_core_session_message_types_t message_id
Definition: switch_core.h:183
#define switch_channel_set_state(channel, state)
Set the current state of a channel.
#define switch_channel_ready(_channel)
An Abstract Representation of a dialplan Application.
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.
A message object designed to allow unlike technologies to exchange data.
Definition: switch_core.h:179
struct switch_caller_application * next
#define switch_core_session_execute_application(_a, _b, _c)
Execute an application on a session.
Definition: switch_core.h:1129
#define switch_channel_audio_sync(_c)
switch_channel_t * channel
#define switch_channel_get_variable(_c, _v)
#define switch_channel_video_sync(_c)
switch_caller_application_t * current_application
#define switch_core_session_receive_message(_session, _message)
Definition: switch_core.h:1247
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.
#define switch_core_session_locate(uuid_str)
Locate a session based on it&#39;s uuid.
Definition: switch_core.h:932
#define switch_channel_set_flag(_c, _f)
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.
void switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Clear given flag(s) from a channel.
#define switch_channel_set_variable(_channel, _var, _val)
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.

◆ switch_core_standard_on_hangup()

static void switch_core_standard_on_hangup ( switch_core_session_t session)
static

Definition at line 55 of file switch_core_state_machine.c.

References switch_caller_application::application_data, switch_caller_application::application_name, switch_rtp_numbers_t::burstrate, CF_RECOVERING, CF_ZOMBIE_EXEC, switch_core_session::channel, switch_rtp_numbers_t::cng_packet_count, switch_caller_extension::current_application, switch_rtp_numbers_t::dtmf_packet_count, switch_rtp_numbers_t::flaws, switch_rtp_numbers_t::flush_packet_count, switch_rtp_stats_t::inbound, switch_rtp_numbers_t::jb_packet_count, switch_rtp_numbers_t::largest_jb_size, switch_rtp_numbers_t::lossrate, switch_rtp_numbers_t::max_variance, switch_rtp_numbers_t::mean_interval, switch_rtp_numbers_t::media_bytes, switch_rtp_numbers_t::media_packet_count, switch_rtp_numbers_t::min_variance, switch_rtp_numbers_t::mos, switch_caller_application::next, switch_rtcp_numbers_t::octet_count, switch_rtp_stats_t::outbound, switch_rtp_numbers_t::packet_count, switch_rtcp_numbers_t::packet_count, switch_rtp_numbers_t::R, switch_rtp_numbers_t::raw_bytes, switch_rtp_stats_t::rtcp, switch_rtp_numbers_t::skip_packet_count, switch_channel_cause2str(), switch_channel_clear_flag(), switch_channel_get_caller_extension(), switch_channel_get_cause(), switch_channel_get_name(), switch_channel_get_variable, SWITCH_CHANNEL_SESSION_LOG, switch_channel_test_flag(), switch_core_media_get_stats(), switch_core_media_set_stats(), switch_core_recovery_untrack(), switch_core_session_execute_application, switch_core_session_get_pool(), SWITCH_LOG_DEBUG, switch_log_printf(), SWITCH_LOG_WARNING, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_STATUS_IGNORE, SWITCH_STATUS_SUCCESS, SWITCH_TRUE, and switch_true().

56 {
57  switch_caller_extension_t *extension;
58 
59  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard HANGUP, cause: %s\n",
61 
62  if (switch_true(switch_channel_get_variable(session->channel, "log_audio_stats_on_hangup"))) {
63  switch_rtp_stats_t *audio_stats = NULL;
64 
67  if (audio_stats) {
70  "%s Call statistics:\n"
71  "in_raw_bytes: %d\n"
72  "in_media_bytes: %d\n"
73  "in_packet_count: %d\n"
74  "in_media_packet_count: %d\n"
75  "in_skip_packet_count: %d\n"
76  "in_jitter_packet_count: %d\n"
77  "in_dtmf_packet_count: %d\n"
78  "in_cng_packet_count: %d\n"
79  "in_flush_packet_count: %d\n"
80  "in_largest_jb_size: %d\n\n"
81  "in_jitter_min_variance: %lf\n"
82  "in_jitter_max_variance: %lf\n"
83  "in_jitter_loss_rate: %lf\n"
84  "in_jitter_burst_rate: %lf\n"
85  "in_mean_interval: %lf\n\n"
86  "in_flaw_total: %d\n"
87  "in_quality_percentage: %lf\n"
88  "in_mos: %lf\n\n"
89  "out_raw_bytes: %d\n"
90  "out_media_bytes: %d\n"
91  "out_packet_count: %d\n"
92  "out_media_packet_count: %d\n"
93  "out_skip_packet_count: %d\n"
94  "out_dtmf_packet_count: %d\n"
95  "out_cng_packet_count: %d\n\n"
96  "rtcp_packet_count: %d\n"
97  "rtcp_octet_count: %d\n",
99  (int)audio_stats->inbound.raw_bytes,
100  (int)audio_stats->inbound.media_bytes,
101  (int)audio_stats->inbound.packet_count,
102  (int)audio_stats->inbound.media_packet_count,
103  (int)audio_stats->inbound.skip_packet_count,
104  (int)audio_stats->inbound.jb_packet_count,
105  (int)audio_stats->inbound.dtmf_packet_count,
106  (int)audio_stats->inbound.cng_packet_count,
107  (int)audio_stats->inbound.flush_packet_count,
108  (int)audio_stats->inbound.largest_jb_size,
109  audio_stats->inbound.min_variance,
110  audio_stats->inbound.max_variance,
111  audio_stats->inbound.lossrate,
112  audio_stats->inbound.burstrate,
113  audio_stats->inbound.mean_interval,
114  (int)audio_stats->inbound.flaws,
115  audio_stats->inbound.R,
116  audio_stats->inbound.mos,
117  (int)audio_stats->outbound.raw_bytes,
118  (int)audio_stats->outbound.media_bytes,
119  (int)audio_stats->outbound.packet_count,
120  (int)audio_stats->outbound.media_packet_count,
121  (int)audio_stats->outbound.skip_packet_count,
122  (int)audio_stats->outbound.dtmf_packet_count,
123  (int)audio_stats->outbound.cng_packet_count,
124  (int)audio_stats->rtcp.packet_count,
125  (int)audio_stats->rtcp.octet_count
126  );
127  } else {
128  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Missing call statistics!\n",
129  switch_channel_get_name(session->channel));
130  }
131  }
132 
135 
137  return;
138  }
139 
140  if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {
141  return;
142  }
143 
144  while(extension->current_application) {
145  switch_caller_application_t *current_application = extension->current_application;
146  switch_status_t status;
147 
148  extension->current_application = extension->current_application->next;
149 
151  current_application->application_name, current_application->application_data);
152 
153 
154  if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_IGNORE) {
155  return;
156  }
157  }
158 
159 
160 
161 
162 
163 }
switch_size_t flaws
Definition: switch_types.h:712
switch_caller_extension_t * switch_channel_get_caller_extension(switch_channel_t *channel)
Retrieve caller extension from a given channel.
static switch_bool_t switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
Definition: switch_utils.h:519
#define SWITCH_CHANNEL_SESSION_LOG(x)
An Abstract Representation of a dialplan extension.
switch_rtp_numbers_t inbound
Definition: switch_types.h:760
switch_rtp_stats_t * switch_core_media_get_stats(switch_core_session_t *session, switch_media_type_t type, switch_memory_pool_t *pool)
const char * switch_channel_cause2str(_In_ switch_call_cause_t cause)
return a cause string for a given cause
switch_size_t largest_jb_size
Definition: switch_types.h:692
An Abstract Representation of a dialplan Application.
switch_size_t media_bytes
Definition: switch_types.h:683
switch_size_t dtmf_packet_count
Definition: switch_types.h:689
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_caller_application * next
#define switch_core_session_execute_application(_a, _b, _c)
Execute an application on a session.
Definition: switch_core.h:1129
switch_rtcp_numbers_t rtcp
Definition: switch_types.h:762
switch_channel_t * channel
switch_size_t raw_bytes
Definition: switch_types.h:682
void switch_core_recovery_untrack(switch_core_session_t *session, switch_bool_t force)
#define switch_channel_get_variable(_c, _v)
switch_rtp_numbers_t outbound
Definition: switch_types.h:761
switch_size_t packet_count
Definition: switch_types.h:684
switch_caller_application_t * current_application
switch_size_t jb_packet_count
Definition: switch_types.h:688
switch_size_t skip_packet_count
Definition: switch_types.h:687
void switch_core_media_set_stats(switch_core_session_t *session)
switch_status_t
Common return values.
switch_size_t flush_packet_count
Definition: switch_types.h:691
switch_size_t media_packet_count
Definition: switch_types.h:686
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.
void switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Clear given flag(s) from a channel.
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.
switch_call_cause_t switch_channel_get_cause(_In_ switch_channel_t *channel)
return the cause code for a given channel
switch_size_t cng_packet_count
Definition: switch_types.h:690

◆ switch_core_standard_on_hibernate()

static void switch_core_standard_on_hibernate ( switch_core_session_t session)
static

Definition at line 414 of file switch_core_state_machine.c.

References switch_core_session::channel, switch_assert, switch_channel_get_name(), SWITCH_CHANNEL_SESSION_LOG, SWITCH_LOG_DEBUG, and switch_log_printf().

415 {
416  switch_assert(session != NULL);
417  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard HIBERNATE\n", switch_channel_get_name(session->channel));
418 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_channel_t * channel
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_assert(expr)
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.

◆ switch_core_standard_on_init()

static void switch_core_standard_on_init ( switch_core_session_t session)
static

Definition at line 38 of file switch_core_state_machine.c.

References CF_RECOVERING, CF_RECOVERING_BRIDGE, switch_core_session::channel, CS_EXECUTE, CS_RESET, CS_ROUTING, switch_channel_clear_flag(), switch_channel_get_name(), SWITCH_CHANNEL_SESSION_LOG, switch_channel_set_state, switch_channel_test_flag(), SWITCH_LOG_DEBUG, and switch_log_printf().

39 {
41 
44  } else {
47  } else {
49  }
50  }
51 
53 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
#define switch_channel_set_state(channel, state)
Set the current state of a channel.
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.
switch_channel_t * channel
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.
void switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Clear given flag(s) from a channel.
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.

◆ switch_core_standard_on_park()

static void switch_core_standard_on_park ( switch_core_session_t session)
static

Definition at line 400 of file switch_core_state_machine.c.

References switch_core_session::channel, switch_assert, switch_channel_get_name(), SWITCH_CHANNEL_SESSION_LOG, switch_core_session_reset(), switch_ivr_park(), SWITCH_LOG_DEBUG, switch_log_printf(), and SWITCH_TRUE.

401 {
402  switch_assert(session != NULL);
405  switch_ivr_park(session, NULL);
406 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
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.
switch_status_t switch_ivr_park(switch_core_session_t *session, switch_input_args_t *args)
Definition: switch_ivr.c:946
switch_channel_t * channel
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_assert(expr)
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.

◆ switch_core_standard_on_reporting()

static void switch_core_standard_on_reporting ( switch_core_session_t session)
static

Definition at line 165 of file switch_core_state_machine.c.

References switch_core_session::channel, switch_channel_cause2str(), switch_channel_get_cause(), switch_channel_get_name(), SWITCH_CHANNEL_SESSION_LOG, SWITCH_LOG_DEBUG, and switch_log_printf().

166 {
167 
168  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard REPORTING, cause: %s\n",
170 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
const char * switch_channel_cause2str(_In_ switch_call_cause_t cause)
return a cause string for a given cause
switch_channel_t * channel
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.
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.
switch_call_cause_t switch_channel_get_cause(_In_ switch_channel_t *channel)
return the cause code for a given channel

◆ switch_core_standard_on_reset()

static void switch_core_standard_on_reset ( switch_core_session_t session)
static

Definition at line 178 of file switch_core_state_machine.c.

References CF_BRIDGE_ORIGINATOR, CF_MEDIA_ACK, CF_PROXY_MODE, CF_RECOVERING_BRIDGE, switch_core_session::channel, CS_RESET, switch_channel_clear_flag(), switch_channel_get_name(), switch_channel_get_partner_uuid(), SWITCH_CHANNEL_SESSION_LOG, switch_channel_set_variable, switch_channel_test_flag(), switch_channel_up, switch_channel_wait_for_flag(), switch_channel_wait_for_state_timeout(), switch_core_session_get_channel(), switch_core_session_get_uuid(), switch_core_session_locate, switch_core_session_rwunlock(), switch_ivr_signal_bridge(), switch_ivr_uuid_bridge(), SWITCH_LOG_DEBUG, switch_log_printf(), SWITCH_TRUE, and switch_yield.

179 {
180  switch_channel_set_variable(session->channel, "call_uuid", switch_core_session_get_uuid(session));
181 
183 
185  switch_core_session_t *other_session = NULL;
186  const char *uuid = switch_core_session_get_uuid(session);
187 
189  const char *other_uuid = switch_channel_get_partner_uuid(session->channel);
190  int x = 0;
191 
192  if (other_uuid) {
193  for (x = 0; other_session == NULL && x < 20; x++) {
194  if (!switch_channel_up(session->channel)) {
195  break;
196  }
197  other_session = switch_core_session_locate(other_uuid);
198  switch_yield(100000);
199  }
200  }
201 
202  if (other_session) {
203  switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
205  switch_channel_wait_for_state_timeout(other_channel, CS_RESET, 5000);
206  switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 2000, NULL);
207 
209  switch_ivr_signal_bridge(session, other_session);
210  } else {
211  switch_ivr_uuid_bridge(uuid, other_uuid);
212  }
213  switch_core_session_rwunlock(other_session);
214  }
215  }
216 
218  }
219 
220 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
const char * switch_channel_get_partner_uuid(switch_channel_t *channel)
#define switch_channel_up(_channel)
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.
_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 switch_yield(ms)
Wait a desired number of microseconds and yield the CPU.
Definition: switch_utils.h:998
switch_channel_t * channel
switch_status_t switch_ivr_uuid_bridge(const char *originator_uuid, const char *originatee_uuid)
Bridge two existing sessions.
void switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout)
void switch_core_session_rwunlock(_In_ switch_core_session_t *session)
Unlock a read or write lock on as given session.
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
#define switch_core_session_locate(uuid_str)
Locate a session based on it&#39;s uuid.
Definition: switch_core.h:932
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.
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)
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.

◆ switch_core_standard_on_routing()

static void switch_core_standard_on_routing ( switch_core_session_t session)
static

Definition at line 222 of file switch_core_state_machine.c.

References CF_ANSWERED, CF_EARLY_MEDIA, CF_PROXY_MODE, CF_SIGNAL_BRIDGE_TTL, switch_core_session::channel, count, CS_CONSUME_MEDIA, CS_EXECUTE, switch_caller_profile::dialplan, switch_dialplan_interface::hunt_function, SMF_NONE, SWITCH_CALL_DIRECTION_OUTBOUND, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER, SWITCH_CAUSE_NO_ROUTE_DESTINATION, switch_channel_direction(), switch_channel_expand_variables, switch_channel_get_caller_profile(), switch_channel_get_name(), switch_channel_get_queued_extension(), switch_channel_hangup, SWITCH_CHANNEL_SESSION_LOG, switch_channel_set_caller_extension(), switch_channel_set_state, switch_channel_set_variable, switch_channel_test_flag(), switch_core_session_get_uuid(), switch_core_session_strdup, SWITCH_FALSE, switch_ivr_blind_transfer_ack(), switch_ivr_media(), switch_loadable_module_get_dialplan_interface(), SWITCH_LOG_DEBUG, SWITCH_LOG_ERROR, SWITCH_LOG_INFO, switch_log_printf(), switch_separate_string(), SWITCH_STATUS_SUCCESS, UNPROTECT_INTERFACE, switch_core_session::uuid_str, and zstr.

223 {
224  switch_dialplan_interface_t *dialplan_interface = NULL;
225  switch_caller_profile_t *caller_profile;
226  switch_caller_extension_t *extension = NULL;
227  char *expanded = NULL;
228  char *dpstr = NULL;
229 
231 
232  switch_channel_set_variable(session->channel, "call_uuid", switch_core_session_get_uuid(session));
233 
234  if ((switch_channel_test_flag(session->channel, CF_ANSWERED) ||
238  }
239 
240  if ((caller_profile = switch_channel_get_caller_profile(session->channel)) == 0) {
241  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't get profile!\n");
243  return;
244  } else {
245  char *dp[25];
246  int argc, x, count = 0;
247 
248  if ((extension = switch_channel_get_queued_extension(session->channel))) {
249  switch_channel_set_caller_extension(session->channel, extension);
251  goto end;
252  }
253 
254  if (!zstr(caller_profile->dialplan)) {
255  if ((dpstr = switch_core_session_strdup(session, caller_profile->dialplan))) {
256  expanded = switch_channel_expand_variables(session->channel, dpstr);
257  argc = switch_separate_string(expanded, ',', dp, (sizeof(dp) / sizeof(dp[0])));
258  for (x = 0; x < argc; x++) {
259  char *dpname = dp[x];
260  char *dparg = NULL;
261 
262  if (dpname) {
263  if ((dparg = strchr(dpname, ':'))) {
264  *dparg++ = '\0';
265  }
266  } else {
267  continue;
268  }
269  if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(dpname))) {
270  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Dialplan [%s] not found, skipping\n", dpname);
271  continue;
272  }
273 
274  count++;
275 
276  extension = dialplan_interface->hunt_function(session, dparg, NULL);
277  UNPROTECT_INTERFACE(dialplan_interface);
278 
279  if (extension) {
280  switch_channel_set_caller_extension(session->channel, extension);
282  goto end;
283  }
284  }
285  }
286  }
287 
288  if (!count) {
292  "No Dialplan on answered channel, changing state to HANGUP\n");
294  } else {
295  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No Dialplan, changing state to CONSUME_MEDIA\n");
297  }
298  goto end;
299  }
300  }
301  }
302 
303  if (!extension) {
304 
306  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "No Route, Aborting\n");
308  }
309  }
310 
311  end:
312 
313  if (expanded && dpstr && expanded != dpstr) {
314  free(expanded);
315  }
316 }
#define switch_channel_hangup(channel, hangup_cause)
Hangup a channel flagging it&#39;s state machine to end.
#define SWITCH_CHANNEL_SESSION_LOG(x)
An Abstract Representation of a dialplan extension.
Call Specific Data.
Definition: switch_caller.h:73
#define switch_channel_set_state(channel, state)
Set the current state of a channel.
Abstract interface to a dialplan module.
const char * dialplan
Definition: switch_caller.h:77
switch_status_t switch_ivr_media(const char *uuid, switch_media_flag_t flags)
Signal a session to request direct media access to it&#39;s remote end.
Definition: switch_ivr.c:1773
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.
#define zstr(x)
Definition: switch_utils.h:314
#define UNPROTECT_INTERFACE(_it)
switch_status_t switch_ivr_blind_transfer_ack(switch_core_session_t *session, switch_bool_t success)
Definition: switch_ivr.c:4418
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_dialplan_hunt_function_t hunt_function
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]
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
switch_caller_extension_t * switch_channel_get_queued_extension(switch_channel_t *channel)
#define switch_channel_expand_variables(_channel, _in)
switch_dialplan_interface_t * switch_loadable_module_get_dialplan_interface(const char *name)
Retrieve the dialplan interface by it&#39;s registered name.
switch_call_direction_t switch_channel_direction(switch_channel_t *channel)
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.
int count
Definition: switch_cJSON.h:204
#define switch_core_session_strdup(_session, _todup)
Copy a string using memory allocation from a session&#39;s pool.
Definition: switch_core.h:719
#define switch_channel_set_variable(_channel, _var, _val)
switch_caller_profile_t * switch_channel_get_caller_profile(switch_channel_t *channel)
Retrieve the given channel&#39;s caller profile.
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.

◆ switch_core_standard_on_soft_execute()

static void switch_core_standard_on_soft_execute ( switch_core_session_t session)
static

Definition at line 394 of file switch_core_state_machine.c.

References switch_core_session::channel, switch_assert, switch_channel_get_name(), SWITCH_CHANNEL_SESSION_LOG, SWITCH_LOG_DEBUG, and switch_log_printf().

395 {
396  switch_assert(session != NULL);
397  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard SOFT_EXECUTE\n", switch_channel_get_name(session->channel));
398 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_channel_t * channel
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_assert(expr)
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.

◆ switch_core_state_machine_init()

void switch_core_state_machine_init ( switch_memory_pool_t pool)

Definition at line 420 of file switch_core_state_machine.c.

Referenced by switch_core_init().

421 {
422  return;
423 }