FreeSWITCH API Documentation  1.7.0
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
CoreSession Class Referenceabstract

#include <switch_cpp.h>

+ Collaboration diagram for CoreSession:

Public Member Functions

 CoreSession ()
 
 CoreSession (char *nuuid, CoreSession *a_leg=NULL)
 
 CoreSession (switch_core_session_t *new_session)
 
virtual ~CoreSession ()
 
int insertFile (const char *file, const char *insert_file, int sample_point)
 
int answer ()
 
int preAnswer ()
 
void hangup (const char *cause="normal_clearing")
 
void hangupState (void)
 
void setVariable (char *var, char *val)
 
void setPrivate (char *var, void *val)
 
void * getPrivate (char *var)
 
const char * getVariable (char *var)
 
switch_status_t process_callback_result (char *result)
 
void say (const char *tosay, const char *module_name, const char *say_type, const char *say_method, const char *say_gender=NULL)
 
void sayPhrase (const char *phrase_name, const char *phrase_data="", const char *phrase_lang=NULL)
 
const char * hangupCause ()
 
const char * getState ()
 
int recordFile (char *file_name, int time_limit=0, int silence_threshold=0, int silence_hits=0)
 Record to a file. More...
 
int originate (CoreSession *a_leg_session, char *dest, int timeout=60, switch_state_handler_table_t *handlers=NULL)
 Set attributes of caller data for purposes of outgoing calls. More...
 
virtual void destroy (void)
 
void setDTMFCallback (void *cbfunc, char *funcargs)
 set a DTMF callback function More...
 
int speak (char *text)
 
void set_tts_parms (char *tts_name, char *voice_name)
 
void set_tts_params (char *tts_name, char *voice_name)
 
int collectDigits (int abs_timeout)
 
int collectDigits (int digit_timeout, int abs_timeout)
 
char * getDigits (int maxdigits, char *terminators, int timeout)
 
char * getDigits (int maxdigits, char *terminators, int timeout, int interdigit)
 
int transfer (char *extension, char *dialplan=NULL, char *context=NULL)
 
char * read (int min_digits, int max_digits, const char *prompt_audio_file, int timeout, const char *valid_terminators, int digit_timeout=0)
 
char * playAndGetDigits (int min_digits, int max_digits, int max_tries, int timeout, char *terminators, char *audio_files, char *bad_input_audio_files, char *digits_regex, const char *var_name=NULL, int digit_timeout=0, const char *transfer_on_failure=NULL)
 Play a file into channel and collect dtmfs. More...
 
int streamFile (char *file, int starting_sample_count=0)
 Play a file that resides on disk into the channel. More...
 
int sleep (int ms, int sync=0)
 
int flushEvents ()
 flush any pending events More...
 
int flushDigits ()
 flush any pending digits More...
 
int setAutoHangup (bool val)
 
void setHangupHook (void *hangup_func)
 Set the hangup callback function. More...
 
bool ready ()
 
bool bridged ()
 
bool answered ()
 
bool mediaReady ()
 
void waitForAnswer (CoreSession *calling_session)
 
void execute (const char *app, const char *data=NULL)
 
void sendEvent (Event *sendME)
 
void setEventData (Event *e)
 
char * getXMLCDR ()
 
virtual bool begin_allow_threads ()=0
 
virtual bool end_allow_threads ()=0
 
const char * get_uuid () const
 Get the uuid of this session. More...
 
const switch_input_args_tget_cb_args () const
 Get the callback function arguments associated with this session. More...
 
virtual void check_hangup_hook ()=0
 Callback to the language specific hangup callback. More...
 
virtual switch_status_t run_dtmf_callback (void *input, switch_input_type_t itype)=0
 
void consoleLog (char *level_str, char *msg)
 
void consoleLog2 (char *level_str, char *file, char *func, int line, char *msg)
 
 CoreSession ()
 
 CoreSession (char *nuuid, CoreSession *a_leg=NULL)
 
 CoreSession (switch_core_session_t *new_session)
 
virtual ~CoreSession ()
 
int insertFile (const char *file, const char *insert_file, int sample_point)
 
int answer ()
 
int preAnswer ()
 
void hangup (const char *cause="normal_clearing")
 
void hangupState (void)
 
void setVariable (char *var, char *val)
 
void setPrivate (char *var, void *val)
 
void * getPrivate (char *var)
 
const char * getVariable (char *var)
 
switch_status_t process_callback_result (char *result)
 
void say (const char *tosay, const char *module_name, const char *say_type, const char *say_method, const char *say_gender=NULL)
 
void sayPhrase (const char *phrase_name, const char *phrase_data="", const char *phrase_lang=NULL)
 
const char * hangupCause ()
 
const char * getState ()
 
int recordFile (char *file_name, int time_limit=0, int silence_threshold=0, int silence_hits=0)
 Record to a file. More...
 
int originate (CoreSession *a_leg_session, char *dest, int timeout=60, switch_state_handler_table_t *handlers=NULL)
 Set attributes of caller data for purposes of outgoing calls. More...
 
virtual void destroy (void)
 
void setDTMFCallback (void *cbfunc, char *funcargs)
 set a DTMF callback function More...
 
int speak (char *text)
 
void set_tts_parms (char *tts_name, char *voice_name)
 
void set_tts_params (char *tts_name, char *voice_name)
 
int collectDigits (int abs_timeout)
 
int collectDigits (int digit_timeout, int abs_timeout)
 
char * getDigits (int maxdigits, char *terminators, int timeout)
 
char * getDigits (int maxdigits, char *terminators, int timeout, int interdigit)
 
int transfer (char *extension, char *dialplan=NULL, char *context=NULL)
 
char * read (int min_digits, int max_digits, const char *prompt_audio_file, int timeout, const char *valid_terminators, int digit_timeout=0)
 
char * playAndGetDigits (int min_digits, int max_digits, int max_tries, int timeout, char *terminators, char *audio_files, char *bad_input_audio_files, char *digits_regex, const char *var_name=NULL, int digit_timeout=0, const char *transfer_on_failure=NULL)
 Play a file into channel and collect dtmfs. More...
 
int streamFile (char *file, int starting_sample_count=0)
 Play a file that resides on disk into the channel. More...
 
int sleep (int ms, int sync=0)
 
int flushEvents ()
 flush any pending events More...
 
int flushDigits ()
 flush any pending digits More...
 
int setAutoHangup (bool val)
 
void setHangupHook (void *hangup_func)
 Set the hangup callback function. More...
 
bool ready ()
 
bool bridged ()
 
bool answered ()
 
bool mediaReady ()
 
void waitForAnswer (CoreSession *calling_session)
 
void execute (const char *app, const char *data=NULL)
 
void sendEvent (Event *sendME)
 
void setEventData (Event *e)
 
char * getXMLCDR ()
 
virtual bool begin_allow_threads ()=0
 
virtual bool end_allow_threads ()=0
 
const char * get_uuid () const
 Get the uuid of this session. More...
 
const switch_input_args_tget_cb_args () const
 Get the callback function arguments associated with this session. More...
 
virtual void check_hangup_hook ()=0
 Callback to the language specific hangup callback. More...
 
virtual switch_status_t run_dtmf_callback (void *input, switch_input_type_t itype)=0
 
void consoleLog (char *level_str, char *msg)
 
void consoleLog2 (char *level_str, char *file, char *func, int line, char *msg)
 

Data Fields

switch_core_session_tsession
 
switch_channel_tchannel
 
unsigned int flags
 
int allocated
 
input_callback_state cb_state
 
switch_channel_state_t hook_state
 
switch_call_cause_t cause
 
char * uuid
 
char * tts_name
 
char * voice_name
 

Protected Member Functions

void store_file_handle (switch_file_handle_t *fh)
 
void store_file_handle (switch_file_handle_t *fh)
 

Protected Attributes

switch_input_args_t args
 
switch_input_args_tap
 
char * xml_cdr_text
 
void * on_hangup
 
