Asterisk - The Open Source Telephony Project  18.5.0
Data Structures | Macros | Enumerations | Functions | Variables
confbridge.h File Reference
#include "asterisk.h"
#include "asterisk/app.h"
#include "asterisk/logger.h"
#include "asterisk/linkedlists.h"
#include "asterisk/channel.h"
#include "asterisk/bridge.h"
#include "asterisk/bridge_features.h"
#include "asterisk/stasis_bridges.h"
#include "conf_state.h"
Include dependency graph for confbridge.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bridge_profile
 
struct  bridge_profile_sounds
 
struct  conf_menu
 
struct  conf_menu_action
 
struct  conf_menu_entry
 
struct  confbridge_conference
 The structure that represents a conference bridge. More...
 
struct  confbridge_user
 The structure that represents a conference bridge user. More...
 
struct  post_join_action
 
struct  user_profile
 

Macros

#define DEFAULT_BRIDGE_PROFILE   "default_bridge"
 
#define DEFAULT_MENU_PROFILE   "default_menu"
 
#define DEFAULT_SILENCE_THRESHOLD   2500
 
#define DEFAULT_TALKING_THRESHOLD   160
 
#define DEFAULT_USER_PROFILE   "default_user"
 
#define MAX_CONF_NAME   AST_MAX_EXTENSION
 
#define MAX_PIN   80
 
#define MAX_PROFILE_NAME   128
 

Enumerations

enum  bridge_profile_flags {
  BRIDGE_OPT_RECORD_CONFERENCE = (1 << 0), BRIDGE_OPT_VIDEO_SRC_LAST_MARKED = (1 << 1), BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED = (1 << 2), BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER = (1 << 3),
  BRIDGE_OPT_RECORD_FILE_APPEND = (1 << 4), BRIDGE_OPT_RECORD_FILE_TIMESTAMP = (1 << 5), BRIDGE_OPT_BINAURAL_ACTIVE = (1 << 6), BRIDGE_OPT_VIDEO_SRC_SFU = (1 << 7),
  BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE = (1 << 8), BRIDGE_OPT_REMB_BEHAVIOR_LOWEST = (1 << 9), BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST = (1 << 10), BRIDGE_OPT_ENABLE_EVENTS = (1 << 11),
  BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL = (1 << 12), BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL = (1 << 13), BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL = (1 << 14), BRIDGE_OPT_REMB_BEHAVIOR_FORCE = (1 << 15)
}
 
enum  conf_menu_action_id {
  MENU_ACTION_TOGGLE_MUTE = 1, MENU_ACTION_PLAYBACK, MENU_ACTION_PLAYBACK_AND_CONTINUE, MENU_ACTION_INCREASE_LISTENING,
  MENU_ACTION_DECREASE_LISTENING, MENU_ACTION_RESET_LISTENING, MENU_ACTION_RESET_TALKING, MENU_ACTION_INCREASE_TALKING,
  MENU_ACTION_DECREASE_TALKING, MENU_ACTION_DIALPLAN_EXEC, MENU_ACTION_ADMIN_TOGGLE_LOCK, MENU_ACTION_ADMIN_KICK_LAST,
  MENU_ACTION_LEAVE, MENU_ACTION_NOOP, MENU_ACTION_SET_SINGLE_VIDEO_SRC, MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC,
  MENU_ACTION_PARTICIPANT_COUNT, MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS, MENU_ACTION_TOGGLE_BINAURAL
}
 
enum  conf_sounds {
  CONF_SOUND_HAS_JOINED, CONF_SOUND_HAS_LEFT, CONF_SOUND_KICKED, CONF_SOUND_MUTED,
  CONF_SOUND_UNMUTED, CONF_SOUND_ONLY_ONE, CONF_SOUND_THERE_ARE, CONF_SOUND_OTHER_IN_PARTY,
  CONF_SOUND_PLACE_IN_CONF, CONF_SOUND_WAIT_FOR_LEADER, CONF_SOUND_LEADER_HAS_LEFT, CONF_SOUND_GET_PIN,
  CONF_SOUND_INVALID_PIN, CONF_SOUND_ONLY_PERSON, CONF_SOUND_LOCKED, CONF_SOUND_LOCKED_NOW,
  CONF_SOUND_UNLOCKED_NOW, CONF_SOUND_ERROR_MENU, CONF_SOUND_JOIN, CONF_SOUND_LEAVE,
  CONF_SOUND_PARTICIPANTS_MUTED, CONF_SOUND_PARTICIPANTS_UNMUTED, CONF_SOUND_BEGIN, CONF_SOUND_BINAURAL_ON,
  CONF_SOUND_BINAURAL_OFF
}
 
enum  user_profile_flags {
  USER_OPT_ADMIN = (1 << 0), USER_OPT_NOONLYPERSON = (1 << 1), USER_OPT_MARKEDUSER = (1 << 2), USER_OPT_STARTMUTED = (1 << 3),
  USER_OPT_MUSICONHOLD = (1 << 4), USER_OPT_QUIET = (1 << 5), USER_OPT_ANNOUNCEUSERCOUNT = (1 << 6), USER_OPT_WAITMARKED = (1 << 7),
  USER_OPT_ENDMARKED = (1 << 8), USER_OPT_DENOISE = (1 << 9), USER_OPT_ANNOUNCE_JOIN_LEAVE = (1 << 10), USER_OPT_TALKER_DETECT = (1 << 11),
  USER_OPT_DROP_SILENCE = (1 << 12), USER_OPT_DTMF_PASS = (1 << 13), USER_OPT_ANNOUNCEUSERCOUNTALL = (1 << 14), USER_OPT_JITTERBUFFER = (1 << 15),
  USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW = (1 << 16), USER_OPT_SEND_EVENTS = (1 << 17), USER_OPT_ECHO_EVENTS = (1 << 18), USER_OPT_TEXT_MESSAGING = (1 << 19),
  USER_OPT_ANSWER_CHANNEL = (1 << 20)
}
 

Functions

int async_play_sound_file (struct confbridge_conference *conference, const char *filename, struct ast_channel *initiator)
 Play sound file into conference bridge asynchronously. More...
 
void async_play_sound_ready (struct ast_channel *chan)
 Indicate the initiator of an async sound file is ready for it to play. More...
 
int conf_add_post_join_action (struct confbridge_user *user, int(*func)(struct confbridge_user *user))
 Queue a function to run with the given conference bridge user as an argument once the state transition is complete. More...
 
void conf_add_user_active (struct confbridge_conference *conference, struct confbridge_user *user)
 Add a conference bridge user as an unmarked active user of the conference. More...
 
void conf_add_user_marked (struct confbridge_conference *conference, struct confbridge_user *user)
 Add a conference bridge user as a marked active user of the conference. More...
 
void conf_add_user_waiting (struct confbridge_conference *conference, struct confbridge_user *user)
 Add a conference bridge user as an waiting user of the conference. More...
 
int conf_announce_channel_push (struct ast_channel *ast)
 Push the announcer channel into the conference. More...
 
struct ast_channel_techconf_announce_get_tech (void)
 Get ConfBridge announce channel technology struct. More...
 
void conf_bridge_profile_copy (struct bridge_profile *dst, struct bridge_profile *src)
 copies a bridge profile More...
 
void conf_bridge_profile_destroy (struct bridge_profile *b_profile)
 Destroy a bridge profile found by 'conf_find_bridge_profile'. More...
 
void conf_destroy_config (void)
 destroy the information loaded from the confbridge.conf file More...
 
void conf_ended (struct confbridge_conference *conference)
 Callback to be called when the conference has become empty. More...
 
struct confbridge_conferenceconf_find_bridge (const char *conference_name)
 Find a confbridge by name. More...
 
const struct bridge_profileconf_find_bridge_profile (struct ast_channel *chan, const char *bridge_profile_name, struct bridge_profile *result)
 Find a bridge profile given a bridge profile's name and store that profile in result structure. More...
 
int conf_find_menu_entry_by_sequence (const char *dtmf_sequence, struct conf_menu *menu, struct conf_menu_entry *result)
 Finds a menu_entry in a menu structure matched by DTMF sequence. More...
 
const struct user_profileconf_find_user_profile (struct ast_channel *chan, const char *user_profile_name, struct user_profile *result)
 find a user profile given a user profile's name and store that profile in result structure. More...
 
const char * conf_get_sound (enum conf_sounds sound, struct bridge_profile_sounds *custom_sounds)
 Looks to see if sound file is stored in bridge profile sounds, if not default sound is provided. More...
 
int conf_handle_dtmf (struct ast_bridge_channel *bridge_channel, struct confbridge_user *user, struct conf_menu_entry *menu_entry, struct conf_menu *menu)
 Once a DTMF sequence matches a sequence in the user's DTMF menu, this function will get called to perform the menu action. More...
 
void conf_handle_first_join (struct confbridge_conference *conference)
 Callback to execute any time we transition from zero to one active users. More...
 
int conf_handle_inactive_waitmarked (struct confbridge_user *user)
 Handle actions every time a waitmarked user joins w/o a marked user present. More...
 
int conf_handle_only_person (struct confbridge_user *user)
 Handle actions whenever an user joins an empty conference. More...
 
void conf_handle_second_active (struct confbridge_conference *conference)
 Handle when a conference moves to having more than one active participant. More...
 
int conf_load_config (void)
 load confbridge.conf file More...
 
void conf_menu_entry_destroy (struct conf_menu_entry *menu_entry)
 Destroys and frees all the actions stored in a menu_entry structure. More...
 
void conf_moh_start (struct confbridge_user *user)
 Start MOH for the conference user. More...
 
void conf_moh_stop (struct confbridge_user *user)
 Stop MOH for the conference user. More...
 
void conf_mute_only_active (struct confbridge_conference *conference)
 Attempt to mute/play MOH to the only user in the conference if they require it. More...
 
struct ast_channel_techconf_record_get_tech (void)
 Get ConfBridge record channel technology struct. More...
 
int conf_reload_config (void)
 reload confbridge.conf file More...
 
void conf_remove_user_active (struct confbridge_conference *conference, struct confbridge_user *user)
 Remove a conference bridge user from the unmarked active conference users in the conference. More...
 
void conf_remove_user_marked (struct confbridge_conference *conference, struct confbridge_user *user)
 Remove a conference bridge user from the marked active conference users in the conference. More...
 
void conf_remove_user_waiting (struct confbridge_conference *conference, struct confbridge_user *user)
 Remove a conference bridge user from the waiting conference users in the conference. More...
 
void conf_send_event_to_participants (struct confbridge_conference *conference, struct ast_channel *chan, struct stasis_message *msg)
 Send events to bridge participants. More...
 
int conf_set_menu_to_user (struct ast_channel *chan, struct confbridge_user *user, const char *menu_profile_name)
 find a menu profile given a menu profile's name and apply the menu in DTMF hooks. More...
 
void conf_update_user_mute (struct confbridge_user *user)
 Update the actual mute status of the user and set it on the bridge. More...
 
struct stasis_message_typeconfbridge_end_type (void)
 get the confbridge end stasis message type More...
 
const char * confbridge_event_type_to_string (struct stasis_message_type *event_type)
 Get the string representation of a confbridge stasis message type. More...
 
void confbridge_handle_atxfer (struct ast_attended_transfer_message *msg)
 Create join/leave events for attended transfers. More...
 
struct stasis_message_typeconfbridge_join_type (void)
 get the confbridge join stasis message type More...
 
struct stasis_message_typeconfbridge_leave_type (void)
 get the confbridge leave stasis message type More...
 
struct stasis_message_typeconfbridge_mute_type (void)
 get the confbridge mute stasis message type More...
 
struct stasis_message_typeconfbridge_start_record_type (void)
 get the confbridge start_record stasis message type More...
 
struct stasis_message_typeconfbridge_start_type (void)
 get the confbridge start stasis message type More...
 
struct stasis_message_typeconfbridge_stop_record_type (void)
 get the confbridge stop_record stasis message type More...
 
struct stasis_message_typeconfbridge_talking_type (void)
 get the confbridge talking stasis message type More...
 
struct stasis_message_typeconfbridge_unmute_type (void)
 get the confbridge unmute stasis message type More...
 
struct stasis_message_typeconfbridge_welcome_type (void)
 get the confbridge welcome stasis message type More...
 
