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