FreeSWITCH API Documentation  1.7.0
switch_channel.h
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Anthony Minessale II <anthm@freeswitch.org>
27  *
28  *
29  * switch_channel.h -- Media Channel Interface
30  *
31  */
32 /**
33  * @file switch_channel.h
34  * @brief Media Channel Interface
35  * @see switch_channel
36  */
37 
38 #ifndef SWITCH_CHANNEL_H
39 #define SWITCH_CHANNEL_H
40 
41 #include <switch.h>
42 
56 };
57 
59 
60 /**
61  * @defgroup switch_channel Channel Functions
62  * @ingroup core1
63  * The switch_channel object is a private entity that belongs to a session that contains the call
64  * specific information such as the call state, variables, caller profiles and DTMF queue
65  * @{
66  */
67 
68 /*!
69  \brief Get the current state of a channel in the state engine
70  \param channel channel to retrieve state from
71  \return current state of channel
72 */
76 
77 /*!
78  \brief Determine if a channel is ready for io
79  \param channel channel to test
80  \return true if the channel is ready
81 */
83 
84 #define switch_channel_ready(_channel) switch_channel_test_ready(_channel, SWITCH_TRUE, SWITCH_FALSE)
85 #define switch_channel_media_ready(_channel) switch_channel_test_ready(_channel, SWITCH_TRUE, SWITCH_TRUE)
86 #define switch_channel_media_up(_channel) (switch_channel_test_flag(_channel, CF_ANSWERED) || switch_channel_test_flag(_channel, CF_EARLY_MEDIA))
87 
88 #define switch_channel_up(_channel) (switch_channel_check_signal(_channel, SWITCH_TRUE) || switch_channel_get_state(_channel) < CS_HANGUP)
89 #define switch_channel_down(_channel) (switch_channel_check_signal(_channel, SWITCH_TRUE) || switch_channel_get_state(_channel) >= CS_HANGUP)
90 
91 #define switch_channel_up_nosig(_channel) (switch_channel_get_state(_channel) < CS_HANGUP)
92 #define switch_channel_down_nosig(_channel) (switch_channel_get_state(_channel) >= CS_HANGUP)
93 
94 #define switch_channel_media_ack(_channel) (!switch_channel_test_cap(_channel, CC_MEDIA_ACK) || switch_channel_test_flag(_channel, CF_MEDIA_ACK))
95 
97 SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout);
99  switch_channel_flag_t want_flag,
100  switch_bool_t pres, uint32_t to, switch_channel_t *super_channel);
101 
103  const char *file, const char *func, int line, switch_channel_state_t state);
104 
106  const char *file, const char *func, int line);
107 #define switch_channel_set_running_state(channel, state) switch_channel_perform_set_running_state(channel, state, __FILE__, __SWITCH_FUNC__, __LINE__)
108 
109 /*!
110  \brief Set the current state of a channel
111  \param channel channel to set state of
112  \param state new state
113  \return current state of channel after application of new state
114 */
115 #define switch_channel_set_state(channel, state) switch_channel_perform_set_state(channel, __FILE__, __SWITCH_FUNC__, __LINE__, state)
116 
117 /*!
118  \brief return a cause code for a given string
119  \param str the string to check
120  \return the code
121 */
123 
124 /*!
125  \brief return the cause code for a given channel
126  \param channel the channel
127  \return the code
128 */
130 
134 
135 /*!
136  \brief return a cause string for a given cause
137  \param cause the code to check
138  \return the string
139 */
141 
142 /*!
143  \brief View the timetable of a channel
144  \param channel channel to retrieve timetable from
145  \return a pointer to the channel's timetable (created, answered, etc..)
146 */
148 
149 /*!
150  \brief Allocate a new channel
151  \param channel NULL pointer to allocate channel to
152  \param pool memory_pool to use for allocation
153  \return SWITCH_STATUS_SUCCESS if successful
154 */
157 
158 /*!
159  \brief Connect a newly allocated channel to a session object and setup it's initial state
160  \param channel the channel to initilize
161  \param session the session to connect the channel to
162  \param state the initial state of the channel
163  \param flags the initial channel flags
164 */
166  switch_channel_flag_t flag);
167 
168 /*!
169  \brief Takes presence_data_cols as a parameter or as a channel variable and copies them to channel profile variables
170  \param channel the channel on which to set the channel profile variables
171  \param presence_data_cols is a colon separated list of channel variables to copy to channel profile variables
172  */
173 SWITCH_DECLARE(void) switch_channel_set_presence_data_vals(switch_channel_t *channel, const char *presence_data_cols);
174 
175 /*!
176  \brief Fire A presence event for the channel
177  \param channel the channel to initilize
178  \param rpid the rpid if for the icon to use
179  \param status the status message
180  \param id presence id
181 */
182 SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel, const char *rpid, const char *status, const char *id,
183  const char *file, const char *func, int line);
184 #define switch_channel_presence(_a, _b, _c, _d) switch_channel_perform_presence(_a, _b, _c, _d, __FILE__, __SWITCH_FUNC__, __LINE__)
185 /*!
186  \brief Uninitalize a channel
187  \param channel the channel to uninit
188 */
190 
191 /*!
192  \brief Set the given channel's caller profile
193  \param channel channel to assign the profile to
194  \param caller_profile the profile to assign
195 */
198 
199 /*!
200  \brief Retrieve the given channel's caller profile
201  \param channel channel to retrieve the profile from
202  \return the requested profile
203 */
205 
206 /*!
207  \brief Set the given channel's originator caller profile
208  \param channel channel to assign the profile to
209  \param caller_profile the profile to assign
210 */
212 
213 
215 
216 /*!
217  \brief Retrieve the given channel's originator caller profile
218  \param channel channel to retrieve the profile from
219  \return the requested profile
220 */
222 
223 /*!
224  \brief Set the given channel's originatee caller profile
225  \param channel channel to assign the profile to
226  \param caller_profile the profile to assign
227 */
229 
230 
231 /*!
232  \brief Retrieve the given channel's originatee caller profile
233  \param channel channel to retrieve the profile from
234  \return the requested profile
235 */
237 
238 /*!
239  \brief Set the given channel's origination caller profile
240  \param channel channel to assign the profile to
241  \param caller_profile the profile to assign
242 */
244 
245 /*!
246  \brief Retrieve the given channel's origination caller profile
247  \param channel channel to retrieve the profile from
248  \return the requested profile
249 */
251 
252 
253 /*!
254  \brief Retrieve the given channel's unique id
255  \param channel channel to retrieve the unique id from
256  \return the unique id
257 */
259 
260 /*!
261  \brief Set a variable on a given channel
262  \param channel channel to set variable on
263  \param varname the name of the variable
264  \param value the value of the variable
265  \returns SWITCH_STATUS_SUCCESS if successful
266 */
267 
268 SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t *channel, const char *name, const char *val);
269 
271  const char *varname, const char *value, switch_bool_t var_check);
273  const char *varname, const char *value, switch_bool_t var_check, switch_stack_t stack);
274 SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...);
275 SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_name_printf(switch_channel_t *channel, const char *val, const char *fmt, ...);
276 
278  const char *varname, const char *value, switch_bool_t var_check);
279 SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname);
280 
283 
284 SWITCH_DECLARE(uint32_t) switch_channel_del_variable_prefix(switch_channel_t *channel, const char *prefix);
286 
287 #define switch_channel_set_variable_safe(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_FALSE)
288 #define switch_channel_set_variable(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_TRUE)
289 #define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE)
290 
291 
293  const char *varname, const char *val,
294  const char *export_varname,
295  switch_bool_t var_check);
296 
298  switch_event_t *var_event, const char *export_varname);
299 
300 #define switch_channel_export_variable(_channel, _varname, _value, _ev) switch_channel_export_variable_var_check(_channel, _varname, _value, _ev, SWITCH_TRUE)
302  const char *export_varname, const char *fmt, ...);
303 
306 
307 /*!
308  \brief Retrieve a variable from a given channel
309  \param channel channel to retrieve variable from
310  \param varname the name of the variable
311  \return the value of the requested variable
312 */
313 SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup, int idx);
314 #define switch_channel_get_variable(_c, _v) switch_channel_get_variable_dup(_c, _v, SWITCH_TRUE, -1)
315 
317 
319 
320 /*!
321  * \brief Start iterating over the entries in the channel variable list.
322  * \param channel the channel to iterate the variables for
323  * \remark This function locks the profile mutex, use switch_channel_variable_last to unlock
324  */
326 
327 /*!
328  * \brief Stop iterating over channel variables.
329  * \remark Unlocks the profile mutex initially locked in switch_channel_variable_first
330  */
332 
333 
335 
337 
338 /*!
339  \brief Assign a caller extension to a given channel
340  \param channel channel to assign extension to
341  \param caller_extension extension to assign
342 */
344 
348 
349 /*!
350  \brief Retrieve caller extension from a given channel
351  \param channel channel to retrieve extension from
352  \return the requested extension
353 */
355 
356 /*!
357  \brief Test for presence of given flag on a given channel
358  \param channel channel to test
359  \param flag to test
360  \return TRUE if flags were present
361 */
363 
364 /*!
365  \brief Set given flag(s) on a given channel
366  \param channel channel on which to set flag
367  \param flag or'd list of flags to set
368 */
370 #define switch_channel_set_flag(_c, _f) switch_channel_set_flag_value(_c, _f, 1)
371 
373 
375 #define switch_channel_set_cap(_c, _cc) switch_channel_set_cap_value(_c, _cc, 1)
376 
380 
381 /*!
382  \brief Set given flag(s) on a given channel's bridge partner
383  \param channel channel to derive the partner channel to set flag on
384  \param flag to set
385  \return true if the flag was set
386 */
388 
389 /*!
390  \brief Clears given flag(s) on a given channel's bridge partner
391  \param channel channel to derive the partner channel to clear flag(s) from
392  \param flag the flag to clear
393  \return true if the flag was cleared
394 */
396 
398 
399 /*!
400  \brief Set given flag(s) on a given channel to be applied on the next state change
401  \param channel channel on which to set flag(s)
402  \param flag flag to set
403 */
406 
407 /*!
408  \brief Clear given flag(s) from a channel
409  \param channel channel to clear flags from
410  \param flag flag to clear
411 */
413 
415 
416 SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *channel, const char *file, const char *func, int line);
417 
418 SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_channel_t *channel, const char *file, const char *func, int line);
420 
421 /*!
422  \brief Answer a channel (initiate/acknowledge a successful connection)
423  \param channel channel to answer
424  \return SWITCH_STATUS_SUCCESS if channel was answered successfully
425 */
426 #define switch_channel_answer(channel) switch_channel_perform_answer(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
427 
428 /*!
429  \brief Mark a channel answered with no indication (for outbound calls)
430  \param channel channel to mark answered
431  \return SWITCH_STATUS_SUCCESS if channel was answered successfully
432 */
433 #define switch_channel_mark_answered(channel) switch_channel_perform_mark_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
434 
435 /*!
436  \brief Mark a channel pre_answered (early media) with no indication (for outbound calls)
437  \param channel channel to mark pre_answered
438  \return SWITCH_STATUS_SUCCESS if channel was pre_answered successfully
439 */
440 #define switch_channel_mark_pre_answered(channel) switch_channel_perform_mark_pre_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
441 
444  const char *file, const char *func, int line);
445 /*!
446  \brief Send Ringing message to a channel
447  \param channel channel to ring
448  \return SWITCH_STATUS_SUCCESS if successful
449 */
450 #define switch_channel_ring_ready(channel) switch_channel_perform_ring_ready_value(channel, SWITCH_RING_READY_RINGING, __FILE__, __SWITCH_FUNC__, __LINE__)
451 #define switch_channel_ring_ready_value(channel, _rv) \
452  switch_channel_perform_ring_ready_value(channel, _rv, __FILE__, __SWITCH_FUNC__, __LINE__)
453 
454 
455 SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel_t *channel, const char *file, const char *func, int line);
456 
457 SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_channel_t *channel, const char *file, const char *func, int line);
458 
461  const char *file, const char *func, int line);
462 
463 /*!
464  \brief Indicate progress on a channel to attempt early media
465  \param channel channel to pre-answer
466  \return SWITCH_STATUS_SUCCESS
467 */
468 #define switch_channel_pre_answer(channel) switch_channel_perform_pre_answer(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
469 
470 /*!
471  \brief Indicate a channel is ready to provide ringback
472  \param channel channel
473  \return SWITCH_STATUS_SUCCESS
474 */
475 #define switch_channel_mark_ring_ready(channel) \
476  switch_channel_perform_mark_ring_ready_value(channel, SWITCH_RING_READY_RINGING, __FILE__, __SWITCH_FUNC__, __LINE__)
477 
478 #define switch_channel_mark_ring_ready_value(channel, _rv) \
479  switch_channel_perform_mark_ring_ready_value(channel, _rv, __FILE__, __SWITCH_FUNC__, __LINE__)
480 
481 /*!
482  \brief add a state handler table to a given channel
483  \param channel channel on which to add the state handler table
484  \param state_handler table of state handler functions
485  \return the index number/priority of the table negative value indicates failure
486 */
488 
489 /*!
490  \brief clear a state handler table from a given channel
491  \param channel channel from which to clear the state handler table
492  \param state_handler table of state handler functions
493 */
495 
496 /*!
497  \brief Retrieve an state handler tablefrom a given channel at given index level
498  \param channel channel from which to retrieve the state handler table
499  \param index the index of the state handler table (start from 0)
500  \return given channel's state handler table at given index or NULL if requested index does not exist.
501 */
503 
504 /*!
505  \brief Set private data on channel
506  \param channel channel on which to set data
507  \param key unique keyname to associate your private data to
508  \param private_info void pointer to private data
509  \return SWITCH_STATUS_SUCCESS if data was set
510  \remarks set NULL to delete your private data
511 */
512 SWITCH_DECLARE(switch_status_t) switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info);
513 
514 /*!
515  \brief Retrieve private from a given channel
516  \param channel channel to retrieve data from
517  \param key unique keyname to retrieve your private data
518  \return void pointer to channel's private data
519 */
520 SWITCH_DECLARE(void *) switch_channel_get_private(switch_channel_t *channel, const char *key);
521 SWITCH_DECLARE(void *) switch_channel_get_private_partner(switch_channel_t *channel, const char *key);
522 
523 /*!
524  \brief Assign a name to a given channel
525  \param channel channel to assign name to
526  \param name name to assign
527  \return SWITCH_STATUS_SUCCESS if name was assigned
528 */
530 
531 /*!
532  \brief Retrieve the name of a given channel
533  \param channel channel to get name of
534  \return the channel's name
535 */
537 
538 
540  const char *file, const char *func, int line, switch_call_cause_t hangup_cause);
541 
542 /*!
543  \brief Hangup a channel flagging it's state machine to end
544  \param channel channel to hangup
545  \param hangup_cause the appropriate hangup cause
546  \return the resulting channel state.
547 */
548 #define switch_channel_hangup(channel, hangup_cause) switch_channel_perform_hangup(channel, __FILE__, __SWITCH_FUNC__, __LINE__, hangup_cause)
549 
550 /*!
551  \brief Test for presence of DTMF on a given channel
552  \param channel channel to test
553  \return number of digits in the queue
554 */
559 
560 
561 /*!
562  \brief Queue DTMF on a given channel
563  \param channel channel to queue DTMF to
564  \param dtmf digit
565  \return SWITCH_STATUS_SUCCESS if successful
566 */
569 
570 /*!
571  \brief Retrieve DTMF digits from a given channel
572  \param channel channel to retrieve digits from
573  \param dtmf digit
574  \return number of bytes read into the buffer
575 */
579  char *dtmf_str, _In_ switch_size_t len);
580 
581 /*!
582  \brief Render the name of the provided state enum
583  \param state state to get name of
584  \return the string representation of the state
585 */
587 
588 /*!
589  \brief Render the enum of the provided state name
590  \param name the name of the state
591  \return the enum value (numeric)
592 */
594 
595 /*!
596  \brief Add information about a given channel to an event object
597  \param channel channel to add information about
598  \param event event to add information to
599 */
601 
604 
605 /*!
606  \brief Expand varaibles in a string based on the variables in a paticular channel
607  \param channel channel to expand the variables from
608  \param in the original string
609  \return the original string if no expansion takes place otherwise a new string that must be freed
610  \note it's necessary to test if the return val is the same as the input and free the string if it is not.
611 */
612 SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *channel, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur);
613 #define switch_channel_expand_variables(_channel, _in) switch_channel_expand_variables_check(_channel, _in, NULL, NULL, 0)
614 
615 #define switch_channel_inbound_display(_channel) ((switch_channel_direction(_channel) == SWITCH_CALL_DIRECTION_INBOUND && !switch_channel_test_flag(_channel, CF_BLEG)) || (switch_channel_direction(_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && switch_channel_test_flag(_channel, CF_DIALPLAN)))
616 
617 #define switch_channel_outbound_display(_channel) ((switch_channel_direction(_channel) == SWITCH_CALL_DIRECTION_INBOUND && switch_channel_test_flag(_channel, CF_BLEG)) || (switch_channel_direction(_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(_channel, CF_DIALPLAN)))
618 
620  _In_opt_ const char *prefix);
622 
623 #define switch_channel_stop_broadcast(_channel) for(;;) {if (switch_channel_test_flag(_channel, CF_BROADCAST)) {switch_channel_set_flag(_channel, CF_STOP_BROADCAST); switch_channel_set_flag(_channel, CF_BREAK); } break;}
624 
625 SWITCH_DECLARE(void) switch_channel_perform_audio_sync(switch_channel_t *channel, const char *file, const char *func, int line);
626 #define switch_channel_audio_sync(_c) switch_channel_perform_audio_sync(_c, __FILE__, __SWITCH_FUNC__, __LINE__)
627 SWITCH_DECLARE(void) switch_channel_perform_video_sync(switch_channel_t *channel, const char *file, const char *func, int line);
628 #define switch_channel_video_sync(_c) switch_channel_perform_video_sync(_c, __FILE__, __SWITCH_FUNC__, __LINE__)
629 
630 SWITCH_DECLARE(void) switch_channel_set_private_flag(switch_channel_t *channel, uint32_t flags);
633 
634 SWITCH_DECLARE(void) switch_channel_set_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags);
635 SWITCH_DECLARE(void) switch_channel_clear_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags);
636 SWITCH_DECLARE(int) switch_channel_test_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags);
637 
638 #define switch_channel_set_app_flag(_c, _f) switch_channel_set_app_flag_key(__FILE__, _c, _f)
639 #define switch_channel_clear_app_flag(_c, _f) switch_channel_clear_app_flag_key(__FILE__, _c, _f)
640 #define switch_channel_test_app_flag(_c, _f) switch_channel_test_app_flag_key(__FILE__, _c, _f)
641 
647 
652 
654  const char *file, const char *func, int line);
655 #define switch_channel_set_callstate(channel, state) switch_channel_perform_set_callstate(channel, state, __FILE__, __SWITCH_FUNC__, __LINE__)
660 
661 /** @} */
662 
663 SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix);
664 SWITCH_DECLARE(switch_status_t) switch_channel_api_on(switch_channel_t *channel, const char *variable_prefix);
676 SWITCH_DECLARE(const char *) switch_channel_set_device_id(switch_channel_t *channel, const char *device_id);
683 SWITCH_DECLARE(switch_status_t) switch_channel_pass_sdp(switch_channel_t *from_channel, switch_channel_t *to_channel, const char *sdp);
684 
686 #endif
687 /* For Emacs:
688  * Local Variables:
689  * mode:c
690  * indent-tabs-mode:t
691  * tab-width:4
692  * c-basic-offset:4
693  * End:
694  * For VIM:
695  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
696  */
char * switch_channel_get_cap_string(switch_channel_t *channel)
switch_status_t switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt,...)
void switch_channel_set_cap_value(switch_channel_t *channel, switch_channel_cap_t cap, uint32_t value)
void switch_channel_global_uninit(void)
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 switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix)
void switch_channel_set_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag)
switch_caller_extension_t * switch_channel_get_caller_extension(switch_channel_t *channel)
Retrieve caller extension from a given channel.
switch_status_t switch_channel_set_profile_var(switch_channel_t *channel, const char *name, const char *val)
Set a variable on a given channel.
An Abstract Representation of a dialplan extension.
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)
Call Specific Data.
Definition: switch_caller.h:73
switch_status_t switch_channel_set_timestamps(_In_ switch_channel_t *channel)
switch_status_t switch_channel_alloc(_In_ switch_channel_t **channel, _In_ switch_call_direction_t direction, _In_ switch_memory_pool_t *pool)
Allocate a new channel.
switch_status_t switch_channel_set_variable_name_printf(switch_channel_t *channel, const char *val, const char *fmt,...)
switch_status_t switch_channel_queue_dtmf(_In_ switch_channel_t *channel, _In_ const switch_dtmf_t *dtmf)
Queue DTMF on a given channel.
uint32_t switch_channel_test_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
switch_status_t switch_channel_export_variable_var_check(switch_channel_t *channel, const char *varname, const char *val, const char *export_varname, switch_bool_t var_check)
void switch_channel_set_hangup_time(switch_channel_t *channel)
switch_status_t switch_channel_perform_mark_pre_answered(switch_channel_t *channel, const char *file, const char *func, int line)
const char * switch_channel_get_partner_uuid(switch_channel_t *channel)
switch_status_t switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
Set private data on channel.
switch_hold_record_t * switch_channel_get_hold_record(switch_channel_t *channel)
const char * switch_channel_cause2str(_In_ switch_call_cause_t cause)
return a cause string for a given cause
void switch_channel_clear_state_flag(switch_channel_t *channel, switch_channel_flag_t flag)
void switch_channel_event_set_extended_data(_In_ switch_channel_t *channel, _In_ switch_event_t *event)
void switch_channel_perform_video_sync(switch_channel_t *channel, const char *file, const char *func, int line)
switch_call_direction_t switch_channel_logical_direction(switch_channel_t *channel)
#define SWITCH_END_EXTERN_C
Definition: switch.h:43
switch_ring_ready_t
void switch_channel_flush_dtmf(_In_ switch_channel_t *channel)
void switch_channel_check_zrtp(switch_channel_t *channel)
void switch_channel_set_bridge_time(switch_channel_t *channel)
const char * switch_channel_device_state2str(switch_device_state_t device_state)
switch_call_direction_t
Definition: switch_types.h:293
void switch_channel_state_thread_lock(switch_channel_t *channel)
const char * switch_channel_callstate2str(switch_channel_callstate_t callstate)
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_bool_t
Definition: switch_types.h:405
void(* switch_device_state_function_t)(switch_core_session_t *session, switch_channel_callstate_t callstate, switch_device_record_t *drec)
Definition: switch_core.h:143
switch_channel_state_t switch_channel_name_state(_In_ const char *name)
Render the enum of the provided state name.
switch_channel_flag_t
Channel Flags.
switch_memory_pool_t * pool
Representation of an event.
Definition: switch_event.h:80
An event Header.
Definition: switch_event.h:65
void * switch_channel_get_private_partner(switch_channel_t *channel, const char *key)
void switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel's caller profile.
switch_channel_state_t switch_channel_get_running_state(switch_channel_t *channel)
void switch_channel_flip_cid(switch_channel_t *channel)
switch_status_t switch_channel_set_variable_partner_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check)
switch_channel_cap_t
switch_status_t switch_channel_unbind_device_state_handler(switch_device_state_function_t function)
void switch_channel_clear_device_record(switch_channel_t *channel)
const char * switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup, int idx)
Retrieve a variable from a given channel.
const char * switch_channel_state_name(_In_ switch_channel_state_t state)
Render the name of the provided state enum.
void switch_channel_set_state_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Set given flag(s) on a given channel to be applied on the next state change.
int switch_channel_check_signal(switch_channel_t *channel, switch_bool_t in_thread_only)
char * switch_channel_expand_variables_check(switch_channel_t *channel, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur)
Expand varaibles in a string based on the variables in a paticular channel.
switch_event_header_t * switch_channel_variable_first(switch_channel_t *channel)
Start iterating over the entries in the channel variable list.
switch_status_t switch_channel_perform_answer(switch_channel_t *channel, const char *file, const char *func, int line)
void switch_channel_process_device_hangup(switch_channel_t *channel)
char * switch_channel_get_flag_string(switch_channel_t *channel)
int switch_channel_test_private_flag(switch_channel_t *channel, uint32_t flags)
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.
void switch_channel_perform_audio_sync(switch_channel_t *channel, const char *file, const char *func, int line)
void switch_channel_set_scope_variables(switch_channel_t *channel, switch_event_t **event)
void switch_channel_set_origination_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel's origination caller profile.
switch_status_t switch_channel_get_scope_variables(switch_channel_t *channel, switch_event_t **event)
switch_caller_profile_t * switch_channel_get_originatee_caller_profile(switch_channel_t *channel)
Retrieve the given channel's originatee caller profile.
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)
void switch_channel_invert_cid(switch_channel_t *channel)
void switch_channel_clear_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags)
void switch_channel_mark_hold(switch_channel_t *channel, switch_bool_t on)
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_perform_pre_answer(switch_channel_t *channel, const char *file, const char *func, int line)
void switch_channel_global_init(switch_memory_pool_t *pool)
int64_t switch_time_t
Definition: switch_apr.h:188
switch_status_t switch_channel_perform_mark_ring_ready_value(switch_channel_t *channel, switch_ring_ready_t rv, const char *file, const char *func, int line)
void switch_channel_set_private_flag(switch_channel_t *channel, uint32_t flags)
const char * switch_channel_get_hold_music(switch_channel_t *channel)
switch_byte_t in
switch_status_t switch_channel_bind_device_state_handler(switch_device_state_function_t function, void *user_data)
void switch_channel_sort_cid(switch_channel_t *channel)
void switch_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel, switch_event_t *var_event, const char *export_varname)
int switch_channel_test_ready(switch_channel_t *channel, switch_bool_t check_ready, switch_bool_t check_media)
Determine if a channel is ready for io.
switch_status_t switch_channel_add_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check, switch_stack_t stack)
uint32_t switch_channel_test_cap_partner(switch_channel_t *channel, switch_channel_cap_t cap)
#define _Out_opt_bytecapcount_(x)
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
switch_status_t switch_channel_dequeue_dtmf(_In_ switch_channel_t *channel, _In_ switch_dtmf_t *dtmf)
Retrieve DTMF digits from a given channel.
switch_status_t switch_channel_caller_extension_masquerade(switch_channel_t *orig_channel, switch_channel_t *new_channel, uint32_t offset)
switch_call_cause_t * switch_channel_get_cause_ptr(switch_channel_t *channel)
switch_status_t switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event)
switch_status_t switch_channel_pass_sdp(switch_channel_t *from_channel, switch_channel_t *to_channel, const char *sdp)
void switch_channel_release_device_record(switch_device_record_t **dcdrp)
#define _In_opt_
void switch_channel_set_flag_value(switch_channel_t *channel, switch_channel_flag_t flag, uint32_t value)
Set given flag(s) on a given channel.
switch_status_t switch_channel_transfer_variable_prefix(switch_channel_t *orig_channel, switch_channel_t *new_channel, const char *prefix)
switch_channel_timetable_t * switch_channel_get_timetable(_In_ switch_channel_t *channel)
View the timetable of a channel.
switch_status_t switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, const char *export_varname, const char *fmt,...)
switch_call_cause_t switch_channel_str2cause(_In_ const char *str)
return a cause code for a given string
const char * switch_channel_set_device_id(switch_channel_t *channel, const char *device_id)
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_time_t profile_created
uintptr_t switch_size_t
void switch_channel_set_presence_data_vals(switch_channel_t *channel, const char *presence_data_cols)
Takes presence_data_cols as a parameter or as a channel variable and copies them to channel profile v...
switch_bool_t switch_channel_set_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
Set given flag(s) on a given channel's bridge partner.
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.
const char * switch_channel_get_hold_music_partner(switch_channel_t *channel)
switch_channel_callstate_t
void switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout)
void switch_channel_restart(switch_channel_t *channel)
void switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
switch_call_cause_t
char * switch_channel_get_uuid(switch_channel_t *channel)
Retrieve the given channel's unique id.
switch_device_state_t
switch_status_t switch_channel_dtmf_lock(switch_channel_t *channel)
switch_status_t switch_channel_set_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check)
uint32_t switch_channel_test_cap(switch_channel_t *channel, switch_channel_cap_t cap)
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)
void switch_channel_set_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags)
void switch_channel_perform_set_callstate(switch_channel_t *channel, switch_channel_callstate_t callstate, const char *file, const char *func, int line)
const char * switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname)
switch_caller_extension_t * switch_channel_get_queued_extension(switch_channel_t *channel)
switch_channel_state_t
Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are ...
void switch_channel_clear_cap(switch_channel_t *channel, switch_channel_cap_t cap)
void switch_channel_step_caller_profile(switch_channel_t *channel)
void switch_channel_clear_private_flag(switch_channel_t *channel, uint32_t flags)
void switch_channel_uninit(switch_channel_t *channel)
Uninitalize a channel.
switch_status_t
Common return values.
void * switch_channel_get_private(switch_channel_t *channel, const char *key)
Retrieve private from a given channel.
switch_core_session_t * switch_channel_get_session(switch_channel_t *channel)
switch_status_t switch_channel_queue_dtmf_string(_In_ switch_channel_t *channel, _In_ const char *dtmf_string)
#define check_media(session)
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.
void switch_channel_variable_last(switch_channel_t *channel)
Stop iterating over channel variables.
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_size_t switch_channel_has_dtmf(_In_ switch_channel_t *channel)
Test for presence of DTMF on a given channel.
int switch_channel_state_change_pending(switch_channel_t *channel)
Main Library Header.
switch_call_cause_t switch_channel_get_cause_q850(switch_channel_t *channel)
uint32_t switch_channel_del_variable_prefix(switch_channel_t *channel, const char *prefix)
#define SWITCH_DECLARE(type)
void switch_channel_transfer_to_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension)
switch_status_t switch_channel_set_name(switch_channel_t *channel, const char *name)
Assign a name to a given channel.
switch_call_direction_t switch_channel_direction(switch_channel_t *channel)
switch_call_cause_t switch_channel_cause_q850(switch_call_cause_t cause)
switch_status_t switch_channel_state_thread_trylock(switch_channel_t *channel)
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
struct apr_pool_t switch_memory_pool_t
switch_stack_t
Expression of how to stack a list.
void switch_channel_clear_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag)
switch_channel_callstate_t switch_channel_get_callstate(switch_channel_t *channel)
switch_caller_profile_t * switch_channel_get_origination_caller_profile(switch_channel_t *channel)
Retrieve the given channel's origination caller profile.
switch_status_t switch_channel_perform_ring_ready_value(switch_channel_t *channel, switch_ring_ready_t rv, const char *file, const char *func, int line)
void switch_channel_state_thread_unlock(switch_channel_t *channel)
switch_status_t switch_channel_try_dtmf_lock(switch_channel_t *channel)
void switch_channel_set_direction(switch_channel_t *channel, switch_call_direction_t direction)
switch_status_t switch_channel_wait_for_flag(switch_channel_t *channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint32_t to, switch_channel_t *super_channel)
void switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
Clear given flag(s) from a channel.
int switch_channel_test_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags)
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_init(switch_channel_t *channel, switch_core_session_t *session, switch_channel_state_t state, switch_channel_flag_t flag)
Connect a newly allocated channel to a session object and setup it's initial state.
switch_caller_profile_t * switch_channel_get_caller_profile(switch_channel_t *channel)
Retrieve the given channel's caller profile.
switch_status_t switch_channel_api_on(switch_channel_t *channel, const char *variable_prefix)
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.
switch_status_t switch_channel_pass_callee_id(switch_channel_t *channel, switch_channel_t *other_channel)
void switch_channel_event_set_basic_data(_In_ switch_channel_t *channel, _In_ switch_event_t *event)
switch_bool_t switch_channel_clear_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
Clears given flag(s) on a given channel's bridge partner.
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)
switch_device_record_t * switch_channel_get_device_record(switch_channel_t *channel)
switch_time_t progress_media
void switch_channel_perform_presence(switch_channel_t *channel, const char *rpid, const char *status, const char *id, const char *file, const char *func, int line)
Fire A presence event for the channel.
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_dtmf_unlock(switch_channel_t *channel)
switch_call_cause_t switch_channel_get_cause(_In_ switch_channel_t *channel)
return the cause code for a given channel
struct switch_channel_timetable * next
switch_channel_callstate_t switch_channel_str2callstate(const char *str)
switch_caller_profile_t * switch_channel_get_originator_caller_profile(switch_channel_t *channel)
Retrieve the given channel's originator caller profile.
#define _In_
#define SWITCH_BEGIN_EXTERN_C
Definition: switch.h:42
void switch_channel_handle_cause(switch_channel_t *channel, switch_call_cause_t cause)