int func_confbridge_helper (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
int manager_confbridge_init (void)
 register stasis message routers to handle manager events for confbridge messages More...
 
void manager_confbridge_shutdown (void)
 unregister stasis message routers to handle manager events for confbridge messages More...
 
int play_sound_file (struct confbridge_conference *conference, const char *filename)
 Play sound file into conference bridge. More...
 

Variables

struct ao2_containerconference_bridges
 Container to hold all conference bridges in progress. More...
 

Macro Definition Documentation

◆ DEFAULT_BRIDGE_PROFILE

#define DEFAULT_BRIDGE_PROFILE   "default_bridge"

◆ DEFAULT_MENU_PROFILE

#define DEFAULT_MENU_PROFILE   "default_menu"

◆ DEFAULT_SILENCE_THRESHOLD

#define DEFAULT_SILENCE_THRESHOLD   2500

Default time in ms of silence necessary to declare talking stopped by the bridge.

Definition at line 49 of file confbridge.h.

Referenced by conf_load_config(), and confbridge_exec().

◆ DEFAULT_TALKING_THRESHOLD

#define DEFAULT_TALKING_THRESHOLD   160

Default minimum average magnitude threshold to determine talking by the DSP.

Definition at line 46 of file confbridge.h.

Referenced by conf_load_config(), and confbridge_exec().

◆ DEFAULT_USER_PROFILE

#define DEFAULT_USER_PROFILE   "default_user"

◆ MAX_CONF_NAME

#define MAX_CONF_NAME   AST_MAX_EXTENSION

Maximum length of a conference bridge name

Definition at line 35 of file confbridge.h.

Referenced by confbridge_exec().

◆ MAX_PIN

#define MAX_PIN   80

Maximum length of a conference pin

Definition at line 37 of file confbridge.h.

◆ MAX_PROFILE_NAME

#define MAX_PROFILE_NAME   128

Maximum length of bridge/user/menu profile names

Definition at line 39 of file confbridge.h.

Enumeration Type Documentation

◆ bridge_profile_flags

Enumerator
BRIDGE_OPT_RECORD_CONFERENCE 

Set if the conference should be recorded

BRIDGE_OPT_VIDEO_SRC_LAST_MARKED 

Set if conference should feed video of last marked user to all participants.

BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED 

Set if conference should feed video of first marked user to all participants.

BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER 

Set if conference set the video feed to follow the loudest talker.

BRIDGE_OPT_RECORD_FILE_APPEND 

Set if the record file should be appended to between start/stops.

BRIDGE_OPT_RECORD_FILE_TIMESTAMP 

Set if the record file should have a timestamp appended

BRIDGE_OPT_BINAURAL_ACTIVE 

Set if binaural convolution is activated

BRIDGE_OPT_VIDEO_SRC_SFU 

Selective forwarding unit

BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE 

The average of all REMB reports is sent to the sender

BRIDGE_OPT_REMB_BEHAVIOR_LOWEST 

The lowest estimated maximum bitrate is sent to the sender

BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST 

The highest estimated maximum bitrate is sent to the sender

BRIDGE_OPT_ENABLE_EVENTS 

Enable sending events to participants

BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL 

The average of all REMB reports in the entire bridge is sent to each sender

BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL 

The lowest estimated maximum bitrate from all receivers is sent to each sender

BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL 

The highest estimated maximum bitrate from all receivers is sent to each sender

BRIDGE_OPT_REMB_BEHAVIOR_FORCE 

Force the REMB estimated bitrate to that specifiec in remb_estimated_bitrate

Definition at line 75 of file confbridge.h.

75  {
76  BRIDGE_OPT_RECORD_CONFERENCE = (1 << 0), /*!< Set if the conference should be recorded */
77  BRIDGE_OPT_VIDEO_SRC_LAST_MARKED = (1 << 1), /*!< Set if conference should feed video of last marked user to all participants. */
78  BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED = (1 << 2), /*!< Set if conference should feed video of first marked user to all participants. */
79  BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER = (1 << 3), /*!< Set if conference set the video feed to follow the loudest talker. */
80  BRIDGE_OPT_RECORD_FILE_APPEND = (1 << 4), /*!< Set if the record file should be appended to between start/stops. */
81  BRIDGE_OPT_RECORD_FILE_TIMESTAMP = (1 << 5), /*!< Set if the record file should have a timestamp appended */
82  BRIDGE_OPT_BINAURAL_ACTIVE = (1 << 6), /*!< Set if binaural convolution is activated */
83  BRIDGE_OPT_VIDEO_SRC_SFU = (1 << 7), /*!< Selective forwarding unit */
84  BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE = (1 << 8), /*!< The average of all REMB reports is sent to the sender */
85  BRIDGE_OPT_REMB_BEHAVIOR_LOWEST = (1 << 9), /*!< The lowest estimated maximum bitrate is sent to the sender */
86  BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST = (1 << 10), /*!< The highest estimated maximum bitrate is sent to the sender */
87  BRIDGE_OPT_ENABLE_EVENTS = (1 << 11), /*!< Enable sending events to participants */
88  BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL = (1 << 12), /*!< The average of all REMB reports in the entire bridge is sent to each sender */
89  BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL = (1 << 13), /*!< The lowest estimated maximum bitrate from all receivers is sent to each sender */
90  BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL = (1 << 14), /*!< The highest estimated maximum bitrate from all receivers is sent to each sender */
91  BRIDGE_OPT_REMB_BEHAVIOR_FORCE = (1 << 15), /*!< Force the REMB estimated bitrate to that specifiec in remb_estimated_bitrate */
92 };

◆ conf_menu_action_id

Enumerator
MENU_ACTION_TOGGLE_MUTE 
MENU_ACTION_PLAYBACK 
MENU_ACTION_PLAYBACK_AND_CONTINUE 
MENU_ACTION_INCREASE_LISTENING 
MENU_ACTION_DECREASE_LISTENING 
MENU_ACTION_RESET_LISTENING 
MENU_ACTION_RESET_TALKING 
MENU_ACTION_INCREASE_TALKING 
MENU_ACTION_DECREASE_TALKING 
MENU_ACTION_DIALPLAN_EXEC 
MENU_ACTION_ADMIN_TOGGLE_LOCK 
MENU_ACTION_ADMIN_KICK_LAST 
MENU_ACTION_LEAVE 
MENU_ACTION_NOOP 
MENU_ACTION_SET_SINGLE_VIDEO_SRC 
MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC 
MENU_ACTION_PARTICIPANT_COUNT 
MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS 
MENU_ACTION_TOGGLE_BINAURAL 

Definition at line 94 of file confbridge.h.

94  {
114 };

◆ conf_sounds

Enumerator
CONF_SOUND_HAS_JOINED 
CONF_SOUND_HAS_LEFT 
CONF_SOUND_KICKED 
CONF_SOUND_MUTED 
CONF_SOUND_UNMUTED 
CONF_SOUND_ONLY_ONE 
CONF_SOUND_THERE_ARE 
CONF_SOUND_OTHER_IN_PARTY 
CONF_SOUND_PLACE_IN_CONF 
CONF_SOUND_WAIT_FOR_LEADER 
CONF_SOUND_LEADER_HAS_LEFT 
CONF_SOUND_GET_PIN 
CONF_SOUND_INVALID_PIN 
CONF_SOUND_ONLY_PERSON 
CONF_SOUND_LOCKED 
CONF_SOUND_LOCKED_NOW 
CONF_SOUND_UNLOCKED_NOW 
CONF_SOUND_ERROR_MENU 
CONF_SOUND_JOIN 
CONF_SOUND_LEAVE 
CONF_SOUND_PARTICIPANTS_MUTED 
CONF_SOUND_PARTICIPANTS_UNMUTED 
CONF_SOUND_BEGIN 
CONF_SOUND_BINAURAL_ON 
CONF_SOUND_BINAURAL_OFF 

Definition at line 167 of file confbridge.h.

167  {
193 };

◆ user_profile_flags

Enumerator
USER_OPT_ADMIN 

Set if the caller is an administrator

USER_OPT_NOONLYPERSON 

Set if the "you are currently the only person in this conference" sound file should not be played

USER_OPT_MARKEDUSER 

Set if the caller is a marked user

USER_OPT_STARTMUTED 

Set if the caller should be initially set muted

USER_OPT_MUSICONHOLD 

Set if music on hold should be played if nobody else is in the conference bridge

USER_OPT_QUIET 

Set if no audio prompts should be played

USER_OPT_ANNOUNCEUSERCOUNT 

Set if the number of users should be announced to the caller

USER_OPT_WAITMARKED 

Set if the user must wait for a marked user before starting

USER_OPT_ENDMARKED 

Set if the user should be kicked after the last Marked user exits

USER_OPT_DENOISE 

Sets if denoise filter should be used on audio before mixing.

USER_OPT_ANNOUNCE_JOIN_LEAVE 

Sets if the user's name should be recorded and announced on join and leave.

USER_OPT_TALKER_DETECT 

Sets if start and stop talking events should generated for this user over AMI.

USER_OPT_DROP_SILENCE 

Sets if silence should be dropped from the mix or not.

USER_OPT_DTMF_PASS 

Sets if dtmf should be passed into the conference or not

USER_OPT_ANNOUNCEUSERCOUNTALL 

Sets if the number of users should be announced to everyone.

USER_OPT_JITTERBUFFER 

Places a jitterbuffer on the user.

USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW 

modifies ANNOUNCE_JOIN_LEAVE - user reviews the recording before continuing

USER_OPT_SEND_EVENTS 

Send text message events to users

USER_OPT_ECHO_EVENTS 

Send events only to the admin(s)

USER_OPT_TEXT_MESSAGING 

Send text messages to the user

USER_OPT_ANSWER_CHANNEL 

Sets if the channel should be answered if currently unanswered

Definition at line 51 of file confbridge.h.

51  {
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 };

Function Documentation

◆ async_play_sound_file()

int async_play_sound_file ( struct confbridge_conference conference,
const char *  filename,
struct ast_channel initiator 
)

Play sound file into conference bridge asynchronously.

If the initiator parameter is non-NULL, then the playback will wait for that initiator channel to get back in the bridge before playing the sound file. This way, the initiator has no danger of hearing a "clipped" file.

Parameters
conferenceThe conference bridge to play sound file into
filenameSound file to play
initiatorChannel that initiated playback.
Return values
0success
-1failure

Definition at line 2282 of file app_confbridge.c.

References async_play_sound_helper().

Referenced by action_toggle_mute_participants(), confbridge_exec(), and leave_marked().

2284 {
2285  return async_play_sound_helper(conference, filename, -1, initiator);
2286 }
static int async_play_sound_helper(struct confbridge_conference *conference, const char *filename, int say_number, struct ast_channel *initiator)

◆ async_play_sound_ready()

void async_play_sound_ready ( struct ast_channel chan)

Indicate the initiator of an async sound file is ready for it to play.

When playing an async sound file, the initiator is typically either out of the bridge or not in a position to hear the queued announcement. This function lets the announcement thread know that the initiator is now ready for the sound to play.

If an async announcement was queued and no initiator channel was provided, then this is a no-op

Parameters
chanThe channel that initiated the async announcement

Definition at line 2288 of file app_confbridge.c.

References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_cond_signal, ast_mutex_lock, ast_mutex_unlock, async_datastore_data::cond, ast_datastore::data, async_datastore_data::lock, NULL, and async_datastore_data::wait.

Referenced by conf_handle_dtmf(), confbridge_exec(), and join_callback().

2289 {
2290  struct ast_datastore *async_datastore;
2291  struct async_datastore_data *add;
2292 
2293  ast_channel_lock(chan);
2294  async_datastore = ast_channel_datastore_find(chan, &async_datastore_info, NULL);
2295  ast_channel_unlock(chan);
2296  if (!async_datastore) {
2297  return;
2298  }
2299 
2300  add = async_datastore->data;
2301 
2302  ast_mutex_lock(&add->lock);
2303  add->wait = 0;
2304  ast_cond_signal(&add->cond);
2305  ast_mutex_unlock(&add->lock);
2306 }
#define ast_channel_lock(chan)
Definition: channel.h:2945
#define ast_mutex_lock(a)
Definition: lock.h:187
Structure for a data store object.
Definition: datastore.h:68
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2404
#define NULL
Definition: resample.c:96
#define ast_cond_signal(cond)
Definition: lock.h:201
static struct ast_datastore_info async_datastore_info
Datastore used for timing of async announcement playback.
#define ast_channel_unlock(chan)
Definition: channel.h:2946
void * data
Definition: datastore.h:70
#define ast_mutex_unlock(a)
Definition: lock.h:188

◆ conf_add_post_join_action()

int conf_add_post_join_action ( struct confbridge_user user,
int(*)(struct confbridge_user *user func 
)

Queue a function to run with the given conference bridge user as an argument once the state transition is complete.

Parameters
userThe conference bridge user to pass to the function
funcThe function to queue
Return values
0success
non-zerofailure

Definition at line 1445 of file app_confbridge.c.

References ast_calloc, AST_LIST_INSERT_TAIL, post_join_action::func, post_join_action::list, and confbridge_user::post_join_list.

Referenced by conf_default_join_waitmarked(), join_marked(), join_unmarked(), and transition_to_marked().

1446 {
1447  struct post_join_action *action;
1448  if (!(action = ast_calloc(1, sizeof(*action)))) {
1449  return -1;
1450  }
1451  action->func = func;
1452  AST_LIST_INSERT_TAIL(&user->post_join_list, action, list);
1453  return 0;
1454 }
struct confbridge_user::@93 post_join_list
struct post_join_action::@92 list
int(* func)(struct confbridge_user *user)
Definition: confbridge.h:266
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:730
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204

◆ conf_add_user_active()

void conf_add_user_active ( struct confbridge_conference conference,
struct confbridge_user user 
)

Add a conference bridge user as an unmarked active user of the conference.

Parameters
conferenceThe conference bridge to add the user to
userThe conference bridge user to add to the conference

Definition at line 4303 of file app_confbridge.c.

References confbridge_conference::active_list, confbridge_conference::activeusers, and AST_LIST_INSERT_TAIL.

Referenced by join_active(), and join_unmarked().

4304 {
4305  AST_LIST_INSERT_TAIL(&conference->active_list, user, list);
4306  conference->activeusers++;
4307 }
struct post_join_action::@92 list
struct confbridge_conference::@90 active_list
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:730
unsigned int activeusers
Definition: confbridge.h:249

◆ conf_add_user_marked()

void conf_add_user_marked ( struct confbridge_conference conference,
struct confbridge_user user 
)

Add a conference bridge user as a marked active user of the conference.

Parameters
conferenceThe conference bridge to add the user to
userThe conference bridge user to add to the conference

Definition at line 4309 of file app_confbridge.c.

References confbridge_conference::active_list, confbridge_conference::activeusers, AST_LIST_INSERT_TAIL, and confbridge_conference::markedusers.

Referenced by join_marked().

4310 {
4311  AST_LIST_INSERT_TAIL(&conference->active_list, user, list);
4312  conference->activeusers++;
4313  conference->markedusers++;
4314 }
struct post_join_action::@92 list
unsigned int markedusers
Definition: confbridge.h:250
struct confbridge_conference::@90 active_list
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:730
unsigned int activeusers
Definition: confbridge.h:249

◆ conf_add_user_waiting()

void conf_add_user_waiting ( struct confbridge_conference conference,
struct confbridge_user user 
)

Add a conference bridge user as an waiting user of the conference.

Parameters
conferenceThe conference bridge to add the user to
userThe conference bridge user to add to the conference

Definition at line 4316 of file app_confbridge.c.

References AST_LIST_INSERT_TAIL, confbridge_conference::waiting_list, and confbridge_conference::waitingusers.

Referenced by conf_default_join_waitmarked().

4317 {
4318  AST_LIST_INSERT_TAIL(&conference->waiting_list, user, list);
4319  conference->waitingusers++;
4320 }
struct post_join_action::@92 list
unsigned int waitingusers
Definition: confbridge.h:251
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:730
struct confbridge_conference::@91 waiting_list

◆ conf_announce_channel_push()

int conf_announce_channel_push ( struct ast_channel ast)

Push the announcer channel into the conference.

Since
12.0.0
Parameters
astEither channel in the announcer channel pair.
Return values
0on success.
-1on error.

Definition at line 144 of file conf_chan_announce.c.

References ao2_cleanup, ao2_lock, ao2_ref, ao2_unlock, AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE, ast_bridge_features_new(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_INDEPENDENT, ast_channel_tech_pvt(), ast_set_flag, AST_UNREAL_CARETAKER_THREAD, ast_bridge_features::feature_flags, lock, NULL, RAII_VAR, and SCOPED_CHANNELLOCK.

Referenced by push_announcer().

145 {
146  struct ast_bridge_features *features;
147  struct ast_channel *chan;
148  RAII_VAR(struct announce_pvt *, p, NULL, ao2_cleanup);
149 
150  {
151  SCOPED_CHANNELLOCK(lock, ast);
152 
153  p = ast_channel_tech_pvt(ast);
154  if (!p) {
155  return -1;
156  }
157  ao2_ref(p, +1);
158  chan = p->base.chan;
159  if (!chan) {
160  return -1;
161  }
162  }
163 
164  features = ast_bridge_features_new();
165  if (!features) {
166  return -1;
167  }
169 
170  /* Impart the output channel into the bridge */
171  if (ast_bridge_impart(p->bridge, chan, NULL, features,
173  return -1;
174  }
175  ao2_lock(p);
177  ao2_unlock(p);
178  return 0;
179 }
Main Channel structure associated with a channel.
Structure that contains features information.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
#define ast_set_flag(p, flag)
Definition: utils.h:70
#define AST_UNREAL_CARETAKER_THREAD
Definition: core_unreal.h:107
#define ao2_unlock(a)
Definition: astobj2.h:730
#define NULL
Definition: resample.c:96
struct ast_flags feature_flags
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
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
Definition: lock.h:617
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:911
ast_mutex_t lock
Definition: app_meetme.c:1091
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_lock(a)
Definition: astobj2.h:718
struct ast_bridge_features * ast_bridge_features_new(void)
Allocate a new bridge features struct.
Definition: bridge.c:3750
#define ao2_cleanup(obj)
Definition: astobj2.h:1958

◆ conf_announce_get_tech()

struct ast_channel_tech* conf_announce_get_tech ( void  )

Get ConfBridge announce channel technology struct.

Since
12.0.0
Returns
ConfBridge announce channel technology.

Definition at line 139 of file conf_chan_announce.c.

References announce_tech.

Referenced by announce_request(), load_module(), and unload_module().

140 {
141  return &announce_tech;
142 }
static struct ast_channel_tech announce_tech

◆ conf_bridge_profile_copy()

void conf_bridge_profile_copy ( struct bridge_profile dst,
struct bridge_profile src 
)

copies a bridge profile

Note
conf_bridge_profile_destroy must be called on the dst structure

Definition at line 2523 of file conf_config_parser.c.

References ao2_ref, and bridge_profile::sounds.

Referenced by conf_find_bridge_profile(), and join_conference_bridge().

2524 {
2525  *dst = *src;
2526  if (src->sounds) {
2527  ao2_ref(src->sounds, +1);
2528  }
2529 }
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
#define ao2_ref(o, delta)
Definition: astobj2.h:464

◆ conf_bridge_profile_destroy()

void conf_bridge_profile_destroy ( struct bridge_profile b_profile)

Destroy a bridge profile found by 'conf_find_bridge_profile'.

Definition at line 2531 of file conf_config_parser.c.

References ao2_ref, NULL, and bridge_profile::sounds.

Referenced by confbridge_exec(), destroy_conference_bridge(), func_confbridge_data_destructor(), func_confbridge_helper(), and handle_cli_confbridge_show_bridge_profile().

2532 {
2533  if (b_profile->sounds) {
2534  ao2_ref(b_profile->sounds, -1);
2535  b_profile->sounds = NULL;
2536  }
2537 }
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
#define NULL
Definition: resample.c:96
#define ao2_ref(o, delta)
Definition: astobj2.h:464

◆ conf_destroy_config()

void conf_destroy_config ( void  )

destroy the information loaded from the confbridge.conf file

Definition at line 2694 of file conf_config_parser.c.

References aco_info_destroy(), ao2_global_obj_release, ARRAY_LEN, ast_cli_unregister_multiple(), and cfg_handle.

Referenced by conf_load_config(), and unload_module().

2695 {
2697  aco_info_destroy(&cfg_info);
2699 }
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
static struct ast_cli_entry cli_confbridge_parser[]
#define ao2_global_obj_release(holder)
Definition: astobj2.h:865
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284

◆ conf_ended()

void conf_ended ( struct confbridge_conference conference)

Callback to be called when the conference has become empty.

Parameters
conferenceThe conference bridge

Definition at line 1473 of file app_confbridge.c.

References ao2_lock, ao2_unlink, ao2_unlock, ast_context_remove_extension(), ast_strlen_zero, confbridge_conference::b_profile, conf_stop_record(), E_MATCH, confbridge_conference::name, NULL, pbx_find_extension(), bridge_profile::regcontext, send_conf_end_event(), and pbx_find_info::stacklen.

Referenced by transition_to_empty().

1474 {
1475  struct pbx_find_info q = { .stacklen = 0 };
1476 
1477  /* Called with a reference to conference */
1478  ao2_unlink(conference_bridges, conference);
1479  send_conf_end_event(conference);
1480  if (!ast_strlen_zero(conference->b_profile.regcontext) &&
1481  pbx_find_extension(NULL, NULL, &q, conference->b_profile.regcontext,
1482  conference->name, 1, NULL, "", E_MATCH)) {
1484  conference->name, 1, NULL);
1485  }
1486  ao2_lock(conference);
1487  conf_stop_record(conference);
1488  ao2_unlock(conference);
1489 }
static void send_conf_end_event(struct confbridge_conference *conference)
static int conf_stop_record(struct confbridge_conference *conference)
#define ao2_unlock(a)
Definition: astobj2.h:730
#define NULL
Definition: resample.c:96
int ast_context_remove_extension(const char *context, const char *extension, int priority, const char *registrar)
Simply remove extension from context.
Definition: pbx.c:4952
struct bridge_profile b_profile
Definition: confbridge.h:248
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ao2_lock(a)
Definition: astobj2.h:718
struct ao2_container * conference_bridges
Container to hold all conference bridges in progress.
#define ao2_unlink(container, obj)
Definition: astobj2.h:1598
int stacklen
Definition: extconf.h:238
char regcontext[AST_MAX_CONTEXT]
Definition: confbridge.h:237
char name[MAX_CONF_NAME]
Definition: confbridge.h:245
struct ast_exten * pbx_find_extension(struct ast_channel *chan, struct ast_context *bypass, struct pbx_find_info *q, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action)
Definition: ael_main.c:152

◆ conf_find_bridge()

struct confbridge_conference* conf_find_bridge ( const char *  conference_name)

Find a confbridge by name.

Since
13.22.0
15.5.0
Parameters
confbridge_nameThe name to search for
Returns
ConfBridge (which must be unreffed) or NULL.

Definition at line 787 of file app_confbridge.c.

References ao2_find, and OBJ_KEY.

Referenced by confbridge_publish_manager_event().

788 {
789  return ao2_find(conference_bridges, conference_name, OBJ_KEY);
790 }
#define OBJ_KEY
Definition: astobj2.h:1155
struct ao2_container * conference_bridges
Container to hold all conference bridges in progress.
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756

◆ conf_find_bridge_profile()

const struct bridge_profile* conf_find_bridge_profile ( struct ast_channel chan,
const char *  bridge_profile_name,
struct bridge_profile result 
)

Find a bridge profile given a bridge profile's name and store that profile in result structure.

Parameters
chanchannel the bridge profile is requested for
bridge_profile_namename of the profile requested (optional)
resultdata contained by the bridge profile will be copied to this struct pointer

If bridge_profile_name is not provided, this function will check for the presence of a bridge profile set by the CONFBRIDGE function on a channel datastore. If that doesn't exist, the default_bridge profile is used.

Return values
bridgeprofile on success
NULLon failure

Definition at line 2539 of file conf_config_parser.c.

References ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_lock, ao2_ref, ao2_unlock, ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_strlen_zero, func_confbridge_data::b_profile, func_confbridge_data::b_usable, cfg_handle, conf_bridge_profile_copy(), ast_datastore::data, DEFAULT_BRIDGE_PROFILE, NULL, OBJ_KEY, RAII_VAR, and result.

Referenced by bridge_template_handler(), confbridge_exec(), and handle_cli_confbridge_show_bridge_profile().

2540 {
2541  struct bridge_profile *tmp2;
2542  struct ast_datastore *datastore = NULL;
2543  struct func_confbridge_data *b_data = NULL;
2545 
2546  if (chan && ast_strlen_zero(bridge_profile_name)) {
2547  ast_channel_lock(chan);
2549  ast_channel_unlock(chan);
2550  if (datastore) {
2551  b_data = datastore->data;
2552  if (b_data->b_usable) {
2553  conf_bridge_profile_copy(result, &b_data->b_profile);
2554  return result;
2555  }
2556  }
2557  }
2558 
2559  if (!cfg) {
2560  return NULL;
2561  }
2562  if (ast_strlen_zero(bridge_profile_name)) {
2563  bridge_profile_name = DEFAULT_BRIDGE_PROFILE;
2564  }
2565  if (!(tmp2 = ao2_find(cfg->bridge_profiles, bridge_profile_name, OBJ_KEY))) {
2566  return NULL;
2567  }
2568  ao2_lock(tmp2);
2569  conf_bridge_profile_copy(result, tmp2);
2570  ao2_unlock(tmp2);
2571  ao2_ref(tmp2, -1);
2572 
2573  return result;
2574 }
#define ast_channel_lock(chan)
Definition: channel.h:2945
#define OBJ_KEY
Definition: astobj2.h:1155
struct bridge_profile b_profile
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
#define ao2_unlock(a)
Definition: astobj2.h:730
Structure for a data store object.
Definition: datastore.h:68
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2404
#define NULL
Definition: resample.c:96
#define ast_strlen_zero(foo)
Definition: strings.h:52
void conf_bridge_profile_copy(struct bridge_profile *dst, struct bridge_profile *src)
copies a bridge profile
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:911
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_lock(a)
Definition: astobj2.h:718
static const struct ast_datastore_info confbridge_datastore
#define ast_channel_unlock(chan)
Definition: channel.h:2946
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
void * data
Definition: datastore.h:70
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
static PGresult * result
Definition: cel_pgsql.c:88
#define DEFAULT_BRIDGE_PROFILE
Definition: confbridge.h:42

◆ conf_find_menu_entry_by_sequence()

int conf_find_menu_entry_by_sequence ( const char *  dtmf_sequence,
struct conf_menu menu,
struct conf_menu_entry result 
)

Finds a menu_entry in a menu structure matched by DTMF sequence.

Note
the menu entry found must be destroyed using conf_menu_entry_destroy()
Return values
1success, entry is found and stored in result
0failure, no entry found for given DTMF sequence

Definition at line 2610 of file conf_config_parser.c.

References ao2_lock, ao2_unlock, AST_LIST_TRAVERSE, copy_menu_entry(), conf_menu_entry::dtmf, conf_menu::entries, and NULL.

Referenced by action_playback_and_continue().

2611 {
2612  struct conf_menu_entry *menu_entry = NULL;
2613 
2614  ao2_lock(menu);
2615  AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2616  if (!strcasecmp(menu_entry->dtmf, dtmf_sequence)) {
2617  copy_menu_entry(result, menu_entry);
2618  ao2_unlock(menu);
2619  return 1;
2620  }
2621  }
2622  ao2_unlock(menu);
2623 
2624  return 0;
2625 }
Definition: confbridge.h:136
#define ao2_unlock(a)
Definition: astobj2.h:730
#define NULL
Definition: resample.c:96
char dtmf[MAXIMUM_DTMF_FEATURE_STRING]
Definition: confbridge.h:138
static int copy_menu_entry(struct conf_menu_entry *dst, struct conf_menu_entry *src)
#define ao2_lock(a)
Definition: astobj2.h:718
struct conf_menu::@89 entries
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
Definition: search.h:40

◆ conf_find_user_profile()

const struct user_profile* conf_find_user_profile ( struct ast_channel chan,
const char *  user_profile_name,
struct user_profile result 
)

find a user profile given a user profile's name and store that profile in result structure.

Parameters
chanchannel the user profile is requested for
user_profile_namename of the profile requested (optional)
resultdata contained by the user profile will be copied to this struct pointer

If user_profile_name is not provided, this function will check for the presence of a user profile set by the CONFBRIDGE function on a channel datastore. If that doesn't exist, the default_user profile is used.

Return values
userprofile on success
NULLon failure

Definition at line 2486 of file conf_config_parser.c.

References ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_lock, ao2_ref, ao2_unlock, ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_strlen_zero, cfg_handle, conf_user_profile_copy(), ast_datastore::data, DEFAULT_USER_PROFILE, NULL, OBJ_KEY, RAII_VAR, result, func_confbridge_data::u_profile, and func_confbridge_data::u_usable.

Referenced by conf_send_event_to_participants(), confbridge_exec(), handle_cli_confbridge_show_user_profile(), and user_template_handler().

2487 {
2488  struct user_profile *tmp2;
2489  struct ast_datastore *datastore = NULL;
2490  struct func_confbridge_data *b_data = NULL;
2492 
2493  if (chan && ast_strlen_zero(user_profile_name)) {
2494  ast_channel_lock(chan);
2496  ast_channel_unlock(chan);
2497  if (datastore) {
2498  b_data = datastore->data;
2499  if (b_data->u_usable) {
2500  conf_user_profile_copy(result, &b_data->u_profile);
2501  return result;
2502  }
2503  }
2504  }
2505 
2506  if (!cfg) {
2507  return NULL;
2508  }
2509  if (ast_strlen_zero(user_profile_name)) {
2510  user_profile_name = DEFAULT_USER_PROFILE;
2511  }
2512  if (!(tmp2 = ao2_find(cfg->user_profiles, user_profile_name, OBJ_KEY))) {
2513  return NULL;
2514  }
2515  ao2_lock(tmp2);
2516  conf_user_profile_copy(result, tmp2);
2517  ao2_unlock(tmp2);
2518  ao2_ref(tmp2, -1);
2519 
2520  return result;
2521 }
#define ast_channel_lock(chan)
Definition: channel.h:2945
struct user_profile u_profile
#define OBJ_KEY
Definition: astobj2.h:1155
static void conf_user_profile_copy(struct user_profile *dst, struct user_profile *src)
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
#define ao2_unlock(a)
Definition: astobj2.h:730
Structure for a data store object.
Definition: datastore.h:68
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2404
#define NULL
Definition: resample.c:96
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:911
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_lock(a)
Definition: astobj2.h:718
static const struct ast_datastore_info confbridge_datastore
#define ast_channel_unlock(chan)
Definition: channel.h:2946
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
void * data
Definition: datastore.h:70
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
static PGresult * result
Definition: cel_pgsql.c:88
#define DEFAULT_USER_PROFILE
Definition: confbridge.h:41

◆ conf_get_sound()

const char* conf_get_sound ( enum conf_sounds  sound,
struct bridge_profile_sounds custom_sounds 
)

Looks to see if sound file is stored in bridge profile sounds, if not default sound is provided.

Definition at line 526 of file app_confbridge.c.

References bridge_profile_sounds::begin, bridge_profile_sounds::binauraloff, bridge_profile_sounds::binauralon, CONF_SOUND_BEGIN, CONF_SOUND_BINAURAL_OFF, CONF_SOUND_BINAURAL_ON, CONF_SOUND_ERROR_MENU, CONF_SOUND_GET_PIN, CONF_SOUND_HAS_JOINED, CONF_SOUND_HAS_LEFT, CONF_SOUND_INVALID_PIN, CONF_SOUND_JOIN, CONF_SOUND_KICKED, CONF_SOUND_LEADER_HAS_LEFT, CONF_SOUND_LEAVE, CONF_SOUND_LOCKED, CONF_SOUND_LOCKED_NOW, CONF_SOUND_MUTED, CONF_SOUND_ONLY_ONE, CONF_SOUND_ONLY_PERSON, CONF_SOUND_OTHER_IN_PARTY, CONF_SOUND_PARTICIPANTS_MUTED, CONF_SOUND_PARTICIPANTS_UNMUTED, CONF_SOUND_PLACE_IN_CONF, CONF_SOUND_THERE_ARE, CONF_SOUND_UNLOCKED_NOW, CONF_SOUND_UNMUTED, CONF_SOUND_WAIT_FOR_LEADER, bridge_profile_sounds::errormenu, bridge_profile_sounds::getpin, bridge_profile_sounds::hasjoin, bridge_profile_sounds::hasleft, bridge_profile_sounds::invalidpin, bridge_profile_sounds::join, bridge_profile_sounds::kicked, bridge_profile_sounds::leaderhasleft, bridge_profile_sounds::leave, bridge_profile_sounds::locked, bridge_profile_sounds::lockednow, bridge_profile_sounds::muted, bridge_profile_sounds::onlyone, bridge_profile_sounds::onlyperson, bridge_profile_sounds::otherinparty, bridge_profile_sounds::participantsmuted, bridge_profile_sounds::participantsunmuted, bridge_profile_sounds::placeintoconf, S_OR, bridge_profile_sounds::thereare, bridge_profile_sounds::unlockednow, bridge_profile_sounds::unmuted, and bridge_profile_sounds::waitforleader.

Referenced by action_kick_last(), action_toggle_binaural(), action_toggle_mute(), action_toggle_mute_participants(), announce_user_count(), conf_get_pin(), conf_handle_inactive_waitmarked(), conf_handle_only_person(), confbridge_exec(), execute_menu_entry(), handle_cli_confbridge_show_bridge_profile(), join_conference_bridge(), leave_marked(), and post_join_play_begin().

527 {
528  switch (sound) {
530  return S_OR(custom_sounds->hasjoin, "conf-hasjoin");
531  case CONF_SOUND_HAS_LEFT:
532  return S_OR(custom_sounds->hasleft, "conf-hasleft");
533  case CONF_SOUND_KICKED:
534  return S_OR(custom_sounds->kicked, "conf-kicked");
535  case CONF_SOUND_MUTED:
536  return S_OR(custom_sounds->muted, "conf-muted");
537  case CONF_SOUND_UNMUTED:
538  return S_OR(custom_sounds->unmuted, "conf-unmuted");
540  return S_OR(custom_sounds->binauralon, "confbridge-binaural-on");
542  return S_OR(custom_sounds->binauraloff, "confbridge-binaural-off");
543  case CONF_SOUND_ONLY_ONE:
544  return S_OR(custom_sounds->onlyone, "conf-onlyone");
546  return S_OR(custom_sounds->thereare, "conf-thereare");
548  return S_OR(custom_sounds->otherinparty, "conf-otherinparty");
550  return S_OR(custom_sounds->placeintoconf, "conf-placeintoconf");
552  return S_OR(custom_sounds->waitforleader, "conf-waitforleader");
554  return S_OR(custom_sounds->leaderhasleft, "conf-leaderhasleft");
555  case CONF_SOUND_GET_PIN:
556  return S_OR(custom_sounds->getpin, "conf-getpin");
558  return S_OR(custom_sounds->invalidpin, "conf-invalidpin");
560  return S_OR(custom_sounds->onlyperson, "conf-onlyperson");
561  case CONF_SOUND_LOCKED:
562  return S_OR(custom_sounds->locked, "conf-locked");
564  return S_OR(custom_sounds->lockednow, "conf-lockednow");
566  return S_OR(custom_sounds->unlockednow, "conf-unlockednow");
568  return S_OR(custom_sounds->errormenu, "conf-errormenu");
569  case CONF_SOUND_JOIN:
570  return S_OR(custom_sounds->join, "confbridge-join");
571  case CONF_SOUND_LEAVE:
572  return S_OR(custom_sounds->leave, "confbridge-leave");
574  return S_OR(custom_sounds->participantsmuted, "conf-now-muted");
576  return S_OR(custom_sounds->participantsunmuted, "conf-now-unmuted");
577  case CONF_SOUND_BEGIN:
578  return S_OR(custom_sounds->begin, "confbridge-conf-begin");
579  }
580 
581  return "";
582 }
const ast_string_field unlockednow
Definition: confbridge.h:222
const ast_string_field thereare
Definition: confbridge.h:222
const ast_string_field join
Definition: confbridge.h:222
const ast_string_field otherinparty
Definition: confbridge.h:222
const ast_string_field onlyone
Definition: confbridge.h:222
const ast_string_field hasjoin
Definition: confbridge.h:222
const ast_string_field begin
Definition: confbridge.h:222
const ast_string_field errormenu
Definition: confbridge.h:222
const ast_string_field binauraloff
Definition: confbridge.h:222
const ast_string_field waitforleader
Definition: confbridge.h:222
const ast_string_field getpin
Definition: confbridge.h:222
const ast_string_field participantsmuted
Definition: confbridge.h:222
const ast_string_field leave
Definition: confbridge.h:222
const ast_string_field lockednow
Definition: confbridge.h:222
const ast_string_field binauralon
Definition: confbridge.h:222
const ast_string_field participantsunmuted
Definition: confbridge.h:222
const ast_string_field unmuted
Definition: confbridge.h:222
const ast_string_field invalidpin
Definition: confbridge.h:222
const ast_string_field onlyperson
Definition: confbridge.h:222
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
Definition: strings.h:79
const ast_string_field muted
Definition: confbridge.h:222
const ast_string_field leaderhasleft
Definition: confbridge.h:222
const ast_string_field kicked
Definition: confbridge.h:222
const ast_string_field locked
Definition: confbridge.h:222
const ast_string_field placeintoconf
Definition: confbridge.h:222
const ast_string_field hasleft
Definition: confbridge.h:222

◆ conf_handle_dtmf()

int conf_handle_dtmf ( struct ast_bridge_channel bridge_channel,
struct confbridge_user user,
struct conf_menu_entry menu_entry,
struct conf_menu menu 
)

Once a DTMF sequence matches a sequence in the user's DTMF menu, this function will get called to perform the menu action.

Parameters
bridge_channelBridged channel this is involving
userthe conference user to perform the action on.
menu_entrythe menu entry that invoked this callback to occur.
menuan AO2 referenced pointer to the entire menu structure the menu_entry derived from.
Note
The menu_entry is a deep copy of the entry found in the menu structure. This allows for the menu_entry to be accessed without requiring the menu lock. If the menu must be accessed, the menu lock must be held. Reference counting of the menu structure is handled outside of the scope of this function.
Return values
0success
-1failure

Definition at line 3214 of file app_confbridge.c.

References async_play_sound_ready(), ast_bridge_channel::chan, conf_moh_suspend(), conf_moh_unsuspend(), confbridge_user::conference, and execute_menu_entry().

Referenced by menu_hook_callback().

3218 {
3219  /* See if music on hold is playing */
3220  conf_moh_suspend(user);
3221 
3222  /* execute the list of actions associated with this menu entry */
3223  execute_menu_entry(user->conference, user, bridge_channel, menu_entry, menu);
3224 
3225  /* See if music on hold needs to be started back up again */
3226  conf_moh_unsuspend(user);
3227 
3228  async_play_sound_ready(bridge_channel->chan);
3229 
3230  return 0;
3231 }
static void conf_moh_unsuspend(struct confbridge_user *user)
static void conf_moh_suspend(struct confbridge_user *user)
struct confbridge_conference * conference
Definition: confbridge.h:272
void async_play_sound_ready(struct ast_channel *chan)
Indicate the initiator of an async sound file is ready for it to play.
static int execute_menu_entry(struct confbridge_conference *conference, struct confbridge_user *user, struct ast_bridge_channel *bridge_channel, struct conf_menu_entry *menu_entry, struct conf_menu *menu)
struct ast_channel * chan

◆ conf_handle_first_join()

void conf_handle_first_join ( struct confbridge_conference conference)

Callback to execute any time we transition from zero to one active users.

Parameters
conferenceThe conference bridge with a single active user joined
Return values
0success
-1failure

Definition at line 1457 of file app_confbridge.c.

References AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, ast_devstate_changed(), and confbridge_conference::name.

Referenced by join_marked(), join_unmarked(), and join_waitmarked().

1458 {
1459  ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, "confbridge:%s", conference->name);
1460 }
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
Definition: devicestate.c:510
char name[MAX_CONF_NAME]
Definition: confbridge.h:245

◆ conf_handle_inactive_waitmarked()

int conf_handle_inactive_waitmarked ( struct confbridge_user user)

Handle actions every time a waitmarked user joins w/o a marked user present.

Parameters
userThe waitmarked user
Return values
0success
-1failure

Definition at line 1421 of file app_confbridge.c.

References ast_test_flag, confbridge_conference::b_profile, conf_get_sound(), CONF_SOUND_WAIT_FOR_LEADER, confbridge_user::conference, play_prompt_to_user(), bridge_profile::sounds, confbridge_user::u_profile, and USER_OPT_QUIET.

Referenced by conf_default_join_waitmarked().

1422 {
1423  /* If we have not been quieted play back that they are waiting for the leader */
1426  /* user hungup while the sound was playing */
1427  return -1;
1428  }
1429  return 0;
1430 }
struct confbridge_conference * conference
Definition: confbridge.h:272
const char * conf_get_sound(enum conf_sounds sound, struct bridge_profile_sounds *custom_sounds)
Looks to see if sound file is stored in bridge profile sounds, if not default sound is provided...
#define ast_test_flag(p, flag)
Definition: utils.h:63
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
struct bridge_profile b_profile
Definition: confbridge.h:248
struct user_profile u_profile
Definition: confbridge.h:274
static int play_prompt_to_user(struct confbridge_user *user, const char *filename)
Play back an audio file to a channel.

