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

Channel Functions
[Core Library]


Detailed Description

The switch_channel object is a private entity that belongs to a session that contains the call specific information such as the call state, variables, caller profiles and DTMF queue


Defines

#define switch_channel_set_running_state(channel, state)   switch_channel_perform_set_running_state(channel, state, __FILE__, __SWITCH_FUNC__, __LINE__)
#define switch_channel_set_state(channel, state)   switch_channel_perform_set_state(channel, __FILE__, __SWITCH_FUNC__, __LINE__, state)
 Set the current state of a channel.
#define switch_channel_answer(channel)   switch_channel_perform_answer(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 Answer a channel (initiate/acknowledge a successful connection).
#define switch_channel_mark_answered(channel)   switch_channel_perform_mark_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 Mark a channel answered with no indication (for outbound calls).
#define switch_channel_mark_pre_answered(channel)   switch_channel_perform_mark_pre_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 Mark a channel pre_answered (early media) with no indication (for outbound calls).
#define switch_channel_ring_ready(channel)   switch_channel_perform_ring_ready(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 Send Ringing message to a channel.
#define switch_channel_pre_answer(channel)   switch_channel_perform_pre_answer(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 Indicate progress on a channel to attempt early media.
#define switch_channel_mark_ring_ready(channel)   switch_channel_perform_mark_ring_ready(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 Indicate a channel is ready to provide ringback.
#define switch_channel_hangup(channel, hangup_cause)   switch_channel_perform_hangup(channel, __FILE__, __SWITCH_FUNC__, __LINE__, hangup_cause)
 Hangup a channel flagging it's state machine to end.
#define switch_channel_stop_broadcast(_channel)   if (switch_channel_test_flag(_channel, CF_BROADCAST)) switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
#define switch_channel_media_ready(_channel)   ((switch_channel_test_flag(_channel, CF_ANSWERED) || switch_channel_test_flag(_channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(_channel, CF_PROXY_MODE))

Functions

switch_channel_state_t switch_channel_get_state (switch_channel_t *channel)
 Get the current state of a channel in the state engine.
switch_channel_state_t switch_channel_get_running_state (switch_channel_t *channel)
uint8_t switch_channel_ready (switch_channel_t *channel)
 Determine if a channel is ready for io.
void switch_channel_wait_for_state (switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state)
switch_status_t switch_channel_wait_for_flag (switch_channel_t *channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint32_t to, switch_channel_t *super_channel)
switch_channel_state_t switch_channel_perform_set_state (switch_channel_t *channel, const char *file, const char *func, int line, switch_channel_state_t state)
switch_channel_state_t switch_channel_perform_set_running_state (switch_channel_t *channel, switch_channel_state_t state, const char *file, const char *func, int line)
switch_call_cause_t switch_channel_str2cause (_In_ const char *str)
 return a cause code for a given string
switch_call_cause_t switch_channel_get_cause (_In_ switch_channel_t *channel)
 return the cause code for a given channel
switch_call_cause_t switch_channel_cause_q850 (switch_call_cause_t cause)
switch_call_cause_t switch_channel_get_cause_q850 (switch_channel_t *channel)
const char * switch_channel_cause2str (_In_ switch_call_cause_t cause)
 return a cause string for a given cause
switch_channel_timetable_tswitch_channel_get_timetable (_In_ switch_channel_t *channel)
 View the timetable of a channel.
switch_status_t switch_channel_alloc (_In_ switch_channel_t **channel, _In_ switch_memory_pool_t *pool)
 Allocate a new channel.
switch_status_t switch_channel_init (switch_channel_t *channel, switch_core_session_t *session, switch_channel_state_t state, uint32_t flags)
 Connect a newly allocated channel to a session object and setup it's initial state.
void switch_channel_presence (switch_channel_t *channel, const char *rpid, const char *status, const char *id)
 Fire A presence event for the channel.
void switch_channel_uninit (switch_channel_t *channel)
 Uninitalize a channel.
void switch_channel_set_caller_profile (switch_channel_t *channel, switch_caller_profile_t *caller_profile)
 Set the given channel's caller profile.
