Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Session Creation / Management
[Core Library]


Defines

#define switch_core_session_destroy(session)   switch_core_session_perform_destroy(session, __FILE__, __SWITCH_FUNC__, __LINE__)
 Destroy a session and return the memory pool to the core.
#define switch_core_session_kill_channel(session, sig)   switch_core_session_perform_kill_channel(session, __FILE__, __SWITCH_FUNC__, __LINE__, sig)
 Send a signal to a channel.

Functions

switch_core_session_tswitch_core_session_request (_In_ const switch_endpoint_interface_t *endpoint_interface, _Inout_opt_ switch_memory_pool_t **pool)
 Allocate and return a new session from the core.
void switch_core_session_perform_destroy (_Inout_ switch_core_session_t **session, _In_z_ const char *file, _In_z_ const char *func, _In_ int line)
uint32_t switch_core_session_count (void)
 Provide the total number of sessions.
uint32_t switch_core_session_get_id (switch_core_session_t *session)
switch_size_t switch_core_session_id (void)
 Provide the current session_id.
switch_core_session_tswitch_core_session_request_by_name (_In_z_ const char *endpoint_name, _Inout_ switch_memory_pool_t **pool)
 Allocate and return a new session from the core based on a given endpoint module name.
switch_status_t switch_core_session_thread_launch (_In_ switch_core_session_t *session)
 Launch the session thread (state machine) on a given session.
_Ret_ switch_channel_tswitch_core_session_get_channel (_In_ switch_core_session_t *session)
 Retrieve a pointer to the channel object associated with a given session.
void switch_core_session_signal_state_change (_In_ switch_core_session_t *session)
 Signal a session's state machine thread that a state change has occured.
char * switch_core_session_get_uuid (_In_ switch_core_session_t *session)
 Retrieve the unique identifier from a session.
char * switch_core_get_uuid (void)
 Retrieve the unique identifier from the core.
switch_core_session_tswitch_core_session_locate (_In_z_ const char *uuid_str)
 Locate a session based on it's uuiid.
char * switch_core_get_variable (_In_z_ const char *varname)
 Retrieve a global variable from the core.
void switch_core_set_variable (_In_z_ const char *varname, _In_opt_z_ const char *value)
 Add a global variable to the core.
void switch_core_dump_variables (_In_ switch_stream_handle_t *stream)
void switch_core_session_hupall (_In_ switch_call_cause_t cause)
 Hangup All Sessions.
void switch_core_session_hupall_matching_var (_In_ const char *var_name, _In_ const char *var_val, _In_ switch_call_cause_t cause)
void switch_core_session_hupall_endpoint (const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause)
switch_status_t switch_core_session_message_send (_In_z_ const char *uuid_str, _In_ switch_core_session_message_t *message)
 Send a message to another session using it's uuid.
switch_status_t switch_core_session_queue_message (_In_ switch_core_session_t *session, _In_ switch_core_session_message_t *message)
 Queue a message on a session.
switch_status_t switch_core_session_pass_indication (_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication)
 pass an indication message on a session
switch_status_t switch_core_session_queue_indication (_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication)
 Queue an indication message on a session.
switch_status_t switch_core_session_dequeue_message (_In_ switch_core_session_t *session, _Out_ switch_core_session_message_t **message)
 DE-Queue an message on a given session.
switch_status_t switch_core_session_flush_message (_In_ switch_core_session_t *session)
 Flush a message queue on a given session.
switch_status_t switch_core_session_event_send (_In_z_ const char *uuid_str, _Inout_ switch_event_t **event)
 Queue an event on another session using its uuid.
switch_app_log_tswitch_core_session_get_app_log (_In_ switch_core_session_t *session)
switch_status_t switch_core_session_exec (_In_ switch_core_session_t *session, _In_ const switch_application_interface_t *application_interface, _In_opt_z_ const char *arg)
switch_status_t switch_core_session_execute_application (_In_ switch_core_session_t *session, _In_ const char *app, _In_opt_z_ const char *arg)
switch_status_t switch_core_session_execute_exten (_In_ switch_core_session_t *session, _In_z_ const char *exten, _In_opt_z_ const char *dialplan, _In_opt_z_ const char *context)
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 * switch_core_session_get_private (_In_ switch_core_session_t *session)
 Retrieve private user data from a session.