◆ conf_handle_only_person()

int conf_handle_only_person ( struct confbridge_user user)

Handle actions whenever an user joins an empty conference.

Parameters
userThe user

Definition at line 1432 of file app_confbridge.c.

References ast_test_flag, confbridge_conference::b_profile, conf_get_sound(), CONF_SOUND_ONLY_PERSON, confbridge_user::conference, play_prompt_to_user(), bridge_profile::sounds, confbridge_user::u_profile, USER_OPT_NOONLYPERSON, and USER_OPT_QUIET.

Referenced by join_marked(), and join_unmarked().

1433 {
1434  /* If audio prompts have not been quieted or this prompt quieted play it on out */
1436  if (play_prompt_to_user(user,
1438  /* user hungup while the sound was playing */
1439  return -1;
1440  }
1441  }
1442  return 0;
1443 }
struct confbridge_conference * conference
Definition: confbridge.h:272
const char * conf_get_sound(enum conf_sounds sound, struct bridge_profile_sounds *custom_sounds)
Looks to see if sound file is stored in bridge profile sounds, if not default sound is provided...
#define ast_test_flag(p, flag)
Definition: utils.h:63
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
struct bridge_profile b_profile
Definition: confbridge.h:248
struct user_profile u_profile
Definition: confbridge.h:274
static int play_prompt_to_user(struct confbridge_user *user, const char *filename)
Play back an audio file to a channel.

