bridge_basic.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 2013 Digium, Inc.
  5. *
  6. * Richard Mudgett <rmudgett@digium.com>
  7. *
  8. * See http://www.asterisk.org for more information about
  9. * the Asterisk project. Please do not directly contact
  10. * any of the maintainers of this project for assistance;
  11. * the project provides a web site, mailing lists and IRC
  12. * channels for your use.
  13. *
  14. * This program is free software, distributed under the terms of
  15. * the GNU General Public License Version 2. See the LICENSE file
  16. * at the top of the source tree.
  17. */
  18. /*!
  19. * \file
  20. * \brief Basic bridge subclass API.
  21. *
  22. * \author Richard Mudgett <rmudgett@digium.com>
  23. *
  24. * See Also:
  25. * \arg \ref AstCREDITS
  26. */
  27. #ifndef _ASTERISK_BRIDGING_BASIC_H
  28. #define _ASTERISK_BRIDGING_BASIC_H
  29. #if defined(__cplusplus) || defined(c_plusplus)
  30. extern "C" {
  31. #endif
  32. #define AST_TRANSFERER_ROLE_NAME "transferer"
  33. /* ------------------------------------------------------------------- */
  34. /*!
  35. * \brief Sets the features a channel will use upon being bridged.
  36. * \since 12.0.0
  37. *
  38. * \param chan Which channel to set features for
  39. * \param features Which feature codes to set for the channel
  40. *
  41. * \retval 0 on success
  42. * \retval -1 on failure
  43. */
  44. int ast_bridge_features_ds_set_string(struct ast_channel *chan, const char *features);
  45. /*!
  46. * \brief writes a channel's DTMF features to a buffer string
  47. * \since 12.0.0
  48. *
  49. * \param chan channel whose feature flags should be checked
  50. * \param buffer pointer string buffer where the output should be stored
  51. * \param buf_size size of the provided buffer (ideally enough for all features, 6+)
  52. *
  53. * \retval 0 on successful write
  54. * \retval -1 on failure
  55. */
  56. int ast_bridge_features_ds_get_string(struct ast_channel *chan, char *buffer, size_t buf_size);
  57. /*!
  58. * \brief Get DTMF feature flags from the channel.
  59. * \since 12.0.0
  60. *
  61. * \param chan Channel to get DTMF features datastore.
  62. *
  63. * \note The channel should be locked before calling this function.
  64. * \note The channel must remain locked until the flags returned have been consumed.
  65. *
  66. * \retval flags on success.
  67. * \retval NULL if the datastore does not exist.
  68. */
  69. struct ast_flags *ast_bridge_features_ds_get(struct ast_channel *chan);
  70. /*!
  71. * \brief Set basic bridge DTMF feature flags datastore on the channel.
  72. * \since 12.0.0
  73. *
  74. * \param chan Channel to set DTMF features datastore.
  75. * \param flags Builtin DTMF feature flags. (ast_bridge_config flags)
  76. *
  77. * \note The channel must be locked before calling this function.
  78. *
  79. * \retval 0 on success.
  80. * \retval -1 on error.
  81. */
  82. int ast_bridge_features_ds_set(struct ast_channel *chan, struct ast_flags *flags);
  83. /*!
  84. * \brief Append basic bridge DTMF feature flags on the channel.
  85. * \since 12.0.0
  86. *
  87. * \param chan Channel to append DTMF features datastore.
  88. * \param flags Builtin DTMF feature flags. (ast_bridge_config flags)
  89. *
  90. * \note The channel must be locked before calling this function.
  91. * \note This function differs from ast_bridge_features_ds_set only in that it won't
  92. * remove features already set on the channel.
  93. *
  94. * \retval 0 on success.
  95. * \retval -1 on error.
  96. */
  97. int ast_bridge_features_ds_append(struct ast_channel *chan, struct ast_flags *flags);
  98. /*! \brief Bridge basic class virtual method table. */
  99. extern struct ast_bridge_methods ast_bridge_basic_v_table;
  100. /*!
  101. * \brief Create a new basic class bridge
  102. *
  103. * \retval a pointer to a new bridge on success
  104. * \retval NULL on failure
  105. *
  106. * Example usage:
  107. *
  108. * \code
  109. * struct ast_bridge *bridge;
  110. * bridge = ast_bridge_basic_new();
  111. * \endcode
  112. *
  113. * This creates a basic two party bridge with any configured
  114. * DTMF features enabled that will be destroyed once one of the
  115. * channels hangs up.
  116. */
  117. struct ast_bridge *ast_bridge_basic_new(void);
  118. /*!
  119. * \brief Set feature flags on a basic bridge
  120. *
  121. * Using this function instead of setting flags directly will
  122. * ensure that after operations such as an attended transfer,
  123. * the bridge will maintain the flags that were set on it.
  124. *
  125. * \params Flags to set on the bridge. These are added to the flags already set.
  126. */
  127. void ast_bridge_basic_set_flags(struct ast_bridge *bridge, unsigned int flags);
  128. /*! Initialize the basic bridge class for use by the system. */
  129. void ast_bridging_init_basic(void);
  130. /* ------------------------------------------------------------------- */
  131. #if defined(__cplusplus) || defined(c_plusplus)
  132. }
  133. #endif
  134. #endif /* _ASTERISK_BRIDGING_BASIC_H */