switch_status_t switch_core_session_set_private (_In_ switch_core_session_t *session, _In_ void *private_info)
 Add private user data to a session.
int switch_core_session_add_stream (_In_ switch_core_session_t *session, _In_opt_ void *private_info)
 Add a logical stream to a session.
void * switch_core_session_get_stream (_In_ switch_core_session_t *session, _In_ int index)
 Retreive a logical stream from a session.
int switch_core_session_get_stream_count (_In_ switch_core_session_t *session)
 Determine the number of logical streams a session has.
void switch_core_session_launch_thread (_In_ switch_core_session_t *session, _In_ void *(*func)(switch_thread_t *, void *), _In_opt_ void *obj)
 Launch a thread designed to exist within the scope of a given session.
void switch_core_thread_session_end (_In_ switch_core_thread_session_t *thread_session)
 Signal a thread using a thread session to terminate.
void switch_core_service_session (_In_ switch_core_session_t *session, _In_ switch_core_thread_session_t *thread_session, _In_ int stream_id)
 Launch a service thread on a session to drop inbound data.
switch_call_cause_t switch_core_session_outgoing_channel (_In_opt_ switch_core_session_t *session, _In_opt_ switch_event_t *var_event, _In_z_ const char *endpoint_name, _In_ switch_caller_profile_t *caller_profile, _Inout_ switch_core_session_t **new_session, _Inout_ switch_memory_pool_t **pool, _In_ switch_originate_flag_t flags)
 Request an outgoing session spawned from an existing session using a desired endpoing module.
switch_call_cause_t switch_core_session_resurrect_channel (_In_z_ const char *endpoint_name, _Inout_ switch_core_session_t **new_session, _Inout_ switch_memory_pool_t **pool, _In_ void *data)
switch_status_t switch_core_session_receive_message (_In_ switch_core_session_t *session, _In_ switch_core_session_message_t *message)
 Receive a message on a given session.
switch_status_t switch_core_session_queue_event (_In_ switch_core_session_t *session, _Inout_ switch_event_t **event)
 Queue an event on a given session.
uint32_t switch_core_session_event_count (_In_ switch_core_session_t *session)
 Indicate the number of waiting events on a session.
switch_status_t switch_core_session_dequeue_event (_In_ switch_core_session_t *session, _Out_ switch_event_t **event)
 DE-Queue an event on a given session.
switch_status_t switch_core_session_queue_private_event (_In_ switch_core_session_t *session, _Inout_ switch_event_t **event)
 Queue a private event on a given session.
uint32_t switch_core_session_private_event_count (_In_ switch_core_session_t *session)
 Indicate the number of waiting private events on a session.
switch_status_t switch_core_session_dequeue_private_event (_In_ switch_core_session_t *session, _Out_ switch_event_t **event)
 DE-Queue a private event on a given session.
uint32_t switch_core_session_flush_private_events (switch_core_session_t *session)
 Flush the private event queue of a session.
switch_status_t switch_core_session_read_frame (_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
 Read a frame from a session.
switch_status_t switch_core_session_read_video_frame (_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
 Read a video frame from a session.
switch_status_t switch_core_session_write_video_frame (_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
 Write a video frame to a session.
void switch_core_session_reset (_In_ switch_core_session_t *session, switch_bool_t flush_dtmf)
 Reset the buffers and resampler on a session.
switch_status_t switch_core_session_write_frame (_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
 Write a frame to a session.
switch_status_t switch_core_session_perform_kill_channel (_In_ switch_core_session_t *session, const char *file, const char *func, int line, switch_signal_t sig)
switch_status_t switch_core_session_send_dtmf (_In_ switch_core_session_t *session, const switch_dtmf_t *dtmf)
 Send DTMF to a session.
switch_status_t switch_core_session_send_dtmf_string (switch_core_session_t *session, const char *dtmf_string)
switch_status_t switch_core_session_recv_dtmf (_In_ switch_core_session_t *session, const switch_dtmf_t *dtmf)
 RECV DTMF on a session.


Define Documentation

#define switch_core_session_destroy session   )     switch_core_session_perform_destroy(session, __FILE__, __SWITCH_FUNC__, __LINE__)
 

Destroy a session and return the memory pool to the core.

Parameters:
session pointer to a pointer of the session to destroy
Returns:

#define switch_core_session_kill_channel session,
sig   )     switch_core_session_perform_kill_channel(session, __FILE__, __SWITCH_FUNC__, __LINE__, sig)
 

Send a signal to a channel.

Parameters:
session session to send signal to
sig signal to send
Returns:
status returned by the session's signal handler


Function Documentation

void switch_core_dump_variables _In_ switch_stream_handle_t stream  ) 
 

char* switch_core_get_uuid void   ) 
 

Retrieve the unique identifier from the core.

Returns:
a string representing the uuid
00267 {
00268         return runtime.uuid_str;
00269 }

char* switch_core_get_variable _In_z_ const char *  varname  ) 
 