switch_caller_profile_tswitch_channel_get_caller_profile (switch_channel_t *channel)
 Retrive the given channel's caller profile.
void switch_channel_set_originator_caller_profile (switch_channel_t *channel, switch_caller_profile_t *caller_profile)
 Set the given channel's originator caller profile.
switch_caller_profile_tswitch_channel_get_originator_caller_profile (switch_channel_t *channel)
 Retrive the given channel's originator caller profile.
void switch_channel_set_originatee_caller_profile (switch_channel_t *channel, switch_caller_profile_t *caller_profile)
 Set the given channel's originatee caller profile.
switch_caller_profile_tswitch_channel_get_originatee_caller_profile (switch_channel_t *channel)
 Retrive the given channel's originatee caller profile.
char * switch_channel_get_uuid (switch_channel_t *channel)
 Retrive the given channel's unique id.
switch_status_t switch_channel_set_variable (switch_channel_t *channel, const char *varname, const char *value)
 Set a variable on a given channel.
switch_status_t switch_channel_set_variable_printf (switch_channel_t *channel, const char *varname, const char *fmt,...)
switch_status_t switch_channel_set_variable_partner (switch_channel_t *channel, const char *varname, const char *value)
const char * switch_channel_get_variable_partner (switch_channel_t *channel, const char *varname)
const char * switch_channel_get_variable (switch_channel_t *channel, const char *varname)
 Retrieve a variable from a given channel.
switch_status_t switch_channel_get_variables (switch_channel_t *channel, switch_event_t **event)
switch_event_header_tswitch_channel_variable_first (switch_channel_t *channel)
void switch_channel_variable_last (switch_channel_t *channel)
void switch_channel_set_caller_extension (switch_channel_t *channel, switch_caller_extension_t *caller_extension)
 Assign a caller extension to a given channel.
switch_caller_extension_tswitch_channel_get_caller_extension (switch_channel_t *channel)
 Retrieve caller extension from a given channel.
uint32_t switch_channel_test_flag (switch_channel_t *channel, switch_channel_flag_t flags)
 Test for presence of given flag(s) on a given channel.
void switch_channel_set_flag (switch_channel_t *channel, switch_channel_flag_t flags)
 Set given flag(s) on a given channel.
switch_bool_t switch_channel_set_flag_partner (switch_channel_t *channel, switch_channel_flag_t flags)
 Set given flag(s) on a given channel's bridge partner.
switch_bool_t switch_channel_clear_flag_partner (switch_channel_t *channel, switch_channel_flag_t flags)
 Clears given flag(s) on a given channel's bridge partner.
void switch_channel_set_state_flag (switch_channel_t *channel, switch_channel_flag_t flags)
 Set given flag(s) on a given channel to be applied on the next state change.
void switch_channel_clear_flag (switch_channel_t *channel, switch_channel_flag_t flags)
 Clear given flag(s) from a channel.
switch_status_t switch_channel_perform_answer (switch_channel_t *channel, const char *file, const char *func, int line)
switch_status_t switch_channel_perform_mark_answered (switch_channel_t *channel, const char *file, const char *func, int line)
switch_status_t switch_channel_perform_ring_ready (switch_channel_t *channel, const char *file, const char *func, int line)
switch_status_t switch_channel_perform_pre_answer (switch_channel_t *channel, const char *file, const char *func, int line)
switch_status_t switch_channel_perform_mark_pre_answered (switch_channel_t *channel, const char *file, const char *func, int line)
switch_status_t switch_channel_perform_mark_ring_ready (switch_channel_t *channel, const char *file, const char *func, int line)
int switch_channel_add_state_handler (switch_channel_t *channel, const switch_state_handler_table_t *state_handler)
 add a state handler table to a given channel
void switch_channel_clear_state_handler (switch_channel_t *channel, const switch_state_handler_table_t *state_handler)
 clear a state handler table from a given channel
const switch_state_handler_table_tswitch_channel_get_state_handler (switch_channel_t *channel, int index)
 Retrieve an state handler tablefrom a given channel at given index level.
