| 1 | /* |
| 2 | * Asterisk -- An open source telephony toolkit. |
| 3 | * |
| 4 | * Copyright (C) 2011, Digium, Inc. |
| 5 | * |
| 6 | * David Vossel <[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 | #ifndef _CONFBRIDGE_H |
| 22 | #define _CONFBRIDGE_H |
| 23 | |
| 24 | #include "asterisk.h" |
| 25 | #include "asterisk/app.h" |
| 26 | #include "asterisk/logger.h" |
| 27 | #include "asterisk/linkedlists.h" |
| 28 | #include "asterisk/channel.h" |
| 29 | #include "asterisk/bridge.h" |
| 30 | #include "asterisk/bridge_features.h" |
| 31 | #include "asterisk/stasis_bridges.h" |
| 32 | #include "conf_state.h" |
| 33 | |
| 34 | /*! Maximum length of a conference bridge name */ |
| 35 | #define MAX_CONF_NAME AST_MAX_EXTENSION |
| 36 | /*! Maximum length of a conference pin */ |
| 37 | #define MAX_PIN 80 |
| 38 | /*! Maximum length of bridge/user/menu profile names */ |
| 39 | #define MAX_PROFILE_NAME 128 |
| 40 | |
| 41 | #define DEFAULT_USER_PROFILE "default_user" |
| 42 | #define DEFAULT_BRIDGE_PROFILE "default_bridge" |
| 43 | #define DEFAULT_MENU_PROFILE "default_menu" |
| 44 | |
| 45 | /*! Default minimum average magnitude threshold to determine talking by the DSP. */ |
| 46 | #define DEFAULT_TALKING_THRESHOLD 160 |
| 47 | |
| 48 | /*! Default time in ms of silence necessary to declare talking stopped by the bridge. */ |
| 49 | #define DEFAULT_SILENCE_THRESHOLD 2500 |
| 50 | |
| 51 | enum user_profile_flags { |
| 52 | USER_OPT_ADMIN = (1 << 0), /*!< Set if the caller is an administrator */ |
| 53 | USER_OPT_NOONLYPERSON = (1 << 1), /*!< Set if the "you are currently the only person in this conference" sound file should not be played */ |
| 54 | USER_OPT_MARKEDUSER = (1 << 2), /*!< Set if the caller is a marked user */ |
| 55 | USER_OPT_STARTMUTED = (1 << 3), /*!< Set if the caller should be initially set muted */ |
| 56 | USER_OPT_MUSICONHOLD = (1 << 4), /*!< Set if music on hold should be played if nobody else is in the conference bridge */ |
| 57 | USER_OPT_QUIET = (1 << 5), /*!< Set if no audio prompts should be played */ |
| 58 | USER_OPT_ANNOUNCEUSERCOUNT = (1 << 6), /*!< Set if the number of users should be announced to the caller */ |
| 59 | USER_OPT_WAITMARKED = (1 << 7), /*!< Set if the user must wait for a marked user before starting */ |
| 60 | USER_OPT_ENDMARKED = (1 << 8), /*!< Set if the user should be kicked after the last Marked user exits */ |
| 61 | USER_OPT_DENOISE = (1 << 9), /*!< Sets if denoise filter should be used on audio before mixing. */ |
| 62 | USER_OPT_ANNOUNCE_JOIN_LEAVE = (1 << 10), /*!< Sets if the user's name should be recorded and announced on join and leave. */ |
| 63 | USER_OPT_TALKER_DETECT = (1 << 11), /*!< Sets if start and stop talking events should generated for this user over AMI. */ |
| 64 | USER_OPT_DROP_SILENCE = (1 << 12), /*!< Sets if silence should be dropped from the mix or not. */ |
| 65 | USER_OPT_DTMF_PASS = (1 << 13), /*!< Sets if dtmf should be passed into the conference or not */ |
| 66 | USER_OPT_ANNOUNCEUSERCOUNTALL = (1 << 14), /*!< Sets if the number of users should be announced to everyone. */ |
| 67 | USER_OPT_JITTERBUFFER = (1 << 15), /*!< Places a jitterbuffer on the user. */ |
| 68 | USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW = (1 << 16), /*!< modifies ANNOUNCE_JOIN_LEAVE - user reviews the recording before continuing */ |
| 69 | USER_OPT_SEND_EVENTS = (1 << 17), /*!< Send text message events to users */ |
| 70 | USER_OPT_ECHO_EVENTS = (1 << 18), /*!< Send events only to the admin(s) */ |
| 71 | USER_OPT_TEXT_MESSAGING = (1 << 19), /*!< Send text messages to the user */ |
| 72 | USER_OPT_ANSWER_CHANNEL = (1 << 20), /*!< Sets if the channel should be answered if currently unanswered */ |
| 73 | USER_OPT_HEAR_OWN_JOIN_SOUND = (1 << 21), /*!< Set if the caller should hear the join sound */ |
| 74 | USER_OPT_ENDMARKEDANY = (1 << 22), /*!< Set if the user should be kicked after any marked user exits */ |
| 75 | }; |
| 76 | |
| 77 | enum bridge_profile_flags { |
| 78 | BRIDGE_OPT_RECORD_CONFERENCE = (1 << 0), /*!< Set if the conference should be recorded */ |
| 79 | BRIDGE_OPT_VIDEO_SRC_LAST_MARKED = (1 << 1), /*!< Set if conference should feed video of last marked user to all participants. */ |
| 80 | BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED = (1 << 2), /*!< Set if conference should feed video of first marked user to all participants. */ |
| 81 | BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER = (1 << 3), /*!< Set if conference set the video feed to follow the loudest talker. */ |
| 82 | BRIDGE_OPT_RECORD_FILE_APPEND = (1 << 4), /*!< Set if the record file should be appended to between start/stops. */ |
| 83 | BRIDGE_OPT_RECORD_FILE_TIMESTAMP = (1 << 5), /*!< Set if the record file should have a timestamp appended */ |
| 84 | BRIDGE_OPT_BINAURAL_ACTIVE = (1 << 6), /*!< Set if binaural convolution is activated */ |
| 85 | BRIDGE_OPT_VIDEO_SRC_SFU = (1 << 7), /*!< Selective forwarding unit */ |
| 86 | BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE = (1 << 8), /*!< The average of all REMB reports is sent to the sender */ |
| 87 | BRIDGE_OPT_REMB_BEHAVIOR_LOWEST = (1 << 9), /*!< The lowest estimated maximum bitrate is sent to the sender */ |
| 88 | BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST = (1 << 10), /*!< The highest estimated maximum bitrate is sent to the sender */ |
| 89 | BRIDGE_OPT_ENABLE_EVENTS = (1 << 11), /*!< Enable sending events to participants */ |
| 90 | BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL = (1 << 12), /*!< The average of all REMB reports in the entire bridge is sent to each sender */ |
| 91 | BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL = (1 << 13), /*!< The lowest estimated maximum bitrate from all receivers is sent to each sender */ |
| 92 | BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL = (1 << 14), /*!< The highest estimated maximum bitrate from all receivers is sent to each sender */ |
| 93 | BRIDGE_OPT_REMB_BEHAVIOR_FORCE = (1 << 15), /*!< Force the REMB estimated bitrate to that specified in remb_estimated_bitrate */ |
| 94 | }; |
| 95 | |
| 96 | enum conf_menu_action_id { |
| 97 | MENU_ACTION_TOGGLE_MUTE = 1, |
| 98 | MENU_ACTION_PLAYBACK, |
| 99 | MENU_ACTION_PLAYBACK_AND_CONTINUE, |
| 100 | MENU_ACTION_INCREASE_LISTENING, |
| 101 | MENU_ACTION_DECREASE_LISTENING, |
| 102 | MENU_ACTION_RESET_LISTENING, |
| 103 | MENU_ACTION_RESET_TALKING, |
| 104 | MENU_ACTION_INCREASE_TALKING, |
| 105 | MENU_ACTION_DECREASE_TALKING, |
| 106 | MENU_ACTION_DIALPLAN_EXEC, |
| 107 | MENU_ACTION_ADMIN_TOGGLE_LOCK, |
| 108 | MENU_ACTION_ADMIN_KICK_LAST, |
| 109 | MENU_ACTION_LEAVE, |
| 110 | MENU_ACTION_NOOP, |
| 111 | MENU_ACTION_SET_SINGLE_VIDEO_SRC, |
| 112 | MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC, |
| 113 | MENU_ACTION_PARTICIPANT_COUNT, |
| 114 | MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS, |
| 115 | MENU_ACTION_TOGGLE_BINAURAL, |
| 116 | }; |
| 117 | |
| 118 | /*! The conference menu action contains both |
| 119 | * the action id that represents the action that |
| 120 | * must take place, along with any data associated |
| 121 | * with that action. */ |
| 122 | struct conf_menu_action { |
| 123 | enum conf_menu_action_id id; |
| 124 | union { |
| 125 | char playback_file[PATH_MAX]; |
| 126 | struct { |
| 127 | char context[AST_MAX_CONTEXT]; |
| 128 | char exten[AST_MAX_EXTENSION]; |
| 129 | int priority; |
| 130 | } dialplan_args; |
| 131 | } data; |
| 132 | AST_LIST_ENTRY(conf_menu_action) action; |
| 133 | }; |
| 134 | |
| 135 | /*! Conference menu entries contain the DTMF sequence |
| 136 | * and the list of actions that are associated with that |
| 137 | * sequence. */ |
| 138 | struct conf_menu_entry { |
| 139 | /*! the DTMF sequence that triggers the actions */ |
| 140 | char dtmf[MAXIMUM_DTMF_FEATURE_STRING]; |
| 141 | /*! The actions associated with this menu entry. */ |
| 142 | AST_LIST_HEAD_NOLOCK(, conf_menu_action) actions; |
| 143 | AST_LIST_ENTRY(conf_menu_entry) entry; |
| 144 | }; |
| 145 | |
| 146 | /*! Conference menu structure. Contains a list |
| 147 | * of DTMF sequences coupled with the actions those |
| 148 | * sequences invoke.*/ |
| 149 | struct conf_menu { |
| 150 | char name[MAX_PROFILE_NAME]; |
| 151 | AST_LIST_HEAD_NOLOCK(, conf_menu_entry) entries; |
| 152 | }; |
| 153 | |
| 154 | struct user_profile { |
| 155 | char name[MAX_PROFILE_NAME]; |
| 156 | char pin[MAX_PIN]; |
| 157 | char moh_class[128]; |
| 158 | char announcement[PATH_MAX]; |
| 159 | unsigned int flags; |
| 160 | unsigned int announce_user_count_all_after; |
| 161 | /*! Minimum average magnitude threshold to determine talking by the DSP. */ |
| 162 | unsigned int talking_threshold; |
| 163 | /*! Time in ms of silence necessary to declare talking stopped by the bridge. */ |
| 164 | unsigned int silence_threshold; |
| 165 | /*! The time in ms the user may stay in the confbridge */ |
| 166 | unsigned int timeout; |
| 167 | }; |
| 168 | |
| 169 | enum conf_sounds { |
| 170 | CONF_SOUND_HAS_JOINED, |
| 171 | CONF_SOUND_HAS_LEFT, |
| 172 | CONF_SOUND_KICKED, |
| 173 | CONF_SOUND_MUTED, |
| 174 | CONF_SOUND_UNMUTED, |
| 175 | CONF_SOUND_ONLY_ONE, |
| 176 | CONF_SOUND_THERE_ARE, |
| 177 | CONF_SOUND_OTHER_IN_PARTY, |
| 178 | CONF_SOUND_PLACE_IN_CONF, |
| 179 | CONF_SOUND_WAIT_FOR_LEADER, |
| 180 | CONF_SOUND_LEADER_HAS_LEFT, |
| 181 | CONF_SOUND_GET_PIN, |
| 182 | CONF_SOUND_INVALID_PIN, |
| 183 | CONF_SOUND_ONLY_PERSON, |
| 184 | CONF_SOUND_LOCKED, |
| 185 | CONF_SOUND_LOCKED_NOW, |
| 186 | CONF_SOUND_UNLOCKED_NOW, |
| 187 | CONF_SOUND_ERROR_MENU, |
| 188 | CONF_SOUND_JOIN, |
| 189 | CONF_SOUND_LEAVE, |
| 190 | CONF_SOUND_PARTICIPANTS_MUTED, |
| 191 | CONF_SOUND_PARTICIPANTS_UNMUTED, |
| 192 | CONF_SOUND_BEGIN, |
| 193 | CONF_SOUND_BINAURAL_ON, |
| 194 | CONF_SOUND_BINAURAL_OFF, |
| 195 | }; |
| 196 | |
| 197 | struct bridge_profile_sounds { |
| 198 | AST_DECLARE_STRING_FIELDS( |
| 199 | AST_STRING_FIELD(hasjoin); |
| 200 | AST_STRING_FIELD(hasleft); |
| 201 | AST_STRING_FIELD(kicked); |
| 202 | AST_STRING_FIELD(muted); |
| 203 | AST_STRING_FIELD(unmuted); |
| 204 | AST_STRING_FIELD(onlyone); |
| 205 | AST_STRING_FIELD(thereare); |
| 206 | AST_STRING_FIELD(otherinparty); |
| 207 | AST_STRING_FIELD(placeintoconf); |
| 208 | AST_STRING_FIELD(waitforleader); |
| 209 | AST_STRING_FIELD(leaderhasleft); |
| 210 | AST_STRING_FIELD(getpin); |
| 211 | AST_STRING_FIELD(invalidpin); |
| 212 | AST_STRING_FIELD(onlyperson); |
| 213 | AST_STRING_FIELD(locked); |
| 214 | AST_STRING_FIELD(lockednow); |
| 215 | AST_STRING_FIELD(unlockednow); |
| 216 | AST_STRING_FIELD(errormenu); |
| 217 | AST_STRING_FIELD(leave); |
| 218 | AST_STRING_FIELD(join); |
| 219 | AST_STRING_FIELD(participantsmuted); |
| 220 | AST_STRING_FIELD(participantsunmuted); |
| 221 | AST_STRING_FIELD(begin); |
| 222 | AST_STRING_FIELD(binauralon); |
| 223 | AST_STRING_FIELD(binauraloff); |
| 224 | ); |
| 225 | }; |
| 226 | |
| 227 | struct bridge_profile { |
| 228 | char name[MAX_PROFILE_NAME]; |
| 229 | char language[MAX_LANGUAGE]; /*!< Language used for playback_chan */ |
| 230 | char rec_file[PATH_MAX]; |
| 231 | char rec_options[128]; |
| 232 | char rec_command[128]; |
| 233 | unsigned int flags; |
| 234 | unsigned int max_members; /*!< The maximum number of participants allowed in the conference */ |
| 235 | unsigned int internal_sample_rate; /*!< The internal sample rate of the bridge. 0 when set to auto adjust mode. */ |
| 236 | unsigned int maximum_sample_rate; /*!< The maximum sample rate of the bridge. 0 when set to no maximum. */ |
| 237 | unsigned int mix_interval; /*!< The internal mixing interval used by the bridge. When set to 0 the bridgewill use a default interval. */ |
| 238 | struct bridge_profile_sounds *sounds; |
| 239 | char regcontext[AST_MAX_CONTEXT]; |
| 240 | unsigned int video_update_discard; /*!< Amount of time after sending a video update request that subsequent requests should be discarded */ |
| 241 | unsigned int remb_send_interval; /*!< Interval at which a combined REMB frame is sent to video sources */ |
| 242 | unsigned int remb_estimated_bitrate; /*!< Bitrate sent when BRIDGE_OPT_REMB_BEHAVIOR_FORCE is set */ |
| 243 | }; |
| 244 | |
| 245 | /*! \brief The structure that represents a conference bridge */ |
| 246 | struct confbridge_conference { |
| 247 | char name[MAX_CONF_NAME]; /*!< Name of the conference bridge */ |
| 248 | struct confbridge_state *state; /*!< Conference state information */ |
| 249 | struct ast_bridge *bridge; /*!< Bridge structure doing the mixing */ |
| 250 | struct bridge_profile b_profile; /*!< The Bridge Configuration Profile */ |
| 251 | unsigned int activeusers; /*!< Number of active users present */ |
| 252 | unsigned int markedusers; /*!< Number of marked users present */ |
| 253 | unsigned int waitingusers; /*!< Number of waiting users present */ |
| 254 | unsigned int locked:1; /*!< Is this conference bridge locked? */ |
| 255 | unsigned int muted:1; /*!< Is this conference bridge muted? */ |
| 256 | struct ast_channel *playback_chan; /*!< Channel used for playback into the conference bridge */ |
| 257 | struct ast_channel *record_chan; /*!< Channel used for recording the conference */ |
| 258 | struct ast_str *record_filename; /*!< Recording filename. */ |
| 259 | struct ast_str *orig_rec_file; /*!< Previous b_profile.rec_file. */ |
| 260 | AST_LIST_HEAD_NOLOCK(, confbridge_user) active_list; /*!< List of users participating in the conference bridge */ |
| 261 | AST_LIST_HEAD_NOLOCK(, confbridge_user) waiting_list; /*!< List of users waiting to join the conference bridge */ |
| 262 | struct ast_taskprocessor *playback_queue; /*!< Queue for playing back bridge announcements and managing the announcer channel */ |
| 263 | }; |
| 264 | |
| 265 | extern struct ao2_container *conference_bridges; |
| 266 | |
| 267 | struct post_join_action { |
| 268 | int (*func)(struct confbridge_user *user); |
| 269 | AST_LIST_ENTRY(post_join_action) list; |
| 270 | }; |
| 271 | |
| 272 | /*! \brief The structure that represents a conference bridge user */ |
| 273 | struct confbridge_user { |
| 274 | struct confbridge_conference *conference; /*!< Conference bridge they are participating in */ |
| 275 | struct bridge_profile b_profile; /*!< The Bridge Configuration Profile */ |
| 276 | struct user_profile u_profile; /*!< The User Configuration Profile */ |
| 277 | char menu_name[MAX_PROFILE_NAME]; /*!< The name of the DTMF menu assigned to this user */ |
| 278 | char name_rec_location[PATH_MAX]; /*!< Location of the User's name recorded file if it exists */ |
| 279 | struct ast_channel *chan; /*!< Asterisk channel participating */ |
| 280 | struct ast_bridge_features features; /*!< Bridge features structure */ |
| 281 | struct ast_bridge_tech_optimizations tech_args; /*!< Bridge technology optimizations for talk detection */ |
| 282 | unsigned int suspended_moh; /*!< Count of active suspended MOH actions. */ |
| 283 | unsigned int muted:1; /*!< Has the user requested to be muted? */ |
| 284 | unsigned int kicked:1; /*!< User has been kicked from the conference */ |
| 285 | unsigned int playing_moh:1; /*!< MOH is currently being played to the user */ |
| 286 | unsigned int talking:1; /*!< User is currently talking */ |
| 287 | AST_LIST_HEAD_NOLOCK(, post_join_action) post_join_list; /*!< List of sounds to play after joining */; |
| 288 | AST_LIST_ENTRY(confbridge_user) list; /*!< Linked list information */ |
| 289 | }; |
| 290 | |
| 291 | /*! \brief load confbridge.conf file */ |
| 292 | int conf_load_config(void); |
| 293 | |
| 294 | /*! \brief reload confbridge.conf file */ |
| 295 | int conf_reload_config(void); |
| 296 | |
| 297 | /*! \brief destroy the information loaded from the confbridge.conf file*/ |
| 298 | void conf_destroy_config(void); |
| 299 | |
| 300 | /*! |
| 301 | * \brief find a user profile given a user profile's name and store |
| 302 | * that profile in result structure. |
| 303 | * |
| 304 | * \param chan channel the user profile is requested for |
| 305 | * \param user_profile_name name of the profile requested (optional) |
| 306 | * \param result data contained by the user profile will be copied to this struct pointer |
| 307 | * |
| 308 | * \details If user_profile_name is not provided, this function will |
| 309 | * check for the presence of a user profile set by the CONFBRIDGE |
| 310 | * function on a channel datastore. If that doesn't exist, the |
| 311 | * default_user profile is used. |
| 312 | * |
| 313 | * \retval user profile on success |
| 314 | * \retval NULL on failure |
| 315 | */ |
| 316 | const struct user_profile *conf_find_user_profile(struct ast_channel *chan, const char *user_profile_name, struct user_profile *result); |
| 317 | |
| 318 | /*! |
| 319 | * \brief Find a bridge profile given a bridge profile's name and store |
| 320 | * that profile in result structure. |
| 321 | * |
| 322 | * \param chan channel the bridge profile is requested for |
| 323 | * \param bridge_profile_name name of the profile requested (optional) |
| 324 | * \param result data contained by the bridge profile will be copied to this struct pointer |
| 325 | * |
| 326 | * \details If bridge_profile_name is not provided, this function will |
| 327 | * check for the presence of a bridge profile set by the CONFBRIDGE |
| 328 | * function on a channel datastore. If that doesn't exist, the |
| 329 | * default_bridge profile is used. |
| 330 | * |
| 331 | * \retval bridge profile on success |
| 332 | * \retval NULL on failure |
| 333 | */ |
| 334 | const struct bridge_profile *conf_find_bridge_profile(struct ast_channel *chan, const char *bridge_profile_name, struct bridge_profile *result); |
| 335 | |
| 336 | /*! |
| 337 | * \brief find a menu profile given a menu profile's name and apply |
| 338 | * the menu in DTMF hooks. |
| 339 | * |
| 340 | * \param chan channel the menu profile is requested for |
| 341 | * \param user user profile the menu is being applied to |
| 342 | * \param menu_profile_name name of the profile requested (optional) |
| 343 | * |
| 344 | * \details If menu_profile_name is not provided, this function will |
| 345 | * check for the presence of a menu profile set by the CONFBRIDGE |
| 346 | * function on a channel datastore. If that doesn't exist, the |
| 347 | * default_menu profile is used. |
| 348 | * |
| 349 | * \retval 0 on success |
| 350 | * \retval -1 on failure |
| 351 | */ |
| 352 | int conf_set_menu_to_user(struct ast_channel *chan, struct confbridge_user *user, const char *menu_profile_name); |
| 353 | |
| 354 | /*! |
| 355 | * \brief Destroy a bridge profile found by 'conf_find_bridge_profile' |
| 356 | */ |
| 357 | void conf_bridge_profile_destroy(struct bridge_profile *b_profile); |
| 358 | |
| 359 | /*! |
| 360 | * \brief copies a bridge profile |
| 361 | * \note conf_bridge_profile_destroy must be called on the dst structure |
| 362 | */ |
| 363 | void conf_bridge_profile_copy(struct bridge_profile *dst, struct bridge_profile *src); |
| 364 | |
| 365 | /*! |
| 366 | * \brief Finds a menu_entry in a menu structure matched by DTMF sequence. |
| 367 | * |
| 368 | * \note the menu entry found must be destroyed using conf_menu_entry_destroy() |
| 369 | * |
| 370 | * \retval 1 success, entry is found and stored in result |
| 371 | * \retval 0 failure, no entry found for given DTMF sequence |
| 372 | */ |
| 373 | int conf_find_menu_entry_by_sequence(const char *dtmf_sequence, struct conf_menu *menu, struct conf_menu_entry *result); |
| 374 | |
| 375 | /*! |
| 376 | * \brief Destroys and frees all the actions stored in a menu_entry structure |
| 377 | */ |
| 378 | void conf_menu_entry_destroy(struct conf_menu_entry *menu_entry); |
| 379 | |
| 380 | /*! |
| 381 | * \brief Once a DTMF sequence matches a sequence in the user's DTMF menu, this function will get |
| 382 | * called to perform the menu action. |
| 383 | * |
| 384 | * \param bridge_channel Bridged channel this is involving |
| 385 | * \param user the conference user to perform the action on. |
| 386 | * \param menu_entry the menu entry that invoked this callback to occur. |
| 387 | * \param menu an AO2 referenced pointer to the entire menu structure the menu_entry |
| 388 | * derived from. |
| 389 | * |
| 390 | * \note The menu_entry is a deep copy of the entry found in the menu structure. This allows |
| 391 | * for the menu_entry to be accessed without requiring the menu lock. If the menu must |
| 392 | * be accessed, the menu lock must be held. Reference counting of the menu structure is |
| 393 | * handled outside of the scope of this function. |
| 394 | * |
| 395 | * \retval 0 success |
| 396 | * \retval -1 failure |
| 397 | */ |
| 398 | int conf_handle_dtmf( |
| 399 | struct ast_bridge_channel *bridge_channel, |
| 400 | struct confbridge_user *user, |
| 401 | struct conf_menu_entry *menu_entry, |
| 402 | struct conf_menu *menu); |
| 403 | |
| 404 | |
| 405 | /*! \brief Looks to see if sound file is stored in bridge profile sounds, if not |
| 406 | * default sound is provided.*/ |
| 407 | const char *conf_get_sound(enum conf_sounds sound, struct bridge_profile_sounds *custom_sounds); |
| 408 | |
| 409 | int func_confbridge_helper(struct ast_channel *chan, const char *cmd, char *data, const char *value); |
| 410 | |
| 411 | /*! |
| 412 | * \brief Play sound file into conference bridge |
| 413 | * |
| 414 | * \param conference The conference bridge to play sound file into |
| 415 | * \param filename Sound file to play |
| 416 | * |
| 417 | * \retval 0 success |
| 418 | * \retval -1 failure |
| 419 | */ |
| 420 | int play_sound_file(struct confbridge_conference *conference, const char *filename); |
| 421 | |
| 422 | /*! |
| 423 | * \brief Play sound file into conference bridge asynchronously |
| 424 | * |
| 425 | * If the initiator parameter is non-NULL, then the playback will wait for |
| 426 | * that initiator channel to get back in the bridge before playing the sound |
| 427 | * file. This way, the initiator has no danger of hearing a "clipped" file. |
| 428 | * |
| 429 | * \param conference The conference bridge to play sound file into |
| 430 | * \param filename Sound file to play |
| 431 | * \param initiator Channel that initiated playback. |
| 432 | * |
| 433 | * \retval 0 success |
| 434 | * \retval -1 failure |
| 435 | */ |
| 436 | int async_play_sound_file(struct confbridge_conference *conference, const char *filename, |
| 437 | struct ast_channel *initiator); |
| 438 | |
| 439 | /*! |
| 440 | * \brief Indicate the initiator of an async sound file is ready for it to play. |
| 441 | * |
| 442 | * When playing an async sound file, the initiator is typically either out of the bridge |
| 443 | * or not in a position to hear the queued announcement. This function lets the announcement |
| 444 | * thread know that the initiator is now ready for the sound to play. |
| 445 | * |
| 446 | * If an async announcement was queued and no initiator channel was provided, then this is |
| 447 | * a no-op |
| 448 | * |
| 449 | * \param chan The channel that initiated the async announcement |
| 450 | */ |
| 451 | void async_play_sound_ready(struct ast_channel *chan); |
| 452 | |
| 453 | /*! \brief Callback to be called when the conference has become empty |
| 454 | * \param conference The conference bridge |
| 455 | */ |
| 456 | void conf_ended(struct confbridge_conference *conference); |
| 457 | |
| 458 | /*! |
| 459 | * \brief Update the actual mute status of the user and set it on the bridge. |
| 460 | * |
| 461 | * \param user User to update the mute status. |
| 462 | */ |
| 463 | void conf_update_user_mute(struct confbridge_user *user); |
| 464 | |
| 465 | /*! |
| 466 | * \brief Stop MOH for the conference user. |
| 467 | * |
| 468 | * \param user Conference user to stop MOH on. |
| 469 | */ |
| 470 | void conf_moh_stop(struct confbridge_user *user); |
| 471 | |
| 472 | /*! |
| 473 | * \brief Start MOH for the conference user. |
| 474 | * |
| 475 | * \param user Conference user to start MOH on. |
| 476 | */ |
| 477 | void conf_moh_start(struct confbridge_user *user); |
| 478 | |
| 479 | /*! \brief Attempt to mute/play MOH to the only user in the conference if they require it |
| 480 | * \param conference A conference bridge containing a single user |
| 481 | */ |
| 482 | void conf_mute_only_active(struct confbridge_conference *conference); |
| 483 | |
| 484 | /*! \brief Callback to execute any time we transition from zero to one active users |
| 485 | * \param conference The conference bridge with a single active user joined |
| 486 | */ |
| 487 | void conf_handle_first_join(struct confbridge_conference *conference); |
| 488 | |
| 489 | /*! \brief Handle actions every time a waitmarked user joins w/o a marked user present |
| 490 | * \param user The waitmarked user |
| 491 | * \retval 0 success |
| 492 | * \retval -1 failure |
| 493 | */ |
| 494 | int conf_handle_inactive_waitmarked(struct confbridge_user *user); |
| 495 | |
| 496 | /*! \brief Handle actions whenever an user joins an empty conference |
| 497 | * |
| 498 | * \param user The user |
| 499 | */ |
| 500 | int conf_handle_only_person(struct confbridge_user *user); |
| 501 | |
| 502 | /*! \brief Handle when a conference moves to having more than one active participant |
| 503 | * \param conference The conference bridge with more than one active participant |
| 504 | */ |
| 505 | void conf_handle_second_active(struct confbridge_conference *conference); |
| 506 | |
| 507 | /*! \brief Add a conference bridge user as an unmarked active user of the conference |
| 508 | * \param conference The conference bridge to add the user to |
| 509 | * \param user The conference bridge user to add to the conference |
| 510 | */ |
| 511 | void conf_add_user_active(struct confbridge_conference *conference, struct confbridge_user *user); |
| 512 | |
| 513 | /*! \brief Add a conference bridge user as a marked active user of the conference |
| 514 | * \param conference The conference bridge to add the user to |
| 515 | * \param user The conference bridge user to add to the conference |
| 516 | */ |
| 517 | void conf_add_user_marked(struct confbridge_conference *conference, struct confbridge_user *user); |
| 518 | |
| 519 | /*! \brief Add a conference bridge user as an waiting user of the conference |
| 520 | * \param conference The conference bridge to add the user to |
| 521 | * \param user The conference bridge user to add to the conference |
| 522 | */ |
| 523 | void conf_add_user_waiting(struct confbridge_conference *conference, struct confbridge_user *user); |
| 524 | |
| 525 | /*! \brief Remove a conference bridge user from the unmarked active conference users in the conference |
| 526 | * \param conference The conference bridge to remove the user from |
| 527 | * \param user The conference bridge user to remove from the conference |
| 528 | */ |
| 529 | void conf_remove_user_active(struct confbridge_conference *conference, struct confbridge_user *user); |
| 530 | |
| 531 | /*! \brief Remove a conference bridge user from the marked active conference users in the conference |
| 532 | * \param conference The conference bridge to remove the user from |
| 533 | * \param user The conference bridge user to remove from the conference |
| 534 | */ |
| 535 | void conf_remove_user_marked(struct confbridge_conference *conference, struct confbridge_user *user); |
| 536 | |
| 537 | /*! \brief Remove a conference bridge user from the waiting conference users in the conference |
| 538 | * \param conference The conference bridge to remove the user from |
| 539 | * \param user The conference bridge user to remove from the conference |
| 540 | */ |
| 541 | void conf_remove_user_waiting(struct confbridge_conference *conference, struct confbridge_user *user); |
| 542 | |
| 543 | /*! \brief Queue a function to run with the given conference bridge user as an argument once the state transition is complete |
| 544 | * \param user The conference bridge user to pass to the function |
| 545 | * \param func The function to queue |
| 546 | * \retval 0 success |
| 547 | * \retval non-zero failure |
| 548 | */ |
| 549 | int conf_add_post_join_action(struct confbridge_user *user, int (*func)(struct confbridge_user *user)); |
| 550 | |
| 551 | /*! |
| 552 | * \since 12.0 |
| 553 | * \brief get the confbridge start stasis message type |
| 554 | * |
| 555 | * \retval stasis message type for confbridge start messages if it's available |
| 556 | * \retval NULL if it isn't |
| 557 | */ |
| 558 | struct stasis_message_type *confbridge_start_type(void); |
| 559 | |
| 560 | /*! |
| 561 | * \since 12.0 |
| 562 | * \brief get the confbridge end stasis message type |
| 563 | * |
| 564 | * \retval stasis message type for confbridge end messages if it's available |
| 565 | * \retval NULL if it isn't |
| 566 | */ |
| 567 | struct stasis_message_type *confbridge_end_type(void); |
| 568 | |
| 569 | /*! |
| 570 | * \since 12.0 |
| 571 | * \brief get the confbridge join stasis message type |
| 572 | * |
| 573 | * \retval stasis message type for confbridge join messages if it's available |
| 574 | * \retval NULL if it isn't |
| 575 | */ |
| 576 | struct stasis_message_type *confbridge_join_type(void); |
| 577 | |
| 578 | /*! |
| 579 | * \since 12.0 |
| 580 | * \brief get the confbridge leave stasis message type |
| 581 | * |
| 582 | * \retval stasis message type for confbridge leave messages if it's available |
| 583 | * \retval NULL if it isn't |
| 584 | */ |
| 585 | struct stasis_message_type *confbridge_leave_type(void); |
| 586 | |
| 587 | /*! |
| 588 | * \since 12.0 |
| 589 | * \brief get the confbridge start_record stasis message type |
| 590 | * |
| 591 | * \retval stasis message type for confbridge start_record messages if it's available |
| 592 | * \retval NULL if it isn't |
| 593 | */ |
| 594 | struct stasis_message_type *confbridge_start_record_type(void); |
| 595 | |
| 596 | /*! |
| 597 | * \since 12.0 |
| 598 | * \brief get the confbridge stop_record stasis message type |
| 599 | * |
| 600 | * \retval stasis message type for confbridge stop_record messages if it's available |
| 601 | * \retval NULL if it isn't |
| 602 | */ |
| 603 | struct stasis_message_type *confbridge_stop_record_type(void); |
| 604 | |
| 605 | /*! |
| 606 | * \since 12.0 |
| 607 | * \brief get the confbridge mute stasis message type |
| 608 | * |
| 609 | * \retval stasis message type for confbridge mute messages if it's available |
| 610 | * \retval NULL if it isn't |
| 611 | */ |
| 612 | struct stasis_message_type *confbridge_mute_type(void); |
| 613 | |
| 614 | /*! |
| 615 | * \since 12.0 |
| 616 | * \brief get the confbridge unmute stasis message type |
| 617 | * |
| 618 | * \retval stasis message type for confbridge unmute messages if it's available |
| 619 | * \retval NULL if it isn't |
| 620 | */ |
| 621 | struct stasis_message_type *confbridge_unmute_type(void); |
| 622 | |
| 623 | /*! |
| 624 | * \since 12.0 |
| 625 | * \brief get the confbridge talking stasis message type |
| 626 | * |
| 627 | * \retval stasis message type for confbridge talking messages if it's available |
| 628 | * \retval NULL if it isn't |
| 629 | */ |
| 630 | struct stasis_message_type *confbridge_talking_type(void); |
| 631 | |
| 632 | /*! |
| 633 | * \since 15.5 |
| 634 | * \brief get the confbridge welcome stasis message type |
| 635 | * |
| 636 | * \retval stasis message type for confbridge welcome messages if it's available |
| 637 | * \retval NULL if it isn't |
| 638 | */ |
| 639 | struct stasis_message_type *confbridge_welcome_type(void); |
| 640 | |
| 641 | /*! |
| 642 | * \since 15.5 |
| 643 | * \brief Get the string representation of a confbridge stasis message type |
| 644 | * |
| 645 | * \param event_type The confbridge event type such as 'confbridge_welcome_type()' |
| 646 | * |
| 647 | * \retval The string representation of the message type |
| 648 | * \retval "unknown" if not found |
| 649 | */ |
| 650 | const char *confbridge_event_type_to_string(struct stasis_message_type *event_type); |
| 651 | |
| 652 | /*! |
| 653 | * \since 12.0 |
| 654 | * \brief register stasis message routers to handle manager events for confbridge messages |
| 655 | * |
| 656 | * \retval 0 success |
| 657 | * \retval non-zero failure |
| 658 | */ |
| 659 | int manager_confbridge_init(void); |
| 660 | |
| 661 | /*! |
| 662 | * \since 12.0 |
| 663 | * \brief unregister stasis message routers to handle manager events for confbridge messages |
| 664 | */ |
| 665 | void manager_confbridge_shutdown(void); |
| 666 | |
| 667 | /*! |
| 668 | * \brief Get ConfBridge record channel technology struct. |
| 669 | * \since 12.0.0 |
| 670 | * |
| 671 | * \return ConfBridge record channel technology. |
| 672 | */ |
| 673 | struct ast_channel_tech *conf_record_get_tech(void); |
| 674 | |
| 675 | /*! |
| 676 | * \brief Get ConfBridge announce channel technology struct. |
| 677 | * \since 12.0.0 |
| 678 | * |
| 679 | * \return ConfBridge announce channel technology. |
| 680 | */ |
| 681 | struct ast_channel_tech *conf_announce_get_tech(void); |
| 682 | |
| 683 | /*! |
| 684 | * \brief Push the announcer channel into the conference. |
| 685 | * \since 12.0.0 |
| 686 | * |
| 687 | * \param ast Either channel in the announcer channel pair. |
| 688 | * |
| 689 | * \retval 0 on success. |
| 690 | * \retval -1 on error. |
| 691 | */ |
| 692 | int conf_announce_channel_push(struct ast_channel *ast); |
| 693 | |
| 694 | /*! |
| 695 | * \brief Find a confbridge by name. |
| 696 | * \since 13.22.0 |
| 697 | * \since 15.5.0 |
| 698 | * |
| 699 | * \param conference_name The name to search for |
| 700 | * |
| 701 | * \return ConfBridge (which must be unreffed) or NULL. |
| 702 | */ |
| 703 | struct confbridge_conference *conf_find_bridge(const char *conference_name); |
| 704 | |
| 705 | /*! |
| 706 | * \brief Send events to bridge participants. |
| 707 | * \since 15.7 |
| 708 | * \since 16.1 |
| 709 | * |
| 710 | * \param conference The conference bridge |
| 711 | * \param chan The channel triggering the action |
| 712 | * \param msg The stasis message describing the event |
| 713 | */ |
| 714 | void conf_send_event_to_participants(struct confbridge_conference *conference, |
| 715 | struct ast_channel *chan, struct stasis_message *msg); |
| 716 | |
| 717 | /*! |
| 718 | * \brief Create join/leave events for attended transfers |
| 719 | * \since 13.28 |
| 720 | * \since 16.5 |
| 721 | * |
| 722 | * \param msg The attended transfer stasis message |
| 723 | * |
| 724 | */ |
| 725 | void confbridge_handle_atxfer(struct ast_attended_transfer_message *msg); |
| 726 | |
| 727 | #endif |