119 static const char app[] =
"ConfBridge";
152 #define MAX_CONF_NAME AST_MAX_EXTENSION
155 #define CONFERENCE_BRIDGE_BUCKETS 53
176 unsigned int kicked:1;
183 static
int play_sound_file(struct conference_bridge *conference_bridge, const
char *filename);
188 const struct conference_bridge *conference_bridge = obj;
195 const struct conference_bridge *conference_bridge0 = obj, *conference_bridge1 = arg;
207 static int announce_user_count(
struct conference_bridge *conference_bridge,
struct conference_bridge_user *conference_bridge_user)
209 if (conference_bridge->
users == 1) {
212 }
else if (conference_bridge->
users == 2) {
260 static int post_join_marked(
struct conference_bridge *conference_bridge,
struct conference_bridge_user *conference_bridge_user)
263 struct conference_bridge_user *other_conference_bridge_user = NULL;
272 if (other_conference_bridge_user == conference_bridge_user) {
284 conference_bridge_user->
chan,
285 "conf-placeintoconf")) {
293 if (other_conference_bridge_user == conference_bridge_user) {
332 static int post_join_unmarked(
struct conference_bridge *conference_bridge,
struct conference_bridge_user *conference_bridge_user)
335 if (conference_bridge->
users == 1) {
364 if (conference_bridge->
users == 2) {
385 struct conference_bridge *conference_bridge = obj;
387 ast_debug(1,
"Destroying conference bridge '%s'\n", conference_bridge->
name);
399 if (conference_bridge->
bridge) {
401 conference_bridge->
bridge = NULL;
405 static void leave_conference_bridge(
struct conference_bridge *conference_bridge,
struct conference_bridge_user *conference_bridge_user);
417 struct conference_bridge *conference_bridge = NULL;
418 struct conference_bridge tmp;
425 ast_debug(1,
"Trying to find conference bridge '%s'\n", name);
433 ao2_ref(conference_bridge, -1);
434 ast_debug(1,
"Conference bridge '%s' is locked and caller is not an admin\n", name);
440 if (!conference_bridge) {
453 ao2_ref(conference_bridge, -1);
454 conference_bridge = NULL;
480 conference_bridge->
users++;
488 if (conference_bridge->
users == 1) {
509 return conference_bridge;
519 static void leave_conference_bridge(
struct conference_bridge *conference_bridge,
struct conference_bridge_user *conference_bridge_user)
529 conference_bridge->
users--;
535 if (conference_bridge->
users) {
537 struct conference_bridge_user *other_participant = NULL;
560 }
else if (conference_bridge->
users == 1) {
579 ao2_ref(conference_bridge, -1);
591 static int play_sound_file(
struct conference_bridge *conference_bridge,
const char *filename)
614 ast_debug(1,
"Created a playback channel to conference bridge '%s'\n", conference_bridge->
name);
626 ast_debug(1,
"Departing underlying channel '%s' from bridge '%p'\n", underlying_channel->
name, conference_bridge->
bridge);
646 struct conference_bridge_user *conference_bridge_user = hook_pvt;
647 struct conference_bridge *conference_bridge = conference_bridge_user->
conference_bridge;
674 }
else if (isadmin && digit ==
'2') {
676 conference_bridge->
locked = (!conference_bridge->
locked ? 1 : 0);
678 }
else if (isadmin && digit ==
'3') {
680 struct conference_bridge_user *last_participant = NULL;
687 last_participant->
kicked = 1;
691 }
else if (digit ==
'4') {
694 }
else if (digit ==
'6') {
697 }
else if (digit ==
'7') {
700 }
else if (digit ==
'8') {
702 }
else if (digit ==
'9') {
726 int res = 0, volume_adjustments[2];
728 struct conference_bridge *conference_bridge = NULL;
729 struct conference_bridge_user conference_bridge_user = {
732 const char *tmp, *join_sound = NULL, *leave_sound = NULL;
753 if (
args.argc == 2) {
808 conference_bridge = NULL;
819 if (volume_adjustments[0]) {
822 if (volume_adjustments[1]) {
int ast_audiohook_volume_set(struct ast_channel *chan, enum ast_audiohook_direction direction, int volume)
Adjust the volume on frames read from or written to a channel.
int ast_hangup(struct ast_channel *chan)
Hang up a channel.
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
#define ao2_link(arg1, arg2)
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
The structure that represents a conference bridge.
int ast_audiohook_volume_get(struct ast_channel *chan, enum ast_audiohook_direction direction)
Retrieve the volume adjustment value on frames read from or written to a channel. ...
ast_mutex_t playback_lock
enum ast_bridge_channel_state ast_bridge_join(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features)
Join (blocking) a channel to a bridge.
struct ast_channel * playback_chan
Structure that contains features information.
#define ast_test_flag(p, flag)
struct conference_bridge * conference_bridge
static int announce_user_count(struct conference_bridge *conference_bridge, struct conference_bridge_user *conference_bridge_user)
Announce number of users in the conference bridge to the caller.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
static int load_module(void)
Called when module is being loaded.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
struct ast_bridge * ast_bridge_new(enum ast_bridge_capability capabilities, int flags)
Create a new bridge.
int ast_bridge_depart(struct ast_bridge *bridge, struct ast_channel *chan)
Depart a channel from a bridge.
int ast_bridge_features_init(struct ast_bridge_features *features)
Initialize bridge features structure.
int ast_bridge_destroy(struct ast_bridge *bridge)
Destroy a bridge.
#define ast_mutex_lock(a)
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
#define CONFERENCE_BRIDGE_BUCKETS
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
static int post_join_unmarked(struct conference_bridge *conference_bridge, struct conference_bridge_user *conference_bridge_user)
Perform post-joining non-marked specific actions.
int ast_unregister_application(const char *app)
Unregister an application.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
struct ast_bridge * bridge
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
static void destroy_conference_bridge(void *obj)
Destroy a conference bridge.
int ast_bridge_features_hook(struct ast_bridge_features *features, const char *dtmf, ast_bridge_features_hook_callback callback, void *hook_pvt)
Attach a custom hook to a bridge features structure.
static int menu_callback(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
DTMF Menu Callback.
#define ast_debug(level,...)
Log a DEBUG message.
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.
int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features)
Impart (non-blocking) a channel on a bridge.
General Asterisk PBX channel definitions.
static void leave_conference_bridge(struct conference_bridge *conference_bridge, struct conference_bridge_user *conference_bridge_user)
Leave a conference bridge.
struct conference_bridge::@5 users_list
static force_inline int attribute_pure ast_strlen_zero(const char *s)
static int play_prompt_to_channel(struct conference_bridge *conference_bridge, struct ast_channel *chan, const char *file)
Play back an audio file to a channel.
#define ao2_ref(o, delta)
static struct ao2_container * conference_bridges
Container to hold all conference bridges in progress.
int ast_bridge_suspend(struct ast_bridge *bridge, struct ast_channel *chan)
Suspend a channel temporarily from a bridge.
Core PBX routines and definitions.
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define ast_strdupa(s)
duplicate a string in memory from the stack
struct ast_bridge_features features
Structure that contains information about a bridge.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
The structure that represents a conference bridge user.
int ast_bridge_remove(struct ast_bridge *bridge, struct ast_channel *chan)
Remove a channel from a bridge.
const ast_string_field name
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
static int play_sound_file(struct conference_bridge *conference_bridge, const char *filename)
Play sound file into conference bridge.
#define ao2_alloc(data_size, destructor_fn)
#define AST_LIST_LAST(head)
Returns the last entry contained in a list.
struct ast_bridge * bridge
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define ao2_find(arg1, arg2, arg3)
#define ast_channel_unlock(chan)
static void parse(struct mgcp_request *req)
int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *digits)
stream file until digit If the file name is non-empty, try to play it.
struct ast_channel *(*const bridged_channel)(struct ast_channel *chan, struct ast_channel *bridge)
Find bridged channel.
static int post_join_marked(struct conference_bridge *conference_bridge, struct conference_bridge_user *conference_bridge_user)
Perform post-joining marked specific actions.
int ast_call(struct ast_channel *chan, char *addr, int timeout)
Make a call.
int ast_audiohook_volume_adjust(struct ast_channel *chan, enum ast_audiohook_direction direction, int volume)
Adjust the volume on frames read from or written to a channel.
Structure used to handle boolean flags.
Support for logging to various files, console and syslog Configuration in file logger.conf.
static int unload_module(void)
Called when module is being unloaded.
static int conference_bridge_hash_cb(const void *obj, const int flags)
Hashing function used for conference bridges container.
struct ast_channel * chan
Structure that contains information regarding a channel in a bridge.
#define AST_FORMAT_SLINEAR
int ast_say_number(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says a number
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
#define ao2_container_alloc(arg1, arg2, arg3)
struct conference_bridge_user::@6 list
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static struct conference_bridge * join_conference_bridge(const char *name, struct conference_bridge_user *conference_bridge_user)
Join a conference bridge.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
char * opt_args[OPTION_ARRAY_SIZE]
static int conference_bridge_cmp_cb(void *obj, void *arg, int flags)
Comparison function used for conference bridges container.
#define AST_APP_ARG(name)
Define an application argument.
#define ast_mutex_init(pmutex)
struct ast_channel * chan
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ast_mutex_destroy(a)
Say numbers and dates (maybe words one day too)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
enum ast_bridge_channel_state state
struct ast_channel * ast_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *status)
Requests a channel.
struct ast_channel_tech * tech
#define ao2_unlink(arg1, arg2)
int ast_bridge_features_cleanup(struct ast_bridge_features *features)
Clean up the contents of a bridge features structure.
const ast_string_field language
int ast_stopstream(struct ast_channel *c)
Stops a stream.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan)
Unsuspend a channel from a bridge.
Structure for mutex and tracking information.
static force_inline int attribute_pure ast_str_case_hash(const char *str)
Compute a hash value on a case-insensitive string.
static int confbridge_exec(struct ast_channel *chan, const char *data)
The ConfBridge application.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
static struct ast_app_option app_opts[128]
#define ast_mutex_unlock(a)