RTS API Documentation  1.10.11
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 
96 #define switch_channel_text_only(_channel) (switch_channel_test_flag(_channel, CF_HAS_TEXT) && !switch_channel_test_flag(_channel, CF_AUDIO))
97 
98 
100 SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout);
102  switch_channel_flag_t want_flag,
103  switch_bool_t pres, uint32_t to, switch_channel_t *super_channel);
105  uint32_t app_flag,
106  const char *key, switch_bool_t pres, uint32_t to);
107 
109  const char *file, const char *func, int line, switch_channel_state_t state);
110 
112  const char *file, const char *func, int line);
113 #define switch_channel_set_running_state(channel, state) switch_channel_perform_set_running_state(channel, state, __FILE__, __SWITCH_FUNC__, __LINE__)
114 
115 /*!
116  \brief Set the current state of a channel
117  \param channel channel to set state of
118  \param state new state
119  \return current state of channel after application of new state
120 */
121 #define switch_channel_set_state(channel, state) switch_channel_perform_set_state(channel, __FILE__, __SWITCH_FUNC__, __LINE__, state)
122 
123 /*!
124  \brief return a cause code for a given string
125  \param str the string to check
126  \return the code
127 */
129 
130 /*!
131  \brief return the cause code for a given channel
132  \param channel the channel
133  \return the code
134 */
136 
140 
141 /*!
142  \brief return a cause string for a given cause
143  \param cause the code to check
144  \return the string
145 */
147 
148 /*!
149  \brief View the timetable of a channel
150  \param channel channel to retrieve timetable from
151  \return a pointer to the channel's timetable (created, answered, etc..)
152 */
154 
155 /*!
156  \brief Allocate a new channel
157  \param channel NULL pointer to allocate channel to
158  \param pool memory_pool to use for allocation
159  \return SWITCH_STATUS_SUCCESS if successful
160 */
163 
164 /*!
165  \brief Connect a newly allocated channel to a session object and setup it's initial state
166  \param channel the channel to initilize
167  \param session the session to connect the channel to
168  \param state the initial state of the channel
169  \param flags the initial channel flags
170 */
172  switch_channel_flag_t flag);
173 
174 /*!
175  \brief Takes presence_data_cols as a parameter or as a channel variable and copies them to channel profile variables
176  \param channel the channel on which to set the channel profile variables
177  \param presence_data_cols is a colon separated list of channel variables to copy to channel profile variables
178  */
179 SWITCH_DECLARE(void) switch_channel_set_presence_data_vals(switch_channel_t *channel, const char *presence_data_cols);
180 
181 /*!
182  \brief Fire A presence event for the channel
183  \param channel the channel to initilize
184  \param rpid the rpid if for the icon to use
185  \param status the status message
186  \param id presence id
187 */
188 SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel, const char *rpid, const char *status, const char *id,
189  const char *file, const char *func, int line);
190 #define switch_channel_presence(_a, _b, _c, _d) switch_channel_perform_presence(_a, _b, _c, _d, __FILE__, __SWITCH_FUNC__, __LINE__)
191 /*!
192  \brief Uninitalize a channel
193  \param channel the channel to uninit
194 */
196 
197 /*!
198  \brief Set the given channel's caller profile
199  \param channel channel to assign the profile to
200  \param caller_profile the profile to assign
201 */
204 
205 /*!
206  \brief Retrieve the given channel's caller profile
207  \param channel channel to retrieve the profile from
208  \return the requested profile
209 */
211 
212 /*!
213  \brief Set the given channel's originator caller profile
214  \param channel channel to assign the profile to
215  \param caller_profile the profile to assign
216 */
218 
219 
221 
222 /*!
223  \brief Retrieve the given channel's originator caller profile
224  \param channel channel to retrieve the profile from
225  \return the requested profile
226 */
228 
229 /*!
230  \brief Set the given channel's originatee caller profile
231  \param channel channel to assign the profile to
232  \param caller_profile the profile to assign
233 */
235 
236 
237 /*!
238  \brief Retrieve the given channel's originatee caller profile
239  \param channel channel to retrieve the profile from
240  \return the requested profile
241 */
243 
244 /*!
245  \brief Set the given channel's origination caller profile
246  \param channel channel to assign the profile to
247  \param caller_profile the profile to assign
248 */
250 
251 /*!
252  \brief Retrieve the given channel's origination caller profile
253  \param channel channel to retrieve the profile from
254  \return the requested profile
255 */
257 
258 
259 /*!
260  \brief Retrieve the given channel's unique id
261  \param channel channel to retrieve the unique id from
262  \return the unique id
263 */
265 
266 /*!
267  \brief Set a variable on a given channel
268  \param channel channel to set variable on
269  \param varname the name of the variable
270  \param value the value of the variable
271  \returns SWITCH_STATUS_SUCCESS if successful
272 */
273 
275 
276 SWITCH_DECLARE(switch_status_t) switch_channel_set_log_tag(switch_channel_t *channel, const char *tagname, const char *tagvalue);
278 
280  const char *varname, const char *value, switch_bool_t var_check);
282  const char *varname, const char *value, switch_bool_t var_check);
284  const char *varname, const char *value, switch_bool_t var_check, switch_stack_t stack);
285 SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...);
287 
289  const char *varname, const char *value, switch_bool_t var_check);
290 SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname);
291 
294 
295 SWITCH_DECLARE(uint32_t) switch_channel_del_variable_prefix(switch_channel_t *channel, const char *prefix);
297 
298 #define switch_channel_set_variable_safe(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_FALSE)
299 #define switch_channel_set_variable(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_TRUE)
300 #define switch_channel_set_variable_strip_quotes(_channel, _var, _val) switch_channel_set_variable_strip_quotes_var_check(_channel, _var, _val, SWITCH_TRUE)
301 #define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE)
302 
303 
305  const char *varname, const char *val,
306  const char *export_varname,
307  switch_bool_t var_check);
308 
310  switch_event_t *var_event, const char *export_varname);
311 
312 #define switch_channel_export_variable(_channel, _varname, _value, _ev) switch_channel_export_variable_var_check(_channel, _varname, _value, _ev, SWITCH_TRUE)
314  const char *export_varname, const char *fmt, ...);
315 
318 
319 /*!
320  \brief Retrieve a variable from a given channel
321  \param channel channel to retrieve variable from
322  \param varname the name of the variable
323  \return the value of the requested variable
324 */
325 SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup, int idx);
326 #define switch_channel_get_variable(_c, _v) switch_channel_get_variable_dup(_c, _v, SWITCH_TRUE, -1)
327 
328 /*!
329  \brief Retrieve a copy of a variable from a given channel. switch_safe_free() call will be required.
330  \param channel channel to retrieve variable from
331  \param varname the name of the variable
332  \return a strdup copy the value of the requested variable without using a memory pool.
333 */
334 SWITCH_DECLARE(const char *) switch_channel_get_variable_strdup(switch_channel_t *channel, const char *varname);
335 
336 /*!
337  \brief Retrieve a variable from a given channel to a pre-allocated buffer without using a memory pool.
338  \param channel channel to retrieve variable from
339  \param varname the name of the variable
340  \param buf a pre allocated buffer to put the value to
341  \param buflen size of the buffer
342  \return SWITCH_STATUS_SUCCESS if the value was copied to the buffer and it is not NULL, SWITCH_STATUS_FALSE otherwise.
343 */
345 
349 
350 static inline int switch_channel_var_false(switch_channel_t *channel, const char *variable) {
351  return switch_false(switch_channel_get_variable_dup(channel, variable, SWITCH_FALSE, -1));
352 }
353 
354 static inline int switch_channel_var_true(switch_channel_t *channel, const char *variable) {
355  return switch_true(switch_channel_get_variable_dup(channel, variable, SWITCH_FALSE, -1));
356 }
357 
358 /*!
359  * \brief Start iterating over the entries in the channel variable list.
360  * \param channel the channel to iterate the variables for
361  * \remark This function locks the profile mutex, use switch_channel_variable_last to unlock
362  */
364 
365 /*!
366  * \brief Stop iterating over channel variables.
367  * \remark Unlocks the profile mutex initially locked in switch_channel_variable_first
368  */
370 
371 
373 
375 
376 /*!
377  \brief Assign a caller extension to a given channel
378  \param channel channel to assign extension to
379  \param caller_extension extension to assign
380 */
382 
386 
387 /*!
388  \brief Retrieve caller extension from a given channel
389  \param channel channel to retrieve extension from
390  \return the requested extension
391 */
393 
394 /*!
395  \brief Test for presence of given flag on a given channel
396  \param channel channel to test
397  \param flag to test
398  \return TRUE if flags were present
399 */
401 
402 /*!
403  \brief Set given flag(s) on a given channel
404  \param channel channel on which to set flag
405  \param flag or'd list of flags to set
406 */
408 #define switch_channel_set_flag(_c, _f) switch_channel_set_flag_value(_c, _f, 1)
409 
411 
413 #define switch_channel_set_cap(_c, _cc) switch_channel_set_cap_value(_c, _cc, 1)
414 
418 
419 /*!
420  \brief Set given flag(s) on a given channel's bridge partner
421  \param channel channel to derive the partner channel to set flag on
422  \param flag to set
423  \return true if the flag was set
424 */
426 
427 /*!
428  \brief Clears given flag(s) on a given channel's bridge partner
429  \param channel channel to derive the partner channel to clear flag(s) from
430  \param flag the flag to clear
431  \return true if the flag was cleared
432 */
434 
436 
437 /*!
438  \brief Set given flag(s) on a given channel to be applied on the next state change
439  \param channel channel on which to set flag(s)
440  \param flag flag to set
441 */
444 
445 /*!
446  \brief Clear given flag(s) from a channel
447  \param channel channel to clear flags from
448  \param flag flag to clear
449 */
451 
453 
454 SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *channel, const char *file, const char *func, int line);
455 
456 SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_channel_t *channel, const char *file, const char *func, int line);
457 
458 /*!
459  \brief Answer a channel (initiate/acknowledge a successful connection)
460  \param channel channel to answer
461  \return SWITCH_STATUS_SUCCESS if channel was answered successfully
462 */
463 #define switch_channel_answer(channel) switch_channel_perform_answer(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
464 
465 /*!
466  \brief Mark a channel answered with no indication (for outbound calls)
467  \param channel channel to mark answered
468  \return SWITCH_STATUS_SUCCESS if channel was answered successfully
469 */
470 #define switch_channel_mark_answered(channel) switch_channel_perform_mark_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
471 
472 /*!
473  \brief Mark a channel pre_answered (early media) with no indication (for outbound calls)
474  \param channel channel to mark pre_answered
475  \return SWITCH_STATUS_SUCCESS if channel was pre_answered successfully
476 */
477 #define switch_channel_mark_pre_answered(channel) switch_channel_perform_mark_pre_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
478 
480  const char *file, const char *func, int line);
481 #define switch_channel_acknowledge_call(channel) switch_channel_perform_acknowledge_call(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
482 
485  const char *file, const char *func, int line);
486 /*!
487  \brief Send Ringing message to a channel
488  \param channel channel to ring
489  \return SWITCH_STATUS_SUCCESS if successful
490 */
491 #define switch_channel_ring_ready(channel) switch_channel_perform_ring_ready_value(channel, SWITCH_RING_READY_RINGING, __FILE__, __SWITCH_FUNC__, __LINE__)
492 #define switch_channel_ring_ready_value(channel, _rv) \
493  switch_channel_perform_ring_ready_value(channel, _rv, __FILE__, __SWITCH_FUNC__, __LINE__)
494 
495 
496 SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel_t *channel, const char *file, const char *func, int line);
497 
498 SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_channel_t *channel, const char *file, const char *func, int line);
499 
502  const char *file, const char *func, int line);
503 
504 /*!
505  \brief Indicate progress on a channel to attempt early media
506  \param channel channel to pre-answer
507  \return SWITCH_STATUS_SUCCESS
508 */
509 #define switch_channel_pre_answer(channel) switch_channel_perform_pre_answer(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
510 
511 /*!
512  \brief Indicate a channel is ready to provide ringback
513  \param channel channel
514  \return SWITCH_STATUS_SUCCESS
515 */
516 #define switch_channel_mark_ring_ready(channel) \
517  switch_channel_perform_mark_ring_ready_value(channel, SWITCH_RING_READY_RINGING, __FILE__, __SWITCH_FUNC__, __LINE__)
518 
519 #define switch_channel_mark_ring_ready_value(channel, _rv) \
520  switch_channel_perform_mark_ring_ready_value(channel, _rv, __FILE__, __SWITCH_FUNC__, __LINE__)
521 
522 /*!
523  \brief add a state handler table to a given channel
524  \param channel channel on which to add the state handler table
525  \param state_handler table of state handler functions
526  \return the index number/priority of the table negative value indicates failure
527 */
529 
530 /*!
531  \brief clear a state handler table from a given channel
532  \param channel channel from which to clear the state handler table
533  \param state_handler table of state handler functions
534 */
536 
537 /*!
538  \brief Retrieve an state handler tablefrom a given channel at given index level
539  \param channel channel from which to retrieve the state handler table
540  \param index the index of the state handler table (start from 0)
541  \return given channel's state handler table at given index or NULL if requested index does not exist.
542 */
544 
545 /*!
546  \brief Set private data on channel
547  \param channel channel on which to set data
548  \param key unique keyname to associate your private data to
549  \param private_info void pointer to private data
550  \return SWITCH_STATUS_SUCCESS if data was set
551  \remarks set NULL to delete your private data
552 */
553 SWITCH_DECLARE(switch_status_t) switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info);
554 
555 /*!
556  \brief Retrieve private from a given channel
557  \param channel channel to retrieve data from
558  \param key unique keyname to retrieve your private data
559  \return void pointer to channel's private data
560 */
561 SWITCH_DECLARE(void *) switch_channel_get_private(switch_channel_t *channel, const char *key);
563 
564 /*!
565  \brief Assign a name to a given channel
566  \param channel channel to assign name to
567  \param name name to assign
568  \return SWITCH_STATUS_SUCCESS if name was assigned
569 */
571 
572 /*!
573  \brief Retrieve the name of a given channel
574  \param channel channel to get name of
575  \return the channel's name
576 */
578 
579 
581  const char *file, const char *func, int line, switch_call_cause_t hangup_cause);
582 
583 /*!
584  \brief Hangup a channel flagging it's state machine to end
585  \param channel channel to hangup
586  \param hangup_cause the appropriate hangup cause
587  \return the resulting channel state.
588 */
589 #define switch_channel_hangup(channel, hangup_cause) switch_channel_perform_hangup(channel, __FILE__, __SWITCH_FUNC__, __LINE__, hangup_cause)
590 
591 /*!
592  \brief Test for presence of DTMF on a given channel
593  \param channel channel to test
594  \return number of digits in the queue
595 */
600 
601 
602 /*!
603  \brief Queue DTMF on a given channel
604  \param channel channel to queue DTMF to
605  \param dtmf digit
606  \return SWITCH_STATUS_SUCCESS if successful
607 */
610 
611 /*!
612  \brief Retrieve DTMF digits from a given channel
613  \param channel channel to retrieve digits from
614  \param dtmf digit
615  \return number of bytes read into the buffer
616 */
620  char *dtmf_str, _In_ switch_size_t len);
621 
622 /*!
623  \brief Render the name of the provided state enum
624  \param state state to get name of
625  \return the string representation of the state
626 */
628 
629 /*!
630  \brief Render the enum of the provided state name
631  \param name the name of the state
632  \return the enum value (numeric)
633 */
635 
636 /*!
637  \brief Add information about a given channel to an event object
638  \param channel channel to add information about
639  \param event event to add information to
640 */
642 
645 
646 /*!
647  \brief Expand varaibles in a string based on the variables in a paticular channel
648  \param channel channel to expand the variables from
649  \param in the original string
650  \return the original string if no expansion takes place otherwise a new string that must be freed
651  \note it's necessary to test if the return val is the same as the input and free the string if it is not.
652 */
653 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);
654 #define switch_channel_expand_variables(_channel, _in) switch_channel_expand_variables_check(_channel, _in, NULL, NULL, 0)
655 
656 #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)))
657 
658 #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)))
659 
661  _In_opt_ const char *prefix);
663 
664 #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;}
665 
666 SWITCH_DECLARE(void) switch_channel_perform_audio_sync(switch_channel_t *channel, const char *file, const char *func, int line);
667 #define switch_channel_audio_sync(_c) switch_channel_perform_audio_sync(_c, __FILE__, __SWITCH_FUNC__, __LINE__)
668 SWITCH_DECLARE(void) switch_channel_perform_video_sync(switch_channel_t *channel, const char *file, const char *func, int line);
669 #define switch_channel_video_sync(_c) switch_channel_perform_video_sync(_c, __FILE__, __SWITCH_FUNC__, __LINE__)
670 
671 SWITCH_DECLARE(void) switch_channel_set_private_flag(switch_channel_t *channel, uint32_t flags);
674 
675 SWITCH_DECLARE(void) switch_channel_set_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags);
676 SWITCH_DECLARE(void) switch_channel_clear_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags);
677 SWITCH_DECLARE(int) switch_channel_test_app_flag_key(const char *app, switch_channel_t *channel, uint32_t flags);
678 
679 #define switch_channel_set_app_flag(_c, _f) switch_channel_set_app_flag_key(__FILE__, _c, _f)
680 #define switch_channel_clear_app_flag(_c, _f) switch_channel_clear_app_flag_key(__FILE__, _c, _f)
681 #define switch_channel_test_app_flag(_c, _f) switch_channel_test_app_flag_key(__FILE__, _c, _f)
682 
688 
693 
695  const char *file, const char *func, int line);
696 #define switch_channel_set_callstate(channel, state) switch_channel_perform_set_callstate(channel, state, __FILE__, __SWITCH_FUNC__, __LINE__)
701 
702 /** @} */
703 
704 SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix);
706 SWITCH_DECLARE(switch_status_t) switch_channel_api_on(switch_channel_t *channel, const char *variable_prefix);
719 SWITCH_DECLARE(const char *) switch_channel_set_device_id(switch_channel_t *channel, const char *device_id);
726 SWITCH_DECLARE(switch_status_t) switch_channel_pass_sdp(switch_channel_t *from_channel, switch_channel_t *to_channel, const char *sdp);
727 
729 #endif
730 /* For Emacs:
731  * Local Variables:
732  * mode:c
733  * indent-tabs-mode:t
734  * tab-width:4
735  * c-basic-offset:4
736  * End:
737  * For VIM:
738  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
739  */
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.
static switch_bool_t switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
Definition: switch_utils.h:519
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_execute_on_value(switch_channel_t *channel, const char *variable_value)
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)
const char * switch_channel_get_partner_uuid_copy(switch_channel_t *channel, char *buf, switch_size_t blen)
#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_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:303
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.
cJSON *const to
switch_bool_t
Definition: switch_types.h:437
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
const char * switch_channel_get_variable_strdup(switch_channel_t *channel, const char *varname)
Retrieve a copy of a variable from a given channel. switch_safe_free() call will be required...
An event Header.
Definition: switch_event.h:65
const char *const const char *const const cJSON *const value
void * switch_channel_get_private_partner(switch_channel_t *channel, const char *key)
static int switch_channel_var_false(switch_channel_t *channel, const char *variable)
void switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel&#39;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&#39;s origination caller profile.
switch_status_t switch_channel_get_scope_variables(switch_channel_t *channel, switch_event_t **event)
int cJSON_bool fmt
Definition: switch_cJSON.h:150
switch_caller_profile_t * switch_channel_get_originatee_caller_profile(switch_channel_t *channel)
Retrieve the given channel&#39;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)
switch_byte_t switch_byte_t * buf
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_set_log_tag(switch_channel_t *channel, const char *tagname, const char *tagvalue)
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
int index
Definition: switch_cJSON.h:160
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&#39;s bridge partner.
switch_status_t switch_channel_get_variable_buf(switch_channel_t *channel, const char *varname, char *buf, switch_size_t buflen)
Retrieve a variable from a given channel to a pre-allocated buffer without using a memory pool...
switch_status_t switch_channel_wait_for_app_flag(switch_channel_t *channel, uint32_t app_flag, const char *key, switch_bool_t pres, uint32_t to)
void switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
Set the given channel&#39;s originator caller profile.
switch_byte_t switch_byte_t uint32_t buflen
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&#39;s unique id.
switch_device_state_t
switch_status_t switch_channel_dtmf_lock(switch_channel_t *channel)
switch_status_t switch_channel_get_variables_prefix(switch_channel_t *channel, const char *prefix, switch_event_t **event)
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)
static int switch_channel_var_true(switch_channel_t *channel, const char *variable)
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&#39;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
char * key
Definition: switch_msrp.c:64
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)
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:145
switch_channel_callstate_t switch_channel_get_callstate(switch_channel_t *channel)
static int switch_false(const char *expr)
Evaluate the falsefullness of a string expression.
Definition: switch_utils.h:551
switch_caller_profile_t * switch_channel_get_origination_caller_profile(switch_channel_t *channel)
Retrieve the given channel&#39;s origination caller profile.
struct fspr_pool_t switch_memory_pool_t
const char *const name
Definition: switch_cJSON.h:250
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_get_log_tags(switch_channel_t *channel, switch_event_t **log_tags)
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&#39;s initial state.
switch_caller_profile_t * switch_channel_get_caller_profile(switch_channel_t *channel)
Retrieve the given channel&#39;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_status_t switch_channel_set_variable_strip_quotes_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check)
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&#39;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&#39;s originator caller profile.
#define _In_
switch_status_t switch_channel_perform_acknowledge_call(switch_channel_t *channel, const char *file, const char *func, int line)
#define SWITCH_BEGIN_EXTERN_C
Definition: switch.h:42
void switch_channel_handle_cause(switch_channel_t *channel, switch_call_cause_t cause)