◆ conf_handle_second_active()

void conf_handle_second_active ( struct confbridge_conference conference)

Handle when a conference moves to having more than one active participant.

Parameters
conferenceThe conference bridge with more than one active participant

Definition at line 1462 of file app_confbridge.c.

References confbridge_conference::active_list, AST_LIST_FIRST, ast_test_flag, conf_moh_stop(), conf_update_user_mute(), confbridge_user::u_profile, and USER_OPT_MUSICONHOLD.

Referenced by join_active(), join_marked(), and join_unmarked().

1463 {
1464  /* If we are the second participant we may need to stop music on hold on the first */
1465  struct confbridge_user *first_user = AST_LIST_FIRST(&conference->active_list);
1466 
1467  if (ast_test_flag(&first_user->u_profile, USER_OPT_MUSICONHOLD)) {
1468  conf_moh_stop(first_user);
1469  }
1470  conf_update_user_mute(first_user);
1471 }
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
Definition: linkedlists.h:420
#define ast_test_flag(p, flag)
Definition: utils.h:63
void conf_update_user_mute(struct confbridge_user *user)
Update the actual mute status of the user and set it on the bridge.
struct confbridge_conference::@90 active_list
void conf_moh_stop(struct confbridge_user *user)
Stop MOH for the conference user.
The structure that represents a conference bridge user.
Definition: confbridge.h:271
struct user_profile u_profile
Definition: confbridge.h:274

◆ conf_load_config()

int conf_load_config ( void  )

load confbridge.conf file

Definition at line 2384 of file conf_config_parser.c.

References __stringify, ACO_EXACT, aco_info_init(), aco_option_register, aco_option_register_custom, ACO_PREFIX, aco_process_config(), ACO_PROCESS_ERROR, ACO_REGEX, announce_user_count_all_handler(), ARRAY_LEN, ast_cli_register_multiple, BRIDGE_OPT_BINAURAL_ACTIVE, BRIDGE_OPT_ENABLE_EVENTS, BRIDGE_OPT_RECORD_CONFERENCE, BRIDGE_OPT_RECORD_FILE_APPEND, BRIDGE_OPT_RECORD_FILE_TIMESTAMP, bridge_template_handler(), CHARFLDSET, conf_destroy_config(), DEFAULT_SILENCE_THRESHOLD, DEFAULT_TALKING_THRESHOLD, error(), FLDSET, language, menu_option_handler(), menu_template_handler(), mix_interval_handler(), NULL, OPT_BOOLFLAG_T, OPT_CHAR_ARRAY_T, OPT_NOOP_T, OPT_UINT_T, PARSE_DEFAULT, regcontext, remb_behavior_handler(), sound_option_handler(), timeout, USER_OPT_ADMIN, USER_OPT_ANNOUNCE_JOIN_LEAVE, USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW, USER_OPT_ANNOUNCEUSERCOUNT, USER_OPT_ANSWER_CHANNEL, USER_OPT_DENOISE, USER_OPT_DROP_SILENCE, USER_OPT_DTMF_PASS, USER_OPT_ECHO_EVENTS, USER_OPT_ENDMARKED, USER_OPT_JITTERBUFFER, USER_OPT_MARKEDUSER, USER_OPT_MUSICONHOLD, USER_OPT_NOONLYPERSON, USER_OPT_QUIET, USER_OPT_SEND_EVENTS, USER_OPT_STARTMUTED, USER_OPT_TALKER_DETECT, USER_OPT_TEXT_MESSAGING, USER_OPT_WAITMARKED, user_template_handler(), and video_mode_handler().

Referenced by load_module().