Retrieve a global variable from the core.

Parameters:
varname the name of the variable
Returns:
the value of the desired variable

void switch_core_service_session _In_ switch_core_session_t session,
_In_ switch_core_thread_session_t thread_session,
_In_ int  stream_id
 

Launch a service thread on a session to drop inbound data.

Parameters:
session the session the launch thread on
stream_id which logical media channel to use
thread_session the thread_session to use

int switch_core_session_add_stream _In_ switch_core_session_t session,
_In_opt_ void *  private_info
 

Add a logical stream to a session.

Parameters:
session the session to add the stream to
private_info an optional pointer to private data for the new stream
Returns:
the stream id of the new stream

uint32_t switch_core_session_count void   ) 
 

Provide the total number of sessions.

Returns:
the total number of allocated sessions
00963 {
00964         return session_manager.session_count;
00965 }

switch_status_t switch_core_session_dequeue_event _In_ switch_core_session_t session,
_Out_ switch_event_t **  event
 

DE-Queue an event on a given session.

Parameters:
session the session to de-queue the message on
event the de-queued event
Returns:
the SWITCH_STATUS_SUCCESS if the event was de-queued

switch_status_t switch_core_session_dequeue_message _In_ switch_core_session_t session,
_Out_ switch_core_session_message_t **  message
 

DE-Queue an message on a given session.

Parameters:
session the session to de-queue the message on
message the de-queued message
Returns:
the SWITCH_STATUS_SUCCESS if the message was de-queued

switch_status_t switch_core_session_dequeue_private_event _In_ switch_core_session_t session,
_Out_ switch_event_t **  event
 

DE-Queue a private event on a given session.

Parameters:
session the session to de-queue the message on
event the de-queued event
Returns:
the SWITCH_STATUS_SUCCESS if the event was de-queued

uint32_t switch_core_session_event_count _In_ switch_core_session_t session  ) 
 

Indicate the number of waiting events on a session.

Parameters:
session the session to check
Returns:
the number of events

switch_status_t switch_core_session_event_send _In_z_ const char *  uuid_str,
_Inout_ switch_event_t **  event
 

Queue an event on another session using its uuid.

Parameters:
uuid_str the unique id of the session you want to send a message to
event the event to send
Returns:
the status returned by the message handler

switch_status_t switch_core_session_exec _In_ switch_core_session_t session,
_In_ const switch_application_interface_t application_interface,
_In_opt_z_ const char *  arg
 

switch_status_t switch_core_session_execute_application _In_ switch_core_session_t session,
_In_ const char *  app,
_In_opt_z_ const char *  arg
 

switch_status_t switch_core_session_execute_exten _In_ switch_core_session_t session,
_In_z_ const char *  exten,
_In_opt_z_ const char *  dialplan,
_In_opt_z_ const char *  context
 

switch_status_t switch_core_session_flush_message _In_ switch_core_session_t session  ) 
 

Flush a message queue on a given session.

Parameters:
session the session to de-queue the message on
Returns:
the SWITCH_STATUS_SUCCESS if the message was de-queued

uint32_t switch_core_session_flush_private_events switch_core_session_t session  ) 
 

Flush the private event queue of a session.

Parameters:
session the session to flush
Returns:
SWITCH_STATUS_SUCCESS if the events have been flushed
00655 {
00656         switch_status_t status = SWITCH_STATUS_FALSE;
00657         int x = 0;
00658         void *pop;
00659 
00660         if (session->private_event_queue) {
00661                 while ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
00662                         x++;
00663                 }
00664         }
00665 
00666         return x;
00667 }

