Asterisk - The Open Source Telephony Project GIT-master-6144b6b
Loading...
Searching...
No Matches
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 /*! Variables to be included in ARI events */
350};
351
352/*!
353 * \brief Structure that contains information about a bridge
354 */
356 /*! Bridge virtual method table. */
358 /*! "Personality" currently exhibited by bridge subclass */
360 /*! Bridge technology that is handling the bridge */
362 /*! Private information unique to the bridge technology */
363 void *tech_pvt;
364 /*! Per-bridge topics */
366 /*! Call ID associated with the bridge */
368 /*! Linked list of channels participating in the bridge */
370 /*! Queue of actions to perform on the bridge. */
372 /*! Softmix technology parameters. */
374 /*! Bridge flags to tweak behavior */
376 /*! Allowed bridge technology capabilities when AST_BRIDGE_FLAG_SMART enabled. */
378 /*! Number of channels participating in the bridge */
379 unsigned int num_channels;
380 /*! Number of active channels in the bridge. */
381 unsigned int num_active;
382 /*! Number of channels with AST_BRIDGE_CHANNEL_FLAG_LONELY in the bridge. */
383 unsigned int num_lonely;
384 /*!
385 * \brief Count of the active temporary requests to inhibit bridge merges.
386 * Zero if merges are allowed.
387 *
388 * \note Temporary as in try again in a moment.
389 */
390 unsigned int inhibit_merge;
391 /*! Cause code of the dissolved bridge. */
392 int cause;
393 /*! TRUE if the bridge was reconfigured. */
394 unsigned int reconfigured:1;
395 /*! TRUE if the bridge has been dissolved. Any channel that now tries to join is immediately ejected. */
396 unsigned int dissolved:1;
397 /*! TRUE if the bridge construction was completed. */
399
401 /*! Immutable name of the creator for the bridge */
403 /*! Immutable name given to the bridge by its creator */
405 /*! Immutable bridge UUID. */
407 );
408
409 /*! Type mapping used for media routing */
411 /*! Current bridge snapshot */
413 /*! The time of bridge creation */
414 struct timeval creationtime;
415 /*! A linked list for bridge variables */
417 /*! A vector of variable names to be included in ARI events on this bridge */
419};
420
421/*! \brief Bridge base class virtual method table. */
423
424/*!
425 * \brief Returns the global bridges container
426 * \since 17.0
427 *
428 * \return a pointer to the bridges container success
429 * \retval NULL on failure
430 *
431 * \note You must use \verbatim ao2_ref(<container>, -1) \endverbatim when done with it
432 *
433 * \warning You must not attempt to modify the container returned.
434 */
435struct ao2_container *ast_bridges(void);
436
437/*!
438 * \brief Create a new base class bridge
439 *
440 * \param capabilities The capabilities that we require to be used on the bridge
441 * \param flags Flags that will alter the behavior of the bridge
442 * \param creator Entity that created the bridge (optional)
443 * \param name Name given to the bridge by its creator (optional, requires named creator)
444 * \param id Unique ID given to the bridge by its creator (optional)
445 *
446 * \return a pointer to a new bridge on success
447 * \retval NULL on failure
448 *
449 * Example usage:
450 *
451 * \code
452 * struct ast_bridge *bridge;
453 * bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_1TO1MIX, AST_BRIDGE_FLAG_DISSOLVE_HANGUP);
454 * \endcode
455 *
456 * This creates a no frills two party bridge that will be
457 * destroyed once one of the channels hangs up.
458 */
459struct ast_bridge *ast_bridge_base_new(uint32_t capabilities, unsigned int flags, const char *creator, const char *name, const char *id);
460
461/*!
462 * \brief Try locking the bridge.
463 *
464 * \param bridge Bridge to try locking
465 *
466 * \retval 0 on success.
467 * \retval non-zero on error.
468 */
469#define ast_bridge_trylock(bridge) _ast_bridge_trylock(bridge, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge)
470static inline int _ast_bridge_trylock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
471{
472 return __ao2_trylock(bridge, AO2_LOCK_REQ_MUTEX, file, function, line, var);
473}
474
475/*!
476 * \brief Lock the bridge.
477 *
478 * \param bridge Bridge to lock
479 */
480#define ast_bridge_lock(bridge) _ast_bridge_lock(bridge, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge)
481static inline void _ast_bridge_lock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
482{
483 __ao2_lock(bridge, AO2_LOCK_REQ_MUTEX, file, function, line, var);
484}
485
486/*!
487 * \brief Unlock the bridge.
488 *
489 * \param bridge Bridge to unlock
490 */
491#define ast_bridge_unlock(bridge) _ast_bridge_unlock(bridge, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge)
492static inline void _ast_bridge_unlock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
493{
494 __ao2_unlock(bridge, file, function, line, var);
495}
496
497/*! \brief Lock two bridges. */
498#define ast_bridge_lock_both(bridge1, bridge2) \
499 do { \
500 for (;;) { \
501 ast_bridge_lock(bridge1); \
502 if (!ast_bridge_trylock(bridge2)) { \
503 break; \
504 } \
505 ast_bridge_unlock(bridge1); \
506 sched_yield(); \
507 } \
508 } while (0)
509
510/*!
511 * \brief Destroy a bridge
512 *
513 * \param bridge Bridge to destroy
514 * \param cause Cause of bridge being destroyed. (If cause <= 0 then use AST_CAUSE_NORMAL_CLEARING)
515 *
516 * \retval 0 on success
517 * \retval -1 on failure
518 *
519 * Example usage:
520 *
521 * \code
522 * ast_bridge_destroy(bridge, AST_CAUSE_NORMAL_CLEARING);
523 * \endcode
524 *
525 * This destroys a bridge that was previously created.
526 *
527 * \note
528 * While this function will kick all channels out of the bridge, channels that
529 * were added to the bridge using ast_bridge_impart() with the flag
530 * AST_BRIDGE_IMPART_CHAN_DEPARTABLE set must have ast_bridge_depart() called
531 * on them.
532 */
533int ast_bridge_destroy(struct ast_bridge *bridge, int cause);
534
535/*!
536 * \brief Notify bridging that this channel was just masqueraded.
537 * \since 12.0.0
538 *
539 * \param chan Channel just involved in a masquerade
540 */
542
544 /*! The bridge reference is being passed by the caller. */
546 /*! The initial bridge join does not cause a COLP exchange. */
548};
549
550/*!
551 * \brief Join a channel to a bridge (blocking)
552 *
553 * \param bridge Bridge to join
554 * \param chan Channel to join
555 * \param swap Channel to swap out if swapping (A channel reference is stolen.)
556 * \param features Bridge features structure
557 * \param tech_args Optional Bridging tech optimization parameters for this channel.
558 * \param flags defined by enum ast_bridge_join_flags.
559 *
560 * \note The passed in swap channel is always unreffed on return. It is not a
561 * good idea to access the swap channel on return or for the caller to keep a
562 * reference to it.
563 *
564 * \note Absolutely _NO_ locks should be held before calling
565 * this function since it blocks.
566 *
567 * \retval 0 if the channel successfully joined the bridge before it exited.
568 * \retval -1 if the channel failed to join the bridge
569 *
570 * Example usage:
571 *
572 * \code
573 * ast_bridge_join(bridge, chan, NULL, NULL, NULL, AST_BRIDGE_JOIN_PASS_REFERENCE);
574 * \endcode
575 *
576 * This adds a channel pointed to by the chan pointer to the bridge pointed to by
577 * the bridge pointer. This function will not return until the channel has been
578 * removed from the bridge, swapped out for another channel, or has hung up.
579 *
580 * If this channel will be replacing another channel the other channel can be specified
581 * in the swap parameter. The other channel will be thrown out of the bridge in an
582 * atomic fashion.
583 *
584 * If channel specific features are enabled a pointer to the features structure
585 * can be specified in the features parameter.
586 */
587int ast_bridge_join(struct ast_bridge *bridge,
588 struct ast_channel *chan,
589 struct ast_channel *swap,
590 struct ast_bridge_features *features,
591 struct ast_bridge_tech_optimizations *tech_args,
592 enum ast_bridge_join_flags flags);
593
595 /*! Field describing what the caller can do with the channel after it is imparted. */
597 /*! The caller wants to reclaim the channel using ast_bridge_depart(). */
599 /*! The caller is passing channel control entirely to the bridging system. */
601 /*! The initial bridge join does not cause a COLP exchange. */
603};
604
605/*!
606 * \brief Impart a channel to a bridge (non-blocking)
607 *
608 * \param bridge Bridge to impart on
609 * \param chan Channel to impart (The channel reference is stolen if impart successful.)
610 * \param swap Channel to swap out if swapping. NULL if not swapping.
611 * \param features Bridge features structure.
612 * \param flags defined by enum ast_bridge_impart_flags.
613 *
614 * \note The given bridge must be unlocked when calling this function.
615 *
616 * \note The features parameter must be NULL or obtained by
617 * ast_bridge_features_new(). You must not dereference features
618 * after calling even if the call fails.
619 *
620 * \note chan is locked by this function.
621 *
622 * \retval 0 on success
623 * \retval -1 on failure (Caller still has ownership of chan)
624 *
625 * Example usage:
626 *
627 * \code
628 * ast_bridge_impart(bridge, chan, NULL, NULL, AST_BRIDGE_IMPART_CHAN_INDEPENDENT);
629 * \endcode
630 *
631 * \details
632 * This adds a channel pointed to by the chan pointer to the
633 * bridge pointed to by the bridge pointer. This function will
634 * return immediately and will not wait until the channel is no
635 * longer part of the bridge.
636 *
637 * If this channel will be replacing another channel the other
638 * channel can be specified in the swap parameter. The other
639 * channel will be thrown out of the bridge in an atomic
640 * fashion.
641 *
642 * If channel specific features are enabled, a pointer to the
643 * features structure can be specified in the features
644 * parameter.
645 *
646 * \note If you impart a channel with
647 * AST_BRIDGE_IMPART_CHAN_DEPARTABLE you MUST
648 * ast_bridge_depart() the channel if this call succeeds. The
649 * bridge channel thread is created join-able. The implication
650 * is that the channel is special and will not behave like a
651 * normal channel.
652 *
653 * \note If you impart a channel with
654 * AST_BRIDGE_IMPART_CHAN_INDEPENDENT you must not
655 * ast_bridge_depart() the channel. The bridge channel thread
656 * is created non-join-able. The channel must be treated as if
657 * it were placed into the bridge by ast_bridge_join().
658 * Channels placed into a bridge by ast_bridge_join() are
659 * removed by a third party using ast_bridge_remove().
660 *
661 * \note Any callbacks on the channel will be invoked on failure
662 * with the reason as AST_BRIDGE_AFTER_CB_REASON_IMPART_FAILED.
663 */
664int ast_bridge_impart(struct ast_bridge *bridge,
665 struct ast_channel *chan,
666 struct ast_channel *swap,
667 struct ast_bridge_features *features,
669
670/*!
671 * \brief Depart a channel from a bridge
672 *
673 * \param chan Channel to depart
674 *
675 * \note chan is locked by this function.
676 *
677 * \retval 0 on success
678 * \retval -1 on failure
679 *
680 * Example usage:
681 *
682 * \code
683 * ast_bridge_depart(chan);
684 * \endcode
685 *
686 * This removes the channel pointed to by the chan pointer from any bridge
687 * it may be in and gives control to the calling thread.
688 * This does not hang up the channel.
689 *
690 * \note This API call can only be used on channels that were added to the bridge
691 * using the ast_bridge_impart API call with the AST_BRIDGE_IMPART_CHAN_DEPARTABLE
692 * flag.
693 */
694int ast_bridge_depart(struct ast_channel *chan);
695
696/*!
697 * \brief Remove a channel from a bridge
698 *
699 * \param bridge Bridge that the channel is to be removed from
700 * \param chan Channel to remove
701 *
702 * \retval 0 on success
703 * \retval -1 on failure
704 *
705 * Example usage:
706 *
707 * \code
708 * ast_bridge_remove(bridge, chan);
709 * \endcode
710 *
711 * This removes the channel pointed to by the chan pointer from the bridge
712 * pointed to by the bridge pointer and requests that it be hung up. Control
713 * over the channel will NOT be given to the calling thread.
714 *
715 * \note This API call can be used on channels that were added to the bridge
716 * using both ast_bridge_join and ast_bridge_impart.
717 */
718int ast_bridge_remove(struct ast_bridge *bridge, struct ast_channel *chan);
719
720/*!
721 * \brief Kick a channel from a bridge
722 *
723 * \param bridge Bridge that the channel is to be kicked from
724 * \param chan Channel to kick
725 *
726 * \retval 0 on success
727 * \retval -1 on failure
728 *
729 * Example usage:
730 *
731 * \code
732 * ast_bridge_kick(bridge, chan);
733 * \endcode
734 *
735 * \details
736 * This kicks the channel pointed to by the chan pointer from
737 * the bridge pointed to by the bridge pointer and requests that
738 * it be hung up. Control over the channel will NOT be given to
739 * the calling thread.
740 *
741 * \note The functional difference between ast_bridge_kick() and
742 * ast_bridge_remove() is that the bridge may dissolve as a
743 * result of the channel being kicked.
744 *
745 * \note This API call can be used on channels that were added
746 * to the bridge using both ast_bridge_join and
747 * ast_bridge_impart.
748 */
749int ast_bridge_kick(struct ast_bridge *bridge, struct ast_channel *chan);
750
751/*!
752 * \brief Merge two bridges together
753 *
754 * \param dst_bridge Destination bridge of merge.
755 * \param src_bridge Source bridge of merge.
756 * \param merge_best_direction TRUE if don't care about which bridge merges into the other.
757 * \param kick_me Array of channels to kick from the bridges.
758 * \param num_kick Number of channels in the kick_me array.
759 *
760 * \note Absolutely _NO_ bridge or channel locks should be held
761 * before calling this function.
762 *
763 * \retval 0 on success
764 * \retval -1 on failure
765 *
766 * Example usage:
767 *
768 * \code
769 * ast_bridge_merge(dst_bridge, src_bridge, 0, NULL, 0);
770 * \endcode
771 *
772 * This moves the channels in src_bridge into the bridge pointed
773 * to by dst_bridge.
774 */
775int 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);
776
777/*!
778 * \brief Move a channel from one bridge to another.
779 * \since 12.0.0
780 *
781 * \param dst_bridge Destination bridge of bridge channel move.
782 * \param src_bridge Source bridge of bridge channel move.
783 * \param chan Channel to move.
784 * \param swap Channel to replace in dst_bridge.
785 * \param attempt_recovery TRUE if failure attempts to push channel back into original bridge.
786 *
787 * \note Absolutely _NO_ bridge or channel locks should be held
788 * before calling this function.
789 *
790 * \retval 0 on success.
791 * \retval -1 on failure.
792 */
793int ast_bridge_move(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_channel *chan, struct ast_channel *swap, int attempt_recovery);
794
795/*!
796 * \brief Adjust the bridge merge inhibit request count.
797 * \since 12.0.0
798 *
799 * \param bridge What to operate on.
800 * \param request Inhibit request increment.
801 * (Positive to add requests. Negative to remove requests.)
802 */
803void ast_bridge_merge_inhibit(struct ast_bridge *bridge, int request);
804
805/*!
806 * \brief Suspend a channel temporarily from a bridge
807 *
808 * \param bridge Bridge to suspend the channel from
809 * \param chan Channel to suspend
810 *
811 * \retval 0 on success
812 * \retval -1 on failure
813 *
814 * Example usage:
815 *
816 * \code
817 * ast_bridge_suspend(bridge, chan);
818 * \endcode
819 *
820 * This suspends the channel pointed to by chan from the bridge pointed to by bridge temporarily.
821 * Control of the channel is given to the calling thread. This differs from ast_bridge_depart as
822 * the channel will not be removed from the bridge.
823 *
824 * \note This API call can be used on channels that were added to the bridge
825 * using both ast_bridge_join and ast_bridge_impart.
826 */
827int ast_bridge_suspend(struct ast_bridge *bridge, struct ast_channel *chan);
828
829/*!
830 * \brief Unsuspend a channel from a bridge
831 *
832 * \param bridge Bridge to unsuspend the channel from
833 * \param chan Channel to unsuspend
834 *
835 * \retval 0 on success
836 * \retval -1 on failure
837 *
838 * Example usage:
839 *
840 * \code
841 * ast_bridge_unsuspend(bridge, chan);
842 * \endcode
843 *
844 * This unsuspends the channel pointed to by chan from the bridge pointed to by bridge.
845 * The bridge will go back to handling the channel once this function returns.
846 *
847 * \note You must not mess with the channel once this function returns.
848 * Doing so may result in bad things happening.
849 */
850int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan);
851
852/*!
853 * \brief Sets BRIDGECHANNEL and BRIDGEPVTCALLID for a channel
854 *
855 * \pre chan must be locked before calling
856 *
857 * \param chan channel name of the bridged peer
858 * \param name
859 * \param pvtid Private CallID of the bridged peer
860 */
861void ast_bridge_vars_set(struct ast_channel *chan, const char *name, const char *pvtid);
862
863/*!
864 * \brief Set a variable on the bridge.
865 * \since 20.20.0
866 * \since 22.10.0
867 * \since 23.4.0
868 *
869 * \pre Bridge is locked
870 *
871 * \param bridge Bridge to operate on.
872 * \param name Name of variable to set.
873 * \param value Value of variable to set. (NULL to delete variable.)
874 * \param report_events If non-zero, the variable change will be reported in ARI events.
875 *
876 * \retval 0 on success
877 * \retval -1 on failure
878 */
879int ast_bridge_set_variable(struct ast_bridge *bridge, const char *name, const char *value, int report_events);
880
881/*!
882 * \brief Get value a variable from the bridge by name.
883 * \since 20.20.0
884 * \since 22.10.0
885 * \since 23.4.0
886 *
887 * \pre Bridge is locked
888 *
889 * \param bridge Bridge to operate on.
890 * \param name Name of variable to get.
891 *
892 * \retval Value of the variable on success.
893 * \retval NULL on failure.
894 */
895const char *ast_bridge_get_variable(const struct ast_bridge *bridge, const char *name);
896
897/*!
898 * \brief Get a list of variables that should be included in ARI events for this bridge.
899 * \since 20.20.0
900 * \since 22.10.0
901 * \since 23.4.0
902 *
903 * \pre Bridge is locked
904 *
905 * \param bridge Bridge to operate on.
906 *
907 * \note The returned list must be freed by the caller.
908 *
909 * \retval A pointer to the head of a linked list of variables to include in ARI events on success.
910 * \retval NULL on failure or if no variables are set to be reported.
911 */
913
914struct ast_unreal_pvt;
915
916/*!
917 * \brief Check and optimize out the unreal channels between bridges.
918 * \since 12.0.0
919 *
920 * \param chan Unreal channel writing a frame into the channel driver.
921 * \param peer Other unreal channel in the pair.
922 * \param pvt Private data provided by an implementation of the unreal driver that
923 * contains the callbacks that should be called when optimization begins/ends
924 *
925 * \note It is assumed that chan is already locked.
926 *
927 * \retval 0 if unreal channels were not optimized out.
928 * \retval non-zero if unreal channels were optimized out.
929 */
930int ast_bridge_unreal_optimize_out(struct ast_channel *chan, struct ast_channel *peer, struct ast_unreal_pvt *pvt);
931
932/*!
933 * \brief Tells, if optimization is allowed, how the optimization would be performed
934 */
936 /*! Optimization would swap peer into the chan_bridge */
938 /*! Optimization would swap chan into the peer_bridge */
940 /*! Optimization would merge peer_bridge into chan_bridge */
942 /*! Optimization would merge chan_bridge into peer_bridge */
944 /*! Optimization is not permitted on one or both bridges */
946};
947
948/*!
949 * \brief Determine if bridges allow for optimization to occur betweem them
950 * \since 12.0.0
951 *
952 * \param chan_bridge First bridge being tested
953 * \param peer_bridge Second bridge being tested
954 *
955 * This determines if two bridges allow for unreal channel optimization
956 * to occur between them. The function does not require for unreal channels
957 * to already be in the bridges when called.
958 *
959 * \note It is assumed that both bridges are locked prior to calling this function
960 *
961 * \note A return other than AST_BRIDGE_OPTIMIZE_PROHIBITED does not guarantee
962 * that an optimization attempt will succeed. However, a return of
963 * AST_BRIDGE_OPTIMIZE_PROHIBITED guarantees that an optimization attempt will
964 * never succeed.
965 *
966 * \return Optimization allowability for the bridges
967 */
969 struct ast_bridge *peer_bridge);
970
971/*!
972 * \brief Put an action onto the specified bridge.
973 * \since 12.0.0
974 *
975 * \param bridge What to queue the action on.
976 * \param action What to do.
977 *
978 * \retval 0 on success.
979 * \retval -1 on error.
980 *
981 * \note This API call is meant for internal bridging operations.
982 */
983int ast_bridge_queue_action(struct ast_bridge *bridge, struct ast_frame *action);
984
985/*!
986 * \brief Queue the given frame to everyone else.
987 * \since 12.0.0
988 *
989 * \param bridge What bridge to distribute frame.
990 * \param bridge_channel Channel to optionally not pass frame to. (NULL to pass to everyone)
991 * \param frame Frame to pass.
992 *
993 * \note This is intended to be called by bridge hooks and
994 * bridge technologies.
995 *
996 * \retval 0 Frame written to at least one channel.
997 * \retval -1 Frame written to no channels.
998 */
999int ast_bridge_queue_everyone_else(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame);
1000
1001/*!
1002 * \brief Adjust the internal mixing sample rate of a bridge
1003 * used during multimix mode.
1004 *
1005 * \param bridge Channel to change the sample rate on.
1006 * \param sample_rate the sample rate to change to. If a
1007 * value of 0 is passed here, the bridge will be free to pick
1008 * what ever sample rate it chooses.
1009 *
1010 */
1011void ast_bridge_set_internal_sample_rate(struct ast_bridge *bridge, unsigned int sample_rate);
1012
1013/*!
1014 * \brief Adjust the maximum mixing sample rate of a bridge
1015 * used during multimix mode.
1016 * \since 13.31.0
1017 * \since 16.8.0
1018 * \since 17.2.0
1019 *
1020 * \param bridge Channel to change the sample rate on.
1021 * \param sample_rate the maximum sample rate to use. If a
1022 * value of 0 is passed here, the bridge will be free to pick
1023 * what ever sample rate it chooses.
1024 *
1025 */
1026void ast_bridge_set_maximum_sample_rate(struct ast_bridge *bridge, unsigned int sample_rate);
1027
1028/*!
1029 * \brief Adjust the internal mixing interval of a bridge used
1030 * during multimix mode.
1031 *
1032 * \param bridge Channel to change the sample rate on.
1033 * \param mixing_interval the sample rate to change to. If 0 is set
1034 * the bridge tech is free to choose any mixing interval it uses by default.
1035 */
1036void ast_bridge_set_mixing_interval(struct ast_bridge *bridge, unsigned int mixing_interval);
1037
1038/*!
1039 * \brief Activates the use of binaural signals in a conference bridge.
1040 *
1041 * \param bridge Channel to activate the binaural signals.
1042 * \param binaural_active If true binaural signal processing will be active for the bridge.
1043 */
1044void ast_bridge_set_binaural_active(struct ast_bridge *bridge, unsigned int binaural_active);
1045
1046/*!
1047 * \brief Set a bridge to feed a single video source to all participants.
1048 */
1049void ast_bridge_set_single_src_video_mode(struct ast_bridge *bridge, struct ast_channel *video_src_chan);
1050
1051/*!
1052 * \brief Set the bridge to pick the strongest talker supporting
1053 * video as the single source video feed
1054 */
1056
1057/*!
1058 * \brief Set the bridge to be a selective forwarding unit
1059 */
1060void ast_bridge_set_sfu_video_mode(struct ast_bridge *bridge);
1061
1062/*!
1063 * \brief Set the amount of time to discard subsequent video updates after a video update has been sent
1064 *
1065 * \param bridge Bridge to set the minimum video update wait time on
1066 * \param video_update_discard Amount of time after sending a video update that others should be discarded
1067 */
1068void ast_bridge_set_video_update_discard(struct ast_bridge *bridge, unsigned int video_update_discard);
1069
1070/*!
1071 * \brief Set the interval at which a combined REMB frame will be sent to video sources
1072 *
1073 * \param bridge Bridge to set the REMB send interval on
1074 * \param remb_send_interval The REMB send interval
1075 *
1076 * \note This can only be called when the bridge has been set to the SFU video mode.
1077 */
1078void ast_bridge_set_remb_send_interval(struct ast_bridge *bridge, unsigned int remb_send_interval);
1079
1080/*!
1081 * \brief Set the REMB report generation behavior on a bridge
1082 *
1083 * \param bridge Bridge to set the REMB behavior on
1084 * \param behavior How REMB reports are generated
1085 *
1086 * \note This can only be called when the bridge has been set to the SFU video mode.
1087 */
1089
1090/*!
1091 * \brief Force the REMB report estimated bitrate to a specific max value
1092 *
1093 * \param bridge Bridge to set the REMB behavior on
1094 * \param estimated_bitrate The estimated bitrate in bits per second
1095 *
1096 * \note This can only be called when the bridge has been set to the SFU video mode.
1097 */
1098void ast_bridge_set_remb_estimated_bitrate(struct ast_bridge *bridge, float estimated_bitrate);
1099
1100/*!
1101 * \brief Update information about talker energy for talker src video mode.
1102 */
1103void ast_bridge_update_talker_src_video_mode(struct ast_bridge *bridge, struct ast_channel *chan, int talker_energy, int is_keyframe);
1104
1105/*!
1106 * \brief Returns the number of video sources currently active in the bridge
1107 */
1108int ast_bridge_number_video_src(struct ast_bridge *bridge);
1109
1110/*!
1111 * \brief Determine if a channel is a video src for the bridge
1112 *
1113 * \retval 0 Not a current video source of the bridge.
1114 * \retval non-zero is a video source of the bridge, The number
1115 * returned represents the priority this video stream has
1116 * on the bridge where 1 is the highest priority.
1117 */
1118int ast_bridge_is_video_src(struct ast_bridge *bridge, struct ast_channel *chan);
1119
1120/*!
1121 * \brief remove a channel as a source of video for the bridge.
1122 */
1123void ast_bridge_remove_video_src(struct ast_bridge *bridge, struct ast_channel *chan);
1124
1125/*!
1126 * \brief Converts an enum representation of a bridge video mode to string
1127 *
1128 * \param video_mode The video mode
1129 *
1130 * \return A string representation of \c video_mode
1131 */
1133
1134/*!
1135 * \brief Controls whether to send a "label" attribute in each stream in an SDP
1136 * \since 16.1.0
1137 *
1138 * \param bridge The bridge
1139 * \param send_sdp_label Whether to send the labels or not
1140 *
1141 * \note The label will contain the uniqueid of the channel related to the stream.
1142 * This is used to allow the recipient to correlate the stream to the participant
1143 * information events sent by app_confbridge.
1144 * The bridge will be locked in this function.
1145 */
1146void ast_bridge_set_send_sdp_label(struct ast_bridge *bridge, unsigned int send_sdp_label);
1147
1148/*!
1149 * \brief Acquire the channel's bridge for transfer purposes.
1150 * \since 13.21.0
1151 *
1152 * \param chan Channel involved in a transfer.
1153 *
1154 * \return The bridge the channel is in or NULL if it either isn't
1155 * in a bridge or should not be considered to be in a bridge.
1156 */
1158
1160 /*! The transfer completed successfully */
1162 /*! A bridge involved does not permit transferring */
1164 /*! The current bridge setup makes transferring an invalid operation */
1166 /*! The transfer operation failed for a miscellaneous reason */
1168};
1169
1171 /*! Transfer of a single party */
1173 /*! Transfer of multiple parties */
1175};
1176
1177/*!
1178 * \brief AO2 object that wraps data for transfer_channel_cb
1179 */
1181 void *data; /*! Data to be used by the transfer_channel_cb -- note that this
1182 * pointer is going to be pointing to something on the stack, so
1183 * it must not be used at any point after returning from the
1184 * transfer_channel_cb. */
1185 int completed; /*! Initially 0, This will be set to 1 by either the transfer
1186 * code or by transfer code hooks (e.g. parking) when the
1187 * transfer is completed and any remaining actions have taken
1188 * place (e.g. parking announcements). It will never be reset
1189 * to 0. This is used for deferring progress for channel
1190 * drivers that support deferred progress. */
1191};
1192
1193/*!
1194 * \brief Callback function type called during blind transfers
1195 *
1196 * A caller of ast_bridge_transfer_blind() may wish to set data on
1197 * the channel that ends up running dialplan. For instance, it may
1198 * be useful to set channel variables on the channel.
1199 *
1200 * \param chan The involved channel
1201 * \param user_data User-provided data needed in the callback
1202 * \param transfer_type The type of transfer being completed
1203 */
1204typedef void (*transfer_channel_cb)(struct ast_channel *chan, struct transfer_channel_data *user_data,
1205 enum ast_transfer_type transfer_type);
1206
1207/*!
1208 * \brief Blind transfer target to the extension and context provided
1209 *
1210 * The channel given is bridged to one or multiple channels. Depending on
1211 * the bridge and the number of participants, the entire bridge could be
1212 * transferred to the given destination, or a single channel may be redirected.
1213 *
1214 * Callers may also provide a callback to be called on the channel that will
1215 * be running dialplan. The user data passed into ast_bridge_transfer_blind
1216 * will be given as the argument to the callback to be interpreted as desired.
1217 * This callback is guaranteed to be called in the same thread as
1218 * ast_bridge_transfer_blind() and before ast_bridge_transfer_blind() returns.
1219 *
1220 * \note Absolutely _NO_ channel locks should be held before
1221 * calling this function.
1222 *
1223 * \param is_external Indicates that transfer was initiated externally
1224 * \param transferer The channel performing the blind transfer
1225 * \param exten The dialplan extension to send the call to
1226 * \param context The dialplan context to send the call to
1227 * \param new_channel_cb A callback to be called on the channel that will
1228 * be executing dialplan
1229 * \param user_data Argument for new_channel_cb
1230 * \return The success or failure result of the blind transfer
1231 */
1233 struct ast_channel *transferer, const char *exten, const char *context,
1234 transfer_channel_cb new_channel_cb, void *user_data);
1235
1236/*!
1237 * \brief Attended transfer
1238 *
1239 * The two channels are both transferer channels. The first is the channel
1240 * that is bridged to the transferee (or if unbridged, the 'first' call of
1241 * the transfer). The second is the channel that is bridged to the transfer
1242 * target (or if unbridged, the 'second' call of the transfer).
1243 *
1244 * \note Absolutely _NO_ channel locks should be held before
1245 * calling this function.
1246 *
1247 * \param to_transferee Transferer channel on initial call (presumably bridged to transferee)
1248 * \param to_transfer_target Transferer channel on consultation call (presumably bridged to transfer target)
1249 * \return The success or failure of the attended transfer
1250 */
1252 struct ast_channel *to_transfer_target);
1253
1254/*!
1255 * \brief Set the relevant transfer variables for a single channel
1256 *
1257 * Sets either the ATTENDEDTRANSFER or BLINDTRANSFER variable for a channel while clearing
1258 * the opposite.
1259 *
1260 * \param chan Channel the variable is being set for
1261 * \param value Value the variable is being set to
1262 * \param is_attended false set BLINDTRANSFER and unset ATTENDEDTRANSFER
1263 * true set ATTENDEDTRANSFER and unset BLINDTRANSFER
1264 */
1265void ast_bridge_set_transfer_variables(struct ast_channel *chan, const char *value, int is_attended);
1266
1267/*!
1268 * \brief Get a container of all channels in the bridge
1269 * \since 12.0.0
1270 *
1271 * \param bridge The bridge which is already locked.
1272 *
1273 * \retval NULL Failed to create container
1274 * \retval non-NULL Container of channels in the bridge
1275 */
1276struct ao2_container *ast_bridge_peers_nolock(struct ast_bridge *bridge);
1277
1278/*!
1279 * \brief Get a container of all channels in the bridge
1280 * \since 12.0.0
1281 *
1282 * \param bridge The bridge
1283 *
1284 * \note The returned container is a snapshot of channels in the
1285 * bridge when called.
1286 *
1287 * \retval NULL Failed to create container
1288 * \retval non-NULL Container of channels in the bridge
1289 */
1290struct ao2_container *ast_bridge_peers(struct ast_bridge *bridge);
1291
1292/*!
1293 * \brief Get the channel's bridge peer only if the bridge is two-party.
1294 * \since 12.0.0
1295 *
1296 * \param bridge The bridge which is already locked.
1297 * \param chan Channel desiring the bridge peer channel.
1298 *
1299 * \note The returned peer channel is the current peer in the
1300 * bridge when called.
1301 *
1302 * \retval NULL Channel not in a bridge or the bridge is not two-party.
1303 * \retval non-NULL Reffed peer channel at time of calling.
1304 */
1305struct ast_channel *ast_bridge_peer_nolock(struct ast_bridge *bridge, struct ast_channel *chan);
1306
1307/*!
1308 * \brief Get the channel's bridge peer only if the bridge is two-party.
1309 * \since 12.0.0
1310 *
1311 * \param bridge The bridge
1312 * \param chan Channel desiring the bridge peer channel.
1313 *
1314 * \note The returned peer channel is the current peer in the
1315 * bridge when called.
1316 *
1317 * \retval NULL Channel not in a bridge or the bridge is not two-party.
1318 * \retval non-NULL Reffed peer channel at time of calling.
1319 */
1320struct ast_channel *ast_bridge_peer(struct ast_bridge *bridge, struct ast_channel *chan);
1321
1322/*!
1323 * \brief Remove marked bridge channel feature hooks.
1324 * \since 12.0.0
1325 *
1326 * \param features Bridge features structure
1327 * \param flags Determinator for whether hook is removed.
1328 */
1330
1331/*!
1332 * \brief Find bridge by id
1333 * \since 12.0.0
1334 *
1335 * \param bridge_id Bridge identifier
1336 *
1337 * \return NULL bridge not found
1338 * \return non-NULL reference to bridge
1339 */
1340struct ast_bridge *ast_bridge_find_by_id(const char *bridge_id);
1341
1342#if defined(__cplusplus) || defined(c_plusplus)
1343}
1344#endif
1345
1346#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:2105
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:4016
struct ao2_container * ast_bridges(void)
Returns the global bridges container.
Definition bridge.c:196
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:3975
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:3710
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:1019
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:1820
ast_bridge_optimization
Tells, if optimization is allowed, how the optimization would be performed.
Definition bridge.h:935
@ AST_BRIDGE_OPTIMIZE_PROHIBITED
Definition bridge.h:945
@ AST_BRIDGE_OPTIMIZE_MERGE_TO_CHAN_BRIDGE
Definition bridge.h:941
@ AST_BRIDGE_OPTIMIZE_SWAP_TO_PEER_BRIDGE
Definition bridge.h:939
@ AST_BRIDGE_OPTIMIZE_MERGE_TO_PEER_BRIDGE
Definition bridge.h:943
@ AST_BRIDGE_OPTIMIZE_SWAP_TO_CHAN_BRIDGE
Definition bridge.h:937
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:3914
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:4256
int ast_bridge_number_video_src(struct ast_bridge *bridge)
Returns the number of video sources currently active in the bridge.
Definition bridge.c:4073
struct ao2_container * ast_bridge_peers_nolock(struct ast_bridge *bridge)
Get a container of all channels in the bridge.
Definition bridge.c:4227
static void _ast_bridge_unlock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
Definition bridge.h:492
void ast_bridge_set_sfu_video_mode(struct ast_bridge *bridge)
Set the bridge to be a selective forwarding unit.
Definition bridge.c:3983
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:3928
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:3991
int ast_bridge_queue_action(struct ast_bridge *bridge, struct ast_frame *action)
Put an action onto the specified bridge.
Definition bridge.c:325
int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
Destroy a bridge.
Definition bridge.c:1029
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:2077
struct ast_bridge_methods ast_bridge_base_v_table
Bridge base class virtual method table.
Definition bridge.c:1008
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:4007
struct varshead * ast_bridge_get_ari_reportable_variables(struct ast_bridge *bridge)
Get a list of variables that should be included in ARI events for this bridge.
Definition bridge.c:1385
struct ast_bridge * ast_bridge_transfer_acquire_bridge(struct ast_channel *chan)
Acquire the channel's bridge for transfer purposes.
Definition bridge.c:4617
int ast_bridge_remove(struct ast_bridge *bridge, struct ast_channel *chan)
Remove a channel from a bridge.
Definition bridge.c:2150
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:1301
void ast_bridge_merge_inhibit(struct ast_bridge *bridge, int request)
Adjust the bridge merge inhibit request count.
Definition bridge.c:3209
int ast_bridge_kick(struct ast_bridge *bridge, struct ast_channel *chan)
Kick a channel from a bridge.
Definition bridge.c:2178
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:5221
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:4284
int ast_bridge_suspend(struct ast_bridge *bridge, struct ast_channel *chan)
Suspend a channel temporarily from a bridge.
Definition bridge.c:3216
ast_transfer_type
Definition bridge.h:1170
@ AST_BRIDGE_TRANSFER_SINGLE_PARTY
Definition bridge.h:1172
@ AST_BRIDGE_TRANSFER_MULTI_PARTY
Definition bridge.h:1174
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:1204
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:4561
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:3958
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:3907
struct ao2_container * ast_bridge_peers(struct ast_bridge *bridge)
Get a container of all channels in the bridge.
Definition bridge.c:4245
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:4126
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:4634
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:4160
static int _ast_bridge_trylock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
Definition bridge.h:470
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:2499
int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan)
Unsuspend a channel from a bridge.
Definition bridge.c:3237
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:4175
ast_transfer_result
Definition bridge.h:1159
@ AST_BRIDGE_TRANSFER_NOT_PERMITTED
Definition bridge.h:1163
@ AST_BRIDGE_TRANSFER_SUCCESS
Definition bridge.h:1161
@ AST_BRIDGE_TRANSFER_INVALID
Definition bridge.h:1165
@ AST_BRIDGE_TRANSFER_FAIL
Definition bridge.h:1167
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
const char * ast_bridge_get_variable(const struct ast_bridge *bridge, const char *name)
Get value a variable from the bridge by name.
Definition bridge.c:1380
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:4025
ast_bridge_impart_flags
Definition bridge.h:594
@ AST_BRIDGE_IMPART_CHAN_DEPARTABLE
Definition bridge.h:598
@ AST_BRIDGE_IMPART_CHAN_MASK
Definition bridge.h:596
@ AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP
Definition bridge.h:602
@ AST_BRIDGE_IMPART_CHAN_INDEPENDENT
Definition bridge.h:600
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:3129
static void _ast_bridge_lock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
Definition bridge.h:481
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:3169
ast_bridge_join_flags
Definition bridge.h:543
@ AST_BRIDGE_JOIN_INHIBIT_JOIN_COLP
Definition bridge.h:547
@ AST_BRIDGE_JOIN_PASS_REFERENCE
Definition bridge.h:545
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:4100
int ast_bridge_set_variable(struct ast_bridge *bridge, const char *name, const char *value, int report_events)
Set a variable on the bridge.
Definition bridge.c:1341
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:3998
void ast_bridge_notify_masquerade(struct ast_channel *chan)
Notify bridging that this channel was just masqueraded.
Definition bridge.c:1641
enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_transferee, struct ast_channel *to_transfer_target)
Attended transfer.
Definition bridge.c:4886
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:2659
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:3921
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)
#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).
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD(name)
Declare a string field.
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
struct varshead * bridgevars
Definition bridge.h:349
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::@198 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:355
struct stasis_topic * topic
Definition bridge.h:365
struct ast_bridge_softmix softmix
Definition bridge.h:373
void * tech_pvt
Definition bridge.h:363
struct ast_vector_int media_types
Definition bridge.h:410
struct timeval creationtime
Definition bridge.h:414
const struct ast_bridge_methods * v_table
Definition bridge.h:357
struct varshead bridgevars
Definition bridge.h:416
unsigned int reconfigured
Definition bridge.h:394
unsigned int num_active
Definition bridge.h:381
ast_callid callid
Definition bridge.h:367
const ast_string_field creator
Definition bridge.h:407
const ast_string_field uniqueid
Definition bridge.h:407
struct ast_bridge_channels_list channels
Definition bridge.h:369
struct ast_bridge_snapshot * current_snapshot
Definition bridge.h:412
void * personality
Definition bridge.h:359
unsigned int num_channels
Definition bridge.h:379
unsigned int dissolved
Definition bridge.h:396
struct ast_bridge::@199 action_queue
int cause
Definition bridge.h:392
struct ast_bridge_technology * technology
Definition bridge.h:361
unsigned int construction_completed
Definition bridge.h:398
struct ast_bridge::@200 ari_reportable_variable_names
const ast_string_field name
Definition bridge.h:407
unsigned int num_lonely
Definition bridge.h:383
unsigned int inhibit_merge
Count of the active temporary requests to inhibit bridge merges. Zero if merges are allowed.
Definition bridge.h:390
struct ast_flags feature_flags
Definition bridge.h:375
uint32_t allowed_capabilities
Definition bridge.h:377
Main Channel structure associated with a channel.
struct ast_bridge * bridge
struct ast_flags flags
Structure used to handle boolean flags.
Definition utils.h:220
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:1180
int value
Definition syslog.c:37
Universally unique identifier support.
#define AST_VECTOR(name, type)
Define a vector structure.
Definition vector.h:44