2385 {
2386  if (aco_info_init(&cfg_info)) {
2387  return -1;
2388  }
2389 
2390  /* User options */
2391  aco_option_register(&cfg_info, "type", ACO_EXACT, user_types, NULL, OPT_NOOP_T, 0, 0);
2392  aco_option_register(&cfg_info, "admin", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ADMIN);
2393  aco_option_register(&cfg_info, "send_events", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_SEND_EVENTS);
2394  aco_option_register(&cfg_info, "echo_events", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ECHO_EVENTS);
2395  aco_option_register(&cfg_info, "marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_MARKEDUSER);
2396  aco_option_register(&cfg_info, "startmuted", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_STARTMUTED);
2397  aco_option_register(&cfg_info, "music_on_hold_when_empty", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_MUSICONHOLD);
2398  aco_option_register(&cfg_info, "quiet", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_QUIET);
2399  aco_option_register_custom(&cfg_info, "announce_user_count_all", ACO_EXACT, user_types, "no", announce_user_count_all_handler, 0);
2400  aco_option_register(&cfg_info, "announce_user_count", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANNOUNCEUSERCOUNT);
2401  /* Negative logic. Defaults to "yes" and evaluates with ast_false(). If !ast_false(), USER_OPT_NOONLYPERSON is cleared */
2402  aco_option_register(&cfg_info, "announce_only_user", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 0, FLDSET(struct user_profile, flags), USER_OPT_NOONLYPERSON);
2403  aco_option_register(&cfg_info, "wait_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_WAITMARKED);
2404  aco_option_register(&cfg_info, "end_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ENDMARKED);
2405  aco_option_register(&cfg_info, "talk_detection_events", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_TALKER_DETECT);
2406  aco_option_register(&cfg_info, "dtmf_passthrough", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DTMF_PASS);
2407  aco_option_register(&cfg_info, "announce_join_leave", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANNOUNCE_JOIN_LEAVE);
2408  aco_option_register(&cfg_info, "announce_join_leave_review", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW);
2409  aco_option_register(&cfg_info, "pin", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, pin));
2410  aco_option_register(&cfg_info, "music_on_hold_class", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, moh_class));
2411  aco_option_register(&cfg_info, "announcement", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, announcement));
2412  aco_option_register(&cfg_info, "denoise", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DENOISE);
2413  aco_option_register(&cfg_info, "dsp_drop_silence", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DROP_SILENCE);
2414  aco_option_register(&cfg_info, "dsp_silence_threshold", ACO_EXACT, user_types, __stringify(DEFAULT_SILENCE_THRESHOLD), OPT_UINT_T, 0, FLDSET(struct user_profile, silence_threshold));
2415  aco_option_register(&cfg_info, "dsp_talking_threshold", ACO_EXACT, user_types, __stringify(DEFAULT_TALKING_THRESHOLD), OPT_UINT_T, 0, FLDSET(struct user_profile, talking_threshold));
2416  aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_JITTERBUFFER);
2417  aco_option_register(&cfg_info, "timeout", ACO_EXACT, user_types, "0", OPT_UINT_T, 0, FLDSET(struct user_profile, timeout));
2418  aco_option_register(&cfg_info, "text_messaging", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_TEXT_MESSAGING);
2419  aco_option_register(&cfg_info, "answer_channel", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANSWER_CHANNEL);
2420 
2421  /* This option should only be used with the CONFBRIDGE dialplan function */
2423 
2424 /* XXX ASTERISK-21271 need a user supplied bridge merge_priority to merge ConfBridges (default = 1, range 1-INT_MAX) */
2425  /* Bridge options */
2426  aco_option_register(&cfg_info, "type", ACO_EXACT, bridge_types, NULL, OPT_NOOP_T, 0, 0);
2427  aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), USER_OPT_JITTERBUFFER);
2428  /* "auto" will fail to parse as a uint, but we use PARSE_DEFAULT to set the value to 0 in that case, which is the value that auto resolves to */
2429  aco_option_register(&cfg_info, "internal_sample_rate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, PARSE_DEFAULT, FLDSET(struct bridge_profile, internal_sample_rate), 0);
2430  aco_option_register(&cfg_info, "binaural_active", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_BINAURAL_ACTIVE);
2431  aco_option_register(&cfg_info, "maximum_sample_rate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, PARSE_DEFAULT, FLDSET(struct bridge_profile, maximum_sample_rate), 0);
2432  aco_option_register_custom(&cfg_info, "mixing_interval", ACO_EXACT, bridge_types, "20", mix_interval_handler, 0);
2433  aco_option_register(&cfg_info, "record_conference", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_CONFERENCE);
2435  aco_option_register(&cfg_info, "record_file_append", ACO_EXACT, bridge_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_FILE_APPEND);
2436  aco_option_register(&cfg_info, "record_file_timestamp", ACO_EXACT, bridge_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_FILE_TIMESTAMP);
2437  aco_option_register(&cfg_info, "max_members", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, max_members));
2438  aco_option_register(&cfg_info, "record_file", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_file));
2439  aco_option_register(&cfg_info, "record_options", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_options));
2440  aco_option_register(&cfg_info, "record_command", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_command));
2442  aco_option_register(&cfg_info, "language", ACO_EXACT, bridge_types, "en", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, language));
2444  aco_option_register(&cfg_info, "video_update_discard", ACO_EXACT, bridge_types, "2000", OPT_UINT_T, 0, FLDSET(struct bridge_profile, video_update_discard));
2445  aco_option_register(&cfg_info, "remb_send_interval", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_send_interval));
2446  aco_option_register_custom(&cfg_info, "remb_behavior", ACO_EXACT, bridge_types, "average", remb_behavior_handler, 0);
2447  aco_option_register(&cfg_info, "remb_estimated_bitrate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_estimated_bitrate));
2448  aco_option_register(&cfg_info, "enable_events", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_ENABLE_EVENTS);
2449  /* This option should only be used with the CONFBRIDGE dialplan function */
2451 
2452  /* Menu options */
2453  aco_option_register(&cfg_info, "type", ACO_EXACT, menu_types, NULL, OPT_NOOP_T, 0, 0);
2454  /* This option should only be used with the CONFBRIDGE dialplan function */
2456  aco_option_register_custom(&cfg_info, "^[0-9A-D*#]+$", ACO_REGEX, menu_types, NULL, menu_option_handler, 0);
2457 
2458  if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
2459  goto error;
2460  }
2461 
2463  goto error;
2464  }
2465 
2466  return 0;
2467 error:
2469  return -1;
2470 }
static int mix_interval_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
static int sound_option_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags)
Register a config option.
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags,...)
Register a config option.
static int timeout
Definition: cdr_mysql.c:86
#define CHARFLDSET(type, field)
A helper macro to pass the appropriate arguments to aco_option_register for OPT_CHAR_ARRAY_T.
Type for a default handler that should do nothing.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
enum aco_process_status aco_process_config(struct aco_info *info, int reload)
Process a config info via the options registered with an aco_info.
Type for default option handler for bools (ast_true/ast_false) that are stored in a flag...
#define NULL
Definition: resample.c:96
static struct aco_type * menu_types[]
Type for default option handler for character array strings.
static int menu_option_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define __stringify(x)
Definition: asterisk.h:214
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define DEFAULT_TALKING_THRESHOLD
Definition: confbridge.h:46
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
Type for default option handler for unsigned integers.
static int video_mode_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int bridge_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static char language[MAX_LANGUAGE]
Definition: chan_alsa.c:117
static int announce_user_count_all_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Their was an error and no changes were applied.
static int user_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
void conf_destroy_config(void)
destroy the information loaded from the confbridge.conf file
static struct ast_cli_entry cli_confbridge_parser[]
static struct aco_type * user_types[]
static struct aco_type * bridge_types[]
static int remb_behavior_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static char regcontext[AST_MAX_CONTEXT]
Definition: chan_iax2.c:321
int error(const char *format,...)
Definition: utils/frame.c:999
#define DEFAULT_SILENCE_THRESHOLD
Definition: confbridge.h:49
static int menu_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)

◆ conf_menu_entry_destroy()

void conf_menu_entry_destroy ( struct conf_menu_entry menu_entry)

Destroys and frees all the actions stored in a menu_entry structure.

Definition at line 2602 of file conf_config_parser.c.

References conf_menu_entry::actions, ast_free, AST_LIST_REMOVE_HEAD, and NULL.

Referenced by action_playback_and_continue(), conf_menu_profile_copy(), and menu_destructor().

2603 {
2604  struct conf_menu_action *menu_action = NULL;
2605  while ((menu_action = AST_LIST_REMOVE_HEAD(&menu_entry->actions, action))) {
2606  ast_free(menu_action);
2607  }
2608 }
struct conf_menu_action::@85 action
#define NULL
Definition: resample.c:96
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:832
#define ast_free(a)
Definition: astmm.h:182
struct conf_menu_entry::@87 actions

◆ conf_moh_start()

void conf_moh_start ( struct confbridge_user user)

Start MOH for the conference user.

Parameters
userConference user to start MOH on.
Returns
Nothing

Definition at line 1360 of file app_confbridge.c.

References ast_bridge_lock, ast_bridge_suspend(), ast_bridge_unlock, ast_bridge_unsuspend(), ast_moh_start(), confbridge_conference::bridge, confbridge_user::chan, confbridge_user::conference, user_profile::moh_class, NULL, confbridge_user::playing_moh, confbridge_user::suspended_moh, and confbridge_user::u_profile.

Referenced by conf_mute_moh_inactive_waitmarked(), conf_mute_only_active(), and leave_marked().

1361 {
1362  user->playing_moh = 1;
1363  if (!user->suspended_moh) {
1364  int in_bridge;
1365 
1366  /*
1367  * Locking the ast_bridge here is the only way to hold off the
1368  * call to ast_bridge_join() in confbridge_exec() from
1369  * interfering with the bridge and MOH operations here.
1370  */
1372 
1373  /*
1374  * Temporarily suspend the user from the bridge so we have
1375  * control to start MOH if needed.
1376  */
1377  in_bridge = !ast_bridge_suspend(user->conference->bridge, user->chan);
1378  ast_moh_start(user->chan, user->u_profile.moh_class, NULL);
1379  if (in_bridge) {
1380  ast_bridge_unsuspend(user->conference->bridge, user->chan);
1381  }
1382 
1384  }
1385 }
struct ast_channel * chan
Definition: confbridge.h:277
unsigned int playing_moh
Definition: confbridge.h:283
struct confbridge_conference * conference
Definition: confbridge.h:272
int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan)
Unsuspend a channel from a bridge.
Definition: bridge.c:3089
unsigned int suspended_moh
Definition: confbridge.h:280
#define NULL
Definition: resample.c:96
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
Definition: channel.c:7866
#define ast_bridge_unlock(bridge)
Unlock the bridge.
Definition: bridge.h:493
#define ast_bridge_lock(bridge)
Lock the bridge.
Definition: bridge.h:480
int ast_bridge_suspend(struct ast_bridge *bridge, struct ast_channel *chan)
Suspend a channel temporarily from a bridge.
Definition: bridge.c:3068
struct user_profile u_profile
Definition: confbridge.h:274
char moh_class[128]
Definition: confbridge.h:155
struct ast_bridge * bridge
Definition: confbridge.h:247

◆ conf_moh_stop()

void conf_moh_stop ( struct confbridge_user user)

Stop MOH for the conference user.

Parameters
userConference user to stop MOH on.
Returns
Nothing

Definition at line 1333 of file app_confbridge.c.

References ast_bridge_lock, ast_bridge_suspend(), ast_bridge_unlock, ast_bridge_unsuspend(), ast_moh_stop(), confbridge_conference::bridge, confbridge_user::chan, confbridge_user::conference, confbridge_user::playing_moh, and confbridge_user::suspended_moh.

Referenced by conf_default_leave_waitmarked(), conf_handle_second_active(), leave_marked(), leave_unmarked(), and transition_to_marked().

1334 {
1335  user->playing_moh = 0;
1336  if (!user->suspended_moh) {
1337  int in_bridge;
1338 
1339  /*
1340  * Locking the ast_bridge here is the only way to hold off the
1341  * call to ast_bridge_join() in confbridge_exec() from
1342  * interfering with the bridge and MOH operations here.
1343  */
1345 
1346  /*
1347  * Temporarily suspend the user from the bridge so we have
1348  * control to stop MOH if needed.
1349  */
1350  in_bridge = !ast_bridge_suspend(user->conference->bridge, user->chan);
1351  ast_moh_stop(user->chan);
1352  if (in_bridge) {
1353  ast_bridge_unsuspend(user->conference->bridge, user->chan);
1354  }
1355 
1357  }
1358 }
struct ast_channel * chan
Definition: confbridge.h:277
unsigned int playing_moh
Definition: confbridge.h:283
struct confbridge_conference * conference
Definition: confbridge.h:272
int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan)
Unsuspend a channel from a bridge.
Definition: bridge.c:3089
unsigned int suspended_moh
Definition: confbridge.h:280
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
Definition: channel.c:7876
#define ast_bridge_unlock(bridge)
Unlock the bridge.
Definition: bridge.h:493
#define ast_bridge_lock(bridge)
Lock the bridge.
Definition: bridge.h:480
int ast_bridge_suspend(struct ast_bridge *bridge, struct ast_channel *chan)
Suspend a channel temporarily from a bridge.
Definition: bridge.c:3068
struct ast_bridge * bridge
Definition: confbridge.h:247

◆ conf_mute_only_active()

void conf_mute_only_active ( struct confbridge_conference conference)

Attempt to mute/play MOH to the only user in the conference if they require it.

Parameters
conferenceA conference bridge containing a single user

Definition at line 4335 of file app_confbridge.c.

References confbridge_conference::active_list, AST_LIST_FIRST, ast_test_flag, conf_moh_start(), conf_update_user_mute(), confbridge_user::u_profile, and USER_OPT_MUSICONHOLD.

Referenced by transition_to_single(), and transition_to_single_marked().

4336 {
4337  struct confbridge_user *only_user = AST_LIST_FIRST(&conference->active_list);
4338 
4339  /* Turn on MOH if the single participant is set up for it */
4340  if (ast_test_flag(&only_user->u_profile, USER_OPT_MUSICONHOLD)) {
4341  conf_moh_start(only_user);
4342  }
4343  conf_update_user_mute(only_user);
4344 }
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
Definition: linkedlists.h:420
#define ast_test_flag(p, flag)
Definition: utils.h:63
void conf_update_user_mute(struct confbridge_user *user)
Update the actual mute status of the user and set it on the bridge.
struct confbridge_conference::@90 active_list
void conf_moh_start(struct confbridge_user *user)
Start MOH for the conference user.
The structure that represents a conference bridge user.
Definition: confbridge.h:271
struct user_profile u_profile
Definition: confbridge.h:274

◆ conf_record_get_tech()

struct ast_channel_tech* conf_record_get_tech ( void  )

Get ConfBridge record channel technology struct.

Since
12.0.0
Returns
ConfBridge record channel technology.

Definition at line 102 of file conf_chan_record.c.

References record_tech.

Referenced by load_module(), rec_request(), and unload_module().

103 {
104  return &record_tech;
105 }
static struct ast_channel_tech record_tech

◆ conf_reload_config()

int conf_reload_config ( void  )

reload confbridge.conf file

Definition at line 2472 of file conf_config_parser.c.

References aco_process_config(), and ACO_PROCESS_ERROR.

Referenced by reload().

2473 {
2474  if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
2475  /* On a reload, just keep the config we already have in place. */
2476  return -1;
2477  }
2478  return 0;
2479 }
enum aco_process_status aco_process_config(struct aco_info *info, int reload)
Process a config info via the options registered with an aco_info.
Their was an error and no changes were applied.

