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