switch_status_t switch_channel_set_private (switch_channel_t *channel, const char *key, const void *private_info)
 Set private data on channel.
void * switch_channel_get_private (switch_channel_t *channel, const char *key)
 Retrieve private from a given channel.
switch_status_t switch_channel_set_name (switch_channel_t *channel, const char *name)
 Assign a name to a given channel.
char * switch_channel_get_name (switch_channel_t *channel)
 Retrieve the name of a given channel.
switch_channel_state_t switch_channel_perform_hangup (switch_channel_t *channel, const char *file, const char *func, int line, switch_call_cause_t hangup_cause)
switch_size_t switch_channel_has_dtmf (_In_ switch_channel_t *channel)
 Test for presence of DTMF on a given channel.
switch_status_t switch_channel_queue_dtmf (_In_ switch_channel_t *channel, _In_ const switch_dtmf_t *dtmf)
 Queue DTMF on a given channel.
switch_status_t switch_channel_queue_dtmf_string (_In_ switch_channel_t *channel, _In_ const char *dtmf_string)
switch_status_t switch_channel_dequeue_dtmf (_In_ switch_channel_t *channel, _In_ switch_dtmf_t *dtmf)
 Retrieve DTMF digits from a given channel.
void switch_channel_flush_dtmf (_In_ switch_channel_t *channel)
switch_size_t switch_channel_dequeue_dtmf_string (_In_ switch_channel_t *channel, _Out_opt_bytecapcount_(len) char *dtmf_str, _In_ switch_size_t len)
const char * switch_channel_state_name (_In_ switch_channel_state_t state)
 Render the name of the provided state enum.
switch_channel_state_t switch_channel_name_state (_In_ const char *name)
 Render the enum of the provided state name.
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.
char * switch_channel_expand_variables (_In_ switch_channel_t *channel, _In_ const char *in)
 Expand varaibles in a string based on the variables in a paticular channel.
char * switch_channel_build_param_string (_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile, _In_opt_ const char *prefix)
switch_status_t switch_channel_set_timestamps (_In_ switch_channel_t *channel)


Define Documentation

#define switch_channel_answer channel   )     switch_channel_perform_answer(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 

Answer a channel (initiate/acknowledge a successful connection).

Parameters:
channel channel to answer
Returns:
SWITCH_STATUS_SUCCESS if channel was answered successfully

#define switch_channel_hangup channel,
hangup_cause   )     switch_channel_perform_hangup(channel, __FILE__, __SWITCH_FUNC__, __LINE__, hangup_cause)
 

Hangup a channel flagging it's state machine to end.

Parameters:
channel channel to hangup
hangup_cause the appropriate hangup cause
Returns:
the resulting channel state.

#define switch_channel_mark_answered channel   )     switch_channel_perform_mark_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 

Mark a channel answered with no indication (for outbound calls).

Parameters:
channel channel to mark answered
Returns:
SWITCH_STATUS_SUCCESS if channel was answered successfully

#define switch_channel_mark_pre_answered channel   )     switch_channel_perform_mark_pre_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 

Mark a channel pre_answered (early media) with no indication (for outbound calls).

Parameters:
channel channel to mark pre_answered
Returns:
SWITCH_STATUS_SUCCESS if channel was pre_answered successfully

#define switch_channel_mark_ring_ready channel   )     switch_channel_perform_mark_ring_ready(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 

Indicate a channel is ready to provide ringback.

Parameters:
channel channel
Returns:
SWITCH_STATUS_SUCCESS

#define switch_channel_media_ready _channel   )     ((switch_channel_test_flag(_channel, CF_ANSWERED) || switch_channel_test_flag(_channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(_channel, CF_PROXY_MODE))
 

#define switch_channel_pre_answer channel   )     switch_channel_perform_pre_answer(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 

Indicate progress on a channel to attempt early media.

Parameters:
channel channel to pre-answer
Returns:
SWITCH_STATUS_SUCCESS

#define switch_channel_ring_ready channel   )     switch_channel_perform_ring_ready(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
 