◆ conf_remove_user_active()

void conf_remove_user_active ( struct confbridge_conference conference,
struct confbridge_user user 
)

Remove a conference bridge user from the unmarked active conference users in the conference.

Parameters
conferenceThe conference bridge to remove the user from
userThe conference bridge user to remove from the conference

Definition at line 4322 of file app_confbridge.c.

References confbridge_conference::active_list, confbridge_conference::activeusers, and AST_LIST_REMOVE.

Referenced by leave_active(), and leave_unmarked().

4323 {
4324  AST_LIST_REMOVE(&conference->active_list, user, list);
4325  conference->activeusers--;
4326 }
struct confbridge_user::@94 list
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
Definition: linkedlists.h:855
struct confbridge_conference::@90 active_list
unsigned int activeusers
Definition: confbridge.h:249

◆ conf_remove_user_marked()

void conf_remove_user_marked ( struct confbridge_conference conference,
struct confbridge_user user 
)

Remove a conference bridge user from the marked active conference users in the conference.

Parameters
conferenceThe conference bridge to remove the user from
userThe conference bridge user to remove from the conference

Definition at line 4328 of file app_confbridge.c.

References confbridge_conference::active_list, confbridge_conference::activeusers, AST_LIST_REMOVE, and confbridge_conference::markedusers.

Referenced by leave_marked().

4329 {
4330  AST_LIST_REMOVE(&conference->active_list, user, list);
4331  conference->activeusers--;
4332  conference->markedusers--;
4333 }
struct confbridge_user::@94 list
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
Definition: linkedlists.h:855
unsigned int markedusers
Definition: confbridge.h:250
struct confbridge_conference::@90 active_list
unsigned int activeusers
Definition: confbridge.h:249

◆ conf_remove_user_waiting()

void conf_remove_user_waiting ( struct confbridge_conference conference,
struct confbridge_user user 
)

Remove a conference bridge user from the waiting conference users in the conference.

Parameters
conferenceThe conference bridge to remove the user from
userThe conference bridge user to remove from the conference

Definition at line 4346 of file app_confbridge.c.

References AST_LIST_REMOVE, confbridge_user::list, confbridge_conference::waiting_list, and confbridge_conference::waitingusers.

Referenced by conf_default_leave_waitmarked().

4347 {
4348  AST_LIST_REMOVE(&conference->waiting_list, user, list);
4349  conference->waitingusers--;
4350 }
struct confbridge_user::@94 list
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
Definition: linkedlists.h:855
unsigned int waitingusers
Definition: confbridge.h:251
struct confbridge_conference::@91 waiting_list

◆ conf_send_event_to_participants()

void conf_send_event_to_participants ( struct confbridge_conference conference,
struct ast_channel chan,
struct stasis_message msg 
)

Send events to bridge participants.

Since
15.7
16.1
Parameters
conferenceThe conference bridge
chanThe channel triggering the action
msgThe stasis message describing the event

Definition at line 414 of file confbridge_manager.c.

References confbridge_conference::active_list, ao2_lock, ao2_ref, ao2_unlock, ast_channel_name(), ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), ast_debug, ast_json_array_append(), ast_json_array_create(), ast_json_object_get(), ast_json_string_set(), ast_json_unref(), AST_LIST_TRAVERSE, ast_log, ast_test_flag, ast_bridge_blob::blob, ast_bridge_blob::bridge, bridge_to_json(), confbridge_user::chan, ast_bridge_blob::channel, channel_to_json(), conf_find_user_profile(), confbridge_event_type_to_string(), confbridge_join_type(), confbridge_welcome_type(), confbridge_user::list, LOG_ERROR, user_profile::name, confbridge_conference::name, NULL, pack_bridge_and_channels(), pack_snapshots(), send_message(), stasis_message_data(), stasis_message_type(), confbridge_user::u_profile, user, USER_OPT_ECHO_EVENTS, and USER_OPT_SEND_EVENTS.

Referenced by send_conf_stasis().

416 {
417  struct ast_bridge_blob *obj = stasis_message_data(msg);
418  struct ast_json *extras = obj->blob;
419  struct user_profile u_profile = {{0}};
420  int source_send_events = 0;
421  int source_echo_events = 0;
422  struct ast_json* json_channels = NULL;
423  struct confbridge_user *user;
424  const char *msg_name = confbridge_event_type_to_string(stasis_message_type(msg));
425 
426  ast_debug(3, "Distributing %s event to participants\n", msg_name);
427 
428  /* This could be a channel level event or a bridge level event */
429  if (chan) {
430  if (!conf_find_user_profile(chan, NULL, &u_profile)) {
431  ast_log(LOG_ERROR, "Unable to retrieve user profile for channel '%s'\n",
432  ast_channel_name(chan));
433  return;
434  }
435  source_send_events = ast_test_flag(&u_profile, USER_OPT_SEND_EVENTS);
436  source_echo_events = ast_test_flag(&u_profile, USER_OPT_ECHO_EVENTS);
437  ast_debug(3, "send_events: %d echo_events: %d for profile %s\n",
438  source_send_events, source_echo_events, u_profile.name);
439  }
440 
441  /* Now send a message to the participants with the json string. */
442  ao2_lock(conference);
443  AST_LIST_TRAVERSE(&conference->active_list, user, list) {
444  struct ast_json *json_object;
445 
446  /*
447  * If the msg type is join, we need to capture all targets channel info so we can
448  * send a welcome message to the source channel with all current participants.
449  */
450  if (source_send_events && stasis_message_type(msg) == confbridge_join_type()) {
451  struct ast_channel_snapshot *target_snapshot;
452  struct ast_json *target_json_channel;
453 
455  if (!target_snapshot) {
456  ast_log(LOG_ERROR, "Unable to get a channel snapshot for '%s'\n",
457  ast_channel_name(user->chan));
458  continue;
459  }
460 
461  target_json_channel = channel_to_json(target_snapshot, extras, NULL);
462  ao2_ref(target_snapshot, -1);
463 
464  if (!json_channels) {
465  json_channels = ast_json_array_create();
466  if (!json_channels) {
467  ast_log(LOG_ERROR, "Unable to allocate json array\n");
468  ast_json_unref(target_json_channel);
469  return;
470  }
471  }
472 
473  ast_json_array_append(json_channels, target_json_channel);
474  }
475 
476  /* Don't send a message to the user that triggered the event. */
477  if (!source_echo_events && user->chan == chan) {
478  ast_debug(3, "Skipping queueing %s message to '%s'. Same channel.\n", msg_name,
479  ast_channel_name(user->chan));
480  continue;
481  }
482 
483  /* Don't send a message to users in profiles not sending events. */
485  ast_debug(3, "Skipping queueing %s message to '%s'. Not receiving events.\n", msg_name,
486  ast_channel_name(user->chan));
487  continue;
488  }
489 
490  json_object = pack_snapshots(obj->bridge, obj->channel, extras, NULL, msg);
491 
492  if (!json_object) {
493  ast_log(LOG_ERROR, "Unable to convert %s message to json\n", msg_name);
494  continue;
495  }
496 
497  send_message(msg_name, conference->name, json_object, user->chan);
498  ast_json_unref(json_object);
499  }
500  ao2_unlock(conference);
501 
502  /*
503  * If this is a join event, send the welcome message to just the joining user
504  * if it's not audio-only or otherwise restricted.
505  */
506  if (source_send_events && json_channels
508  struct ast_json *json_object;
509  struct ast_json *json_bridge;
510  const char *welcome_msg_name = confbridge_event_type_to_string(confbridge_welcome_type());
511 
512  json_bridge = bridge_to_json(obj->bridge);
513  json_object = pack_bridge_and_channels(json_bridge, json_channels, msg);
514  if (!json_object) {
515  ast_log(LOG_ERROR, "Unable to convert ConfbridgeWelcome message to json\n");
516  return;
517  }
518  ast_json_string_set(ast_json_object_get(json_object, "type"), welcome_msg_name);
519 
520  send_message(welcome_msg_name, conference->name, json_object, chan);
521  ast_json_unref(json_object);
522  }
523 }
static char user[512]
struct stasis_message_type * confbridge_join_type(void)
get the confbridge join stasis message type
struct ast_channel * chan
Definition: confbridge.h:277
struct ast_channel_snapshot * channel
#define ast_test_flag(p, flag)
Definition: utils.h:63
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
Definition: json.c:73
const struct user_profile * conf_find_user_profile(struct ast_channel *chan, const char *user_profile_name, struct user_profile *result)
find a user profile given a user profile&#39;s name and store that profile in result structure.
Structure representing a snapshot of channel state.
struct ast_json * blob
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
#define ao2_unlock(a)
Definition: astobj2.h:730
struct confbridge_user::@94 list
#define NULL
Definition: resample.c:96
struct confbridge_conference::@90 active_list
struct ast_bridge_snapshot * bridge
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
static struct ast_json * pack_snapshots(struct ast_bridge_snapshot *bridge_snapshot, struct ast_channel_snapshot *channel_snapshot, struct ast_json *conf_blob, struct ast_json *labels_blob, struct stasis_message *msg)
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_lock(a)
Definition: astobj2.h:718
Blob of data associated with a bridge.
struct ast_json * ast_json_array_create(void)
Create a empty JSON array.
Definition: json.c:352
int ast_json_array_append(struct ast_json *array, struct ast_json *value)
Append to an array.
Definition: json.c:368
const char * ast_channel_uniqueid(const struct ast_channel *chan)
#define LOG_ERROR
Definition: logger.h:285
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
const char * confbridge_event_type_to_string(struct stasis_message_type *event_type)
Get the string representation of a confbridge stasis message type.
struct ast_channel_snapshot * ast_channel_snapshot_get_latest(const char *uniqueid)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object...
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
Definition: json.c:397
const char * ast_channel_name(const struct ast_channel *chan)
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:153
struct stasis_message_type * confbridge_welcome_type(void)
get the confbridge welcome stasis message type
static struct ast_json * channel_to_json(struct ast_channel_snapshot *channel_snapshot, struct ast_json *conf_blob, struct ast_json *labels_blob)
Abstract JSON element (object, array, string, int, ...).
The structure that represents a conference bridge user.
Definition: confbridge.h:271
static struct ast_json * bridge_to_json(struct ast_bridge_snapshot *bridge_snapshot)
struct user_profile u_profile
Definition: confbridge.h:274
int ast_json_string_set(struct ast_json *string, const char *value)
Change the value of a JSON string.
Definition: json.c:278
char name[MAX_CONF_NAME]
Definition: confbridge.h:245
static struct ast_json * pack_bridge_and_channels(struct ast_json *json_bridge, struct ast_json *json_channels, struct stasis_message *msg)
static void send_message(const char *msg_name, char *conf_name, struct ast_json *json_object, struct ast_channel *chan)

◆ conf_set_menu_to_user()

int conf_set_menu_to_user ( struct ast_channel chan,
struct confbridge_user user,
const char *  menu_profile_name 
)

find a menu profile given a menu profile's name and apply the menu in DTMF hooks.

Parameters
chanchannel the menu profile is requested for
useruser profile the menu is being applied to
menu_profile_namename of the profile requested (optional)

If menu_profile_name is not provided, this function will check for the presence of a menu profile set by the CONFBRIDGE function on a channel datastore. If that doesn't exist, the default_menu profile is used.

Return values
0on success
-1on failure

Definition at line 2656 of file conf_config_parser.c.

References ao2_bump, ao2_cleanup, ao2_find, ao2_global_obj_ref, apply_menu_to_user(), ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_strlen_zero, cfg_handle, ast_datastore::data, DEFAULT_MENU_PROFILE, func_confbridge_data::m_usable, func_confbridge_data::menu, NULL, OBJ_KEY, and RAII_VAR.

Referenced by confbridge_exec().

2657 {
2659  RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
2660 
2661  if (chan && ast_strlen_zero(menu_profile_name)) {
2662  struct ast_datastore *datastore;
2663  struct func_confbridge_data *b_data;
2664 
2665  ast_channel_lock(chan);
2667  ast_channel_unlock(chan);
2668  if (datastore) {
2669  /* If a menu exists in the CONFBRIDGE function datastore, use it. */
2670  b_data = datastore->data;
2671  if (b_data->m_usable) {
2672  menu = ao2_bump(b_data->menu);
2673  return apply_menu_to_user(user, menu);
2674  }
2675  }
2676  }
2677 
2678  /* Otherwise, we need to get whatever menu profile is specified to use (or default). */
2679  if (!cfg) {
2680  return -1;
2681  }
2682 
2683  if (ast_strlen_zero(menu_profile_name)) {
2684  menu_profile_name = DEFAULT_MENU_PROFILE;
2685  }
2686 
2687  if (!(menu = ao2_find(cfg->menus, menu_profile_name, OBJ_KEY))) {
2688  return -1;
2689  }
2690 
2691  return apply_menu_to_user(user, menu);
2692 }
#define ast_channel_lock(chan)
Definition: channel.h:2945
struct conf_menu * menu
#define OBJ_KEY
Definition: astobj2.h:1155
static int apply_menu_to_user(struct confbridge_user *user, struct conf_menu *menu)
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
Structure for a data store object.
Definition: datastore.h:68
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2404
#define NULL
Definition: resample.c:96
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ao2_bump(obj)
Definition: astobj2.h:491
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:911
static const struct ast_datastore_info confbridge_datastore
#define ast_channel_unlock(chan)
Definition: channel.h:2946
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
void * data
Definition: datastore.h:70
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
#define DEFAULT_MENU_PROFILE
Definition: confbridge.h:43

◆ conf_update_user_mute()

void conf_update_user_mute ( struct confbridge_user user)

Update the actual mute status of the user and set it on the bridge.

Parameters
userUser to update the mute status.
Returns
Nothing

Definition at line 1275 of file app_confbridge.c.

References ast_channel_name(), ast_debug, ast_test_flag, ast_test_suite_event_notify, confbridge_conference::b_profile, confbridge_user::chan, confbridge_user::conference, confbridge_user::features, confbridge_conference::markedusers, ast_bridge_features::mute, confbridge_user::muted, bridge_profile::name, confbridge_user::playing_moh, confbridge_user::u_profile, and USER_OPT_WAITMARKED.

Referenced by action_toggle_mute_participants(), conf_handle_second_active(), conf_mute_moh_inactive_waitmarked(), conf_mute_only_active(), generic_mute_unmute_user(), join_active(), join_marked(), join_unmarked(), leave_marked(), and transition_to_marked().