Here is the call graph for this function:

switch_app_log_t* switch_core_session_get_app_log _In_ switch_core_session_t session  ) 
 

_Ret_ switch_channel_t* switch_core_session_get_channel _In_ switch_core_session_t session  ) 
 

Retrieve a pointer to the channel object associated with a given session.

Parameters:
session the session to retrieve from
Returns:
a pointer to the channel object

uint32_t switch_core_session_get_id switch_core_session_t session  ) 
 

00968 {
00969         return session->id;
00970 }

void* switch_core_session_get_private _In_ switch_core_session_t session  ) 
 

Retrieve private user data from a session.

Parameters:
session the session to retrieve from
Returns:
a pointer to the private data

void* switch_core_session_get_stream _In_ switch_core_session_t session,
_In_ int  index
 

Retreive a logical stream from a session.

Parameters:
session the session to add the stream to
index the index to retrieve
Returns:
the stream

int switch_core_session_get_stream_count _In_ switch_core_session_t session  ) 
 

Determine the number of logical streams a session has.

Parameters:
session the session to query
Returns:
the total number of logical streams

char* switch_core_session_get_uuid _In_ switch_core_session_t session  ) 
 

Retrieve the unique identifier from a session.

Parameters:
session the session to retrieve the uuid from
Returns:
a string representing the uuid

void switch_core_session_hupall _In_ switch_call_cause_t  cause  ) 
 

Hangup All Sessions.

Parameters:
cause the hangup cause to apply to the hungup channels

void switch_core_session_hupall_endpoint const switch_endpoint_interface_t endpoint_interface,
switch_call_cause_t  cause
 

00099 {
00100         switch_hash_index_t *hi;
00101         void *val;
00102         switch_core_session_t *session;
00103 
00104         switch_mutex_lock(runtime.throttle_mutex);
00105         for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
00106                 switch_hash_this(hi, NULL, NULL, &val);
00107                 if (val) {
00108                         session = (switch_core_session_t *) val;
00109                         switch_core_session_read_lock(session);
00110                         if (session->endpoint_interface == endpoint_interface) {
00111                                 switch_channel_hangup(switch_core_session_get_channel(session), cause);
00112                         }
00113                         switch_core_session_rwunlock(session);
00114                 }
00115         }
00116         switch_mutex_unlock(runtime.throttle_mutex);
00117 }       

Here is the call graph for this function:

void switch_core_session_hupall_matching_var _In_ const char *  var_name,
_In_ const char *  var_val,
_In_ switch_call_cause_t  cause
 

switch_size_t switch_core_session_id void   ) 
 

Provide the current session_id.

Returns:
the total number of allocated sessions since core startup
00973 {
00974         return session_manager.session_id;
00975 }

void switch_core_session_launch_thread _In_ switch_core_session_t session,
_In_ void *(*)(switch_thread_t *, void *)  func,
_In_opt_ void *  obj
 

Launch a thread designed to exist within the scope of a given session.

Parameters:
session a session to allocate the thread from
func a function to execute in the thread
obj an arguement

switch_core_session_t* switch_core_session_locate _In_z_ const char *  uuid_str  ) 
 

Locate a session based on it's uuiid.

Parameters:
uuid_str the unique id of the session you want to find
Returns:
the session or NULL
Note:
if the session was located it will have a read lock obtained which will need to be released with switch_core_session_rwunlock()

switch_status_t switch_core_session_message_send _In_z_ const char *  uuid_str,
_In_ switch_core_session_message_t message
 

Send a message to another session using it's uuid.

Parameters:
uuid_str the unique id of the session you want to send a message to
message the switch_core_session_message_t object to send
Returns:
the status returned by the message handler

switch_call_cause_t switch_core_session_outgoing_channel _In_opt_ switch_core_session_t session,
_In_opt_ switch_event_t var_event,
_In_z_ const char *  endpoint_name,
_In_ switch_caller_profile_t caller_profile,
_Inout_ switch_core_session_t **  new_session,
_Inout_ switch_memory_pool_t **  pool,
_In_ switch_originate_flag_t  flags
 

Request an outgoing session spawned from an existing session using a desired endpoing module.