Send Ringing message to a channel.

Parameters:
channel channel to ring
Returns:
SWITCH_STATUS_SUCCESS if successful

#define switch_channel_set_running_state channel,
state   )     switch_channel_perform_set_running_state(channel, state, __FILE__, __SWITCH_FUNC__, __LINE__)
 

#define switch_channel_set_state channel,
state   )     switch_channel_perform_set_state(channel, __FILE__, __SWITCH_FUNC__, __LINE__, state)
 

Set the current state of a channel.

Parameters:
channel channel to set state of
state new state
Returns:
current state of channel after application of new state

#define switch_channel_stop_broadcast _channel   )     if (switch_channel_test_flag(_channel, CF_BROADCAST)) switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
 


Function Documentation

int switch_channel_add_state_handler switch_channel_t channel,
const switch_state_handler_table_t state_handler
 

add a state handler table to a given channel

Parameters:
channel channel on which to add the state handler table
state_handler table of state handler functions
Returns:
the index number/priority of the table negative value indicates failure
01315 {
01316         int x, index;
01317 
01318         switch_assert(channel != NULL);
01319         switch_mutex_lock(channel->flag_mutex);
01320         for (x = 0; x < SWITCH_MAX_STATE_HANDLERS; x++) {
01321                 if (channel->state_handlers[x] == state_handler) {
01322                         index = x;
01323                         goto end;
01324                 }
01325         }
01326         index = channel->state_handler_index++;
01327 
01328         if (channel->state_handler_index >= SWITCH_MAX_STATE_HANDLERS) {
01329                 index = -1;
01330                 goto end;
01331         }
01332 
01333         channel->state_handlers[index] = state_handler;
01334 
01335   end:
01336         switch_mutex_unlock(channel->flag_mutex);
01337         return index;
01338 }

Here is the call graph for this function:

switch_status_t switch_channel_alloc _In_ switch_channel_t **  channel,
_In_ switch_memory_pool_t pool
 

Allocate a new channel.

Parameters:
channel NULL pointer to allocate channel to
pool memory_pool to use for allocation
Returns:
SWITCH_STATUS_SUCCESS if successful

char* switch_channel_build_param_string _In_ switch_channel_t channel,
_In_opt_ switch_caller_profile_t caller_profile,
_In_opt_ const char *  prefix
 

const char* switch_channel_cause2str _In_ switch_call_cause_t  cause  ) 
 

return a cause string for a given cause

Parameters:
cause the code to check
Returns:
the string

switch_call_cause_t switch_channel_cause_q850 switch_call_cause_t  cause  ) 
 

00170 {
00171         if (cause <= SWITCH_CAUSE_INTERWORKING) {
00172                 return cause;
00173         } else {
00174                 return SWITCH_CAUSE_NORMAL_CLEARING;
00175         }
00176 }

void switch_channel_clear_flag switch_channel_t channel,
switch_channel_flag_t  flags
 

Clear given flag(s) from a channel.

Parameters:
channel channel to clear flags from
flags or'd list of flags to clear
00755 {
00756         switch_assert(channel != NULL);
00757         switch_clear_flag_locked(channel, flags);
00758 }

switch_bool_t switch_channel_clear_flag_partner switch_channel_t channel,
switch_channel_flag_t  flags
 

Clears given flag(s) on a given channel's bridge partner.

Parameters:
channel channel to derive the partner channel to clear flag(s) from
flags the flags to clear
Returns:
true if the flag was cleared
00666 {
00667         const char *uuid;
00668 
00669         switch_assert(channel != NULL);
00670 
00671         if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
00672                 switch_core_session_t *session;
00673                 if ((session = switch_core_session_locate(uuid))) {
00674                         switch_channel_clear_flag(switch_core_session_get_channel(session), flags);
00675                         switch_core_session_rwunlock(session);
00676                         return SWITCH_TRUE;
00677                 }
00678         }
00679 
00680         return SWITCH_FALSE;
00681 }

Here is the call graph for this function:

void switch_channel_clear_state_handler switch_channel_t channel,
const switch_state_handler_table_t state_handler
 