switch_file_handle_tfhp
 
char dtmf_buf [512]
 

Detailed Description

Definition at line 205 of file switch_cpp.h.

Constructor & Destructor Documentation

CoreSession::CoreSession ( )

Definition at line 601 of file switch_cpp.cpp.

References init_vars.

602 {
603  init_vars();
604 }
#define init_vars()
Definition: switch_cpp.h:16
CoreSession::CoreSession ( char *  nuuid,
CoreSession a_leg = NULL 
)

Definition at line 606 of file switch_cpp.cpp.

References allocated, cause, channel, CS_SOFT_EXECUTE, init_vars, S_HUP, session, SOF_NONE, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER, switch_channel_set_state, switch_channel_wait_for_state(), switch_core_session_force_locate, switch_core_session_get_channel(), switch_core_session_get_uuid(), switch_ivr_originate(), switch_set_flag, SWITCH_STATUS_SUCCESS, and uuid.

607 {
608  switch_channel_t *other_channel = NULL;
609 
610  init_vars();
611 
612  if (a_leg && a_leg->session) {
613  other_channel = switch_core_session_get_channel(a_leg->session);
614  }
615 
616  if (!strchr(nuuid, '/') && (session = switch_core_session_force_locate(nuuid))) {
617  uuid = strdup(nuuid);
619  allocated = 1;
620  } else {
622  if (switch_ivr_originate(a_leg ? a_leg->session : NULL, &session, &cause, nuuid, 60, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL)
625  allocated = 1;
626  switch_set_flag(this, S_HUP);
630  }
631  }
632 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define switch_core_session_force_locate(uuid_str)
Locate a session based on it's uuid even if the channel is not ready.
Definition: switch_core.h:925
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
Definition: switch_utils.h:631
#define switch_channel_set_state(channel, state)
Set the current state of a channel.
switch_core_session_t * session
Definition: switch_cpp.h:223
_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.
void switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state)
switch_call_cause_t cause
Definition: switch_cpp.h:230
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
#define init_vars()
Definition: switch_cpp.h:16
char * uuid
Definition: switch_cpp.h:232
switch_status_t switch_ivr_originate(switch_core_session_t *session, switch_core_session_t **bleg, switch_call_cause_t *cause, const char *bridgeto, uint32_t timelimit_sec, const switch_state_handler_table_t *table, const char *cid_name_override, const char *cid_num_override, switch_caller_profile_t *caller_profile_override, switch_event_t *ovars, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
Make an outgoing call.
CoreSession::CoreSession ( switch_core_session_t new_session)

Definition at line 634 of file switch_cpp.cpp.

References allocated, channel, init_vars, session, switch_core_session_get_channel(), switch_core_session_get_uuid(), switch_core_session_read_lock_hangup(), and uuid.

635 {
636  init_vars();
637 
638  if (new_session) {
639  session = new_session;
641  allocated = 1;
644  }
645 }
switch_channel_t * channel
Definition: switch_cpp.h:224
switch_core_session_t * session
Definition: switch_cpp.h:223
_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.
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
switch_status_t switch_core_session_read_lock_hangup(_In_ switch_core_session_t *session)
Acquire a read lock on the session.
#define init_vars()
Definition: switch_cpp.h:16
char * uuid
Definition: switch_cpp.h:232
CoreSession::~CoreSession ( )
virtual

Definition at line 647 of file switch_cpp.cpp.

References allocated, destroy(), and this_check_void.

648 {
649  this_check_void();
650  if (allocated) destroy();
651 }
virtual void destroy(void)
#define this_check_void()
Definition: switch_cpp.h:13
CoreSession::CoreSession ( )
CoreSession::CoreSession ( char *  nuuid,
CoreSession a_leg = NULL 
)
CoreSession::CoreSession ( switch_core_session_t new_session)
virtual CoreSession::~CoreSession ( )
virtual

Member Function Documentation

int CoreSession::answer ( )

Definition at line 681 of file switch_cpp.cpp.

References sanity_check, switch_channel_answer, SWITCH_STATUS_SUCCESS, and this_check.

682 {
683  switch_status_t status;
684  this_check(-1);
685  sanity_check(-1);
686  status = switch_channel_answer(channel);
687  return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
688 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define switch_channel_answer(channel)
Answer a channel (initiate/acknowledge a successful connection)
#define this_check(x)
Definition: switch_cpp.h:12
#define sanity_check(x)
Definition: switch_cpp.h:14
switch_status_t
Common return values.
int CoreSession::answer ( )
bool CoreSession::answered ( )

Definition at line 1079 of file switch_cpp.cpp.

References CF_ANSWERED, sanity_check, switch_channel_test_flag(), and this_check.

1079  {
1080 
1081  this_check(false);
1082  sanity_check(false);
1084 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define this_check(x)
Definition: switch_cpp.h:12
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 sanity_check(x)
Definition: switch_cpp.h:14
bool CoreSession::answered ( )
virtual bool CoreSession::begin_allow_threads ( )
pure virtual
virtual bool CoreSession::begin_allow_threads ( )
pure virtual
bool CoreSession::bridged ( )

Definition at line 1060 of file switch_cpp.cpp.

References CF_BRIDGED, sanity_check, switch_channel_test_flag(), switch_channel_up, and this_check.

1060  {
1061 
1062  this_check(false);
1063 
1064  if (!session) {
1065  return false;
1066  }
1067  sanity_check(false);
1068 
1070 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define switch_channel_up(_channel)
#define this_check(x)
Definition: switch_cpp.h:12
switch_core_session_t * session
Definition: switch_cpp.h:223
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 sanity_check(x)
Definition: switch_cpp.h:14
bool CoreSession::bridged ( )
virtual void CoreSession::check_hangup_hook ( )
pure virtual

Callback to the language specific hangup callback.

Referenced by hanguphook().

virtual void CoreSession::check_hangup_hook ( )
pure virtual

Callback to the language specific hangup callback.

int CoreSession::collectDigits ( int  abs_timeout)

For timeout milliseconds, call the dtmf function set previously by setDTMFCallback whenever a dtmf or event is received

Definition at line 853 of file switch_cpp.cpp.

853  {
854  return collectDigits(0, abs_timeout);
855 }
int collectDigits(int abs_timeout)
Definition: switch_cpp.cpp:853
int CoreSession::collectDigits ( int  abs_timeout)

For timeout milliseconds, call the dtmf function set previously by setDTMFCallback whenever a dtmf or event is received

int CoreSession::collectDigits ( int  digit_timeout,
int  abs_timeout 
)
int CoreSession::collectDigits ( int  digit_timeout,
int  abs_timeout 
)

Definition at line 857 of file switch_cpp.cpp.

References sanity_check, switch_ivr_collect_digits_callback(), SWITCH_STATUS_SUCCESS, and this_check.

857  {
858  this_check(-1);
859  sanity_check(-1);
861  switch_ivr_collect_digits_callback(session, ap, digit_timeout, abs_timeout);
863  return SWITCH_STATUS_SUCCESS;
864 }
switch_input_args_t * ap
Definition: switch_cpp.h:210
switch_status_t switch_ivr_collect_digits_callback(switch_core_session_t *session, switch_input_args_t *args, uint32_t digit_timeout, uint32_t abs_timeout)
Wait for DTMF digits calling a pluggable callback function when digits are collected.
Definition: switch_ivr.c:1173
#define this_check(x)
Definition: switch_cpp.h:12
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check(x)
Definition: switch_cpp.h:14
virtual bool end_allow_threads()=0
void CoreSession::consoleLog ( char *  level_str,
char *  msg 
)

Definition at line 1279 of file switch_cpp.cpp.

References SWITCH_CHANNEL_SESSION_LOG, SWITCH_LOG_DEBUG, SWITCH_LOG_INVALID, switch_log_printf(), switch_log_str2level(), and switch_str_nil.

1280 {
1282  if (level_str) {
1283  level = switch_log_str2level(level_str);
1284  if (level == SWITCH_LOG_INVALID) {
1285  level = SWITCH_LOG_DEBUG;
1286  }
1287  }
1289 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_core_session_t * session
Definition: switch_cpp.h:223
switch_log_level_t switch_log_str2level(_In_z_ const char *str)
Return the level number of the specified log level name.
#define switch_str_nil(s)
Make a null string a blank string instead.
Definition: switch_utils.h:903
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_log_level_t
Log Level Enumeration.
void CoreSession::consoleLog ( char *  level_str,
char *  msg 
)
void CoreSession::consoleLog2 ( char *  level_str,
char *  file,
char *  func,
int  line,
char *  msg 
)
void CoreSession::consoleLog2 ( char *  level_str,
char *  file,
char *  func,
int  line,
char *  msg 
)

Definition at line 1291 of file switch_cpp.cpp.

References SWITCH_CHANNEL_ID_SESSION, SWITCH_LOG_DEBUG, SWITCH_LOG_INVALID, switch_log_printf(), switch_log_str2level(), and switch_str_nil.

1292 {
1294  if (level_str) {
1295  level = switch_log_str2level(level_str);
1296  if (level == SWITCH_LOG_INVALID) {
1297  level = SWITCH_LOG_DEBUG;
1298  }
1299  }
1300  switch_log_printf(SWITCH_CHANNEL_ID_SESSION, file, func, line, (const char*)session,
1301  level, "%s", switch_str_nil(msg));
1302 }
switch_core_session_t * session
Definition: switch_cpp.h:223
switch_log_level_t switch_log_str2level(_In_z_ const char *str)
Return the level number of the specified log level name.
#define switch_str_nil(s)
Make a null string a blank string instead.
Definition: switch_utils.h:903
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_log_level_t
Log Level Enumeration.
virtual void CoreSession::destroy ( void  )
virtual
void CoreSession::destroy ( void  )
virtual

Definition at line 1086 of file switch_cpp.cpp.

References CF_TRANSFER, init_vars, S_HUP, SWITCH_CAUSE_NORMAL_CLEARING, switch_channel_get_name(), switch_channel_hangup, SWITCH_CHANNEL_SESSION_LOG, switch_channel_set_private(), switch_channel_test_flag(), switch_channel_up, switch_core_session_get_channel(), switch_core_session_rwunlock(), SWITCH_LOG_DEBUG, switch_log_printf(), switch_safe_free, switch_test_flag, and this_check_void.

Referenced by ~CoreSession().

1087 {
1088  this_check_void();
1089 
1090  if (!allocated) {
1091  return;
1092  }
1093 
1094  allocated = 0;
1095 
1100 
1101  if (session) {
1102  if (!channel) {
1104  }
1105 
1106  if (channel) {
1108  "%s destroy/unlink session from object\n", switch_channel_get_name(channel));
1109  switch_channel_set_private(channel, "CoreSession", NULL);
1112  }
1113  }
1114 
1116  session = NULL;
1117  channel = NULL;
1118  }
1119 
1120  init_vars();
1121 
1122 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define switch_channel_hangup(channel, hangup_cause)
Hangup a channel flagging it's state machine to end.
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_status_t switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
Set private data on channel.
#define switch_channel_up(_channel)
char * voice_name
Definition: switch_cpp.h:234
char * tts_name
Definition: switch_cpp.h:233
switch_core_session_t * session
Definition: switch_cpp.h:223
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_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
Definition: switch_utils.h:789
#define this_check_void()
Definition: switch_cpp.h:13
void switch_core_session_rwunlock(_In_ switch_core_session_t *session)
Unlock a read or write lock on as given session.
#define init_vars()
Definition: switch_cpp.h:16
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
Definition: switch_utils.h:624
char * uuid
Definition: switch_cpp.h:232
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 * xml_cdr_text
Definition: switch_cpp.h:212
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.
virtual bool CoreSession::end_allow_threads ( )
pure virtual
virtual bool CoreSession::end_allow_threads ( )
pure virtual
void CoreSession::execute ( const char *  app,
const char *  data = NULL 
)

Definition at line 757 of file switch_cpp.cpp.

References sanity_check_noreturn, SWITCH_CHANNEL_SESSION_LOG, switch_core_session_execute_application, SWITCH_LOG_ERROR, switch_log_printf(), this_check_void, and zstr.

758 {
759  this_check_void();
761 
762  if (zstr(app)) {
763  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No application specified\n");
764  return;
765  }
766 
770 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
#define zstr(x)
Definition: switch_utils.h:281
#define switch_core_session_execute_application(_a, _b, _c)
Execute an application on a session.
Definition: switch_core.h:1103
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
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.
virtual bool end_allow_threads()=0
void CoreSession::execute ( const char *  app,
const char *  data = NULL 
)
int CoreSession::flushDigits ( )

flush any pending digits

Definition at line 1232 of file switch_cpp.cpp.

References sanity_check, switch_channel_flush_dtmf(), switch_core_session_get_channel(), SWITCH_STATUS_SUCCESS, and this_check.

1233 {
1234  this_check(-1);
1235  sanity_check(-1);
1237  return SWITCH_STATUS_SUCCESS;
1238 }
void switch_channel_flush_dtmf(_In_ switch_channel_t *channel)
#define this_check(x)
Definition: switch_cpp.h:12
switch_core_session_t * session
Definition: switch_cpp.h:223
_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 sanity_check(x)
Definition: switch_cpp.h:14
int CoreSession::flushDigits ( )

flush any pending digits

int CoreSession::flushEvents ( )

flush any pending events

Definition at line 1215 of file switch_cpp.cpp.

References sanity_check, switch_core_session_dequeue_event(), switch_event_destroy(), SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, SWITCH_TRUE, and this_check.

1216 {
1217  switch_event_t *event;
1218 
1219  this_check(-1);
1220  sanity_check(-1);
1221 
1222  if (!session) {
1223  return SWITCH_STATUS_FALSE;
1224  }
1225 
1227  switch_event_destroy(&event);
1228  }
1229  return SWITCH_STATUS_SUCCESS;
1230 }
Representation of an event.
Definition: switch_event.h:80
#define this_check(x)
Definition: switch_cpp.h:12
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check(x)
Definition: switch_cpp.h:14
switch_status_t switch_core_session_dequeue_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event, switch_bool_t force)
DE-Queue an event on a given session.
void switch_event_destroy(switch_event_t **event)
Destroy an event.
int CoreSession::flushEvents ( )

flush any pending events

const switch_input_args_t& CoreSession::get_cb_args ( ) const
inline

Get the callback function arguments associated with this session.

Returns
a const reference to the callback function arguments

Definition at line 385 of file switch_swigable_cpp.h.

References args.

385  {
386  return args;
387  };
switch_input_args_t args
Definition: switch_cpp.h:208
const switch_input_args_t& CoreSession::get_cb_args ( ) const
inline

Get the callback function arguments associated with this session.

Returns
a const reference to the callback function arguments

Definition at line 385 of file switch_cpp.h.

385  {
386  return args;
387  };
switch_input_args_t args
Definition: switch_cpp.h:208
const char* CoreSession::get_uuid ( ) const
inline

Get the uuid of this session.

Returns
the uuid of this session

Definition at line 378 of file switch_cpp.h.

378  {
379  return uuid ? uuid : (char *) "uninitialized";
380  };
char * uuid
Definition: switch_cpp.h:232
const char* CoreSession::get_uuid ( ) const
inline

Get the uuid of this session.

Returns
the uuid of this session

Definition at line 378 of file switch_swigable_cpp.h.

378  {
379  return uuid ? uuid : (char *) "uninitialized";
380  };
char * uuid
Definition: switch_cpp.h:232
char* CoreSession::getDigits ( int  maxdigits,
char *  terminators,
int  timeout 
)

Collect up to maxdigits digits worth of digits and store them in dtmf_buf. In the case of mod_python, the dtmf_buf parameter is configured to act as a return value, (see mod_python.i). This does NOT call any callbacks upon receiving dtmf digits. For that, use collectDigits.

char * CoreSession::getDigits ( int  maxdigits,
char *  terminators,
int  timeout 
)

Collect up to maxdigits digits worth of digits and store them in dtmf_buf. In the case of mod_python, the dtmf_buf parameter is configured to act as a return value, (see mod_python.i). This does NOT call any callbacks upon receiving dtmf digits. For that, use collectDigits.

Definition at line 866 of file switch_cpp.cpp.

867 {
868  return getDigits(maxdigits, terminators, timeout, 0);
869 }
char * getDigits(int maxdigits, char *terminators, int timeout)
Definition: switch_cpp.cpp:866
char* CoreSession::getDigits ( int  maxdigits,
char *  terminators,
int  timeout,
int  interdigit 
)
char * CoreSession::getDigits ( int  maxdigits,
char *  terminators,
int  timeout,
int  interdigit 
)

Definition at line 871 of file switch_cpp.cpp.

References memset(), sanity_check, SWITCH_CHANNEL_SESSION_LOG, switch_ivr_collect_digits_count(), SWITCH_LOG_DEBUG, switch_log_printf(), and this_check.

875 {
876  this_check((char *)"");
877  sanity_check((char *)"");
879  char terminator;
880 
881  memset(dtmf_buf, 0, sizeof(dtmf_buf));
883  dtmf_buf,
884  sizeof(dtmf_buf),
885  maxdigits,
886  terminators,
887  &terminator,
888  (uint32_t) timeout, (uint32_t)interdigit, 0);
889 
892  return dtmf_buf;
893 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
#define this_check(x)
Definition: switch_cpp.h:12
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check(x)
Definition: switch_cpp.h:14
switch_status_t switch_ivr_collect_digits_count(switch_core_session_t *session, char *buf, switch_size_t buflen, switch_size_t maxdigits, const char *terminators, char *terminator, uint32_t first_timeout, uint32_t digit_timeout, uint32_t abs_timeout)
Wait for specified number of DTMF digits, untile terminator is received or until the channel hangs up...
Definition: switch_ivr.c:1287
char dtmf_buf[512]
Definition: switch_cpp.h:216
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.
memset(buf, 0, buflen)
virtual bool end_allow_threads()=0
void * CoreSession::getPrivate ( char *  var)

Definition at line 735 of file switch_cpp.cpp.

References sanity_check, switch_channel_get_private(), and this_check.

736 {
737  this_check(NULL);
738  sanity_check(NULL);
739  return switch_channel_get_private(channel, var);
740 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define this_check(x)
Definition: switch_cpp.h:12
#define sanity_check(x)
Definition: switch_cpp.h:14
void * switch_channel_get_private(switch_channel_t *channel, const char *key)
Retrieve private from a given channel.
void* CoreSession::getPrivate ( char *  var)
const char* CoreSession::getState ( )
const char * CoreSession::getState ( )

Definition at line 1130 of file switch_cpp.cpp.

References switch_channel_get_state(), switch_channel_state_name(), and this_check.

1131 {
1132  this_check(NULL);
1133 
1134  if (channel) {
1136  }
1137 
1138  return "ERROR";
1139 
1140 }
switch_channel_t * channel
Definition: switch_cpp.h:224
switch_channel_state_t switch_channel_get_state(switch_channel_t *channel)
Get the current state of a channel in the state engine.
#define this_check(x)
Definition: switch_cpp.h:12
const char * switch_channel_state_name(_In_ switch_channel_state_t state)
Render the name of the provided state enum.
const char * CoreSession::getVariable ( char *  var)

Definition at line 750 of file switch_cpp.cpp.

References sanity_check, switch_channel_get_variable, and this_check.

751 {
752  this_check("");
753  sanity_check("");
755 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define this_check(x)
Definition: switch_cpp.h:12
#define sanity_check(x)
Definition: switch_cpp.h:14
#define switch_channel_get_variable(_c, _v)
const char* CoreSession::getVariable ( char *  var)
char * CoreSession::getXMLCDR ( )

Definition at line 653 of file switch_cpp.cpp.

References sanity_check, SWITCH_FALSE, switch_ivr_generate_xml_cdr(), switch_safe_free, SWITCH_STATUS_SUCCESS, switch_xml_free(), switch_xml_toxml(), and this_check.

654 {
655 
656  switch_xml_t cdr = NULL;
657 
658  this_check((char *)"");
659  sanity_check((char *)"");
660 
662 
665  switch_xml_free(cdr);
666  }
667 
668  return (char *) (xml_cdr_text ? xml_cdr_text : "");
669 }
void switch_xml_free(_In_opt_ switch_xml_t xml)
frees the memory allocated for an switch_xml structure
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 this_check(x)
Definition: switch_cpp.h:12
switch_core_session_t * session
Definition: switch_cpp.h:223
A representation of an XML tree.
Definition: switch_xml.h:76
#define sanity_check(x)
Definition: switch_cpp.h:14
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
Definition: switch_utils.h:789
switch_status_t switch_ivr_generate_xml_cdr(switch_core_session_t *session, switch_xml_t *xml_cdr)
Generate an XML CDR report.
Definition: switch_ivr.c:2713
char * xml_cdr_text
Definition: switch_cpp.h:212
char* CoreSession::getXMLCDR ( )
void CoreSession::hangup ( const char *  cause = "normal_clearing")

Definition at line 718 of file switch_cpp.cpp.

References sanity_check_noreturn, switch_channel_hangup, SWITCH_CHANNEL_SESSION_LOG, switch_channel_str2cause(), SWITCH_LOG_DEBUG, switch_log_printf(), and this_check_void.

719 {
720  this_check_void();
723  this->begin_allow_threads();
725  this->end_allow_threads();
726 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define switch_channel_hangup(channel, hangup_cause)
Hangup a channel flagging it's state machine to end.
#define SWITCH_CHANNEL_SESSION_LOG(x)
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
switch_call_cause_t switch_channel_str2cause(_In_ const char *str)
return a cause code for a given string
switch_call_cause_t cause
Definition: switch_cpp.h:230
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
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.
virtual bool end_allow_threads()=0
void CoreSession::hangup ( const char *  cause = "normal_clearing")
const char* CoreSession::hangupCause ( )
const char * CoreSession::hangupCause ( )

Definition at line 1124 of file switch_cpp.cpp.

References switch_channel_cause2str(), and this_check.

1125 {
1126  this_check(NULL);
1128 }
const char * switch_channel_cause2str(_In_ switch_call_cause_t cause)
return a cause string for a given cause
#define this_check(x)
Definition: switch_cpp.h:12
switch_call_cause_t cause
Definition: switch_cpp.h:230
void CoreSession::hangupState ( void  )
void CoreSession::hangupState ( void  )

Definition at line 708 of file switch_cpp.cpp.

References sanity_check_noreturn, switch_channel_down, switch_core_session_hangup_state(), and SWITCH_FALSE.

709 {
711  this->begin_allow_threads();
714  }
715  this->end_allow_threads();
716 }
switch_channel_t * channel
Definition: switch_cpp.h:224
void switch_core_session_hangup_state(switch_core_session_t *session, switch_bool_t force)
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check_noreturn
Definition: switch_cpp.h:15
#define switch_channel_down(_channel)
virtual bool end_allow_threads()=0
int CoreSession::insertFile ( const char *  file,
const char *  insert_file,
int  sample_point 
)

Definition at line 690 of file switch_cpp.cpp.

References sanity_check, switch_ivr_insert_file(), SWITCH_STATUS_SUCCESS, and this_check.

691 {
692  switch_status_t status;
693  this_check(-1);
694  sanity_check(-1);
695  status = switch_ivr_insert_file(session, file, insert_file, (switch_size_t)sample_point);
696  return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
697 }
#define this_check(x)
Definition: switch_cpp.h:12
switch_status_t switch_ivr_insert_file(switch_core_session_t *session, const char *file, const char *insert_file, switch_size_t sample_point)
Definition: switch_ivr.c:4009
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check(x)
Definition: switch_cpp.h:14
uintptr_t switch_size_t
switch_status_t
Common return values.
int CoreSession::insertFile ( const char *  file,
const char *  insert_file,
int  sample_point 
)
bool CoreSession::mediaReady ( )

Definition at line 1072 of file switch_cpp.cpp.

References sanity_check, switch_channel_media_ready, and this_check.

1072  {
1073 
1074  this_check(false);
1075  sanity_check(false);
1076  return switch_channel_media_ready(channel) != 0;
1077 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define this_check(x)
Definition: switch_cpp.h:12
#define switch_channel_media_ready(_channel)
#define sanity_check(x)
Definition: switch_cpp.h:14
bool CoreSession::mediaReady ( )
int CoreSession::originate ( CoreSession a_leg_session,
char *  dest,
int  timeout = 60,
switch_state_handler_table_t handlers = NULL 
)

Set attributes of caller data for purposes of outgoing calls.

Parameters
var- the variable name, eg, "caller_id_name"
val- the data to set, eg, "bob"Originate a call to a destination
a_leg_session- the session where the call is originating from and also the session in which this session was created
dest- a string representing destination, eg, sofia/mydomain.com/foo@bar.com
timeout- time to wait for call to be answered
Returns
an int status code indicating success or failure

Definition at line 1142 of file switch_cpp.cpp.

References CS_SOFT_EXECUTE, SOF_NONE, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER, SWITCH_CHANNEL_LOG, switch_channel_set_state, switch_core_session_get_channel(), switch_core_session_get_uuid(), switch_ivr_originate(), switch_log_printf(), SWITCH_LOG_WARNING, switch_safe_free, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and this_check.

1143 {
1144 
1145  switch_core_session_t *aleg_core_session = NULL;
1146 
1147  this_check(0);
1148 
1150 
1151  if (a_leg_session != NULL) {
1152  aleg_core_session = a_leg_session->session;
1153  }
1154 
1155  // this session has no valid switch_core_session_t at this point, and therefore
1156  // no valid channel. since the threadstate is stored in the channel, and there
1157  // is none, if we try to call begin_alllow_threads it will fail miserably.
1158  // use the 'a leg session' to do the thread swapping stuff.
1159  if (a_leg_session) a_leg_session->begin_allow_threads();
1160 
1161  if (switch_ivr_originate(aleg_core_session,
1162  &session,
1163  &cause,
1164  dest,
1165  timeout,
1166  handlers,
1167  NULL,
1168  NULL,
1169  NULL,
1170  NULL,
1171  SOF_NONE,
1172  NULL) != SWITCH_STATUS_SUCCESS) {
1173  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error Creating Outgoing Channel! [%s]\n", dest);
1174  goto failed;
1175 
1176  }
1177 
1178  if (a_leg_session) a_leg_session->end_allow_threads();
1180  allocated = 1;
1184 
1185  return SWITCH_STATUS_SUCCESS;
1186 
1187  failed:
1188  if (a_leg_session) a_leg_session->end_allow_threads();
1189  return SWITCH_STATUS_FALSE;
1190 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define SWITCH_CHANNEL_LOG
#define switch_channel_set_state(channel, state)
Set the current state of a channel.
#define this_check(x)
Definition: switch_cpp.h:12
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
_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_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
Definition: switch_utils.h:789
switch_call_cause_t cause
Definition: switch_cpp.h:230
char * switch_core_session_get_uuid(_In_ switch_core_session_t *session)
Retrieve the unique identifier from a session.
char * uuid
Definition: switch_cpp.h:232
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_ivr_originate(switch_core_session_t *session, switch_core_session_t **bleg, switch_call_cause_t *cause, const char *bridgeto, uint32_t timelimit_sec, const switch_state_handler_table_t *table, const char *cid_name_override, const char *cid_num_override, switch_caller_profile_t *caller_profile_override, switch_event_t *ovars, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
Make an outgoing call.
virtual bool end_allow_threads()=0
int CoreSession::originate ( CoreSession a_leg_session,
char *  dest,
int  timeout = 60,
switch_state_handler_table_t handlers = NULL 
)

Set attributes of caller data for purposes of outgoing calls.

Parameters
var- the variable name, eg, "caller_id_name"
val- the data to set, eg, "bob"Originate a call to a destination
a_leg_session- the session where the call is originating from and also the session in which this session was created
dest- a string representing destination, eg, sofia/mydomain.com/foo@bar.com
timeout- time to wait for call to be answered
Returns
an int status code indicating success or failure
char* CoreSession::playAndGetDigits ( int  min_digits,
int  max_digits,
int  max_tries,
int  timeout,
char *  terminators,
char *  audio_files,
char *  bad_input_audio_files,
char *  digits_regex,
const char *  var_name = NULL,
int  digit_timeout = 0,
const char *  transfer_on_failure = NULL 
)

Play a file into channel and collect dtmfs.

See API docs in switch_ivr.h: switch_play_and_get_digits(..)

NOTE: this does not call any dtmf callbacks set by setDTMFCallback(..) as it uses its own internal callback handler.

char * CoreSession::playAndGetDigits ( int  min_digits,
int  max_digits,
int  max_tries,
int  timeout,
char *  terminators,
char *  audio_files,
char *  bad_input_audio_files,
char *  digits_regex,
const char *  var_name = NULL,
int  digit_timeout = 0,
const char *  transfer_on_failure = NULL 
)

Play a file into channel and collect dtmfs.

See API docs in switch_ivr.h: switch_play_and_get_digits(..)

NOTE: this does not call any dtmf callbacks set by setDTMFCallback(..) as it uses its own internal callback handler.

Definition at line 937 of file switch_cpp.cpp.

References memset(), sanity_check, switch_play_and_get_digits(), and this_check.

948 {
949  sanity_check((char *)"");
950  this_check((char *)"");
952  memset(dtmf_buf, 0, sizeof(dtmf_buf));
954  (uint32_t) min_digits,
955  (uint32_t) max_digits,
956  (uint32_t) max_tries,
957  (uint32_t) timeout,
958  terminators,
959  audio_files,
960  bad_input_audio_files,
961  var_name,
962  dtmf_buf,
963  sizeof(dtmf_buf),
964  digits_regex,
965  (uint32_t) digit_timeout,
966  transfer_on_failure);
967 
969  return dtmf_buf;
970 }
switch_status_t switch_play_and_get_digits(switch_core_session_t *session, uint32_t min_digits, uint32_t max_digits, uint32_t max_tries, uint32_t timeout, const char *valid_terminators, const char *audio_file, const char *bad_input_audio_file, const char *var_name, char *digit_buffer, uint32_t digit_buffer_length, const char *digits_regex, uint32_t digit_timeout, const char *transfer_on_failure)
Play a sound and gather digits with the number of retries specified if the user doesn't give digits i...
#define this_check(x)
Definition: switch_cpp.h:12
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check(x)
Definition: switch_cpp.h:14
char dtmf_buf[512]
Definition: switch_cpp.h:216
memset(buf, 0, buflen)
virtual bool end_allow_threads()=0
int CoreSession::preAnswer ( )

Definition at line 699 of file switch_cpp.cpp.

References sanity_check, switch_channel_pre_answer, SWITCH_STATUS_SUCCESS, and this_check.

700 {
701  switch_status_t status;
702  this_check(-1);
703  sanity_check(-1);
705  return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
706 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define this_check(x)
Definition: switch_cpp.h:12
#define sanity_check(x)
Definition: switch_cpp.h:14
switch_status_t
Common return values.
#define switch_channel_pre_answer(channel)
Indicate progress on a channel to attempt early media.
int CoreSession::preAnswer ( )
switch_status_t CoreSession::process_callback_result ( char *  result)

Definition at line 1470 of file switch_cpp.cpp.

References sanity_check, switch_ivr_process_fh(), SWITCH_STATUS_FALSE, and this_check.

1471 {
1472 
1475 
1476  return switch_ivr_process_fh(session, result, fhp);
1477 }
switch_status_t switch_ivr_process_fh(switch_core_session_t *session, const char *cmd, switch_file_handle_t *fhp)
Definition: switch_ivr.c:3888
#define this_check(x)
Definition: switch_cpp.h:12
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check(x)
Definition: switch_cpp.h:14
switch_file_handle_t * fhp
Definition: switch_cpp.h:215
switch_status_t CoreSession::process_callback_result ( char *  result)
char* CoreSession::read ( int  min_digits,
int  max_digits,
const char *  prompt_audio_file,
int  timeout,
const char *  valid_terminators,
int  digit_timeout = 0 
)
char * CoreSession::read ( int  min_digits,
int  max_digits,
const char *  prompt_audio_file,
int  timeout,
const char *  valid_terminators,
int  digit_timeout = 0 
)

Definition at line 908 of file switch_cpp.cpp.

References sanity_check, switch_ivr_read(), and this_check.

914 {
915  this_check((char *)"");
916  sanity_check((char *)"");
917  if (min_digits < 1) {
918  min_digits = 1;
919  }
920 
921  if (max_digits < 1) {
922  max_digits = 1;
923  }
924 
925  if (timeout < 1) {
926  timeout = 1;
927  }
928 
930  switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, NULL, dtmf_buf,
931  sizeof(dtmf_buf), timeout, valid_terminators, (uint32_t)digit_timeout);
933 
934  return dtmf_buf;
935 }
switch_status_t switch_ivr_read(switch_core_session_t *session, uint32_t min_digits, uint32_t max_digits, const char *prompt_audio_file, const char *var_name, char *digit_buffer, switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators, uint32_t digit_timeout)
#define this_check(x)
Definition: switch_cpp.h:12
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check(x)
Definition: switch_cpp.h:14
char dtmf_buf[512]
Definition: switch_cpp.h:216
virtual bool end_allow_threads()=0
bool CoreSession::ready ( )

Definition at line 1047 of file switch_cpp.cpp.

References sanity_check, switch_channel_ready, and this_check.

1047  {
1048 
1049  this_check(false);
1050 
1051  if (!session) {
1052  return false;
1053  }
1054  sanity_check(false);
1055 
1056  return switch_channel_ready(channel) != 0;
1057 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define switch_channel_ready(_channel)
#define this_check(x)
Definition: switch_cpp.h:12
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check(x)
Definition: switch_cpp.h:14
bool CoreSession::ready ( )
int CoreSession::recordFile ( char *  file_name,
int  time_limit = 0,
int  silence_threshold = 0,
int  silence_hits = 0 
)

Record to a file.

Parameters
file_name
<[max_len]>maximum length of the recording in seconds
<[silence_threshold]>energy level audio must fall below to be considered silence (500 is a good starting point).
<[silence_secs]>seconds of silence to interrupt the record.

Definition at line 1192 of file switch_cpp.cpp.

References memset(), sanity_check, switch_file_handle::silence_hits, switch_ivr_record_file(), SWITCH_STATUS_SUCCESS, this_check, and switch_file_handle::thresh.

1193 {
1194  switch_status_t status;
1195  switch_file_handle_t local_fh;
1196 
1197  this_check(-1);
1198  sanity_check(-1);
1199 
1200  memset(&local_fh, 0, sizeof(local_fh));
1201  fhp = &local_fh;
1202  local_fh.thresh = silence_threshold;
1203  local_fh.silence_hits = silence_hits;
1204 
1206  status = switch_ivr_record_file(session, &local_fh, file_name, ap, time_limit);
1208 
1209  fhp = NULL;
1210 
1211  return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
1212 
1213 }
switch_input_args_t * ap
Definition: switch_cpp.h:210
#define this_check(x)
Definition: switch_cpp.h:12
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check(x)
Definition: switch_cpp.h:14
switch_file_handle_t * fhp
Definition: switch_cpp.h:215
switch_status_t switch_ivr_record_file(_In_ switch_core_session_t *session, _In_ switch_file_handle_t *fh, _In_z_ const char *file, _In_opt_ switch_input_args_t *args, _In_ uint32_t limit)
record a file from the session to a file
switch_status_t
Common return values.
memset(buf, 0, buflen)
virtual bool end_allow_threads()=0
int CoreSession::recordFile ( char *  file_name,
int  time_limit = 0,
int  silence_threshold = 0,
int  silence_hits = 0 
)

Record to a file.

Parameters
file_name
<[max_len]>maximum length of the recording in seconds
<[silence_threshold]>energy level audio must fall below to be considered silence (500 is a good starting point).
<[silence_secs]>seconds of silence to interrupt the record.
virtual switch_status_t CoreSession::run_dtmf_callback ( void *  input,
switch_input_type_t  itype 
)
pure virtual

Referenced by dtmf_callback().

virtual switch_status_t CoreSession::run_dtmf_callback ( void *  input,
switch_input_type_t  itype 
)
pure virtual
void CoreSession::say ( const char *  tosay,
const char *  module_name,
const char *  say_type,
const char *  say_method,
const char *  say_gender = NULL 
)
void CoreSession::say ( const char *  tosay,
const char *  module_name,
const char *  say_type,
const char *  say_method,
const char *  say_gender = NULL 
)

Definition at line 972 of file switch_cpp.cpp.

References sanity_check_noreturn, SWITCH_CHANNEL_SESSION_LOG, switch_ivr_say(), SWITCH_LOG_ERROR, switch_log_printf(), and this_check_void.

973 {
974  this_check_void();
976  if (!(tosay && module_name && say_type && say_method)) {
978  return;
979  }
981  switch_ivr_say(session, tosay, module_name, say_type, say_method, say_gender, ap);
983 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_input_args_t * ap
Definition: switch_cpp.h:210
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
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_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type, const char *say_method, const char *say_gender, switch_input_args_t *args)
Definition: switch_ivr.c:3507
virtual bool end_allow_threads()=0
void CoreSession::sayPhrase ( const char *  phrase_name,
const char *  phrase_data = "",
const char *  phrase_lang = NULL 
)
void CoreSession::sayPhrase ( const char *  phrase_name,
const char *  phrase_data = "",
const char *  phrase_lang = NULL 
)

Definition at line 985 of file switch_cpp.cpp.

References sanity_check_noreturn, SWITCH_CHANNEL_SESSION_LOG, switch_ivr_phrase_macro, SWITCH_LOG_ERROR, switch_log_printf(), and this_check_void.

986 {
987  this_check_void();
989 
990  if (!(phrase_name)) {
992  return;
993  }
994 
996  switch_ivr_phrase_macro(session, phrase_name, phrase_data, phrase_lang, ap);
998 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_input_args_t * ap
Definition: switch_cpp.h:210
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
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_ivr_phrase_macro(session, macro_name, data, lang, args)
Definition: switch_ivr.h:903
virtual bool end_allow_threads()=0
void CoreSession::sendEvent ( Event sendME)
void CoreSession::sendEvent ( Event sendME)

Definition at line 795 of file switch_cpp.cpp.

References sanity_check_noreturn, switch_core_session_receive_event(), switch_event_dup(), SWITCH_STATUS_SUCCESS, and this_check_void.

796 {
797  this_check_void();
799 
800  if (sendME->event) {
801  switch_event_t *new_event;
802  if (switch_event_dup(&new_event, sendME->event) == SWITCH_STATUS_SUCCESS) {
804  }
805  }
806 }
switch_event_t * event
Definition: switch_cpp.h:161
Representation of an event.
Definition: switch_event.h:80
switch_core_session_t * session
Definition: switch_cpp.h:223
switch_status_t switch_event_dup(switch_event_t **event, switch_event_t *todup)
Duplicate an event.
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
switch_status_t switch_core_session_receive_event(_In_ switch_core_session_t *session, _Inout_ switch_event_t **event)
Send an event to a session translating it to it's native message format.
void CoreSession::set_tts_params ( char *  tts_name,
char *  voice_name 
)

Definition at line 843 of file switch_cpp.cpp.

References sanity_check_noreturn, switch_safe_free, and this_check_void.

844 {
845  this_check_void();
849  tts_name = strdup(tts_name_p);
850  voice_name = strdup(voice_name_p);
851 }
char * voice_name
Definition: switch_cpp.h:234
char * tts_name
Definition: switch_cpp.h:233
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
Definition: switch_utils.h:789
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
void CoreSession::set_tts_params ( char *  tts_name,
char *  voice_name 
)
void CoreSession::set_tts_parms ( char *  tts_name,
char *  voice_name 
)
void CoreSession::set_tts_parms ( char *  tts_name,
char *  voice_name 
)

Definition at line 832 of file switch_cpp.cpp.

References sanity_check_noreturn, SWITCH_CHANNEL_SESSION_LOG, SWITCH_LOG_ERROR, switch_log_printf(), switch_safe_free, and this_check_void.

833 {
834  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "set_tts_parms is deprecated. Use set_tts_params.\n");
835  this_check_void();
839  tts_name = strdup(tts_name_p);
840  voice_name = strdup(voice_name_p);
841 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
char * voice_name
Definition: switch_cpp.h:234
char * tts_name
Definition: switch_cpp.h:233
switch_core_session_t * session
Definition: switch_cpp.h:223
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
Definition: switch_utils.h:789
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
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 CoreSession::setAutoHangup ( bool  val)
int CoreSession::setAutoHangup ( bool  val)

Definition at line 1240 of file switch_cpp.cpp.

References S_HUP, sanity_check, switch_clear_flag, switch_set_flag, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and this_check.

1241 {
1242  this_check(-1);
1243  sanity_check(-1);
1244 
1245  if (!session) {
1246  return SWITCH_STATUS_FALSE;
1247  }
1248  if (val) {
1249  switch_set_flag(this, S_HUP);
1250  } else {
1251  switch_clear_flag(this, S_HUP);
1252  }
1253  return SWITCH_STATUS_SUCCESS;
1254 }
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
Definition: switch_utils.h:631
#define this_check(x)
Definition: switch_cpp.h:12
switch_core_session_t * session
Definition: switch_cpp.h:223
#define switch_clear_flag(obj, flag)
Clear a flag on an arbitrary object while locked.
Definition: switch_utils.h:655
#define sanity_check(x)
Definition: switch_cpp.h:14
void CoreSession::setDTMFCallback ( void *  cbfunc,
char *  funcargs 
)

set a DTMF callback function

The DTMF callback function will be set and persist for the life of the session, and be called when a dtmf is pressed by user during streamfile(), collectDigits(), and certain other methods are executing.

void CoreSession::setDTMFCallback ( void *  cbfunc,
char *  funcargs 
)

set a DTMF callback function

The DTMF callback function will be set and persist for the life of the session, and be called when a dtmf is pressed by user during streamfile(), collectDigits(), and certain other methods are executing.

Definition at line 772 of file switch_cpp.cpp.

References dtmf_callback(), sanity_check_noreturn, switch_channel_set_private(), and this_check_void.

772  {
773 
774  this_check_void();
776 
777  cb_state.funcargs = funcargs;
778  cb_state.function = cbfunc;
779 
780  args.buf = &cb_state;
781  args.buflen = sizeof(cb_state); // not sure what this is used for, copy mod_spidermonkey
782 
783  switch_channel_set_private(channel, "CoreSession", this);
784 
785  // we cannot set the actual callback to a python function, because
786  // the callback is a function pointer with a specific signature.
787  // so, set it to the following c function which will act as a proxy,
788  // finding the python callback in the args callback args structure
790  ap = &args;
791 
792 
793 }
switch_channel_t * channel
Definition: switch_cpp.h:224
switch_status_t switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
Set private data on channel.
switch_input_args_t * ap
Definition: switch_cpp.h:210
switch_status_t dtmf_callback(switch_core_session_t *session_cb, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
switch_input_callback_function_t input_callback
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
switch_input_args_t args
Definition: switch_cpp.h:208
input_callback_state cb_state
Definition: switch_cpp.h:227
void CoreSession::setEventData ( Event e)
void CoreSession::setEventData ( Event e)

Definition at line 671 of file switch_cpp.cpp.

References sanity_check_noreturn, switch_channel_event_set_data(), and this_check_void.

672 {
673  this_check_void();
675 
676  if (channel && e->event) {
678  }
679 }
switch_channel_t * channel
Definition: switch_cpp.h:224
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_event_t * event
Definition: switch_cpp.h:161
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
void CoreSession::setHangupHook ( void *  hangup_func)

Set the hangup callback function.

Parameters
hangup_func- language specific function ptr cast into void *
void CoreSession::setHangupHook ( void *  hangup_func)

Set the hangup callback function.

Parameters
hangup_func- language specific function ptr cast into void *

Definition at line 1265 of file switch_cpp.cpp.

References hanguphook(), sanity_check_noreturn, switch_channel_get_state(), SWITCH_CHANNEL_SESSION_LOG, switch_channel_set_private(), switch_core_session_get_channel(), SWITCH_LOG_DEBUG, switch_log_printf(), and this_check_void.

1265  {
1266 
1267  this_check_void();
1269 
1270  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "CoreSession::seHangupHook, hangup_func: %p\n", hangup_func);
1271  on_hangup = hangup_func;
1273 
1275  switch_channel_set_private(channel, "CoreSession", this);
1276  switch_core_event_hook_add_state_change(session, hanguphook);
1277 }
switch_channel_t * channel
Definition: switch_cpp.h:224
switch_channel_state_t switch_channel_get_state(switch_channel_t *channel)
Get the current state of a channel in the state engine.
switch_status_t hanguphook(switch_core_session_t *session_hungup)
the actual hangup hook called back by freeswitch core which in turn gets the session and calls the ap...
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_status_t switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
Set private data on channel.
switch_core_session_t * session
Definition: switch_cpp.h:223
_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.
void * on_hangup
Definition: switch_cpp.h:214
switch_channel_state_t hook_state
Definition: switch_cpp.h:229
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
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 CoreSession::setPrivate ( char *  var,
void *  val 
)
void CoreSession::setPrivate ( char *  var,
void *  val 
)

Definition at line 728 of file switch_cpp.cpp.

References sanity_check_noreturn, switch_channel_set_private(), and this_check_void.

729 {
730  this_check_void();
733 }
switch_channel_t * channel
Definition: switch_cpp.h:224
switch_status_t switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
Set private data on channel.
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
void CoreSession::setVariable ( char *  var,
char *  val 
)
void CoreSession::setVariable ( char *  var,
char *  val 
)

Definition at line 742 of file switch_cpp.cpp.

References sanity_check_noreturn, SWITCH_CHANNEL_SESSION_LOG, switch_channel_set_variable_var_check(), SWITCH_FALSE, SWITCH_LOG_DEBUG, switch_log_printf(), and this_check_void.

743 {
744  this_check_void();
746  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "CoreSession::setVariable('%s', '%s')\n", var, val);
748 }
switch_channel_t * channel
Definition: switch_cpp.h:224
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_core_session_t * session
Definition: switch_cpp.h:223
#define this_check_void()
Definition: switch_cpp.h:13
switch_status_t switch_channel_set_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check)
#define sanity_check_noreturn
Definition: switch_cpp.h:15
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 CoreSession::sleep ( int  ms,
int  sync = 0 
)

Definition at line 1032 of file switch_cpp.cpp.

References sanity_check, switch_ivr_sleep(), SWITCH_STATUS_SUCCESS, and this_check.

1032  {
1033 
1034  switch_status_t status;
1035 
1036  this_check(-1);
1037  sanity_check(-1);
1038 
1040  status = switch_ivr_sleep(session, ms, (switch_bool_t) sync, ap);
1042 
1043  return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
1044 
1045 }
switch_status_t switch_ivr_sleep(switch_core_session_t *session, uint32_t ms, switch_bool_t sync, switch_input_args_t *args)
Wait for time to pass for a specified number of milliseconds.
Definition: switch_ivr.c:127
switch_input_args_t * ap
Definition: switch_cpp.h:210
switch_bool_t
Definition: switch_types.h:405
#define this_check(x)
Definition: switch_cpp.h:12
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
#define sanity_check(x)
Definition: switch_cpp.h:14
switch_status_t
Common return values.
virtual bool end_allow_threads()=0
int CoreSession::sleep ( int  ms,
int  sync = 0 
)
int CoreSession::speak ( char *  text)

Definition at line 808 of file switch_cpp.cpp.

References sanity_check, SWITCH_CHANNEL_SESSION_LOG, switch_ivr_speak_text(), SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and this_check.

809 {
810  switch_status_t status;
811 
812  this_check(-1);
813  sanity_check(-1);
814 
815  if (!tts_name) {
817  return SWITCH_STATUS_FALSE;
818  }
819 
820  if (!voice_name) {
822  return SWITCH_STATUS_FALSE;
823  }
824 
825 
829  return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
830 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_input_args_t * ap
Definition: switch_cpp.h:210
char * voice_name
Definition: switch_cpp.h:234
char * tts_name
Definition: switch_cpp.h:233
#define this_check(x)
Definition: switch_cpp.h:12
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
switch_status_t switch_ivr_speak_text(switch_core_session_t *session, const char *tts_name, const char *voice_name, char *text, switch_input_args_t *args)
Speak given text with given tts engine.
#define sanity_check(x)
Definition: switch_cpp.h:14
switch_status_t
Common return values.
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.
virtual bool end_allow_threads()=0
int CoreSession::speak ( char *  text)
void CoreSession::store_file_handle ( switch_file_handle_t fh)
protected
void CoreSession::store_file_handle ( switch_file_handle_t fh)
protected
int CoreSession::streamFile ( char *  file,
int  starting_sample_count = 0 
)

Play a file that resides on disk into the channel.

Parameters
file- the path to the .wav/.mp3 to be played
starting_sample_count- the index of the sample to start playing from
Returns
an int status code indicating success or failure

Definition at line 1000 of file switch_cpp.cpp.

References memset(), switch_file_handle::prebuf, switch_file_handle::samples, sanity_check, switch_channel_get_variable, switch_ivr_play_file(), SWITCH_STATUS_SUCCESS, and this_check.

1000  {
1001 
1002  switch_status_t status;
1003  //switch_file_handle_t fh = { 0 };
1004  const char *prebuf;
1005  switch_file_handle_t local_fh;
1006 
1007  this_check(-1);
1008  sanity_check(-1);
1009 
1010  memset(&local_fh, 0, sizeof(local_fh));
1011  fhp = &local_fh;
1012  local_fh.samples = starting_sample_count;
1013 
1014 
1015  if ((prebuf = switch_channel_get_variable(this->channel, "stream_prebuffer"))) {
1016  int maybe = atoi(prebuf);
1017  if (maybe > 0) {
1018  local_fh.prebuf = maybe;
1019  }
1020  }
1021 
1023  status = switch_ivr_play_file(session, fhp, file, ap);
1025 
1026  fhp = NULL;
1027 
1028  return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
1029 
1030 }
switch_channel_t * channel
Definition: switch_cpp.h:224
switch_input_args_t * ap
Definition: switch_cpp.h:210
#define this_check(x)
Definition: switch_cpp.h:12
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
switch_status_t switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file, switch_input_args_t *args)
play a file from the disk to the session
#define sanity_check(x)
Definition: switch_cpp.h:14
#define switch_channel_get_variable(_c, _v)
switch_file_handle_t * fhp
Definition: switch_cpp.h:215
switch_status_t
Common return values.
memset(buf, 0, buflen)
virtual bool end_allow_threads()=0
int CoreSession::streamFile ( char *  file,
int  starting_sample_count = 0 
)

Play a file that resides on disk into the channel.

Parameters
file- the path to the .wav/.mp3 to be played
starting_sample_count- the index of the sample to start playing from
Returns
an int status code indicating success or failure
int CoreSession::transfer ( char *  extension,
char *  dialplan = NULL,
char *  context = NULL 
)

Definition at line 895 of file switch_cpp.cpp.

References sanity_check, SWITCH_CHANNEL_SESSION_LOG, switch_ivr_session_transfer(), SWITCH_LOG_DEBUG, switch_log_printf(), SWITCH_STATUS_SUCCESS, and this_check.

896 {
897  switch_status_t status;
898  this_check(-1);
899  sanity_check(-1);
901  status = switch_ivr_session_transfer(session, extension, dialplan, context);
902  switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "transfer result: %d\n", status);
904  return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
905 }
#define SWITCH_CHANNEL_SESSION_LOG(x)
#define this_check(x)
Definition: switch_cpp.h:12
virtual bool begin_allow_threads()=0
switch_core_session_t * session
Definition: switch_cpp.h:223
switch_status_t switch_ivr_session_transfer(_In_ switch_core_session_t *session, const char *extension, const char *dialplan, const char *context)
Transfer an existing session to another location.
#define sanity_check(x)
Definition: switch_cpp.h:14
switch_status_t
Common return values.
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.
virtual bool end_allow_threads()=0
int CoreSession::transfer ( char *  extension,
char *  dialplan = NULL,
char *  context = NULL 
)
void CoreSession::waitForAnswer ( CoreSession calling_session)

Definition at line 1256 of file switch_cpp.cpp.

References sanity_check_noreturn, switch_ivr_wait_for_answer(), and this_check_void.

1257 {
1258  this_check_void();
1260 
1261  switch_ivr_wait_for_answer(calling_session ? calling_session->session : NULL, session);
1262 
1263 }
switch_status_t switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session)
switch_core_session_t * session
Definition: switch_cpp.h:223
#define this_check_void()
Definition: switch_cpp.h:13
#define sanity_check_noreturn
Definition: switch_cpp.h:15
void CoreSession::waitForAnswer ( CoreSession calling_session)

Field Documentation

int CoreSession::allocated

Definition at line 226 of file switch_cpp.h.

Referenced by CoreSession(), and ~CoreSession().

switch_input_args_t * CoreSession::ap
protected

Definition at line 210 of file switch_cpp.h.

switch_input_args_t CoreSession::args
protected

Definition at line 208 of file switch_cpp.h.

Referenced by get_cb_args().

switch_call_cause_t CoreSession::cause

Definition at line 230 of file switch_cpp.h.

Referenced by CoreSession(), and hanguphook().

input_callback_state CoreSession::cb_state

Definition at line 227 of file switch_cpp.h.

switch_channel_t * CoreSession::channel

Definition at line 224 of file switch_cpp.h.

Referenced by CoreSession().

char CoreSession::dtmf_buf
protected

Definition at line 216 of file switch_cpp.h.

switch_file_handle_t * CoreSession::fhp
protected

Definition at line 215 of file switch_cpp.h.

unsigned int CoreSession::flags

Definition at line 225 of file switch_cpp.h.

switch_channel_state_t CoreSession::hook_state

Definition at line 229 of file switch_cpp.h.

Referenced by hanguphook().

void * CoreSession::on_hangup
protected

Definition at line 214 of file switch_cpp.h.

switch_core_session_t * CoreSession::session

Definition at line 223 of file switch_cpp.h.

Referenced by API::API(), and CoreSession().

char * CoreSession::tts_name

Definition at line 233 of file switch_cpp.h.

char * CoreSession::uuid

Definition at line 232 of file switch_cpp.h.

Referenced by CoreSession().

char * CoreSession::voice_name

Definition at line 234 of file switch_cpp.h.

char * CoreSession::xml_cdr_text
protected

Definition at line 212 of file switch_cpp.h.


The documentation for this class was generated from the following files: