Asterisk - The Open Source Telephony Project GIT-master-754dea3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
bridge.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2007 - 2009, 2013 Digium, Inc.
5 *
6 * Richard Mudgett <rmudgett@digium.com>
7 * Joshua Colp <jcolp@digium.com>
8 *
9 * See http://www.asterisk.org for more information about
10 * the Asterisk project. Please do not directly contact
11 * any of the maintainers of this project for assistance;
12 * the project provides a web site, mailing lists and IRC
13 * channels for your use.
14 *
15 * This program is free software, distributed under the terms of
16 * the GNU General Public License Version 2. See the LICENSE file
17 * at the top of the source tree.
18 */
19
20/*!
21 * \file
22 * \brief Bridging API
23 *
24 * \author Richard Mudgett <rmudgett@digium.com>
25 * \author Joshua Colp <jcolp@digium.com>
26 * \ref AstBridging
27 *
28 * See Also:
29 * \arg \ref AstCREDITS
30 */
31
32/*!
33 * \page AstBridging Bridging API
34 *
35 * The purpose of this API is to provide an easy and flexible way to bridge
36 * channels of different technologies with different features.
37 *
38 * Bridging technologies provide the mechanism that do the actual handling
39 * of frames between channels. They provide capability information, codec information,
40 * and preference value to assist the bridging core in choosing a bridging technology when
41 * creating a bridge. Different bridges may use different bridging technologies based on needs
42 * but once chosen they all operate under the same premise; they receive frames and send frames.
43 *
44 * Bridges are a combination of bridging technology, channels, and features. A
45 * developer creates a new bridge based on what they are currently expecting to do
46 * with it or what they will do with it in the future. The bridging core determines what
47 * available bridging technology will best fit the requirements and creates a new bridge.
48 * Once created, channels can be added to the bridge in a blocking or non-blocking fashion.
49 *
50 * Features are such things as channel muting or DTMF based features such as attended transfer,
51 * blind transfer, and hangup. Feature information must be set at the most granular level, on
52 * the channel. While you can use features on a global scope the presence of a feature structure
53 * on the channel will override the global scope. An example would be having the bridge muted
54 * at global scope and attended transfer enabled on a channel. Since the channel itself is not muted
55 * it would be able to speak.
56 *
57 * Feature hooks allow a developer to tell the bridging core that when a DTMF string
58 * is received from a channel a callback should be called in their application. For
59 * example, a conference bridge application may want to provide an IVR to control various
60 * settings on the conference bridge. This can be accomplished by attaching a feature hook
61 * that calls an IVR function when a DTMF string is entered.
62 *
63 */
64
65#ifndef _ASTERISK_BRIDGING_H
66#define _ASTERISK_BRIDGING_H
67
68#if defined(__cplusplus) || defined(c_plusplus)
69extern "C" {
70#endif
71
75#include "asterisk/dsp.h"
76#include "asterisk/uuid.h"
77
78/* Macros to assist debugging */
79#define BRIDGE_PRINTF_SPEC "%s(%s)(%p)"
80#define BRIDGE_PRINTF_VARS(bridge) S_OR((bridge)->uniqueid, "<unknown>"), S_OR((bridge)->name, "<unknown>"), (bridge)
81
82struct a02_container;
84struct ast_bridge;
86
87/*! \brief Capabilities for a bridge technology */
89 /*! Bridge technology can service calls on hold. */
91 /*! Bridge waits for channel to answer. Passes early media. (XXX Not supported yet) */
93 /*! Bridge is capable of natively bridging two channels. (Smart bridge only) */
95 /*! Bridge is capable of mixing at most two channels. (Smart bridgeable) */
97 /*! Bridge is capable of mixing an arbitrary number of channels. (Smart bridgeable) */
99};
100
101/*! \brief Video source modes */
103 /*! Video is not allowed in the bridge */
105 /*! A single user is picked as the only distributed of video across the bridge */
107 /*! A single user's video feed is distributed to all bridge channels, but
108 * that feed is automatically picked based on who is talking the most. */
110 /*! Operate as a selective forwarding unit. Video from each participant is
111 * cloned to a dedicated stream on a subset of the remaining participants.
112 */
114};
115
116/*! \brief This is used for both SINGLE_SRC mode to set what channel
117 * should be the current single video feed */
119 /*! Only accept video coming from this channel */
121};
122
123/*! \brief This is used for both SINGLE_SRC_TALKER mode to set what channel
124 * should be the current single video feed */
126 /*! Only accept video coming from this channel */
129
130 /*! Current talker see's this person */
132};
133
134/*! \brief REMB report behaviors */
136 /*! The average of all reports is sent to the sender */
138 /*! The lowest reported bitrate is forwarded to the sender */
140 /*! The highest reported bitrate is forwarded to the sender */
142 /*! The average of all reports WITHIN the bridge is sent to each sender */
144 /*! The lowest reported bitrate from all channels in the bridge is forwarded to each sender */
146 /*! The highest reported bitrate from all channels in the bridge is forwarded to each sender */
148 /*! Force the REMB estimated bitrate to a specified value */
150};
151
152/*! \brief This is used for selective forwarding unit configuration */
154 /*! The interval at which a REMB report is generated and sent */
155 unsigned int remb_send_interval;
156 /*! How the combined REMB report is generated */
158 /*! The estimated bitrate when behavior is "force" */
160};
161
162/*! \brief Data structure that defines a video source mode */
165 /* Add data for all the video modes here. */
166 union {
171 /*! The minimum interval between video updates */
173};
174
175/*!
176 * \brief Destroy the bridge.
177 *
178 * \param self Bridge to operate upon.
179 */
180typedef void (*ast_bridge_destructor_fn)(struct ast_bridge *self);
181
182/*!
183 * \brief The bridge is being dissolved.
184 *
185 * \param self Bridge to operate upon.
186 *
187 * \details
188 * The bridge is being dissolved. Remove any external
189 * references to the bridge so it can be destroyed.
190 *
191 * \note On entry, self must NOT be locked.
192 */
193typedef void (*ast_bridge_dissolving_fn)(struct ast_bridge *self);
194
195/*!
196 * \brief Push this channel into the bridge.
197 *
198 * \param self Bridge to operate upon.
199 * \param bridge_channel Bridge channel to push.
200 * \param swap Bridge channel to swap places with if not NULL.
201 *
202 * \details
203 * Setup any channel hooks controlled by the bridge. Allocate
204 * bridge_channel->bridge_pvt and initialize any resources put
205 * in bridge_channel->bridge_pvt if needed. If there is a swap
206 * channel, use it as a guide to setting up the bridge_channel.
207 *
208 * \note On entry, self is already locked.
209 *
210 * \retval 0 on success.
211 * \retval -1 on failure. The channel did not get pushed.
212 */
213typedef int (*ast_bridge_push_channel_fn)(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap);
214
215/*!
216 * \brief Pull this channel from the bridge.
217 *
218 * \param self Bridge to operate upon.
219 * \param bridge_channel Bridge channel to pull.
220 *
221 * \details
222 * Remove any channel hooks controlled by the bridge. Release
223 * any resources held by bridge_channel->bridge_pvt and release
224 * bridge_channel->bridge_pvt.
225 *
226 * \note On entry, self is already locked.
227 */
228typedef void (*ast_bridge_pull_channel_fn)(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel);
229
230/*!
231 * \brief Notify the bridge that this channel was just masqueraded.
232 *
233 * \param self Bridge to operate upon.
234 * \param bridge_channel Bridge channel that was masqueraded.
235 *
236 * \details
237 * A masquerade just happened to this channel. The bridge needs
238 * to re-evaluate this a channel in the bridge.
239 *
240 * \note On entry, self is already locked.
241 */
242typedef void (*ast_bridge_notify_masquerade_fn)(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel);
243
244/*!
245 * \brief Get the merge priority of this bridge.
246 *
247 * \param self Bridge to operate upon.
248 *
249 * \note On entry, self is already locked.
250 *
251 * \return Merge priority
252 */
253typedef int (*ast_bridge_merge_priority_fn)(struct ast_bridge *self);
254
255/*!
256 * \brief Bridge virtual methods table definition.
257 *
258 * \note Any changes to this struct must be reflected in
259 * bridge_alloc() validity checking.
260 */
262 /*! Bridge class name for log messages. */
263 const char *name;
264 /*! Destroy the bridge. */
266 /*! The bridge is being dissolved. Remove any references to the bridge. */
268 /*! Push the bridge channel into the bridge. */
270 /*! Pull the bridge channel from the bridge. */
272 /*! Notify the bridge of a masquerade with the channel. */
274 /*! Get the bridge merge priority. */
276 /*! Peek at swap channel before it can hang up, prior to push. */
278};
279
280/*! Softmix technology parameters. */
282 /*! The video mode softmix is using */
284 /*!
285 * \brief The internal sample rate softmix uses to mix channels.
286 *
287 * \note If this value is 0, the sofmix may auto adjust the mixing rate.
288 */
290 /*!
291 * \brief The mixing interval indicates how quickly softmix
292 * mixing should occur to mix audio.
293 *
294 * \note When set to 0, softmix must choose a default interval
295 * for itself.
296 */
298 /*! TRUE if binaural convolve is activated in configuration. */
299 unsigned int binaural_active;
300 /*!
301 * Add a "label" attribute to each stream in the SDP containing
302 * the channel uniqueid. Used for participant info correlation.
303 */
304 unsigned int send_sdp_label;
305 /*!
306 * \brief The maximum sample rate softmix uses to mix channels.
307 *
308 * \note If this value is 0, there is no maximum sample rate.
309 */
311};
312
314
315/*!
316 * \brief Structure that contains a snapshot of information about a bridge
317 */
320 /*! Immutable bridge UUID. */
322 /*! Bridge technology that is handling the bridge */
324 /*! Bridge subclass that is handling the bridge */
326 /*! Creator of the bridge */
328 /*! Name given to the bridge by its creator */
330 /*! Unique ID of the channel providing video, if one exists */
332 );
333 /*! AO2 container of bare channel uniqueid strings participating in the bridge.
334 * Allocated from ast_str_container_alloc() */
336 /*! Bridge flags to tweak behavior */
338 /*! Bridge capabilities */
339 uint32_t capabilities;
340 /*! Number of channels participating in the bridge */
341 unsigned int num_channels;
342 /*! Number of active channels in the bridge. */
343 unsigned int num_active;
344 /*! The video mode of the bridge */
346 /*! The time of bridge creation */
347 struct timeval creationtime;
348};
349
350/*!
351 * \brief Structure that contains information about a bridge
352 */
354 /*! Bridge virtual method table. */
356 /*! "Personality" currently exhibited by bridge subclass */
358 /*! Bridge technology that is handling the bridge */
360 /*! Private information unique to the bridge technology */
361 void *tech_pvt;
362 /*! Per-bridge topics */
364 /*! Call ID associated with the bridge */
366 /*! Linked list of channels participating in the bridge */
368 /*! Queue of actions to perform on the bridge. */
370 /*! Softmix technology parameters. */
372 /*! Bridge flags to tweak behavior */
374 /*! Allowed bridge technology capabilities when AST_BRIDGE_FLAG_SMART enabled. */
376 /*! Number of channels participating in the bridge */
377 unsigned int num_channels;
378 /*! Number of active channels in the bridge. */
379 unsigned int num_active;
380 /*! Number of channels with AST_BRIDGE_CHANNEL_FLAG_LONELY in the bridge. */
381 unsigned int num_lonely;
382 /*!
383 * \brief Count of the active temporary requests to inhibit bridge merges.
384 * Zero if merges are allowed.
385 *
386 * \note Temporary as in try again in a moment.
387 */
388 unsigned int inhibit_merge;
389 /*! Cause code of the dissolved bridge. */
390 int cause;
391 /*! TRUE if the bridge was reconfigured. */
392 unsigned int reconfigured:1;
393 /*! TRUE if the bridge has been dissolved. Any channel that now tries to join is immediately ejected. */
394 unsigned int dissolved:1;
395 /*! TRUE if the bridge construction was completed. */
397
399 /*! Immutable name of the creator for the bridge */
401 /*! Immutable name given to the bridge by its creator */
403 /*! Immutable bridge UUID. */
405 );
406
407 /*! Type mapping used for media routing */
409 /*! Current bridge snapshot */
411 /*! The time of bridge creation */
412 struct timeval creationtime;
413};
414
415/*! \brief Bridge base class virtual method table. */
417
418/*!
419 * \brief Returns the global bridges container
420 * \since 17.0
421 *
422 * \return a pointer to the bridges container success
423 * \retval NULL on failure
424 *
425 * \note You must use \verbatim ao2_ref(<container>, -1) \endverbatim when done with it
426 *
427 * \warning You must not attempt to modify the container returned.
428 */
429struct ao2_container *ast_bridges(void);
430
431/*!
432 * \brief Create a new base class bridge
433 *
434 * \param capabilities The capabilities that we require to be used on the bridge
435 * \param flags Flags that will alter the behavior of the bridge
436 * \param creator Entity that created the bridge (optional)
437 * \param name Name given to the bridge by its creator (optional, requires named creator)
438 * \param id Unique ID given to the bridge by its creator (optional)
439 *
440 * \return a pointer to a new bridge on success
441 * \retval NULL on failure
442 *
443 * Example usage:
444 *
445 * \code
446 * struct ast_bridge *bridge;
447 * bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_1TO1MIX, AST_BRIDGE_FLAG_DISSOLVE_HANGUP);
448 * \endcode
449 *
450 * This creates a no frills two party bridge that will be
451 * destroyed once one of the channels hangs up.
452 */
453struct ast_bridge *ast_bridge_base_new(uint32_t capabilities, unsigned int flags, const char *creator, const char *name, const char *id);
454
455/*!
456 * \brief Try locking the bridge.
457 *
458 * \param bridge Bridge to try locking
459 *
460 * \retval 0 on success.
461 * \retval non-zero on error.
462 */
463#define ast_bridge_trylock(bridge) _ast_bridge_trylock(bridge, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge)
464static inline int _ast_bridge_trylock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
465{
466 return __ao2_trylock(bridge, AO2_LOCK_REQ_MUTEX, file, function, line, var);
467}
468
469/*!
470 * \brief Lock the bridge.
471 *
472 * \param bridge Bridge to lock
473 */
474#define ast_bridge_lock(bridge) _ast_bridge_lock(bridge, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge)
475static inline void _ast_bridge_lock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
476{
477 __ao2_lock(bridge, AO2_LOCK_REQ_MUTEX, file, function, line, var);
478}
479
480/*!
481 * \brief Unlock the bridge.
482 *
483 * \param bridge Bridge to unlock
484 */
485#define ast_bridge_unlock(bridge) _ast_bridge_unlock(bridge, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge)
486static inline void _ast_bridge_unlock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
487{
488 __ao2_unlock(bridge, file, function, line, var);
489}
490
491/*! \brief Lock two bridges. */
492#define ast_bridge_lock_both(bridge1, bridge2) \
493 do { \
494 for (;;) { \
495 ast_bridge_lock(bridge1); \
496 if (!ast_bridge_trylock(bridge2)) { \
497 break; \
498 } \
499 ast_bridge_unlock(bridge1); \
500 sched_yield(); \
501 } \
502 } while (0)
503
504/*!
505 * \brief Destroy a bridge
506 *
507 * \param bridge Bridge to destroy
508 * \param cause Cause of bridge being destroyed. (If cause <= 0 then use AST_CAUSE_NORMAL_CLEARING)
509 *
510 * \retval 0 on success
511 * \retval -1 on failure
512 *
513 * Example usage:
514 *
515 * \code
516 * ast_bridge_destroy(bridge, AST_CAUSE_NORMAL_CLEARING);
517 * \endcode
518 *
519 * This destroys a bridge that was previously created.
520 *
521 * \note
522 * While this function will kick all channels out of the bridge, channels that
523 * were added to the bridge using ast_bridge_impart() with the flag
524 * AST_BRIDGE_IMPART_CHAN_DEPARTABLE set must have ast_bridge_depart() called
525 * on them.
526 */
527int ast_bridge_destroy(struct ast_bridge *bridge, int cause);
528
529/*!
530 * \brief Notify bridging that this channel was just masqueraded.
531 * \since 12.0.0
532 *
533 * \param chan Channel just involved in a masquerade
534 */
536
538 /*! The bridge reference is being passed by the caller. */
540 /*! The initial bridge join does not cause a COLP exchange. */
542};
543
544/*!
545 * \brief Join a channel to a bridge (blocking)
546 *
547 * \param bridge Bridge to join
548 * \param chan Channel to join
549 * \param swap Channel to swap out if swapping (A channel reference is stolen.)
550 * \param features Bridge features structure
551 * \param tech_args Optional Bridging tech optimization parameters for this channel.
552 * \param flags defined by enum ast_bridge_join_flags.
553 *
554 * \note The passed in swap channel is always unreffed on return. It is not a
555 * good idea to access the swap channel on return or for the caller to keep a
556 * reference to it.
557 *
558 * \note Absolutely _NO_ locks should be held before calling
559 * this function since it blocks.
560 *
561 * \retval 0 if the channel successfully joined the bridge before it exited.
562 * \retval -1 if the channel failed to join the bridge
563 *
564 * Example usage:
565 *
566 * \code
567 * ast_bridge_join(bridge, chan, NULL, NULL, NULL, AST_BRIDGE_JOIN_PASS_REFERENCE);
568 * \endcode
569 *
570 * This adds a channel pointed to by the chan pointer to the bridge pointed to by
571 * the bridge pointer. This function will not return until the channel has been
572 * removed from the bridge, swapped out for another channel, or has hung up.
573 *
574 * If this channel will be replacing another channel the other channel can be specified
575 * in the swap parameter. The other channel will be thrown out of the bridge in an
576 * atomic fashion.
577 *
578 * If channel specific features are enabled a pointer to the features structure
579 * can be specified in the features parameter.
580 */
581int ast_bridge_join(struct ast_bridge *bridge,
582 struct ast_channel *chan,
583 struct ast_channel *swap,
584 struct ast_bridge_features *features,
585 struct ast_bridge_tech_optimizations *tech_args,
586 enum ast_bridge_join_flags flags);
587
589 /*! Field describing what the caller can do with the channel after it is imparted. */
591 /*! The caller wants to reclaim the channel using ast_bridge_depart(). */
593 /*! The caller is passing channel control entirely to the bridging system. */
595 /*! The initial bridge join does not cause a COLP exchange. */
597};
598
599/*!
600 * \brief Impart a channel to a bridge (non-blocking)
601 *
602 * \param bridge Bridge to impart on
603 * \param chan Channel to impart (The channel reference is stolen if impart successful.)
604 * \param swap Channel to swap out if swapping. NULL if not swapping.
605 * \param features Bridge features structure.
606 * \param flags defined by enum ast_bridge_impart_flags.
607 *
608 * \note The given bridge must be unlocked when calling this function.
609 *
610 * \note The features parameter must be NULL or obtained by
611 * ast_bridge_features_new(). You must not dereference features
612 * after calling even if the call fails.
613 *
614 * \note chan is locked by this function.
615 *
616 * \retval 0 on success
617 * \retval -1 on failure (Caller still has ownership of chan)
618 *
619 * Example usage:
620 *
621 * \code
622 * ast_bridge_impart(bridge, chan, NULL, NULL, AST_BRIDGE_IMPART_CHAN_INDEPENDENT);
623 * \endcode
624 *
625 * \details
626 * This adds a channel pointed to by the chan pointer to the
627 * bridge pointed to by the bridge pointer. This function will
628 * return immediately and will not wait until the channel is no
629 * longer part of the bridge.
630 *
631 * If this channel will be replacing another channel the other
632 * channel can be specified in the swap parameter. The other
633 * channel will be thrown out of the bridge in an atomic
634 * fashion.
635 *
636 * If channel specific features are enabled, a pointer to the
637 * features structure can be specified in the features
638 * parameter.
639 *
640 * \note If you impart a channel with
641 * AST_BRIDGE_IMPART_CHAN_DEPARTABLE you MUST
642 * ast_bridge_depart() the channel if this call succeeds. The
643 * bridge channel thread is created join-able. The implication
644 * is that the channel is special and will not behave like a
645 * normal channel.
646 *
647 * \note If you impart a channel with
648 * AST_BRIDGE_IMPART_CHAN_INDEPENDENT you must not
649 * ast_bridge_depart() the channel. The bridge channel thread
650 * is created non-join-able. The channel must be treated as if
651 * it were placed into the bridge by ast_bridge_join().
652 * Channels placed into a bridge by ast_bridge_join() are
653 * removed by a third party using ast_bridge_remove().
654 *
655 * \note Any callbacks on the channel will be invoked on failure
656 * with the reason as AST_BRIDGE_AFTER_CB_REASON_IMPART_FAILED.
657 */
658int ast_bridge_impart(struct ast_bridge *bridge,
659 struct ast_channel *chan,
660 struct ast_channel *swap,
661 struct ast_bridge_features *features,
663
664/*!
665 * \brief Depart a channel from a bridge
666 *
667 * \param chan Channel to depart
668 *
669 * \note chan is locked by this function.
670 *
671 * \retval 0 on success
672 * \retval -1 on failure
673 *
674 * Example usage:
675 *
676 * \code
677 * ast_bridge_depart(chan);
678 * \endcode
679 *
680 * This removes the channel pointed to by the chan pointer from any bridge
681 * it may be in and gives control to the calling thread.
682 * This does not hang up the channel.
683 *
684 * \note This API call can only be used on channels that were added to the bridge
685 * using the ast_bridge_impart API call with the AST_BRIDGE_IMPART_CHAN_DEPARTABLE
686 * flag.
687 */
688int ast_bridge_depart(struct ast_channel *chan);
689
690/*!
691 * \brief Remove a channel from a bridge
692 *
693 * \param bridge Bridge that the channel is to be removed from
694 * \param chan Channel to remove
695 *
696 * \retval 0 on success
697 * \retval -1 on failure
698 *
699 * Example usage:
700 *
701 * \code
702 * ast_bridge_remove(bridge, chan);
703 * \endcode
704 *
705 * This removes the channel pointed to by the chan pointer from the bridge
706 * pointed to by the bridge pointer and requests that it be hung up. Control
707 * over the channel will NOT be given to the calling thread.
708 *
709 * \note This API call can be used on channels that were added to the bridge
710 * using both ast_bridge_join and ast_bridge_impart.
711 */
712int ast_bridge_remove(struct ast_bridge *bridge, struct ast_channel *chan);
713
714/*!
715 * \brief Kick a channel from a bridge
716 *
717 * \param bridge Bridge that the channel is to be kicked from
718 * \param chan Channel to kick
719 *
720 * \retval 0 on success
721 * \retval -1 on failure
722 *
723 * Example usage:
724 *
725 * \code
726 * ast_bridge_kick(bridge, chan);
727 * \endcode
728 *
729 * \details
730 * This kicks the channel pointed to by the chan pointer from
731 * the bridge pointed to by the bridge pointer and requests that
732 * it be hung up. Control over the channel will NOT be given to
733 * the calling thread.
734 *
735 * \note The functional difference between ast_bridge_kick() and
736 * ast_bridge_remove() is that the bridge may dissolve as a
737 * result of the channel being kicked.
738 *
739 * \note This API call can be used on channels that were added
740 * to the bridge using both ast_bridge_join and
741 * ast_bridge_impart.
742 */
743int ast_bridge_kick(struct ast_bridge *bridge, struct ast_channel *chan);
744
745/*!
746 * \brief Merge two bridges together
747 *
748 * \param dst_bridge Destination bridge of merge.
749 * \param src_bridge Source bridge of merge.
750 * \param merge_best_direction TRUE if don't care about which bridge merges into the other.
751 * \param kick_me Array of channels to kick from the bridges.
752 * \param num_kick Number of channels in the kick_me array.
753 *
754 * \note Absolutely _NO_ bridge or channel locks should be held
755 * before calling this function.
756 *
757 * \retval 0 on success
758 * \retval -1 on failure
759 *
760 * Example usage:
761 *
762 * \code
763 * ast_bridge_merge(dst_bridge, src_bridge, 0, NULL, 0);
764 * \endcode
765 *
766 * This moves the channels in src_bridge into the bridge pointed
767 * to by dst_bridge.
768 */
769int ast_bridge_merge(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, int merge_best_direction, struct ast_channel **kick_me, unsigned int num_kick);
770
771/*!
772 * \brief Move a channel from one bridge to another.
773 * \since 12.0.0
774 *
775 * \param dst_bridge Destination bridge of bridge channel move.
776 * \param src_bridge Source bridge of bridge channel move.
777 * \param chan Channel to move.
778 * \param swap Channel to replace in dst_bridge.
779 * \param attempt_recovery TRUE if failure attempts to push channel back into original bridge.
780 *
781 * \note Absolutely _NO_ bridge or channel locks should be held
782 * before calling this function.
783 *
784 * \retval 0 on success.
785 * \retval -1 on failure.
786 */
787int ast_bridge_move(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_channel *chan, struct ast_channel *swap, int attempt_recovery);
788
789/*!
790 * \brief Adjust the bridge merge inhibit request count.
791 * \since 12.0.0
792 *
793 * \param bridge What to operate on.
794 * \param request Inhibit request increment.
795 * (Positive to add requests. Negative to remove requests.)
796 */
797void ast_bridge_merge_inhibit(struct ast_bridge *bridge, int request);
798
799/*!
800 * \brief Suspend a channel temporarily from a bridge
801 *
802 * \param bridge Bridge to suspend the channel from
803 * \param chan Channel to suspend
804 *
805 * \retval 0 on success
806 * \retval -1 on failure
807 *
808 * Example usage:
809 *
810 * \code
811 * ast_bridge_suspend(bridge, chan);
812 * \endcode
813 *
814 * This suspends the channel pointed to by chan from the bridge pointed to by bridge temporarily.
815 * Control of the channel is given to the calling thread. This differs from ast_bridge_depart as
816 * the channel will not be removed from the bridge.
817 *
818 * \note This API call can be used on channels that were added to the bridge
819 * using both ast_bridge_join and ast_bridge_impart.
820 */
821int ast_bridge_suspend(struct ast_bridge *bridge, struct ast_channel *chan);
822
823/*!
824 * \brief Unsuspend a channel from a bridge
825 *
826 * \param bridge Bridge to unsuspend the channel from
827 * \param chan Channel to unsuspend
828 *
829 * \retval 0 on success
830 * \retval -1 on failure
831 *
832 * Example usage:
833 *
834 * \code
835 * ast_bridge_unsuspend(bridge, chan);
836 * \endcode
837 *
838 * This unsuspends the channel pointed to by chan from the bridge pointed to by bridge.
839 * The bridge will go back to handling the channel once this function returns.
840 *
841 * \note You must not mess with the channel once this function returns.
842 * Doing so may result in bad things happening.
843 */
844int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan);
845
846/*!
847 * \brief Sets BRIDGECHANNEL and BRIDGEPVTCALLID for a channel
848 *
849 * \pre chan must be locked before calling
850 *
851 * \param chan channel name of the bridged peer
852 * \param name
853 * \param pvtid Private CallID of the bridged peer
854 */
855void ast_bridge_vars_set(struct ast_channel *chan, const char *name, const char *pvtid);
856
857struct ast_unreal_pvt;
858
859/*!
860 * \brief Check and optimize out the unreal channels between bridges.
861 * \since 12.0.0
862 *
863 * \param chan Unreal channel writing a frame into the channel driver.
864 * \param peer Other unreal channel in the pair.
865 * \param pvt Private data provided by an implementation of the unreal driver that
866 * contains the callbacks that should be called when optimization begins/ends
867 *
868 * \note It is assumed that chan is already locked.
869 *
870 * \retval 0 if unreal channels were not optimized out.
871 * \retval non-zero if unreal channels were optimized out.
872 */
873int ast_bridge_unreal_optimize_out(struct ast_channel *chan, struct ast_channel *peer, struct ast_unreal_pvt *pvt);
874
875/*!
876 * \brief Tells, if optimization is allowed, how the optimization would be performed
877 */
879 /*! Optimization would swap peer into the chan_bridge */
881 /*! Optimization would swap chan into the peer_bridge */
883 /*! Optimization would merge peer_bridge into chan_bridge */
885 /*! Optimization would merge chan_bridge into peer_bridge */
887 /*! Optimization is not permitted on one or both bridges */
889};
890
891/*!
892 * \brief Determine if bridges allow for optimization to occur betweem them
893 * \since 12.0.0
894 *
895 * \param chan_bridge First bridge being tested
896 * \param peer_bridge Second bridge being tested
897 *
898 * This determines if two bridges allow for unreal channel optimization
899 * to occur between them. The function does not require for unreal channels
900 * to already be in the bridges when called.
901 *
902 * \note It is assumed that both bridges are locked prior to calling this function
903 *
904 * \note A return other than AST_BRIDGE_OPTIMIZE_PROHIBITED does not guarantee
905 * that an optimization attempt will succeed. However, a return of
906 * AST_BRIDGE_OPTIMIZE_PROHIBITED guarantees that an optimization attempt will
907 * never succeed.
908 *
909 * \return Optimization allowability for the bridges
910 */
912 struct ast_bridge *peer_bridge);
913
914/*!
915 * \brief Put an action onto the specified bridge.
916 * \since 12.0.0
917 *
918 * \param bridge What to queue the action on.
919 * \param action What to do.
920 *
921 * \retval 0 on success.
922 * \retval -1 on error.
923 *
924 * \note This API call is meant for internal bridging operations.
925 */
926int ast_bridge_queue_action(struct ast_bridge *bridge, struct ast_frame *action);
927
928/*!
929 * \brief Queue the given frame to everyone else.
930 * \since 12.0.0
931 *
932 * \param bridge What bridge to distribute frame.
933 * \param bridge_channel Channel to optionally not pass frame to. (NULL to pass to everyone)
934 * \param frame Frame to pass.
935 *
936 * \note This is intended to be called by bridge hooks and
937 * bridge technologies.
938 *
939 * \retval 0 Frame written to at least one channel.
940 * \retval -1 Frame written to no channels.
941 */
942int ast_bridge_queue_everyone_else(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame);
943
944/*!
945 * \brief Adjust the internal mixing sample rate of a bridge
946 * used during multimix mode.
947 *
948 * \param bridge Channel to change the sample rate on.
949 * \param sample_rate the sample rate to change to. If a
950 * value of 0 is passed here, the bridge will be free to pick
951 * what ever sample rate it chooses.
952 *
953 */
954void ast_bridge_set_internal_sample_rate(struct ast_bridge *bridge, unsigned int sample_rate);
955
956/*!
957 * \brief Adjust the maximum mixing sample rate of a bridge
958 * used during multimix mode.
959 * \since 13.31.0
960 * \since 16.8.0
961 * \since 17.2.0
962 *
963 * \param bridge Channel to change the sample rate on.
964 * \param sample_rate the maximum sample rate to use. If a
965 * value of 0 is passed here, the bridge will be free to pick
966 * what ever sample rate it chooses.
967 *
968 */
969void ast_bridge_set_maximum_sample_rate(struct ast_bridge *bridge, unsigned int sample_rate);
970
971/*!
972 * \brief Adjust the internal mixing interval of a bridge used
973 * during multimix mode.
974 *
975 * \param bridge Channel to change the sample rate on.
976 * \param mixing_interval the sample rate to change to. If 0 is set
977 * the bridge tech is free to choose any mixing interval it uses by default.
978 */
979void ast_bridge_set_mixing_interval(struct ast_bridge *bridge, unsigned int mixing_interval);
980
981/*!
982 * \brief Activates the use of binaural signals in a conference bridge.
983 *
984 * \param bridge Channel to activate the binaural signals.
985 * \param binaural_active If true binaural signal processing will be active for the bridge.
986 */
987void ast_bridge_set_binaural_active(struct ast_bridge *bridge, unsigned int binaural_active);
988
989/*!
990 * \brief Set a bridge to feed a single video source to all participants.
991 */
992void ast_bridge_set_single_src_video_mode(struct ast_bridge *bridge, struct ast_channel *video_src_chan);
993
994/*!
995 * \brief Set the bridge to pick the strongest talker supporting
996 * video as the single source video feed
997 */
999
1000/*!
1001 * \brief Set the bridge to be a selective forwarding unit
1002 */
1003void ast_bridge_set_sfu_video_mode(struct ast_bridge *bridge);
1004
1005/*!
1006 * \brief Set the amount of time to discard subsequent video updates after a video update has been sent
1007 *
1008 * \param bridge Bridge to set the minimum video update wait time on
1009 * \param video_update_discard Amount of time after sending a video update that others should be discarded
1010 */
1011void ast_bridge_set_video_update_discard(struct ast_bridge *bridge, unsigned int video_update_discard);
1012
1013/*!
1014 * \brief Set the interval at which a combined REMB frame will be sent to video sources
1015 *
1016 * \param bridge Bridge to set the REMB send interval on
1017 * \param remb_send_interval The REMB send interval
1018 *
1019 * \note This can only be called when the bridge has been set to the SFU video mode.
1020 */
1021void ast_bridge_set_remb_send_interval(struct ast_bridge *bridge, unsigned int remb_send_interval);
1022
1023/*!
1024 * \brief Set the REMB report generation behavior on a bridge
1025 *
1026 * \param bridge Bridge to set the REMB behavior on
1027 * \param behavior How REMB reports are generated
1028 *
1029 * \note This can only be called when the bridge has been set to the SFU video mode.
1030 */
1032
1033/*!
1034 * \brief Force the REMB report estimated bitrate to a specific max value
1035 *
1036 * \param bridge Bridge to set the REMB behavior on
1037 * \param estimated_bitrate The estimated bitrate in bits per second
1038 *
1039 * \note This can only be called when the bridge has been set to the SFU video mode.
1040 */
1041void ast_bridge_set_remb_estimated_bitrate(struct ast_bridge *bridge, float estimated_bitrate);
1042
1043/*!
1044 * \brief Update information about talker energy for talker src video mode.
1045 */
1046void ast_bridge_update_talker_src_video_mode(struct ast_bridge *bridge, struct ast_channel *chan, int talker_energy, int is_keyframe);
1047
1048/*!
1049 * \brief Returns the number of video sources currently active in the bridge
1050 */
1051int ast_bridge_number_video_src(struct ast_bridge *bridge);
1052
1053/*!
1054 * \brief Determine if a channel is a video src for the bridge
1055 *
1056 * \retval 0 Not a current video source of the bridge.
1057 * \retval non-zero is a video source of the bridge, The number
1058 * returned represents the priority this video stream has
1059 * on the bridge where 1 is the highest priority.
1060 */
1061int ast_bridge_is_video_src(struct ast_bridge *bridge, struct ast_channel *chan);
1062
1063/*!
1064 * \brief remove a channel as a source of video for the bridge.
1065 */
1066void ast_bridge_remove_video_src(struct ast_bridge *bridge, struct ast_channel *chan);
1067
1068/*!
1069 * \brief Converts an enum representation of a bridge video mode to string
1070 *
1071 * \param video_mode The video mode
1072 *
1073 * \return A string representation of \c video_mode
1074 */
1076
1077/*!
1078 * \brief Controls whether to send a "label" attribute in each stream in an SDP
1079 * \since 16.1.0
1080 *
1081 * \param bridge The bridge
1082 * \param send_sdp_label Whether to send the labels or not
1083 *
1084 * \note The label will contain the uniqueid of the channel related to the stream.
1085 * This is used to allow the recipient to correlate the stream to the participant
1086 * information events sent by app_confbridge.
1087 * The bridge will be locked in this function.
1088 */
1089void ast_bridge_set_send_sdp_label(struct ast_bridge *bridge, unsigned int send_sdp_label);
1090
1091/*!
1092 * \brief Acquire the channel's bridge for transfer purposes.
1093 * \since 13.21.0
1094 *
1095 * \param chan Channel involved in a transfer.
1096 *
1097 * \return The bridge the channel is in or NULL if it either isn't
1098 * in a bridge or should not be considered to be in a bridge.
1099 */
1101
1103 /*! The transfer completed successfully */
1105 /*! A bridge involved does not permit transferring */
1107 /*! The current bridge setup makes transferring an invalid operation */
1109 /*! The transfer operation failed for a miscellaneous reason */
1111};
1112
1114 /*! Transfer of a single party */
1116 /*! Transfer of multiple parties */
1118};
1119
1120/*!
1121 * \brief AO2 object that wraps data for transfer_channel_cb
1122 */
1124 void *data; /*! Data to be used by the transfer_channel_cb -- note that this
1125 * pointer is going to be pointing to something on the stack, so
1126 * it must not be used at any point after returning from the
1127 * transfer_channel_cb. */
1128 int completed; /*! Initially 0, This will be set to 1 by either the transfer
1129 * code or by transfer code hooks (e.g. parking) when the
1130 * transfer is completed and any remaining actions have taken
1131 * place (e.g. parking announcements). It will never be reset
1132 * to 0. This is used for deferring progress for channel
1133 * drivers that support deferred progress. */
1134};
1135
1136/*!
1137 * \brief Callback function type called during blind transfers
1138 *
1139 * A caller of ast_bridge_transfer_blind() may wish to set data on
1140 * the channel that ends up running dialplan. For instance, it may
1141 * be useful to set channel variables on the channel.
1142 *
1143 * \param chan The involved channel
1144 * \param user_data User-provided data needed in the callback
1145 * \param transfer_type The type of transfer being completed
1146 */
1147typedef void (*transfer_channel_cb)(struct ast_channel *chan, struct transfer_channel_data *user_data,
1148 enum ast_transfer_type transfer_type);
1149
1150/*!
1151 * \brief Blind transfer target to the extension and context provided
1152 *
1153 * The channel given is bridged to one or multiple channels. Depending on
1154 * the bridge and the number of participants, the entire bridge could be
1155 * transferred to the given destination, or a single channel may be redirected.
1156 *
1157 * Callers may also provide a callback to be called on the channel that will
1158 * be running dialplan. The user data passed into ast_bridge_transfer_blind
1159 * will be given as the argument to the callback to be interpreted as desired.
1160 * This callback is guaranteed to be called in the same thread as
1161 * ast_bridge_transfer_blind() and before ast_bridge_transfer_blind() returns.
1162 *
1163 * \note Absolutely _NO_ channel locks should be held before
1164 * calling this function.
1165 *
1166 * \param is_external Indicates that transfer was initiated externally
1167 * \param transferer The channel performing the blind transfer
1168 * \param exten The dialplan extension to send the call to
1169 * \param context The dialplan context to send the call to
1170 * \param new_channel_cb A callback to be called on the channel that will
1171 * be executing dialplan
1172 * \param user_data Argument for new_channel_cb
1173 * \return The success or failure result of the blind transfer
1174 */
1176 struct ast_channel *transferer, const char *exten, const char *context,
1177 transfer_channel_cb new_channel_cb, void *user_data);
1178
1179/*!
1180 * \brief Attended transfer
1181 *
1182 * The two channels are both transferer channels. The first is the channel
1183 * that is bridged to the transferee (or if unbridged, the 'first' call of
1184 * the transfer). The second is the channel that is bridged to the transfer
1185 * target (or if unbridged, the 'second' call of the transfer).
1186 *
1187 * \note Absolutely _NO_ channel locks should be held before
1188 * calling this function.
1189 *
1190 * \param to_transferee Transferer channel on initial call (presumably bridged to transferee)
1191 * \param to_transfer_target Transferer channel on consultation call (presumably bridged to transfer target)
1192 * \return The success or failure of the attended transfer
1193 */
1195 struct ast_channel *to_transfer_target);
1196
1197/*!
1198 * \brief Set the relevant transfer variables for a single channel
1199 *
1200 * Sets either the ATTENDEDTRANSFER or BLINDTRANSFER variable for a channel while clearing
1201 * the opposite.
1202 *
1203 * \param chan Channel the variable is being set for
1204 * \param value Value the variable is being set to
1205 * \param is_attended false set BLINDTRANSFER and unset ATTENDEDTRANSFER
1206 * true set ATTENDEDTRANSFER and unset BLINDTRANSFER
1207 */
1208void ast_bridge_set_transfer_variables(struct ast_channel *chan, const char *value, int is_attended);
1209
1210/*!
1211 * \brief Get a container of all channels in the bridge
1212 * \since 12.0.0
1213 *
1214 * \param bridge The bridge which is already locked.
1215 *
1216 * \retval NULL Failed to create container
1217 * \retval non-NULL Container of channels in the bridge
1218 */
1219struct ao2_container *ast_bridge_peers_nolock(struct ast_bridge *bridge);
1220
1221/*!
1222 * \brief Get a container of all channels in the bridge
1223 * \since 12.0.0
1224 *
1225 * \param bridge The bridge
1226 *
1227 * \note The returned container is a snapshot of channels in the
1228 * bridge when called.
1229 *
1230 * \retval NULL Failed to create container
1231 * \retval non-NULL Container of channels in the bridge
1232 */
1233struct ao2_container *ast_bridge_peers(struct ast_bridge *bridge);
1234
1235/*!
1236 * \brief Get the channel's bridge peer only if the bridge is two-party.
1237 * \since 12.0.0
1238 *
1239 * \param bridge The bridge which is already locked.
1240 * \param chan Channel desiring the bridge peer channel.
1241 *
1242 * \note The returned peer channel is the current peer in the
1243 * bridge when called.
1244 *
1245 * \retval NULL Channel not in a bridge or the bridge is not two-party.
1246 * \retval non-NULL Reffed peer channel at time of calling.
1247 */
1248struct ast_channel *ast_bridge_peer_nolock(struct ast_bridge *bridge, struct ast_channel *chan);
1249
1250/*!
1251 * \brief Get the channel's bridge peer only if the bridge is two-party.
1252 * \since 12.0.0
1253 *
1254 * \param bridge The bridge
1255 * \param chan Channel desiring the bridge peer channel.
1256 *
1257 * \note The returned peer channel is the current peer in the
1258 * bridge when called.
1259 *
1260 * \retval NULL Channel not in a bridge or the bridge is not two-party.
1261 * \retval non-NULL Reffed peer channel at time of calling.
1262 */
1263struct ast_channel *ast_bridge_peer(struct ast_bridge *bridge, struct ast_channel *chan);
1264
1265/*!
1266 * \brief Remove marked bridge channel feature hooks.
1267 * \since 12.0.0
1268 *
1269 * \param features Bridge features structure
1270 * \param flags Determinator for whether hook is removed.
1271 */
1273
1274/*!
1275 * \brief Find bridge by id
1276 * \since 12.0.0
1277 *
1278 * \param bridge_id Bridge identifier
1279 *
1280 * \return NULL bridge not found
1281 * \return non-NULL reference to bridge
1282 */
1283struct ast_bridge *ast_bridge_find_by_id(const char *bridge_id);
1284
1285#if defined(__cplusplus) || defined(c_plusplus)
1286}
1287#endif
1288
1289#endif /* _ASTERISK_BRIDGING_H */
#define var
Definition: ast_expr2f.c:605
int __ao2_trylock(void *a, enum ao2_lock_req lock_how, const char *file, const char *func, int line, const char *var)
Try locking– (don't block if fail)
Definition: astobj2.c:342
@ AO2_LOCK_REQ_MUTEX
Definition: astobj2.h:702
int __ao2_unlock(void *a, const char *file, const char *func, int line, const char *var)
Unlock an object.
Definition: astobj2.c:288
int __ao2_lock(void *a, enum ao2_lock_req lock_how, const char *file, const char *func, int line, const char *var)
Lock an object.
Definition: astobj2.c:222
int ast_bridge_depart(struct ast_channel *chan)
Depart a channel from a bridge.
Definition: bridge.c:1975
void ast_bridge_set_remb_estimated_bitrate(struct ast_bridge *bridge, float estimated_bitrate)
Force the REMB report estimated bitrate to a specific max value.
Definition: bridge.c:3876
struct ao2_container * ast_bridges(void)
Returns the global bridges container.
Definition: bridge.c:185
void(* ast_bridge_destructor_fn)(struct ast_bridge *self)
Destroy the bridge.
Definition: bridge.h:180
void ast_bridge_set_talker_src_video_mode(struct ast_bridge *bridge)
Set the bridge to pick the strongest talker supporting video as the single source video feed.
Definition: bridge.c:3835
void ast_bridge_features_remove(struct ast_bridge_features *features, enum ast_bridge_hook_remove_flags flags)
Remove marked bridge channel feature hooks.
Definition: bridge.c:3570
struct ast_bridge * ast_bridge_base_new(uint32_t capabilities, unsigned int flags, const char *creator, const char *name, const char *id)
Create a new base class bridge.
Definition: bridge.c:999
int ast_bridge_join(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, struct ast_bridge_tech_optimizations *tech_args, enum ast_bridge_join_flags flags)
Join a channel to a bridge (blocking)
Definition: bridge.c:1690
ast_bridge_optimization
Tells, if optimization is allowed, how the optimization would be performed.
Definition: bridge.h:878
@ AST_BRIDGE_OPTIMIZE_PROHIBITED
Definition: bridge.h:888
@ AST_BRIDGE_OPTIMIZE_MERGE_TO_CHAN_BRIDGE
Definition: bridge.h:884
@ AST_BRIDGE_OPTIMIZE_SWAP_TO_PEER_BRIDGE
Definition: bridge.h:882
@ AST_BRIDGE_OPTIMIZE_MERGE_TO_PEER_BRIDGE
Definition: bridge.h:886
@ AST_BRIDGE_OPTIMIZE_SWAP_TO_CHAN_BRIDGE
Definition: bridge.h:880
void(* ast_bridge_notify_masquerade_fn)(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel)
Notify the bridge that this channel was just masqueraded.
Definition: bridge.h:242
void ast_bridge_set_binaural_active(struct ast_bridge *bridge, unsigned int binaural_active)
Activates the use of binaural signals in a conference bridge.
Definition: bridge.c:3774
ast_bridge_video_sfu_remb_behavior
REMB report behaviors.
Definition: bridge.h:135
@ AST_BRIDGE_VIDEO_SFU_REMB_LOWEST
Definition: bridge.h:139
@ AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST_ALL
Definition: bridge.h:147
@ AST_BRIDGE_VIDEO_SFU_REMB_AVERAGE
Definition: bridge.h:137
@ AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST
Definition: bridge.h:141
@ AST_BRIDGE_VIDEO_SFU_REMB_AVERAGE_ALL
Definition: bridge.h:143
@ AST_BRIDGE_VIDEO_SFU_REMB_FORCE
Definition: bridge.h:149
@ AST_BRIDGE_VIDEO_SFU_REMB_LOWEST_ALL
Definition: bridge.h:145
void(* ast_bridge_dissolving_fn)(struct ast_bridge *self)
The bridge is being dissolved.
Definition: bridge.h:193
struct ast_channel * ast_bridge_peer_nolock(struct ast_bridge *bridge, struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
Definition: bridge.c:4116
int ast_bridge_number_video_src(struct ast_bridge *bridge)
Returns the number of video sources currently active in the bridge.
Definition: bridge.c:3933
struct ao2_container * ast_bridge_peers_nolock(struct ast_bridge *bridge)
Get a container of all channels in the bridge.
Definition: bridge.c:4087
static void _ast_bridge_unlock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
Definition: bridge.h:486
void ast_bridge_set_sfu_video_mode(struct ast_bridge *bridge)
Set the bridge to be a selective forwarding unit.
Definition: bridge.c:3843
void ast_bridge_set_maximum_sample_rate(struct ast_bridge *bridge, unsigned int sample_rate)
Adjust the maximum mixing sample rate of a bridge used during multimix mode.
Definition: bridge.c:3788
void ast_bridge_set_video_update_discard(struct ast_bridge *bridge, unsigned int video_update_discard)
Set the amount of time to discard subsequent video updates after a video update has been sent.
Definition: bridge.c:3851
int ast_bridge_queue_action(struct ast_bridge *bridge, struct ast_frame *action)
Put an action onto the specified bridge.
Definition: bridge.c:314
int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
Destroy a bridge.
Definition: bridge.c:1009
int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, enum ast_bridge_impart_flags flags) attribute_warn_unused_result
Impart a channel to a bridge (non-blocking)
Definition: bridge.c:1947
struct ast_bridge_methods ast_bridge_base_v_table
Bridge base class virtual method table.
Definition: bridge.c:988
void ast_brige_set_remb_behavior(struct ast_bridge *bridge, enum ast_bridge_video_sfu_remb_behavior behavior)
Set the REMB report generation behavior on a bridge.
Definition: bridge.c:3867
struct ast_bridge * ast_bridge_transfer_acquire_bridge(struct ast_channel *chan)
Acquire the channel's bridge for transfer purposes.
Definition: bridge.c:4477
int ast_bridge_remove(struct ast_bridge *bridge, struct ast_channel *chan)
Remove a channel from a bridge.
Definition: bridge.c:2020
void ast_bridge_vars_set(struct ast_channel *chan, const char *name, const char *pvtid)
Sets BRIDGECHANNEL and BRIDGEPVTCALLID for a channel.
Definition: bridge.c:1281
void ast_bridge_merge_inhibit(struct ast_bridge *bridge, int request)
Adjust the bridge merge inhibit request count.
Definition: bridge.c:3069
int ast_bridge_kick(struct ast_bridge *bridge, struct ast_channel *chan)
Kick a channel from a bridge.
Definition: bridge.c:2048
int(* ast_bridge_merge_priority_fn)(struct ast_bridge *self)
Get the merge priority of this bridge.
Definition: bridge.h:253
ast_bridge_capability
Capabilities for a bridge technology.
Definition: bridge.h:88
@ AST_BRIDGE_CAPABILITY_EARLY
Definition: bridge.h:92
@ AST_BRIDGE_CAPABILITY_MULTIMIX
Definition: bridge.h:98
@ AST_BRIDGE_CAPABILITY_NATIVE
Definition: bridge.h:94
@ AST_BRIDGE_CAPABILITY_1TO1MIX
Definition: bridge.h:96
@ AST_BRIDGE_CAPABILITY_HOLDING
Definition: bridge.h:90
struct ast_bridge * ast_bridge_find_by_id(const char *bridge_id)
Find bridge by id.
Definition: bridge.c:5081
struct ast_channel * ast_bridge_peer(struct ast_bridge *bridge, struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
Definition: bridge.c:4144
int ast_bridge_suspend(struct ast_bridge *bridge, struct ast_channel *chan)
Suspend a channel temporarily from a bridge.
Definition: bridge.c:3076
ast_transfer_type
Definition: bridge.h:1113
@ AST_BRIDGE_TRANSFER_SINGLE_PARTY
Definition: bridge.h:1115
@ AST_BRIDGE_TRANSFER_MULTI_PARTY
Definition: bridge.h:1117
void(* transfer_channel_cb)(struct ast_channel *chan, struct transfer_channel_data *user_data, enum ast_transfer_type transfer_type)
Callback function type called during blind transfers.
Definition: bridge.h:1147
void ast_bridge_set_transfer_variables(struct ast_channel *chan, const char *value, int is_attended)
Set the relevant transfer variables for a single channel.
Definition: bridge.c:4421
void ast_bridge_set_single_src_video_mode(struct ast_bridge *bridge, struct ast_channel *video_src_chan)
Set a bridge to feed a single video source to all participants.
Definition: bridge.c:3818
void ast_bridge_set_mixing_interval(struct ast_bridge *bridge, unsigned int mixing_interval)
Adjust the internal mixing interval of a bridge used during multimix mode.
Definition: bridge.c:3767
struct ao2_container * ast_bridge_peers(struct ast_bridge *bridge)
Get a container of all channels in the bridge.
Definition: bridge.c:4105
void ast_bridge_remove_video_src(struct ast_bridge *bridge, struct ast_channel *chan)
remove a channel as a source of video for the bridge.
Definition: bridge.c:3986
enum ast_transfer_result ast_bridge_transfer_blind(int is_external, struct ast_channel *transferer, const char *exten, const char *context, transfer_channel_cb new_channel_cb, void *user_data)
Blind transfer target to the extension and context provided.
Definition: bridge.c:4494
void(* ast_bridge_pull_channel_fn)(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel)
Pull this channel from the bridge.
Definition: bridge.h:228
const char * ast_bridge_video_mode_to_string(enum ast_bridge_video_mode_type video_mode)
Converts an enum representation of a bridge video mode to string.
Definition: bridge.c:4020
static int _ast_bridge_trylock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
Definition: bridge.h:464
int ast_bridge_merge(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, int merge_best_direction, struct ast_channel **kick_me, unsigned int num_kick)
Merge two bridges together.
Definition: bridge.c:2369
int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan)
Unsuspend a channel from a bridge.
Definition: bridge.c:3097
void ast_bridge_set_send_sdp_label(struct ast_bridge *bridge, unsigned int send_sdp_label)
Controls whether to send a "label" attribute in each stream in an SDP.
Definition: bridge.c:4035
ast_transfer_result
Definition: bridge.h:1102
@ AST_BRIDGE_TRANSFER_NOT_PERMITTED
Definition: bridge.h:1106
@ AST_BRIDGE_TRANSFER_SUCCESS
Definition: bridge.h:1104
@ AST_BRIDGE_TRANSFER_INVALID
Definition: bridge.h:1108
@ AST_BRIDGE_TRANSFER_FAIL
Definition: bridge.h:1110
ast_bridge_video_mode_type
Video source modes.
Definition: bridge.h:102
@ AST_BRIDGE_VIDEO_MODE_SINGLE_SRC
Definition: bridge.h:106
@ AST_BRIDGE_VIDEO_MODE_TALKER_SRC
Definition: bridge.h:109
@ AST_BRIDGE_VIDEO_MODE_NONE
Definition: bridge.h:104
@ AST_BRIDGE_VIDEO_MODE_SFU
Definition: bridge.h:113
void ast_bridge_update_talker_src_video_mode(struct ast_bridge *bridge, struct ast_channel *chan, int talker_energy, int is_keyframe)
Update information about talker energy for talker src video mode.
Definition: bridge.c:3885
ast_bridge_impart_flags
Definition: bridge.h:588
@ AST_BRIDGE_IMPART_CHAN_DEPARTABLE
Definition: bridge.h:592
@ AST_BRIDGE_IMPART_CHAN_MASK
Definition: bridge.h:590
@ AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP
Definition: bridge.h:596
@ AST_BRIDGE_IMPART_CHAN_INDEPENDENT
Definition: bridge.h:594
int ast_bridge_unreal_optimize_out(struct ast_channel *chan, struct ast_channel *peer, struct ast_unreal_pvt *pvt)
Check and optimize out the unreal channels between bridges.
Definition: bridge.c:2989
static void _ast_bridge_lock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
Definition: bridge.h:475
enum ast_bridge_optimization ast_bridges_allow_optimization(struct ast_bridge *chan_bridge, struct ast_bridge *peer_bridge)
Determine if bridges allow for optimization to occur betweem them.
Definition: bridge.c:3029
ast_bridge_join_flags
Definition: bridge.h:537
@ AST_BRIDGE_JOIN_INHIBIT_JOIN_COLP
Definition: bridge.h:541
@ AST_BRIDGE_JOIN_PASS_REFERENCE
Definition: bridge.h:539
int ast_bridge_is_video_src(struct ast_bridge *bridge, struct ast_channel *chan)
Determine if a channel is a video src for the bridge.
Definition: bridge.c:3960
void ast_bridge_set_remb_send_interval(struct ast_bridge *bridge, unsigned int remb_send_interval)
Set the interval at which a combined REMB frame will be sent to video sources.
Definition: bridge.c:3858
void ast_bridge_notify_masquerade(struct ast_channel *chan)
Notify bridging that this channel was just masqueraded.
Definition: bridge.c:1511
enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_transferee, struct ast_channel *to_transfer_target)
Attended transfer.
Definition: bridge.c:4746
int ast_bridge_queue_everyone_else(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
Queue the given frame to everyone else.
int ast_bridge_move(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_channel *chan, struct ast_channel *swap, int attempt_recovery)
Move a channel from one bridge to another.
Definition: bridge.c:2529
void ast_bridge_set_internal_sample_rate(struct ast_bridge *bridge, unsigned int sample_rate)
Adjust the internal mixing sample rate of a bridge used during multimix mode.
Definition: bridge.c:3781
int(* ast_bridge_push_channel_fn)(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
Push this channel into the bridge.
Definition: bridge.h:213
Channel Bridging API.
ast_bridge_hook_remove_flags
Channel Bridging Roles API.
static int request(void *obj)
Definition: chan_pjsip.c:2605
#define attribute_warn_unused_result
Definition: compiler.h:71
Convenient Signal Processing routines.
static const char name[]
Definition: format_mp3.c:68
unsigned int ast_callid
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
Definition: linkedlists.h:225
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
Definition: stringfields.h:341
#define AST_STRING_FIELD(name)
Declare a string field.
Definition: stringfields.h:303
Generic container type.
Structure that contains information regarding a channel in a bridge.
struct ast_channel * swap
Structure that contains features information.
Bridge virtual methods table definition.
Definition: bridge.h:261
ast_bridge_dissolving_fn dissolving
Definition: bridge.h:267
ast_bridge_push_channel_fn push
Definition: bridge.h:269
const char * name
Definition: bridge.h:263
ast_bridge_notify_masquerade_fn notify_masquerade
Definition: bridge.h:273
ast_bridge_destructor_fn destroy
Definition: bridge.h:265
ast_bridge_merge_priority_fn get_merge_priority
Definition: bridge.h:275
ast_bridge_pull_channel_fn pull
Definition: bridge.h:271
ast_bridge_push_channel_fn push_peek
Definition: bridge.h:277
Structure that contains a snapshot of information about a bridge.
Definition: bridge.h:318
uint32_t capabilities
Definition: bridge.h:339
enum ast_bridge_video_mode_type video_mode
Definition: bridge.h:345
struct timeval creationtime
Definition: bridge.h:347
unsigned int num_active
Definition: bridge.h:343
const ast_string_field video_source_id
Definition: bridge.h:332
const ast_string_field creator
Definition: bridge.h:332
const ast_string_field uniqueid
Definition: bridge.h:332
unsigned int num_channels
Definition: bridge.h:341
const ast_string_field technology
Definition: bridge.h:332
const ast_string_field name
Definition: bridge.h:332
struct ao2_container * channels
Definition: bridge.h:335
const ast_string_field subclass
Definition: bridge.h:332
struct ast_flags feature_flags
Definition: bridge.h:337
unsigned int send_sdp_label
Definition: bridge.h:304
unsigned int maximum_sample_rate
The maximum sample rate softmix uses to mix channels.
Definition: bridge.h:310
unsigned int internal_sample_rate
The internal sample rate softmix uses to mix channels.
Definition: bridge.h:289
unsigned int binaural_active
Definition: bridge.h:299
struct ast_bridge_video_mode video_mode
Definition: bridge.h:283
unsigned int internal_mixing_interval
The mixing interval indicates how quickly softmix mixing should occur to mix audio.
Definition: bridge.h:297
Structure specific to bridge technologies capable of performing talking optimizations.
Structure that is the essence of a bridge technology.
Data structure that defines a video source mode.
Definition: bridge.h:163
struct ast_bridge_video_single_src_data single_src_data
Definition: bridge.h:167
struct ast_bridge_video_talker_src_data talker_src_data
Definition: bridge.h:168
unsigned int video_update_discard
Definition: bridge.h:172
union ast_bridge_video_mode::@191 mode_data
enum ast_bridge_video_mode_type mode
Definition: bridge.h:164
struct ast_bridge_video_sfu_data sfu_data
Definition: bridge.h:169
This is used for selective forwarding unit configuration.
Definition: bridge.h:153
unsigned int remb_send_interval
Definition: bridge.h:155
enum ast_bridge_video_sfu_remb_behavior remb_behavior
Definition: bridge.h:157
This is used for both SINGLE_SRC mode to set what channel should be the current single video feed.
Definition: bridge.h:118
struct ast_channel * chan_vsrc
Definition: bridge.h:120
This is used for both SINGLE_SRC_TALKER mode to set what channel should be the current single video f...
Definition: bridge.h:125
struct ast_channel * chan_old_vsrc
Definition: bridge.h:131
struct ast_channel * chan_vsrc
Definition: bridge.h:127
Structure that contains information about a bridge.
Definition: bridge.h:353
struct stasis_topic * topic
Definition: bridge.h:363
struct ast_bridge_softmix softmix
Definition: bridge.h:371
void * tech_pvt
Definition: bridge.h:361
struct ast_vector_int media_types
Definition: bridge.h:408
struct timeval creationtime
Definition: bridge.h:412
const struct ast_bridge_methods * v_table
Definition: bridge.h:355
unsigned int reconfigured
Definition: bridge.h:392
unsigned int num_active
Definition: bridge.h:379
ast_callid callid
Definition: bridge.h:365
const ast_string_field creator
Definition: bridge.h:405
const ast_string_field uniqueid
Definition: bridge.h:405
struct ast_bridge_channels_list channels
Definition: bridge.h:367
struct ast_bridge_snapshot * current_snapshot
Definition: bridge.h:410
void * personality
Definition: bridge.h:357
unsigned int num_channels
Definition: bridge.h:377
unsigned int dissolved
Definition: bridge.h:394
int cause
Definition: bridge.h:390
struct ast_bridge_technology * technology
Definition: bridge.h:359
unsigned int construction_completed
Definition: bridge.h:396
const ast_string_field name
Definition: bridge.h:405
unsigned int num_lonely
Definition: bridge.h:381
struct ast_bridge::@192 action_queue
unsigned int inhibit_merge
Count of the active temporary requests to inhibit bridge merges. Zero if merges are allowed.
Definition: bridge.h:388
struct ast_flags feature_flags
Definition: bridge.h:373
uint32_t allowed_capabilities
Definition: bridge.h:375
Main Channel structure associated with a channel.
struct ast_bridge * bridge
struct ast_flags flags
Structure used to handle boolean flags.
Definition: utils.h:199
Data structure associated with a single frame of data.
The base pvt structure for local channel derivatives.
Definition: core_unreal.h:91
struct ast_channel * chan
Definition: core_unreal.h:94
Integer vector definition.
Definition: vector.h:52
AO2 object that wraps data for transfer_channel_cb.
Definition: bridge.h:1123
int value
Definition: syslog.c:37
Universally unique identifier support.