clear a state handler table from a given channel

Parameters:
channel channel from which to clear the state handler table
state_handler table of state handler functions
01358 {
01359         int index, i = channel->state_handler_index;
01360         const switch_state_handler_table_t *new_handlers[SWITCH_MAX_STATE_HANDLERS] = { 0 };
01361 
01362         switch_assert(channel != NULL);
01363 
01364         switch_mutex_lock(channel->flag_mutex);
01365         channel->state_handler_index = 0;
01366 
01367         if (state_handler) {
01368                 for (index = 0; index < i; index++) {
01369                         if (channel->state_handlers[index] != state_handler) {
01370                                 new_handlers[channel->state_handler_index++] = channel->state_handlers[index];
01371                         }
01372                 }
01373         }
01374         for (index = 0; index < SWITCH_MAX_STATE_HANDLERS; index++) {
01375                 channel->state_handlers[index] = NULL;
01376         }
01377 
01378         if (state_handler) {
01379                 for (index = 0; index < channel->state_handler_index; index++) {
01380                         channel->state_handlers[index] = new_handlers[index];
01381                 }
01382         }
01383 
01384         switch_mutex_unlock(channel->flag_mutex);
01385 }

Here is the call graph for this function:

switch_status_t switch_channel_dequeue_dtmf _In_ switch_channel_t channel,
_In_ switch_dtmf_t dtmf
 

Retrieve DTMF digits from a given channel.

Parameters:
channel channel to retrieve digits from
dtmf digit
Returns:
number of bytes read into the buffer

switch_size_t switch_channel_dequeue_dtmf_string _In_ switch_channel_t channel,
_Out_opt_bytecapcount_(len) char *  dtmf_str,
_In_ switch_size_t  len
 

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.

Parameters:
channel channel to add information about
event event to add information to

char* switch_channel_expand_variables _In_ switch_channel_t channel,
_In_ const char *  in
 

Expand varaibles in a string based on the variables in a paticular channel.

Parameters:
channel channel to expand the variables from
in the original string
Returns:
the original string if no expansion takes place otherwise a new string that must be freed
Note:
it's necessary to test if the return val is the same as the input and free the string if it is not.

void switch_channel_flush_dtmf _In_ switch_channel_t channel  ) 
 

switch_caller_extension_t* switch_channel_get_caller_extension switch_channel_t channel  ) 
 

Retrieve caller extension from a given channel.

Parameters:
channel channel to retrieve extension from
Returns:
the requested extension
01399 {
01400         switch_caller_extension_t *extension = NULL;
01401 
01402         switch_assert(channel != NULL);
01403         switch_mutex_lock(channel->profile_mutex);
01404         if (channel->caller_profile) {
01405                 extension = channel->caller_profile->caller_extension;
01406         }
01407         switch_mutex_unlock(channel->profile_mutex);
01408         return extension;
01409 }

Here is the call graph for this function:

switch_caller_profile_t* switch_channel_get_caller_profile switch_channel_t channel  ) 
 

Retrive the given channel's caller profile.

Parameters:
channel channel to retrive the profile from
Returns:
the requested profile
01243 {
01244         switch_caller_profile_t *profile;
01245         switch_assert(channel != NULL);
01246         switch_mutex_lock(channel->profile_mutex);
01247         profile = channel->caller_profile;
01248         switch_mutex_unlock(channel->profile_mutex);
01249         return profile;
01250 }

Here is the call graph for this function:

switch_call_cause_t switch_channel_get_cause _In_ switch_channel_t channel  ) 
 

return the cause code for a given channel

Parameters:
channel the channel
Returns:
the code

switch_call_cause_t switch_channel_get_cause_q850 switch_channel_t channel  ) 
 

00179 {
00180         return switch_channel_cause_q850(channel->hangup_cause);
00181 }

Here is the call graph for this function:

char* switch_channel_get_name switch_channel_t channel  ) 
 

Retrieve the name of a given channel.

Parameters:
channel channel to get name of
Returns:
the channel's name
00560 {
00561         switch_assert(channel != NULL);
00562         return (!switch_strlen_zero(channel->name)) ? channel->name : "N/A";
00563 }