1276 {
1277  int mute_user;
1278  int mute_system;
1279  int mute_effective;
1280 
1281  /* User level mute request. */
1282  mute_user = user->muted;
1283 
1284  /* System level mute request. */
1285  mute_system = user->playing_moh
1286  /*
1287  * Do not allow waitmarked users to talk to anyone unless there
1288  * is a marked user present.
1289  */
1290  || (!user->conference->markedusers
1292 
1293  mute_effective = mute_user || mute_system;
1294 
1295  ast_debug(1, "User %s is %s: user:%d system:%d.\n",
1296  ast_channel_name(user->chan), mute_effective ? "muted" : "unmuted",
1297  mute_user, mute_system);
1298  user->features.mute = mute_effective;
1299  ast_test_suite_event_notify("CONF_MUTE_UPDATE",
1300  "Mode: %s\r\n"
1301  "Conference: %s\r\n"
1302  "Channel: %s",
1303  mute_effective ? "muted" : "unmuted",
1304  user->conference->b_profile.name,
1305  ast_channel_name(user->chan));
1306 }
struct ast_channel * chan
Definition: confbridge.h:277
unsigned int playing_moh
Definition: confbridge.h:283
struct confbridge_conference * conference
Definition: confbridge.h:272
#define ast_test_flag(p, flag)
Definition: utils.h:63
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:226
unsigned int markedusers
Definition: confbridge.h:250
struct bridge_profile b_profile
Definition: confbridge.h:248
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_test_suite_event_notify(s, f,...)
Definition: test.h:196
unsigned int muted
Definition: confbridge.h:281
struct ast_bridge_features features
Definition: confbridge.h:278
const char * ast_channel_name(const struct ast_channel *chan)
struct user_profile u_profile
Definition: confbridge.h:274

◆ confbridge_end_type()

struct stasis_message_type* confbridge_end_type ( void  )

get the confbridge end stasis message type

Since
12.0
Return values
stasismessage type for confbridge end messages if it's available
NULLif it isn't

Referenced by confbridge_event_type_to_string(), manager_confbridge_init(), manager_confbridge_shutdown(), and send_conf_end_event().

◆ confbridge_event_type_to_string()

const char* confbridge_event_type_to_string ( struct stasis_message_type event_type)

Get the string representation of a confbridge stasis message type.

Since
15.5
Parameters
event_typeThe confbridge event type such as 'confbridge_welcome_type()'
Return values
Thestring representation of the message type
unknownif not found

Definition at line 249 of file confbridge_manager.c.

References confbridge_end_type(), confbridge_join_type(), confbridge_leave_type(), confbridge_mute_type(), confbridge_start_record_type(), confbridge_start_type(), confbridge_stop_record_type(), confbridge_talking_type(), confbridge_unmute_type(), and confbridge_welcome_type().

Referenced by conf_send_event_to_participants(), confbridge_publish_manager_event(), pack_bridge_and_channels(), and send_message().

250 {
251  if (event_type == confbridge_start_type()) {
252  return "ConfbridgeStart";
253  } else if (event_type == confbridge_end_type()) {
254  return "ConfbridgeEnd";
255  } else if (event_type == confbridge_join_type()) {
256  return "ConfbridgeJoin";
257  } else if (event_type == confbridge_leave_type()) {
258  return "ConfbridgeLeave";
259  } else if (event_type == confbridge_start_record_type()) {
260  return "ConfbridgeRecord";
261  } else if (event_type == confbridge_stop_record_type()) {
262  return "ConfbridgeStopRecord";
263  } else if (event_type == confbridge_mute_type()) {
264  return "ConfbridgeMute";
265  } else if (event_type == confbridge_unmute_type()) {
266  return "ConfbridgeUnmute";
267  } else if (event_type == confbridge_talking_type()) {
268  return "ConfbridgeTalking";
269  } else if (event_type == confbridge_welcome_type()) {
270  return "ConfbridgeWelcome";
271  } else {
272  return "unknown";
273  }
274 }
struct stasis_message_type * confbridge_start_record_type(void)
get the confbridge start_record stasis message type
struct stasis_message_type * confbridge_join_type(void)
get the confbridge join stasis message type
struct stasis_message_type * confbridge_start_type(void)
get the confbridge start stasis message type
struct stasis_message_type * confbridge_leave_type(void)
get the confbridge leave stasis message type
struct stasis_message_type * confbridge_stop_record_type(void)
get the confbridge stop_record stasis message type
struct stasis_message_type * confbridge_end_type(void)
get the confbridge end stasis message type
struct stasis_message_type * confbridge_welcome_type(void)
get the confbridge welcome stasis message type
struct stasis_message_type * confbridge_talking_type(void)
get the confbridge talking stasis message type
struct stasis_message_type * confbridge_unmute_type(void)
get the confbridge unmute stasis message type
struct stasis_message_type * confbridge_mute_type(void)
get the confbridge mute stasis message type

◆ confbridge_handle_atxfer()

void confbridge_handle_atxfer ( struct ast_attended_transfer_message msg)

Create join/leave events for attended transfers.

Since
13.28
16.5
Parameters
msgThe attended transfer stasis message

Definition at line 1562 of file app_confbridge.c.

References confbridge_conference::active_list, ao2_find, ao2_lock, ast_channel_snapshot_dialplan::appl, ast_channel_name(), ast_debug, ast_json_pack(), ast_json_unref(), AST_LIST_TRAVERSE, ast_log, ast_strdupa, ast_strlen_zero, ast_test_flag, ast_channel_snapshot::base, confbridge_user::chan, ast_bridge_channel_snapshot_pair::channel_snapshot, confbridge_join_type(), confbridge_leave_type(), confbridge_unlock_and_unref(), hangup_data::conference, ast_channel_snapshot_dialplan::data, ast_channel_snapshot::dialplan, LOG_ERROR, confbridge_user::muted, ast_channel_snapshot_base::name, NULL, OBJ_SEARCH_KEY, RAII_VAR, send_conf_stasis_snapshots(), ast_attended_transfer_message::target, ast_attended_transfer_message::to_transfer_target, ast_attended_transfer_message::to_transferee, ast_attended_transfer_message::transferee, confbridge_user::u_profile, USER_OPT_ADMIN, confbridge_conference::waiting_list, and confbridge_conference::waitingusers.

Referenced by confbridge_atxfer_cb().

1563 {
1564  struct ast_channel_snapshot *old_snapshot;
1565  struct ast_channel_snapshot *new_snapshot;
1566  char *confbr_name = NULL;
1567  char *comma;
1569  struct confbridge_user *user = NULL;
1570  int found_user = 0;
1571  struct ast_json *json_object;
1572 
1574  && strcmp(msg->to_transferee.channel_snapshot->dialplan->appl, "ConfBridge") == 0
1575  && msg->target) {
1576  /* We're transferring a bridge to an extension */
1577  old_snapshot = msg->to_transferee.channel_snapshot;
1578  new_snapshot = msg->target;
1579  } else if (msg->to_transfer_target.channel_snapshot
1580  && strcmp(msg->to_transfer_target.channel_snapshot->dialplan->appl, "ConfBridge") == 0
1581  && msg->transferee) {
1582  /* We're transferring a call to a bridge */
1583  old_snapshot = msg->to_transfer_target.channel_snapshot;
1584  new_snapshot = msg->transferee;
1585  } else {
1586  ast_log(LOG_ERROR, "Could not determine proper channels\n");
1587  return;
1588  }
1589 
1590  /*
1591  * old_snapshot->data should have the original parameters passed to
1592  * the ConfBridge app:
1593  * conference[,bridge_profile[,user_profile[,menu]]]
1594  * We'll use "conference" to look up the bridge.
1595  *
1596  * We _could_ use old_snapshot->bridgeid to get the bridge but
1597  * that would involve locking the conference_bridges container
1598  * and iterating over it looking for a matching bridge.
1599  */
1600  if (ast_strlen_zero(old_snapshot->dialplan->data)) {
1601  ast_log(LOG_ERROR, "Channel '%s' didn't have app data set\n", old_snapshot->base->name);
1602  return;
1603  }
1604  confbr_name = ast_strdupa(old_snapshot->dialplan->data);
1605  comma = strchr(confbr_name, ',');
1606  if (comma) {
1607  *comma = '\0';
1608  }
1609 
1610  ast_debug(1, "Confbr: %s Leaving: %s Joining: %s\n", confbr_name, old_snapshot->base->name, new_snapshot->base->name);
1611 
1612  conference = ao2_find(conference_bridges, confbr_name, OBJ_SEARCH_KEY);
1613  if (!conference) {
1614  ast_log(LOG_ERROR, "Conference bridge '%s' not found\n", confbr_name);
1615  return;
1616  }
1617  ao2_lock(conference);
1618 
1619  /*
1620  * We need to grab the user profile for the departing user in order to
1621  * properly format the join/leave messages.
1622  */
1623  AST_LIST_TRAVERSE(&conference->active_list, user, list) {
1624  if (strcasecmp(ast_channel_name(user->chan), old_snapshot->base->name) == 0) {
1625  found_user = 1;
1626  break;
1627  }
1628  }
1629 
1630  /*
1631  * If we didn't find the user in the active list, try the waiting list.
1632  */
1633  if (!found_user && conference->waitingusers) {
1634  AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
1635  if (strcasecmp(ast_channel_name(user->chan), old_snapshot->base->name) == 0) {
1636  found_user = 1;
1637  break;
1638  }
1639  }
1640  }
1641 
1642  if (!found_user) {
1643  ast_log(LOG_ERROR, "Unable to find user profile for channel '%s' in bridge '%s'\n",
1644  old_snapshot->base->name, confbr_name);
1645  return;
1646  }
1647 
1648  /*
1649  * We're going to use the existing user profile to create the messages.
1650  */
1651  json_object = ast_json_pack("{s: b}",
1652  "admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
1653  );
1654  if (!json_object) {
1655  return;
1656  }
1657 
1658  send_conf_stasis_snapshots(conference, old_snapshot, confbridge_leave_type(), json_object);
1659  ast_json_unref(json_object);
1660 
1661  json_object = ast_json_pack("{s: b, s: b}",
1662  "admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN),
1663  "muted", user->muted);
1664  if (!json_object) {
1665  return;
1666  }
1667  send_conf_stasis_snapshots(conference, new_snapshot, confbridge_join_type(), json_object);
1668  ast_json_unref(json_object);
1669 }
const ast_string_field data
struct ast_channel_snapshot_base * base
struct stasis_message_type * confbridge_join_type(void)
get the confbridge join stasis message type
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
Definition: json.c:591
struct ast_channel * chan
Definition: confbridge.h:277
The arg parameter is a search key, but is not an object.
Definition: astobj2.h:1105
#define ast_test_flag(p, flag)
Definition: utils.h:63
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
Definition: json.c:73
Structure representing a snapshot of channel state.
struct ast_channel_snapshot * target
#define NULL
Definition: resample.c:96
struct ast_channel_snapshot_dialplan * dialplan
struct ast_bridge_channel_snapshot_pair to_transferee
#define ast_strlen_zero(foo)
Definition: strings.h:52
struct stasis_message_type * confbridge_leave_type(void)
get the confbridge leave stasis message type
struct ast_bridge_channel_snapshot_pair to_transfer_target
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
const ast_string_field appl
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:911
struct ast_channel_snapshot * transferee
#define ao2_lock(a)
Definition: astobj2.h:718
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
struct ao2_container * conference_bridges
Container to hold all conference bridges in progress.
struct ast_channel_snapshot * channel_snapshot
#define LOG_ERROR
Definition: logger.h:285
static void confbridge_unlock_and_unref(void *obj)
unsigned int muted
Definition: confbridge.h:281
static void send_conf_stasis_snapshots(struct confbridge_conference *conference, struct ast_channel_snapshot *chan_snapshot, struct stasis_message_type *type, struct ast_json *extras)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
The structure that represents a conference bridge.
Definition: confbridge.h:244
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
structure to hold users read from users.conf
const char * ast_channel_name(const struct ast_channel *chan)
Abstract JSON element (object, array, string, int, ...).
The structure that represents a conference bridge user.
Definition: confbridge.h:271
struct user_profile u_profile
Definition: confbridge.h:274
const ast_string_field name

◆ confbridge_join_type()

struct stasis_message_type* confbridge_join_type ( void  )

get the confbridge join stasis message type

Since
12.0
Return values
stasismessage type for confbridge join messages if it's available
NULLif it isn't

Referenced by conf_send_event_to_participants(), confbridge_event_type_to_string(), confbridge_handle_atxfer(), manager_confbridge_init(), manager_confbridge_shutdown(), and send_join_event().

◆ confbridge_leave_type()

struct stasis_message_type* confbridge_leave_type ( void  )

get the confbridge leave stasis message type

Since
12.0
Return values
stasismessage type for confbridge leave messages if it's available
NULLif it isn't

Referenced by confbridge_event_type_to_string(), confbridge_handle_atxfer(), manager_confbridge_init(), manager_confbridge_shutdown(), send_leave_event(), and send_message().

◆ confbridge_mute_type()

struct stasis_message_type* confbridge_mute_type ( void  )

get the confbridge mute stasis message type

Since
12.0
Return values
stasismessage type for confbridge mute messages if it's available
NULLif it isn't

Referenced by confbridge_event_type_to_string(), manager_confbridge_init(), manager_confbridge_shutdown(), and send_mute_event().

◆ confbridge_start_record_type()

struct stasis_message_type* confbridge_start_record_type ( void  )

get the confbridge start_record stasis message type

Since
12.0
Return values
stasismessage type for confbridge start_record messages if it's available
NULLif it isn't

Referenced by confbridge_event_type_to_string(), manager_confbridge_init(), manager_confbridge_shutdown(), and send_start_record_event().

◆ confbridge_start_type()

struct stasis_message_type* confbridge_start_type ( void  )

get the confbridge start stasis message type

Since
12.0
Return values
stasismessage type for confbridge start messages if it's available
NULLif it isn't

Referenced by confbridge_event_type_to_string(), manager_confbridge_init(), manager_confbridge_shutdown(), and send_conf_start_event().

◆ confbridge_stop_record_type()

struct stasis_message_type* confbridge_stop_record_type ( void  )

get the confbridge stop_record stasis message type

Since
12.0
Return values
stasismessage type for confbridge stop_record messages if it's available
NULLif it isn't

Referenced by confbridge_event_type_to_string(), manager_confbridge_init(), manager_confbridge_shutdown(), and send_stop_record_event().

◆ confbridge_talking_type()

struct stasis_message_type* confbridge_talking_type ( void  )

get the confbridge talking stasis message type

Since
12.0
Return values
stasismessage type for confbridge talking messages if it's available
NULLif it isn't

Referenced by conf_handle_talker_cb(), confbridge_event_type_to_string(), manager_confbridge_init(), and manager_confbridge_shutdown().

◆ confbridge_unmute_type()

struct stasis_message_type* confbridge_unmute_type ( void  )

get the confbridge unmute stasis message type

Since
12.0
Return values
stasismessage type for confbridge unmute messages if it's available
NULLif it isn't

Referenced by confbridge_event_type_to_string(), manager_confbridge_init(), manager_confbridge_shutdown(), and send_unmute_event().

◆ confbridge_welcome_type()

struct stasis_message_type* confbridge_welcome_type ( void  )

get the confbridge welcome stasis message type

Since
15.5
Return values
stasismessage type for confbridge welcome messages if it's available
NULLif it isn't