Parameters:
session the originating session
var_event switch_event_t containing paramaters
endpoint_name the name of the module to use for the new session
caller_profile the originator's caller profile
new_session a NULL pointer to aim at the newly created session
pool optional existing memory pool to donate to the session
flags flags to use
Returns:
the cause code of the attempted call

switch_status_t switch_core_session_pass_indication _In_ switch_core_session_t session,
_In_ switch_core_session_message_types_t  indication
 

pass an indication message on a session

Parameters:
session the session to pass the message across
indication the indication message to pass
Returns:
SWITCH_STATUS_SUCCESS if the message was passed

void switch_core_session_perform_destroy _Inout_ switch_core_session_t **  session,
_In_z_ const char *  file,
_In_z_ const char *  func,
_In_ int  line
 

switch_status_t switch_core_session_perform_kill_channel _In_ switch_core_session_t session,
const char *  file,
const char *  func,
int  line,
switch_signal_t  sig
 

uint32_t switch_core_session_private_event_count _In_ switch_core_session_t session  ) 
 

Indicate the number of waiting private events on a session.

Parameters:
session the session to check
Returns:
the number of events

switch_status_t switch_core_session_queue_event _In_ switch_core_session_t session,
_Inout_ switch_event_t **  event
 

Queue an event on a given session.

Parameters:
session the session to queue the message on
event the event to queue
Returns:
the status returned by the message handler

switch_status_t switch_core_session_queue_indication _In_ switch_core_session_t session,
_In_ switch_core_session_message_types_t  indication
 

Queue an indication message on a session.

Parameters:
session the session to queue the message to
indication the indication message to queue
Returns:
SWITCH_STATUS_SUCCESS if the message was queued

switch_status_t switch_core_session_queue_message _In_ switch_core_session_t session,
_In_ switch_core_session_message_t message
 

Queue a message on a session.

Parameters:
session the session to queue the message to
message the message to queue
Returns:
SWITCH_STATUS_SUCCESS if the message was queued

switch_status_t switch_core_session_queue_private_event _In_ switch_core_session_t session,
_Inout_ switch_event_t **  event
 

Queue a private event on a given session.

Parameters:
session the session to queue the message on
event the event to queue
Returns:
the status returned by the message handler

switch_status_t switch_core_session_read_frame _In_ switch_core_session_t session,
switch_frame_t **  frame,
switch_io_flag_t  flags,
int  stream_id
 

Read a frame from a session.

Parameters:
session the session to read from
frame a NULL pointer to a frame to aim at the newly read frame
flags I/O flags to modify behavior (i.e. non blocking)
stream_id which logical media channel to use
Returns:
SWITCH_STATUS_SUCCESS a the frame was read

switch_status_t switch_core_session_read_video_frame _In_ switch_core_session_t session,
switch_frame_t **  frame,
switch_io_flag_t  flags,
int  stream_id
 

Read a video frame from a session.

Parameters:
session the session to read from
frame a NULL pointer to a frame to aim at the newly read frame
flags I/O flags to modify behavior (i.e. non blocking)
stream_id which logical media channel to use
Returns:
SWITCH_STATUS_SUCCESS a if the frame was read

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.

Parameters:
session the session to receive the event
event the event to receive
Returns:
the status returned by the handler

switch_status_t switch_core_session_receive_message _In_ switch_core_session_t session,
_In_ switch_core_session_message_t message
 

Receive a message on a given session.

Parameters:
session the session to receive the message from
message the message to recieve
Returns:
the status returned by the message handler

switch_status_t switch_core_session_recv_dtmf _In_ switch_core_session_t session,
const switch_dtmf_t dtmf
 

RECV DTMF on a session.

Parameters:
session session to recv DTMF from
dtmf string to recv from the session
Returns:
SWITCH_STATUS_SUCCESS if the dtmf is ok to queue

switch_core_session_t* switch_core_session_request _In_ const switch_endpoint_interface_t endpoint_interface,
_Inout_opt_ switch_memory_pool_t **  pool
 

Allocate and return a new session from the core.

Parameters:
endpoint_interface the endpoint interface the session is to be based on
pool the pool to use for the allocation (a new one will be used if NULL)
Returns:
the newly created session