switch_caller_profile_t* switch_channel_get_originatee_caller_profile switch_channel_t channel  ) 
 

Retrive the given channel's originatee caller profile.

Parameters:
channel channel to retrive the profile from
Returns:
the requested profile
01294 {
01295         switch_caller_profile_t *profile = NULL;
01296         switch_assert(channel != NULL);
01297 
01298         switch_mutex_lock(channel->profile_mutex);
01299         if (channel->caller_profile) {
01300                 profile = channel->caller_profile->originatee_caller_profile;
01301         }
01302         switch_mutex_unlock(channel->profile_mutex);
01303 
01304         return profile;
01305 }

Here is the call graph for this function:

switch_caller_profile_t* switch_channel_get_originator_caller_profile switch_channel_t channel  ) 
 

Retrive the given channel's originator caller profile.

Parameters:
channel channel to retrive the profile from
Returns:
the requested profile
01280 {
01281         switch_caller_profile_t *profile = NULL;
01282         switch_assert(channel != NULL);
01283 
01284         switch_mutex_lock(channel->profile_mutex);
01285         if (channel->caller_profile) {
01286                 profile = channel->caller_profile->originator_caller_profile;
01287         }
01288         switch_mutex_unlock(channel->profile_mutex);
01289 
01290         return profile;
01291 }

Here is the call graph for this function:

void* switch_channel_get_private switch_channel_t channel,
const char *  key
 

Retrieve private from a given channel.

Parameters:
channel channel to retrieve data from
key unique keyname to retrieve your private data
Returns:
void pointer to channel's private data
00530 {
00531         void *val;
00532         switch_assert(channel != NULL);
00533         val = switch_core_hash_find_locked(channel->private_hash, key, channel->profile_mutex);
00534         return val;
00535 }

Here is the call graph for this function:

switch_channel_state_t switch_channel_get_running_state switch_channel_t channel  ) 
 

00773 {
00774         switch_channel_state_t state;
00775         switch_assert(channel != NULL);
00776 
00777         switch_mutex_lock(channel->flag_mutex);
00778         state = channel->running_state;
00779         switch_mutex_unlock(channel->flag_mutex);
00780 
00781         return state;
00782 }

Here is the call graph for this function:

switch_channel_state_t switch_channel_get_state switch_channel_t channel  ) 
 

Get the current state of a channel in the state engine.

Parameters:
channel channel to retrieve state from
Returns:
current state of channel
00761 {
00762         switch_channel_state_t state;
00763         switch_assert(channel != NULL);
00764 
00765         switch_mutex_lock(channel->flag_mutex);
00766         state = channel->state;
00767         switch_mutex_unlock(channel->flag_mutex);
00768 
00769         return state;
00770 }

Here is the call graph for this function:

const switch_state_handler_table_t* switch_channel_get_state_handler switch_channel_t channel,
int  index
 

Retrieve an state handler tablefrom a given channel at given index level.

Parameters:
channel channel from which to retrieve the state handler table
index the index of the state handler table (start from 0)
Returns:
given channel's state handler table at given index or NULL if requested index does not exist.
01341 {
01342         const switch_state_handler_table_t *h = NULL;
01343 
01344         switch_assert(channel != NULL);
01345 
01346         if (index >= SWITCH_MAX_STATE_HANDLERS || index > channel->state_handler_index) {
01347                 return NULL;
01348         }
01349 
01350         switch_mutex_lock(channel->flag_mutex);
01351         h = channel->state_handlers[index];
01352         switch_mutex_unlock(channel->flag_mutex);
01353 
01354         return h;
01355 }

Here is the call graph for this function:

switch_channel_timetable_t* switch_channel_get_timetable _In_ switch_channel_t channel  ) 
 

View the timetable of a channel.

Parameters:
channel channel to retrieve timetable from
Returns:
a pointer to the channel's timetable (created, answered, etc..)

char* switch_channel_get_uuid switch_channel_t channel  ) 
 

Retrive the given channel's unique id.