Referenced by conf_send_event_to_participants(), confbridge_event_type_to_string(), manager_confbridge_init(), and manager_confbridge_shutdown().

◆ func_confbridge_helper()

int func_confbridge_helper ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)

Definition at line 1115 of file conf_config_parser.c.

References aco_process_var(), ao2_cleanup, args, AST_APP_ARG, ast_calloc, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, ast_datastore_free(), AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero, func_confbridge_data::b_profile, func_confbridge_data::b_usable, bridge_profile_sounds_alloc(), conf_bridge_profile_destroy(), ast_datastore::data, DEFAULT_BRIDGE_PROFILE, DEFAULT_MENU_PROFILE, DEFAULT_USER_PROFILE, ast_variable::file, LOG_WARNING, func_confbridge_data::m_usable, func_confbridge_data::menu, menu_alloc(), ast_variable::name, NULL, parse(), bridge_profile::sounds, type, func_confbridge_data::u_profile, func_confbridge_data::u_usable, user_profile_destructor(), value, and ast_variable::value.

1116 {
1117  struct ast_datastore *datastore;
1118  struct func_confbridge_data *b_data;
1119  char *parse;
1120  struct ast_variable tmpvar = { 0, };
1121  struct ast_variable template = {
1122  .name = "template",
1123  .file = "CONFBRIDGE"
1124  };
1126  AST_APP_ARG(type);
1127  AST_APP_ARG(option);
1128  );
1129 
1130  if (!chan) {
1131  ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1132  return -1;
1133  }
1134 
1135  /* parse all the required arguments and make sure they exist. */
1136  if (ast_strlen_zero(data)) {
1137  return -1;
1138  }
1139  parse = ast_strdupa(data);
1140  AST_STANDARD_APP_ARGS(args, parse);
1141  if (ast_strlen_zero(args.type) || ast_strlen_zero(args.option)) {
1142  return -1;
1143  }
1144 
1145  ast_channel_lock(chan);
1147  if (!datastore) {
1149  if (!datastore) {
1150  ast_channel_unlock(chan);
1151  return 0;
1152  }
1153  b_data = ast_calloc(1, sizeof(*b_data));
1154  if (!b_data) {
1155  ast_channel_unlock(chan);
1156  ast_datastore_free(datastore);
1157  return 0;
1158  }
1159  datastore->data = b_data;
1161  if (!b_data->b_profile.sounds) {
1162  ast_channel_unlock(chan);
1163  ast_datastore_free(datastore);
1164  return 0;
1165  }
1166  if (!(b_data->menu = menu_alloc("dialplan"))) {
1167  ast_channel_unlock(chan);
1168  ast_datastore_free(datastore);
1169  return 0;
1170  }
1171  ast_channel_datastore_add(chan, datastore);
1172  } else {
1173  b_data = datastore->data;
1174  }
1175  ast_channel_unlock(chan);
1176 
1177  /* SET(CONFBRIDGE(type,option)=value) */
1178  if (!value) {
1179  value = "";
1180  }
1181  tmpvar.name = args.option;
1182  tmpvar.value = value;
1183  tmpvar.file = "CONFBRIDGE";
1184  if (!strcasecmp(args.type, "bridge")) {
1185  if (!strcasecmp(args.option, "clear")) {
1186  b_data->b_usable = 0;
1188  memset(&b_data->b_profile, 0, sizeof(b_data->b_profile)) ;
1189  if (!(b_data->b_profile.sounds = bridge_profile_sounds_alloc())) {
1190  /* If this reallocation fails, the datastore has become unusable and must be destroyed. */
1191  ast_channel_lock(chan);
1192  ast_channel_datastore_remove(chan, datastore);
1193  ast_channel_unlock(chan);
1194  ast_datastore_free(datastore);
1195  }
1196  return 0;
1197  }
1198 
1199  if (b_data && !b_data->b_usable && strcasecmp(args.option, "template")) {
1200  template.value = DEFAULT_BRIDGE_PROFILE;
1201  aco_process_var(&bridge_type, "dialplan", &template, &b_data->b_profile);
1202  }
1203 
1204  if (!aco_process_var(&bridge_type, "dialplan", &tmpvar, &b_data->b_profile)) {
1205  b_data->b_usable = 1;
1206  return 0;
1207  }
1208  } else if (!strcasecmp(args.type, "user")) {
1209  if (!strcasecmp(args.option, "clear")) {
1210  b_data->u_usable = 0;
1212  memset(&b_data->u_profile, 0, sizeof(b_data->u_profile));
1213  return 0;
1214  }
1215 
1216  if (b_data && !b_data->u_usable && strcasecmp(args.option, "template")) {
1217  template.value = DEFAULT_USER_PROFILE;
1218  aco_process_var(&user_type, "dialplan", &template, &b_data->u_profile);
1219  }
1220 
1221  if (!aco_process_var(&user_type, "dialplan", &tmpvar, &b_data->u_profile)) {
1222  b_data->u_usable = 1;
1223  return 0;
1224  }
1225  } else if (!strcasecmp(args.type, "menu")) {
1226  if (!strcasecmp(args.option, "clear")) {
1227  b_data->m_usable = 0;
1228  ao2_cleanup(b_data->menu);
1229  if (!(b_data->menu = menu_alloc("dialplan"))) {
1230  /* If this reallocation fails, the datastore has become unusable and must be destroyed */
1231  ast_channel_lock(chan);
1232  ast_channel_datastore_remove(chan, datastore);
1233  ast_channel_unlock(chan);
1234  ast_datastore_free(datastore);
1235  }
1236  return 0;
1237  }
1238 
1239  if (b_data && !b_data->m_usable && strcasecmp(args.option, "template")) {
1240  template.value = DEFAULT_MENU_PROFILE;
1241  aco_process_var(&menu_type, "dialplan", &template, &b_data->menu);
1242  }
1243 
1244  if (!aco_process_var(&menu_type, "dialplan", &tmpvar, b_data->menu)) {
1245  b_data->m_usable = 1;
1246  return 0;
1247  }
1248  }
1249 
1250  ast_log(LOG_WARNING, "%s(%s,%s) cannot be set to '%s'. Invalid type, option, or value.\n",
1251  cmd, args.type, args.option, value);
1252  return -1;
1253 }
static const char type[]
Definition: chan_ooh323.c:109
#define ast_channel_lock(chan)
Definition: channel.h:2945
struct conf_menu * menu
struct user_profile u_profile
static struct aco_type user_type
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
#define LOG_WARNING
Definition: logger.h:274
Structure for variables, used for configurations and for channel variables.
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
struct bridge_profile b_profile
Structure for a data store object.
Definition: datastore.h:68
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2404
const char * args
static struct aco_type bridge_type
#define NULL
Definition: resample.c:96
int value
Definition: syslog.c:37
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Definition: datastore.c:68
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ast_log
Definition: astobj2.c:42
static struct aco_type menu_type
void conf_bridge_profile_destroy(struct bridge_profile *b_profile)
Destroy a bridge profile found by &#39;conf_find_bridge_profile&#39;.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
static const struct ast_datastore_info confbridge_datastore
static void * menu_alloc(const char *category)
#define ast_channel_unlock(chan)
Definition: channel.h:2946
static void parse(struct mgcp_request *req)
Definition: chan_mgcp.c:1872
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204
void * data
Definition: datastore.h:70
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
#define DEFAULT_MENU_PROFILE
Definition: confbridge.h:43
#define DEFAULT_BRIDGE_PROFILE
Definition: confbridge.h:42
#define ast_datastore_alloc(info, uid)
Definition: datastore.h:89
#define DEFAULT_USER_PROFILE
Definition: confbridge.h:41
int aco_process_var(struct aco_type *type, const char *cat, struct ast_variable *var, void *obj)
Parse a single ast_variable and apply it to an object.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2390
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
Definition: channel.c:2399
static void user_profile_destructor(void *obj)
static struct bridge_profile_sounds * bridge_profile_sounds_alloc(void)
#define AST_APP_ARG(name)
Define an application argument.

◆ manager_confbridge_init()

int manager_confbridge_init ( void  )

register stasis message routers to handle manager events for confbridge messages

Since
12.0
Return values
0success
non-zerofailure

Definition at line 721 of file confbridge_manager.c.

References ast_attended_transfer_type(), ast_bridge_topic_all(), ast_channel_topic_all(), confbridge_atxfer_cb(), confbridge_end_cb(), confbridge_end_type(), confbridge_join_cb(), confbridge_join_type(), confbridge_leave_cb(), confbridge_leave_type(), confbridge_mute_cb(), confbridge_mute_type(), confbridge_start_cb(), confbridge_start_record_cb(), confbridge_start_record_type(), confbridge_start_type(), confbridge_stop_record_cb(), confbridge_stop_record_type(), confbridge_talking_cb(), confbridge_talking_type(), confbridge_unmute_cb(), confbridge_unmute_type(), confbridge_welcome_type(), manager_confbridge_shutdown(), NULL, stasis_message_router_add(), stasis_message_router_create, and STASIS_MESSAGE_TYPE_INIT.

Referenced by load_module().

722 {
733 
736 
737  if (!bridge_state_router) {
738  return -1;
739  }
740 
744  NULL)) {
746  return -1;
747  }
751  NULL)) {
753  return -1;
754  }
758  NULL)) {
760  return -1;
761  }
765  NULL)) {
767  return -1;
768  }
772  NULL)) {
774  return -1;
775  }
779  NULL)) {
781  return -1;
782  }
786  NULL)) {
788  return -1;
789  }
793  NULL)) {
795  return -1;
796  }
800  NULL)) {
802  return -1;
803  }
807  NULL)) {
809  return -1;
810  }
811 
814 
815  if (!channel_state_router) {
817  return -1;
818  }
819 
823  NULL)) {
825  return -1;
826  }
830  NULL)) {
832  return -1;
833  }
837  NULL)) {
839  return -1;
840  }
844  NULL)) {
846  return -1;
847  }
851  NULL)) {
853  return -1;
854  }
858  NULL)) {
860  return -1;
861  }
865  NULL)) {
867  return -1;
868  }
872  NULL)) {
874  return -1;
875  }
879  NULL)) {
881  return -1;
882  }
883 
884  /* FYI: confbridge_welcome_type is never routed */
885 
886  return 0;
887 }
struct stasis_message_type * confbridge_start_record_type(void)
get the confbridge start_record stasis message type
struct stasis_message_type * confbridge_join_type(void)
get the confbridge join stasis message type
static void confbridge_talking_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static void confbridge_start_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
int stasis_message_router_add(struct stasis_message_router *router, struct stasis_message_type *message_type, stasis_subscription_cb callback, void *data)
Add a route to a message router.
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
Definition: stasis.h:1501
static void confbridge_join_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static void confbridge_start_record_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static void confbridge_stop_record_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
#define NULL
Definition: resample.c:96
struct stasis_message_type * confbridge_start_type(void)
get the confbridge start stasis message type
static void confbridge_mute_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
struct stasis_message_type * confbridge_leave_type(void)
get the confbridge leave stasis message type
struct stasis_topic * ast_channel_topic_all(void)
A topic which publishes the events for all channels.
static void confbridge_atxfer_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
struct stasis_message_type * confbridge_stop_record_type(void)
get the confbridge stop_record stasis message type
#define stasis_message_router_create(topic)
static void confbridge_end_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
struct stasis_message_type * ast_attended_transfer_type(void)
Message type for ast_attended_transfer_message.
void manager_confbridge_shutdown(void)
unregister stasis message routers to handle manager events for confbridge messages ...
static struct stasis_message_router * channel_state_router
static struct stasis_message_router * bridge_state_router
struct stasis_topic * ast_bridge_topic_all(void)
A topic which publishes the events for all bridges.
struct stasis_message_type * confbridge_end_type(void)
get the confbridge end stasis message type
struct stasis_message_type * confbridge_welcome_type(void)
get the confbridge welcome stasis message type
struct stasis_message_type * confbridge_talking_type(void)
get the confbridge talking stasis message type
struct stasis_message_type * confbridge_unmute_type(void)
get the confbridge unmute stasis message type
struct stasis_message_type * confbridge_mute_type(void)
get the confbridge mute stasis message type
static void confbridge_unmute_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static void confbridge_leave_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)

◆ manager_confbridge_shutdown()

void manager_confbridge_shutdown ( void  )

unregister stasis message routers to handle manager events for confbridge messages

Since
12.0

Definition at line 698 of file confbridge_manager.c.

References confbridge_end_type(), confbridge_join_type(), confbridge_leave_type(), confbridge_mute_type(), confbridge_start_record_type(), confbridge_start_type(), confbridge_stop_record_type(), confbridge_talking_type(), confbridge_unmute_type(), confbridge_welcome_type(), NULL, stasis_message_router_unsubscribe(), and STASIS_MESSAGE_TYPE_CLEANUP.

Referenced by manager_confbridge_init(), and unload_module().

698  {
709 
710  if (bridge_state_router) {
713  }
714 
715  if (channel_state_router) {
718  }
719 }
struct stasis_message_type * confbridge_start_record_type(void)
get the confbridge start_record stasis message type
struct stasis_message_type * confbridge_join_type(void)
get the confbridge join stasis message type
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
Definition: stasis.h:1523
#define NULL
Definition: resample.c:96
struct stasis_message_type * confbridge_start_type(void)
get the confbridge start stasis message type
struct stasis_message_type * confbridge_leave_type(void)
get the confbridge leave stasis message type
struct stasis_message_type * confbridge_stop_record_type(void)
get the confbridge stop_record stasis message type
static struct stasis_message_router * channel_state_router
static struct stasis_message_router * bridge_state_router
struct stasis_message_type * confbridge_end_type(void)
get the confbridge end stasis message type
struct stasis_message_type * confbridge_welcome_type(void)
get the confbridge welcome stasis message type
void stasis_message_router_unsubscribe(struct stasis_message_router *router)
Unsubscribe the router from the upstream topic.
struct stasis_message_type * confbridge_talking_type(void)
get the confbridge talking stasis message type
struct stasis_message_type * confbridge_unmute_type(void)
get the confbridge unmute stasis message type
struct stasis_message_type * confbridge_mute_type(void)
get the confbridge mute stasis message type

◆ play_sound_file()

int play_sound_file ( struct confbridge_conference conference,
const char *  filename 
)

Play sound file into conference bridge.

Parameters
conferenceThe conference bridge to play sound file into
filenameSound file to play
Return values
0success
-1failure

Definition at line 2035 of file app_confbridge.c.

References play_sound_helper().

Referenced by action_toggle_mute_participants(), announce_user_count(), confbridge_exec(), and post_join_play_begin().

2036 {
2037  return play_sound_helper(conference, filename, -1);
2038 }
static int play_sound_helper(struct confbridge_conference *conference, const char *filename, int say_number)

Variable Documentation

◆ conference_bridges

struct ao2_container* conference_bridges

Container to hold all conference bridges in progress.

Definition at line 469 of file app_confbridge.c.

Referenced by announce_request().