switch_core_session_t* switch_core_session_request_by_name _In_z_ const char *  endpoint_name,
_Inout_ switch_memory_pool_t **  pool
 

Allocate and return a new session from the core based on a given endpoint module name.

Parameters:
endpoint_name the name of the endpoint module
pool the pool to use
Returns:
the newly created session

void switch_core_session_reset _In_ switch_core_session_t session,
switch_bool_t  flush_dtmf
 

Reset the buffers and resampler on a session.

Parameters:
session the session to reset
flush_dtmf flush all queued dtmf events too

switch_call_cause_t switch_core_session_resurrect_channel _In_z_ const char *  endpoint_name,
_Inout_ switch_core_session_t **  new_session,
_Inout_ switch_memory_pool_t **  pool,
_In_ void *  data
 

switch_status_t switch_core_session_send_dtmf _In_ switch_core_session_t session,
const switch_dtmf_t dtmf
 

Send DTMF to a session.

Parameters:
session session to send DTMF to
dtmf string to send to the session
Returns:
SWITCH_STATUS_SUCCESS if the dtmf was written

switch_status_t switch_core_session_send_dtmf_string switch_core_session_t session,
const char *  dtmf_string
 

01039 {
01040         char *p;
01041         switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
01042         int sent = 0, dur;
01043         char *string;
01044         int i, argc;
01045         char *argv[256];
01046         int dur_total = 0;
01047 
01048         switch_assert(session != NULL);
01049 
01050 
01051         if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
01052                 return SWITCH_STATUS_FALSE;
01053         }
01054 
01055         if (switch_strlen_zero(dtmf_string)) {
01056                 return SWITCH_STATUS_FALSE;
01057         }
01058 
01059         if (strlen(dtmf_string) > 99) {
01060                 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Attempt to send very large dtmf string ignored!\n");
01061                 return SWITCH_STATUS_FALSE;
01062         }
01063 
01064         string = switch_core_session_strdup(session, dtmf_string);
01065         argc = switch_separate_string(string, '+', argv, (sizeof(argv) / sizeof(argv[0])));
01066 
01067         if (argc) {
01068                 switch_channel_pre_answer(session->channel);
01069         }
01070 
01071         for (i = 0; i < argc; i++) {
01072                 dtmf.duration = switch_core_default_dtmf_duration(0);
01073                 dur = switch_core_default_dtmf_duration(0) / 8;
01074                 if ((p = strchr(argv[i], '@'))) {
01075                         *p++ = '\0';
01076                         if ((dur = atoi(p)) > 50) {
01077                                 dtmf.duration = dur * 8;
01078                         }
01079                 }
01080 
01081 
01082                 if (dtmf.duration > switch_core_max_dtmf_duration(0)) {
01083                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
01084                                                           switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
01085                         dtmf.duration = switch_core_max_dtmf_duration(0);
01086                 } else if (!dtmf.duration) {
01087                         dtmf.duration = switch_core_default_dtmf_duration(0);
01088                 }
01089 
01090                 for (p = argv[i]; p && *p; p++) {
01091                         if (is_dtmf(*p)) {
01092                                 dtmf.digit = *p;
01093                                 if (switch_core_session_send_dtmf(session, &dtmf) == SWITCH_STATUS_SUCCESS) {
01094                                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s send dtmf\ndigit=%c ms=%u samples=%u\n",
01095                                                                           switch_channel_get_name(session->channel), dtmf.digit, dur, dtmf.duration);
01096                                         sent++;
01097                                         dur_total += dtmf.duration + 2000; /* account for 250ms pause */
01098                                 }
01099                         }
01100                 }
01101 
01102                 if (dur_total) {
01103                         char tmp[32] = "";
01104                         switch_snprintf(tmp, sizeof(tmp), "%d", dur_total / 8);
01105                         switch_channel_set_variable(session->channel, "last_dtmf_duration", tmp);
01106                 }
01107 
01108         }
01109         return sent ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
01110 }

Here is the call graph for this function:

switch_status_t switch_core_session_set_private _In_ switch_core_session_t session,
_In_ void *  private_info
 

Add private user data to a session.

Parameters:
session the session to add used data to
private_info the used data to add
Returns:
SWITCH_STATUS_SUCCESS if data is added