Parameters:
channel channel to retrive the unique id from
Returns:
the unique id
01308 {
01309         switch_assert(channel != NULL);
01310         switch_assert(channel->session != NULL);
01311         return switch_core_session_get_uuid(channel->session);
01312 }

Here is the call graph for this function:

const char* switch_channel_get_variable switch_channel_t channel,
const char *  varname
 

Retrieve a variable from a given channel.

Parameters:
channel channel to retrieve variable from
varname the name of the variable
Returns:
the value of the requested variable
00444 {
00445         const char *v = NULL;
00446         switch_assert(channel != NULL);
00447 
00448         switch_mutex_lock(channel->profile_mutex);
00449         if (!channel->variables || !(v = switch_event_get_header(channel->variables, (char *) varname))) {
00450                 switch_caller_profile_t *cp = channel->caller_profile;
00451 
00452                 if (cp) {
00453                         if (!strncmp(varname, "aleg_", 5)) {
00454                                 cp = cp->originator_caller_profile;
00455                                 varname += 5;
00456                         } else if (!strncmp(varname, "bleg_", 5)) {
00457                                 cp = cp->originatee_caller_profile;
00458                                 varname += 5;
00459                         }
00460                 }
00461 
00462                 if (!cp || !(v = switch_caller_get_field_by_name(cp, varname))) {
00463                         v = switch_core_get_variable(varname);
00464                 }
00465         }
00466         switch_mutex_unlock(channel->profile_mutex);
00467 
00468         return v;
00469 }

Here is the call graph for this function:

const char* switch_channel_get_variable_partner switch_channel_t channel,
const char *  varname
 

00472 {
00473         const char *uuid;
00474         const char *val = NULL;
00475         switch_assert(channel != NULL);
00476 
00477         if (!switch_strlen_zero(varname)) {
00478                 if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
00479                         switch_core_session_t *session;
00480                         switch_mutex_lock(channel->profile_mutex);
00481                         if ((session = switch_core_session_locate(uuid))) {
00482                                 switch_channel_t *tchannel = switch_core_session_get_channel(session);
00483                                 switch_mutex_lock(tchannel->profile_mutex);
00484                                 val = switch_channel_get_variable(tchannel, varname);
00485                                 switch_mutex_unlock(tchannel->profile_mutex);
00486                                 switch_core_session_rwunlock(session);
00487                         }
00488                         switch_mutex_unlock(channel->profile_mutex);
00489                 }
00490         }
00491 
00492         return val;
00493 }

Here is the call graph for this function:

switch_status_t switch_channel_get_variables switch_channel_t channel,
switch_event_t **  event
 

02066 {
02067         switch_status_t status;
02068         switch_mutex_lock(channel->profile_mutex);
02069         status = switch_event_dup(event, channel->variables);
02070         switch_mutex_lock(channel->profile_mutex);
02071         return status;
02072 }

Here is the call graph for this function:

switch_size_t switch_channel_has_dtmf _In_ switch_channel_t channel  ) 
 

Test for presence of DTMF on a given channel.

Parameters:
channel channel to test
Returns:
number of digits in the queue

switch_status_t switch_channel_init switch_channel_t channel,
switch_core_session_t session,
switch_channel_state_t  state,
uint32_t  flags
 

Connect a newly allocated channel to a session object and setup it's initial state.

Parameters:
channel the channel to initilize
session the session to connect the channel to
state the initial state of the channel
flags the initial channel flags
00398 {
00399         switch_assert(channel != NULL);
00400         channel->state = state;
00401         channel->flags = flags;
00402         channel->session = session;
00403         channel->running_state = CS_NONE;
00404         return SWITCH_STATUS_SUCCESS;
00405 }

switch_channel_state_t switch_channel_name_state _In_ const char *  name  ) 
 

Render the enum of the provided state name.

Parameters:
name the name of the state
Returns:
the enum value (numeric)

switch_status_t switch_channel_perform_answer switch_channel_t channel,
const char *  file,
const char *  func,
int  line
 

01669 {
01670         switch_core_session_message_t msg;
01671