summaryrefslogtreecommitdiff
path: root/apps/confbridge
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2013-03-09 00:21:46 +0000
committerRichard Mudgett <rmudgett@digium.com>2013-03-09 00:21:46 +0000
commit761465d6425fa0c5ce61095fe45588292ead1b15 (patch)
treed2421cbcfc5b3b2dcaaea1d04b4c515ef740c365 /apps/confbridge
parentb4a010e958226d21750a5a1797bf50f22898e974 (diff)
confbridge: Rename items for clarity and consistency.
struct conference_bridge_user -> struct confbridge_user struct conference_bridge -> struct confbridge_conference struct conference_state -> struct confbridge_state struct conference_bridge_user *conference_bridge_user -> struct confbridge_user *user struct conference_bridge_user *cbu -> struct confbridge_user *user struct conference_bridge *conference_bridge -> struct confbridge_conference *conference The names are now generally shorter, consistently used, and don't conflict with the struct names. This patch handles the renaming part of the issue. (issue ASTERISK-20776) Reported by: rmudgett git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382764 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/confbridge')
-rw-r--r--apps/confbridge/conf_config_parser.c11
-rw-r--r--apps/confbridge/conf_state.c36
-rw-r--r--apps/confbridge/conf_state_empty.c46
-rw-r--r--apps/confbridge/conf_state_inactive.c38
-rw-r--r--apps/confbridge/conf_state_multi.c32
-rw-r--r--apps/confbridge/conf_state_multi_marked.c122
-rw-r--r--apps/confbridge/conf_state_single.c42
-rw-r--r--apps/confbridge/conf_state_single_marked.c38
-rw-r--r--apps/confbridge/include/conf_state.h36
-rw-r--r--apps/confbridge/include/confbridge.h100
10 files changed, 251 insertions, 250 deletions
diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c
index 560bee4e1..83184d10a 100644
--- a/apps/confbridge/conf_config_parser.c
+++ b/apps/confbridge/conf_config_parser.c
@@ -1954,7 +1954,7 @@ const struct bridge_profile *conf_find_bridge_profile(struct ast_channel *chan,
}
struct dtmf_menu_hook_pvt {
- struct conference_bridge_user *conference_bridge_user;
+ struct confbridge_user *user;
struct conf_menu_entry menu_entry;
struct conf_menu *menu;
};
@@ -1975,7 +1975,7 @@ static void menu_hook_destroy(void *hook_pvt)
static int menu_hook_callback(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
{
struct dtmf_menu_hook_pvt *pvt = hook_pvt;
- return conf_handle_dtmf(bridge_channel, pvt->conference_bridge_user, &pvt->menu_entry, pvt->menu);
+ return conf_handle_dtmf(bridge_channel, pvt->user, &pvt->menu_entry, pvt->menu);
}
static int copy_menu_entry(struct conf_menu_entry *dst, struct conf_menu_entry *src)
@@ -2021,7 +2021,7 @@ int conf_find_menu_entry_by_sequence(const char *dtmf_sequence, struct conf_menu
return 0;
}
-int conf_set_menu_to_user(const char *menu_name, struct conference_bridge_user *conference_bridge_user)
+int conf_set_menu_to_user(const char *menu_name, struct confbridge_user *user)
{
struct conf_menu *menu;
struct conf_menu_entry *menu_entry = NULL;
@@ -2037,6 +2037,7 @@ int conf_set_menu_to_user(const char *menu_name, struct conference_bridge_user *
ao2_lock(menu);
AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
struct dtmf_menu_hook_pvt *pvt;
+
if (!(pvt = ast_calloc(1, sizeof(*pvt)))) {
ao2_unlock(menu);
ao2_ref(menu, -1);
@@ -2048,11 +2049,11 @@ int conf_set_menu_to_user(const char *menu_name, struct conference_bridge_user *
ao2_ref(menu, -1);
return -1;
}
- pvt->conference_bridge_user = conference_bridge_user;
+ pvt->user = user;
ao2_ref(menu, +1);
pvt->menu = menu;
- ast_bridge_features_hook(&conference_bridge_user->features, pvt->menu_entry.dtmf, menu_hook_callback, pvt, menu_hook_destroy);
+ ast_bridge_features_hook(&user->features, pvt->menu_entry.dtmf, menu_hook_callback, pvt, menu_hook_destroy);
}
ao2_unlock(menu);
diff --git a/apps/confbridge/conf_state.c b/apps/confbridge/conf_state.c
index ea5ab10f0..988e2e250 100644
--- a/apps/confbridge/conf_state.c
+++ b/apps/confbridge/conf_state.c
@@ -42,9 +42,9 @@
#include "include/conf_state.h"
#include "include/confbridge.h"
-void conf_invalid_event_fn(struct conference_bridge_user *cbu)
+void conf_invalid_event_fn(struct confbridge_user *user)
{
- ast_log(LOG_ERROR, "Invalid event for confbridge user '%s'\n", cbu->u_profile.name);
+ ast_log(LOG_ERROR, "Invalid event for confbridge user '%s'\n", user->u_profile.name);
}
/*!
@@ -55,7 +55,7 @@ void conf_invalid_event_fn(struct conference_bridge_user *cbu)
*
* \return Nothing
*/
-static void conf_mute_moh_inactive_waitmarked(struct conference_bridge_user *user)
+static void conf_mute_moh_inactive_waitmarked(struct confbridge_user *user)
{
/* Be sure we are muted so we can't talk to anybody else waiting */
user->features.mute = 1;
@@ -65,30 +65,30 @@ static void conf_mute_moh_inactive_waitmarked(struct conference_bridge_user *use
}
}
-void conf_default_join_waitmarked(struct conference_bridge_user *cbu)
+void conf_default_join_waitmarked(struct confbridge_user *user)
{
- conf_add_user_waiting(cbu->conference_bridge, cbu);
- conf_mute_moh_inactive_waitmarked(cbu);
- conf_add_post_join_action(cbu, conf_handle_inactive_waitmarked);
+ conf_add_user_waiting(user->conference, user);
+ conf_mute_moh_inactive_waitmarked(user);
+ conf_add_post_join_action(user, conf_handle_inactive_waitmarked);
}
-void conf_default_leave_waitmarked(struct conference_bridge_user *cbu)
+void conf_default_leave_waitmarked(struct confbridge_user *user)
{
- conf_remove_user_waiting(cbu->conference_bridge, cbu);
+ conf_remove_user_waiting(user->conference, user);
}
-void conf_change_state(struct conference_bridge_user *cbu, struct conference_state *newstate)
+void conf_change_state(struct confbridge_user *user, struct confbridge_state *newstate)
{
- ast_debug(1, "Changing conference '%s' state from %s to %s\n", cbu->conference_bridge->name, cbu->conference_bridge->state->name, newstate->name);
+ ast_debug(1, "Changing conference '%s' state from %s to %s\n", user->conference->name, user->conference->state->name, newstate->name);
ast_test_suite_event_notify("CONF_CHANGE_STATE", "Conference: %s\r\nOldState: %s\r\nNewState: %s\r\n",
- cbu->conference_bridge->name,
- cbu->conference_bridge->state->name,
+ user->conference->name,
+ user->conference->state->name,
newstate->name);
- if (cbu->conference_bridge->state->exit) {
- cbu->conference_bridge->state->exit(cbu);
+ if (user->conference->state->exit) {
+ user->conference->state->exit(user);
}
- cbu->conference_bridge->state = newstate;
- if (cbu->conference_bridge->state->entry) {
- cbu->conference_bridge->state->entry(cbu);
+ user->conference->state = newstate;
+ if (user->conference->state->entry) {
+ user->conference->state->entry(user);
}
}
diff --git a/apps/confbridge/conf_state_empty.c b/apps/confbridge/conf_state_empty.c
index afc736d4a..bd1309bfd 100644
--- a/apps/confbridge/conf_state_empty.c
+++ b/apps/confbridge/conf_state_empty.c
@@ -37,12 +37,12 @@
#include "include/confbridge.h"
#include "include/conf_state.h"
-static void join_unmarked(struct conference_bridge_user *cbu);
-static void join_waitmarked(struct conference_bridge_user *cbu);
-static void join_marked(struct conference_bridge_user *cbu);
-static void transition_to_empty(struct conference_bridge_user *cbu);
+static void join_unmarked(struct confbridge_user *user);
+static void join_waitmarked(struct confbridge_user *user);
+static void join_marked(struct confbridge_user *user);
+static void transition_to_empty(struct confbridge_user *user);
-struct conference_state STATE_EMPTY = {
+struct confbridge_state STATE_EMPTY = {
.name = "EMPTY",
.join_unmarked = join_unmarked,
.join_waitmarked = join_waitmarked,
@@ -50,37 +50,37 @@ struct conference_state STATE_EMPTY = {
.entry = transition_to_empty,
};
-struct conference_state *CONF_STATE_EMPTY = &STATE_EMPTY;
+struct confbridge_state *CONF_STATE_EMPTY = &STATE_EMPTY;
-static void join_unmarked(struct conference_bridge_user *cbu)
+static void join_unmarked(struct confbridge_user *user)
{
- conf_add_user_active(cbu->conference_bridge, cbu);
- conf_handle_first_join(cbu->conference_bridge);
- conf_add_post_join_action(cbu, conf_handle_only_unmarked);
+ conf_add_user_active(user->conference, user);
+ conf_handle_first_join(user->conference);
+ conf_add_post_join_action(user, conf_handle_only_unmarked);
- conf_change_state(cbu, CONF_STATE_SINGLE);
+ conf_change_state(user, CONF_STATE_SINGLE);
}
-static void join_waitmarked(struct conference_bridge_user *cbu)
+static void join_waitmarked(struct confbridge_user *user)
{
- conf_default_join_waitmarked(cbu);
- conf_handle_first_join(cbu->conference_bridge);
+ conf_default_join_waitmarked(user);
+ conf_handle_first_join(user->conference);
- conf_change_state(cbu, CONF_STATE_INACTIVE);
+ conf_change_state(user, CONF_STATE_INACTIVE);
}
-static void join_marked(struct conference_bridge_user *cbu)
+static void join_marked(struct confbridge_user *user)
{
- conf_add_user_marked(cbu->conference_bridge, cbu);
- conf_handle_first_join(cbu->conference_bridge);
- conf_add_post_join_action(cbu, conf_handle_first_marked_common);
+ conf_add_user_marked(user->conference, user);
+ conf_handle_first_join(user->conference);
+ conf_add_post_join_action(user, conf_handle_first_marked_common);
- conf_change_state(cbu, CONF_STATE_SINGLE_MARKED);
+ conf_change_state(user, CONF_STATE_SINGLE_MARKED);
}
-static void transition_to_empty(struct conference_bridge_user *cbu)
+static void transition_to_empty(struct confbridge_user *user)
{
/* Set device state to "not in use" */
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "confbridge:%s", cbu->conference_bridge->name);
- conf_ended(cbu->conference_bridge);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "confbridge:%s", user->conference->name);
+ conf_ended(user->conference);
}
diff --git a/apps/confbridge/conf_state_inactive.c b/apps/confbridge/conf_state_inactive.c
index 80210fcb8..28447983d 100644
--- a/apps/confbridge/conf_state_inactive.c
+++ b/apps/confbridge/conf_state_inactive.c
@@ -35,12 +35,12 @@
#include "include/confbridge.h"
#include "include/conf_state.h"
-static void join_unmarked(struct conference_bridge_user *cbu);
-static void join_marked(struct conference_bridge_user *cbu);
-static void leave_waitmarked(struct conference_bridge_user *cbu);
-static void transition_to_inactive(struct conference_bridge_user *cbu);
+static void join_unmarked(struct confbridge_user *user);
+static void join_marked(struct confbridge_user *user);
+static void leave_waitmarked(struct confbridge_user *user);
+static void transition_to_inactive(struct confbridge_user *user);
-struct conference_state STATE_INACTIVE = {
+struct confbridge_state STATE_INACTIVE = {
.name = "INACTIVE",
.join_unmarked = join_unmarked,
.join_waitmarked = conf_default_join_waitmarked,
@@ -48,33 +48,33 @@ struct conference_state STATE_INACTIVE = {
.leave_waitmarked = leave_waitmarked,
.entry = transition_to_inactive,
};
-struct conference_state *CONF_STATE_INACTIVE = &STATE_INACTIVE;
+struct confbridge_state *CONF_STATE_INACTIVE = &STATE_INACTIVE;
-static void join_unmarked(struct conference_bridge_user *cbu)
+static void join_unmarked(struct confbridge_user *user)
{
- conf_add_user_active(cbu->conference_bridge, cbu);
- conf_add_post_join_action(cbu, conf_handle_only_unmarked);
+ conf_add_user_active(user->conference, user);
+ conf_add_post_join_action(user, conf_handle_only_unmarked);
- conf_change_state(cbu, CONF_STATE_SINGLE);
+ conf_change_state(user, CONF_STATE_SINGLE);
}
-static void join_marked(struct conference_bridge_user *cbu)
+static void join_marked(struct confbridge_user *user)
{
- conf_add_user_marked(cbu->conference_bridge, cbu);
- conf_handle_second_active(cbu->conference_bridge);
+ conf_add_user_marked(user->conference, user);
+ conf_handle_second_active(user->conference);
- conf_change_state(cbu, CONF_STATE_MULTI_MARKED);
+ conf_change_state(user, CONF_STATE_MULTI_MARKED);
}
-static void leave_waitmarked(struct conference_bridge_user *cbu)
+static void leave_waitmarked(struct confbridge_user *user)
{
- conf_remove_user_waiting(cbu->conference_bridge, cbu);
- if (cbu->conference_bridge->waitingusers == 0) {
- conf_change_state(cbu, CONF_STATE_EMPTY);
+ conf_remove_user_waiting(user->conference, user);
+ if (user->conference->waitingusers == 0) {
+ conf_change_state(user, CONF_STATE_EMPTY);
}
}
-static void transition_to_inactive(struct conference_bridge_user *cbu)
+static void transition_to_inactive(struct confbridge_user *user)
{
return;
}
diff --git a/apps/confbridge/conf_state_multi.c b/apps/confbridge/conf_state_multi.c
index 5dcd8f412..70098158b 100644
--- a/apps/confbridge/conf_state_multi.c
+++ b/apps/confbridge/conf_state_multi.c
@@ -35,12 +35,12 @@
#include "include/confbridge.h"
#include "include/conf_state.h"
-static void join_unmarked(struct conference_bridge_user *cbu);
-static void join_marked(struct conference_bridge_user *cbu);
-static void leave_unmarked(struct conference_bridge_user *cbu);
-void transition_to_multi(struct conference_bridge_user *cbu);
+static void join_unmarked(struct confbridge_user *user);
+static void join_marked(struct confbridge_user *user);
+static void leave_unmarked(struct confbridge_user *user);
+void transition_to_multi(struct confbridge_user *user);
-struct conference_state STATE_MULTI = {
+struct confbridge_state STATE_MULTI = {
.name = "MULTI",
.join_unmarked = join_unmarked,
.join_waitmarked = conf_default_join_waitmarked,
@@ -49,29 +49,29 @@ struct conference_state STATE_MULTI = {
.leave_waitmarked = conf_default_leave_waitmarked,
.entry = transition_to_multi,
};
-struct conference_state *CONF_STATE_MULTI = &STATE_MULTI;
+struct confbridge_state *CONF_STATE_MULTI = &STATE_MULTI;
-static void join_unmarked(struct conference_bridge_user *cbu)
+static void join_unmarked(struct confbridge_user *user)
{
- conf_add_user_active(cbu->conference_bridge, cbu);
+ conf_add_user_active(user->conference, user);
}
-static void join_marked(struct conference_bridge_user *cbu)
+static void join_marked(struct confbridge_user *user)
{
- conf_add_user_marked(cbu->conference_bridge, cbu);
+ conf_add_user_marked(user->conference, user);
- conf_change_state(cbu, CONF_STATE_MULTI_MARKED);
+ conf_change_state(user, CONF_STATE_MULTI_MARKED);
}
-static void leave_unmarked(struct conference_bridge_user *cbu)
+static void leave_unmarked(struct confbridge_user *user)
{
- conf_remove_user_active(cbu->conference_bridge, cbu);
- if (cbu->conference_bridge->activeusers == 1) {
- conf_change_state(cbu, CONF_STATE_SINGLE);
+ conf_remove_user_active(user->conference, user);
+ if (user->conference->activeusers == 1) {
+ conf_change_state(user, CONF_STATE_SINGLE);
}
}
-void transition_to_multi(struct conference_bridge_user *cbu)
+void transition_to_multi(struct confbridge_user *user)
{
return;
}
diff --git a/apps/confbridge/conf_state_multi_marked.c b/apps/confbridge/conf_state_multi_marked.c
index 21c567207..0c831f8b5 100644
--- a/apps/confbridge/conf_state_multi_marked.c
+++ b/apps/confbridge/conf_state_multi_marked.c
@@ -39,13 +39,13 @@
#include "asterisk/musiconhold.h"
#include "include/conf_state.h"
-static void join_active(struct conference_bridge_user *cbu);
-static void join_marked(struct conference_bridge_user *cbu);
-static void leave_active(struct conference_bridge_user *cbu);
-static void leave_marked(struct conference_bridge_user *cbu);
-static void transition_to_marked(struct conference_bridge_user *cbu);
+static void join_active(struct confbridge_user *user);
+static void join_marked(struct confbridge_user *user);
+static void leave_active(struct confbridge_user *user);
+static void leave_marked(struct confbridge_user *user);
+static void transition_to_marked(struct confbridge_user *user);
-static struct conference_state STATE_MULTI_MARKED = {
+static struct confbridge_state STATE_MULTI_MARKED = {
.name = "MULTI_MARKED",
.join_unmarked = join_active,
.join_waitmarked = join_active,
@@ -55,87 +55,87 @@ static struct conference_state STATE_MULTI_MARKED = {
.leave_marked = leave_marked,
.entry = transition_to_marked,
};
-struct conference_state *CONF_STATE_MULTI_MARKED = &STATE_MULTI_MARKED;
+struct confbridge_state *CONF_STATE_MULTI_MARKED = &STATE_MULTI_MARKED;
-static void join_active(struct conference_bridge_user *cbu)
+static void join_active(struct confbridge_user *user)
{
- conf_add_user_active(cbu->conference_bridge, cbu);
+ conf_add_user_active(user->conference, user);
}
-static void join_marked(struct conference_bridge_user *cbu)
+static void join_marked(struct confbridge_user *user)
{
- conf_add_user_marked(cbu->conference_bridge, cbu);
+ conf_add_user_marked(user->conference, user);
}
-static void leave_active(struct conference_bridge_user *cbu)
+static void leave_active(struct confbridge_user *user)
{
- conf_remove_user_active(cbu->conference_bridge, cbu);
- if (cbu->conference_bridge->activeusers == 1) {
- conf_change_state(cbu, CONF_STATE_SINGLE_MARKED);
+ conf_remove_user_active(user->conference, user);
+ if (user->conference->activeusers == 1) {
+ conf_change_state(user, CONF_STATE_SINGLE_MARKED);
}
}
-static void leave_marked(struct conference_bridge_user *cbu)
+static void leave_marked(struct confbridge_user *user)
{
- struct conference_bridge_user *cbu_iter;
+ struct confbridge_user *user_iter;
- conf_remove_user_marked(cbu->conference_bridge, cbu);
+ conf_remove_user_marked(user->conference, user);
- if (cbu->conference_bridge->markedusers == 0) {
+ if (user->conference->markedusers == 0) {
/* Play back the audio prompt saying the leader has left the conference */
- if (!ast_test_flag(&cbu->u_profile, USER_OPT_QUIET)) {
- ao2_unlock(cbu->conference_bridge);
- ast_autoservice_start(cbu->chan);
- play_sound_file(cbu->conference_bridge,
- conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, cbu->b_profile.sounds));
- ast_autoservice_stop(cbu->chan);
- ao2_lock(cbu->conference_bridge);
+ if (!ast_test_flag(&user->u_profile, USER_OPT_QUIET)) {
+ ao2_unlock(user->conference);
+ ast_autoservice_start(user->chan);
+ play_sound_file(user->conference,
+ conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, user->b_profile.sounds));
+ ast_autoservice_stop(user->chan);
+ ao2_lock(user->conference);
}
- AST_LIST_TRAVERSE_SAFE_BEGIN(&cbu->conference_bridge->active_list, cbu_iter, list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&user->conference->active_list, user_iter, list) {
/* Kick ENDMARKED cbu_iters */
- if (ast_test_flag(&cbu_iter->u_profile, USER_OPT_ENDMARKED)) {
- cbu_iter->kicked = 1;
- ast_bridge_remove(cbu_iter->conference_bridge->bridge, cbu_iter->chan);
- } else if (ast_test_flag(&cbu_iter->u_profile, USER_OPT_WAITMARKED) &&
- !ast_test_flag(&cbu_iter->u_profile, USER_OPT_MARKEDUSER)) {
+ if (ast_test_flag(&user_iter->u_profile, USER_OPT_ENDMARKED)) {
+ user_iter->kicked = 1;
+ ast_bridge_remove(user_iter->conference->bridge, user_iter->chan);
+ } else if (ast_test_flag(&user_iter->u_profile, USER_OPT_WAITMARKED) &&
+ !ast_test_flag(&user_iter->u_profile, USER_OPT_MARKEDUSER)) {
AST_LIST_REMOVE_CURRENT(list);
- cbu_iter->conference_bridge->activeusers--;
- AST_LIST_INSERT_TAIL(&cbu_iter->conference_bridge->waiting_list, cbu_iter, list);
- cbu_iter->conference_bridge->waitingusers++;
- /* Handle muting/moh of cbu_iter if necessary */
- if (ast_test_flag(&cbu_iter->u_profile, USER_OPT_MUSICONHOLD)) {
- cbu_iter->features.mute = 1;
- conf_moh_start(cbu_iter);
+ user_iter->conference->activeusers--;
+ AST_LIST_INSERT_TAIL(&user_iter->conference->waiting_list, user_iter, list);
+ user_iter->conference->waitingusers++;
+ /* Handle muting/moh of user_iter if necessary */
+ if (ast_test_flag(&user_iter->u_profile, USER_OPT_MUSICONHOLD)) {
+ user_iter->features.mute = 1;
+ conf_moh_start(user_iter);
}
}
}
AST_LIST_TRAVERSE_SAFE_END;
}
- switch (cbu->conference_bridge->activeusers) {
+ switch (user->conference->activeusers) {
case 0:
/* Implies markedusers == 0 */
- switch (cbu->conference_bridge->waitingusers) {
+ switch (user->conference->waitingusers) {
case 0:
- conf_change_state(cbu, CONF_STATE_EMPTY);
+ conf_change_state(user, CONF_STATE_EMPTY);
break;
default:
- conf_change_state(cbu, CONF_STATE_INACTIVE);
+ conf_change_state(user, CONF_STATE_INACTIVE);
break;
}
break;
case 1:
- switch (cbu->conference_bridge->markedusers) {
+ switch (user->conference->markedusers) {
case 0:
- conf_change_state(cbu, CONF_STATE_SINGLE);
+ conf_change_state(user, CONF_STATE_SINGLE);
break;
case 1:
/* XXX I seem to remember doing this for a reason, but right now it escapes me
* how we could possibly ever have a waiting user while we have a marked user */
- switch (cbu->conference_bridge->waitingusers) {
+ switch (user->conference->waitingusers) {
case 0:
- conf_change_state(cbu, CONF_STATE_SINGLE_MARKED);
+ conf_change_state(user, CONF_STATE_SINGLE_MARKED);
break;
case 1:
break; /* Stay in marked */
@@ -144,9 +144,9 @@ static void leave_marked(struct conference_bridge_user *cbu)
}
break;
default:
- switch (cbu->conference_bridge->markedusers) {
+ switch (user->conference->markedusers) {
case 0:
- conf_change_state(cbu, CONF_STATE_MULTI);
+ conf_change_state(user, CONF_STATE_MULTI);
break;
default:
break; /* Stay in marked */
@@ -154,27 +154,27 @@ static void leave_marked(struct conference_bridge_user *cbu)
}
}
-static void transition_to_marked(struct conference_bridge_user *cbu)
+static void transition_to_marked(struct confbridge_user *user)
{
- struct conference_bridge_user *cbu_iter;
+ struct confbridge_user *user_iter;
/* Play the audio file stating they are going to be placed into the conference */
- if (cbu->conference_bridge->markedusers == 1 && ast_test_flag(&cbu->u_profile, USER_OPT_MARKEDUSER)) {
- conf_handle_first_marked_common(cbu);
+ if (user->conference->markedusers == 1 && ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)) {
+ conf_handle_first_marked_common(user);
}
/* Move all waiting users to active, stopping MOH and umuting if necessary */
- AST_LIST_TRAVERSE_SAFE_BEGIN(&cbu->conference_bridge->waiting_list, cbu_iter, list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&user->conference->waiting_list, user_iter, list) {
AST_LIST_REMOVE_CURRENT(list);
- cbu->conference_bridge->waitingusers--;
- AST_LIST_INSERT_TAIL(&cbu->conference_bridge->active_list, cbu_iter, list);
- cbu->conference_bridge->activeusers++;
- if (cbu_iter->playing_moh) {
- conf_moh_stop(cbu_iter);
+ user->conference->waitingusers--;
+ AST_LIST_INSERT_TAIL(&user->conference->active_list, user_iter, list);
+ user->conference->activeusers++;
+ if (user_iter->playing_moh) {
+ conf_moh_stop(user_iter);
}
/* only unmute them if they are not supposed to start muted */
- if (!ast_test_flag(&cbu_iter->u_profile, USER_OPT_STARTMUTED)) {
- cbu_iter->features.mute = 0;
+ if (!ast_test_flag(&user_iter->u_profile, USER_OPT_STARTMUTED)) {
+ user_iter->features.mute = 0;
}
}
AST_LIST_TRAVERSE_SAFE_END;
diff --git a/apps/confbridge/conf_state_single.c b/apps/confbridge/conf_state_single.c
index 806ed637b..2d01420b0 100644
--- a/apps/confbridge/conf_state_single.c
+++ b/apps/confbridge/conf_state_single.c
@@ -35,12 +35,12 @@
#include "include/confbridge.h"
#include "include/conf_state.h"
-static void join_unmarked(struct conference_bridge_user *cbu);
-static void join_marked(struct conference_bridge_user *cbu);
-static void leave_unmarked(struct conference_bridge_user *cbu);
-static void transition_to_single(struct conference_bridge_user *cbu);
+static void join_unmarked(struct confbridge_user *user);
+static void join_marked(struct confbridge_user *user);
+static void leave_unmarked(struct confbridge_user *user);
+static void transition_to_single(struct confbridge_user *user);
-struct conference_state STATE_SINGLE = {
+struct confbridge_state STATE_SINGLE = {
.name = "SINGLE",
.join_unmarked = join_unmarked,
.join_waitmarked = conf_default_join_waitmarked,
@@ -49,36 +49,36 @@ struct conference_state STATE_SINGLE = {
.leave_waitmarked = conf_default_leave_waitmarked,
.entry = transition_to_single,
};
-struct conference_state *CONF_STATE_SINGLE = &STATE_SINGLE;
+struct confbridge_state *CONF_STATE_SINGLE = &STATE_SINGLE;
-static void join_unmarked(struct conference_bridge_user *cbu)
+static void join_unmarked(struct confbridge_user *user)
{
- conf_add_user_active(cbu->conference_bridge, cbu);
- conf_handle_second_active(cbu->conference_bridge);
+ conf_add_user_active(user->conference, user);
+ conf_handle_second_active(user->conference);
- conf_change_state(cbu, CONF_STATE_MULTI);
+ conf_change_state(user, CONF_STATE_MULTI);
}
-static void join_marked(struct conference_bridge_user *cbu)
+static void join_marked(struct confbridge_user *user)
{
- conf_add_user_marked(cbu->conference_bridge, cbu);
- conf_handle_second_active(cbu->conference_bridge);
+ conf_add_user_marked(user->conference, user);
+ conf_handle_second_active(user->conference);
- conf_change_state(cbu, CONF_STATE_MULTI_MARKED);
+ conf_change_state(user, CONF_STATE_MULTI_MARKED);
}
-static void leave_unmarked(struct conference_bridge_user *cbu)
+static void leave_unmarked(struct confbridge_user *user)
{
- conf_remove_user_active(cbu->conference_bridge, cbu);
+ conf_remove_user_active(user->conference, user);
- if (cbu->conference_bridge->waitingusers) {
- conf_change_state(cbu, CONF_STATE_INACTIVE);
+ if (user->conference->waitingusers) {
+ conf_change_state(user, CONF_STATE_INACTIVE);
} else {
- conf_change_state(cbu, CONF_STATE_EMPTY);
+ conf_change_state(user, CONF_STATE_EMPTY);
}
}
-static void transition_to_single(struct conference_bridge_user *cbu)
+static void transition_to_single(struct confbridge_user *user)
{
- conf_mute_only_active(cbu->conference_bridge);
+ conf_mute_only_active(user->conference);
}
diff --git a/apps/confbridge/conf_state_single_marked.c b/apps/confbridge/conf_state_single_marked.c
index a7ac57816..340245831 100644
--- a/apps/confbridge/conf_state_single_marked.c
+++ b/apps/confbridge/conf_state_single_marked.c
@@ -35,12 +35,12 @@
#include "include/confbridge.h"
#include "include/conf_state.h"
-static void join_active(struct conference_bridge_user *cbu);
-static void join_marked(struct conference_bridge_user *cbu);
-static void leave_marked(struct conference_bridge_user *cbu);
-static void transition_to_single_marked(struct conference_bridge_user *cbu);
+static void join_active(struct confbridge_user *user);
+static void join_marked(struct confbridge_user *user);
+static void leave_marked(struct confbridge_user *user);
+static void transition_to_single_marked(struct confbridge_user *user);
-struct conference_state STATE_SINGLE_MARKED = {
+struct confbridge_state STATE_SINGLE_MARKED = {
.name = "SINGLE_MARKED",
.join_unmarked = join_active,
.join_waitmarked = join_active,
@@ -48,32 +48,32 @@ struct conference_state STATE_SINGLE_MARKED = {
.leave_marked = leave_marked,
.entry = transition_to_single_marked,
};
-struct conference_state *CONF_STATE_SINGLE_MARKED = &STATE_SINGLE_MARKED;
+struct confbridge_state *CONF_STATE_SINGLE_MARKED = &STATE_SINGLE_MARKED;
-static void join_active(struct conference_bridge_user *cbu)
+static void join_active(struct confbridge_user *user)
{
- conf_add_user_active(cbu->conference_bridge, cbu);
- conf_handle_second_active(cbu->conference_bridge);
+ conf_add_user_active(user->conference, user);
+ conf_handle_second_active(user->conference);
- conf_change_state(cbu, CONF_STATE_MULTI_MARKED);
+ conf_change_state(user, CONF_STATE_MULTI_MARKED);
}
-static void join_marked(struct conference_bridge_user *cbu)
+static void join_marked(struct confbridge_user *user)
{
- conf_add_user_marked(cbu->conference_bridge, cbu);
- conf_handle_second_active(cbu->conference_bridge);
+ conf_add_user_marked(user->conference, user);
+ conf_handle_second_active(user->conference);
- conf_change_state(cbu, CONF_STATE_MULTI_MARKED);
+ conf_change_state(user, CONF_STATE_MULTI_MARKED);
}
-static void leave_marked(struct conference_bridge_user *cbu)
+static void leave_marked(struct confbridge_user *user)
{
- conf_remove_user_marked(cbu->conference_bridge, cbu);
+ conf_remove_user_marked(user->conference, user);
- conf_change_state(cbu, CONF_STATE_EMPTY);
+ conf_change_state(user, CONF_STATE_EMPTY);
}
-static void transition_to_single_marked(struct conference_bridge_user *cbu)
+static void transition_to_single_marked(struct confbridge_user *user)
{
- conf_mute_only_active(cbu->conference_bridge);
+ conf_mute_only_active(user->conference);
}
diff --git a/apps/confbridge/include/conf_state.h b/apps/confbridge/include/conf_state.h
index 8a2585095..b6f6f473d 100644
--- a/apps/confbridge/include/conf_state.h
+++ b/apps/confbridge/include/conf_state.h
@@ -36,16 +36,16 @@
#ifndef _CONF_STATE_H_
#define _CONF_STATE_H_
-struct conference_state;
-struct conference_bridge;
-struct conference_bridge_user;
+struct confbridge_state;
+struct confbridge_conference;
+struct confbridge_user;
-typedef void (*conference_event_fn)(struct conference_bridge_user *cbu);
-typedef void (*conference_entry_fn)(struct conference_bridge_user *cbu);
-typedef void (*conference_exit_fn)(struct conference_bridge_user *cbu);
+typedef void (*conference_event_fn)(struct confbridge_user *user);
+typedef void (*conference_entry_fn)(struct confbridge_user *user);
+typedef void (*conference_exit_fn)(struct confbridge_user *user);
/*! \brief A conference state object to hold the various state callback functions */
-struct conference_state {
+struct confbridge_state {
const char *name;
conference_event_fn join_unmarked; /*!< Handle an unmarked join event */
conference_event_fn join_waitmarked; /*!< Handle a waitmarked join event */
@@ -58,38 +58,38 @@ struct conference_state {
};
/*! \brief Conference state with no active or waiting users */
-extern struct conference_state *CONF_STATE_EMPTY;
+extern struct confbridge_state *CONF_STATE_EMPTY;
/*! \brief Conference state with only waiting users */
-extern struct conference_state *CONF_STATE_INACTIVE;
+extern struct confbridge_state *CONF_STATE_INACTIVE;
/*! \brief Conference state with only a single unmarked active user */
-extern struct conference_state *CONF_STATE_SINGLE;
+extern struct confbridge_state *CONF_STATE_SINGLE;
/*! \brief Conference state with only a single marked active user */
-extern struct conference_state *CONF_STATE_SINGLE_MARKED;
+extern struct confbridge_state *CONF_STATE_SINGLE_MARKED;
/*! \brief Conference state with multiple active users, but no marked users */
-extern struct conference_state *CONF_STATE_MULTI;
+extern struct confbridge_state *CONF_STATE_MULTI;
/*! \brief Conference state with multiple active users and at least one marked user */
-extern struct conference_state *CONF_STATE_MULTI_MARKED;
+extern struct confbridge_state *CONF_STATE_MULTI_MARKED;
/*! \brief Execute conference state transition because of a user action
- * \param cbu The user that joined/left
+ * \param user The user that joined/left
* \param newstate The state to transition to
*/
-void conf_change_state(struct conference_bridge_user *cbu, struct conference_state *newstate);
+void conf_change_state(struct confbridge_user *user, struct confbridge_state *newstate);
/* Common event handlers shared between different states */
/*! \brief Logic to execute every time a waitmarked user joins an unmarked conference */
-void conf_default_join_waitmarked(struct conference_bridge_user *cbu);
+void conf_default_join_waitmarked(struct confbridge_user *user);
/*! \brief Logic to execute every time a waitmarked user leaves an unmarked conference */
-void conf_default_leave_waitmarked(struct conference_bridge_user *cbu);
+void conf_default_leave_waitmarked(struct confbridge_user *user);
/*! \brief A handler for join/leave events that are invalid in a particular state */
-void conf_invalid_event_fn(struct conference_bridge_user *cbu);
+void conf_invalid_event_fn(struct confbridge_user *user);
#endif
diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h
index 54d429a28..245561376 100644
--- a/apps/confbridge/include/confbridge.h
+++ b/apps/confbridge/include/confbridge.h
@@ -201,16 +201,16 @@ struct bridge_profile {
};
/*! \brief The structure that represents a conference bridge */
-struct conference_bridge {
+struct confbridge_conference {
char name[MAX_CONF_NAME]; /*!< Name of the conference bridge */
- struct conference_state *state; /*!< Conference state information */
+ struct confbridge_state *state; /*!< Conference state information */
struct ast_bridge *bridge; /*!< Bridge structure doing the mixing */
struct bridge_profile b_profile; /*!< The Bridge Configuration Profile */
unsigned int activeusers; /*!< Number of active users present */
unsigned int markedusers; /*!< Number of marked users present */
unsigned int waitingusers; /*!< Number of waiting users present */
unsigned int locked:1; /*!< Is this conference bridge locked? */
- unsigned int muted:1; /*!< Is this conference bridge muted? */
+ unsigned int muted:1; /*!< Is this conference bridge muted? */
unsigned int record_state:2; /*!< Whether recording is started, stopped, or should exit */
struct ast_channel *playback_chan; /*!< Channel used for playback into the conference bridge */
struct ast_channel *record_chan; /*!< Channel used for recording the conference */
@@ -218,18 +218,18 @@ struct conference_bridge {
ast_mutex_t playback_lock; /*!< Lock used for playback channel */
ast_mutex_t record_lock; /*!< Lock used for the record thread */
ast_cond_t record_cond; /*!< Recording condition variable */
- AST_LIST_HEAD_NOLOCK(, conference_bridge_user) active_list; /*!< List of users participating in the conference bridge */
- AST_LIST_HEAD_NOLOCK(, conference_bridge_user) waiting_list; /*!< List of users waiting to join the conference bridge */
+ AST_LIST_HEAD_NOLOCK(, confbridge_user) active_list; /*!< List of users participating in the conference bridge */
+ AST_LIST_HEAD_NOLOCK(, confbridge_user) waiting_list; /*!< List of users waiting to join the conference bridge */
};
struct post_join_action {
- int (*func)(struct conference_bridge_user *);
+ int (*func)(struct confbridge_user *user);
AST_LIST_ENTRY(post_join_action) list;
};
/*! \brief The structure that represents a conference bridge user */
-struct conference_bridge_user {
- struct conference_bridge *conference_bridge; /*!< Conference bridge they are participating in */
+struct confbridge_user {
+ struct confbridge_conference *conference; /*!< Conference bridge they are participating in */
struct bridge_profile b_profile; /*!< The Bridge Configuration Profile */
struct user_profile u_profile; /*!< The User Configuration Profile */
char menu_name[64]; /*!< The name of the DTMF menu assigned to this user */
@@ -241,7 +241,7 @@ struct conference_bridge_user {
unsigned int kicked:1; /*!< User has been kicked from the conference */
unsigned int playing_moh:1; /*!< MOH is currently being played to the user */
AST_LIST_HEAD_NOLOCK(, post_join_action) post_join_list; /*!< List of sounds to play after joining */;
- AST_LIST_ENTRY(conference_bridge_user) list; /*!< Linked list information */
+ AST_LIST_ENTRY(confbridge_user) list; /*!< Linked list information */
};
/*! \brief load confbridge.conf file */
@@ -296,7 +296,7 @@ void conf_bridge_profile_copy(struct bridge_profile *dst, struct bridge_profile
* \retval 0 on success, menu was found and set
* \retval -1 on error, menu was not found
*/
-int conf_set_menu_to_user(const char *menu_name, struct conference_bridge_user *conference_bridge_user);
+int conf_set_menu_to_user(const char *menu_name, struct confbridge_user *user);
/*!
* \brief Finds a menu_entry in a menu structure matched by DTMF sequence.
@@ -318,7 +318,7 @@ void conf_menu_entry_destroy(struct conf_menu_entry *menu_entry);
* called to perform the menu action.
*
* \param bridge_channel Bridged channel this is involving
- * \param conference_bridge_user the conference user to perform the action on.
+ * \param user the conference user to perform the action on.
* \param menu_entry the menu entry that invoked this callback to occur.
* \param menu an AO2 referenced pointer to the entire menu structure the menu_entry
* derived from.
@@ -333,7 +333,7 @@ void conf_menu_entry_destroy(struct conf_menu_entry *menu_entry);
*/
int conf_handle_dtmf(
struct ast_bridge_channel *bridge_channel,
- struct conference_bridge_user *conference_bridge_user,
+ struct confbridge_user *user,
struct conf_menu_entry *menu_entry,
struct conf_menu *menu);
@@ -347,18 +347,18 @@ int func_confbridge_helper(struct ast_channel *chan, const char *cmd, char *data
/*!
* \brief Play sound file into conference bridge
*
- * \param conference_bridge The conference bridge to play sound file into
+ * \param conference The conference bridge to play sound file into
* \param filename Sound file to play
*
* \retval 0 success
* \retval -1 failure
*/
-int play_sound_file(struct conference_bridge *conference_bridge, const char *filename);
+int play_sound_file(struct confbridge_conference *conference, const char *filename);
/*! \brief Callback to be called when the conference has become empty
- * \param conference_bridge The conference bridge
+ * \param conference The conference bridge
*/
-void conf_ended(struct conference_bridge *conference_bridge);
+void conf_ended(struct confbridge_conference *conference);
/*!
* \brief Stop MOH for the conference user.
@@ -367,7 +367,7 @@ void conf_ended(struct conference_bridge *conference_bridge);
*
* \return Nothing
*/
-void conf_moh_stop(struct conference_bridge_user *user);
+void conf_moh_stop(struct confbridge_user *user);
/*!
* \brief Start MOH for the conference user.
@@ -376,88 +376,88 @@ void conf_moh_stop(struct conference_bridge_user *user);
*
* \return Nothing
*/
-void conf_moh_start(struct conference_bridge_user *user);
+void conf_moh_start(struct confbridge_user *user);
/*! \brief Attempt to mute/play MOH to the only user in the conference if they require it
- * \param conference_bridge A conference bridge containing a single user
+ * \param conference A conference bridge containing a single user
*/
-void conf_mute_only_active(struct conference_bridge *conference_bridge);
+void conf_mute_only_active(struct confbridge_conference *conference);
/*! \brief Callback to execute any time we transition from zero to one marked users
- * \param cbu The first marked user joining the conference
+ * \param user The first marked user joining the conference
* \retval 0 success
* \retval -1 failure
*/
-int conf_handle_first_marked_common(struct conference_bridge_user *cbu);
+int conf_handle_first_marked_common(struct confbridge_user *user);
/*! \brief Callback to execute any time we transition from zero to one active users
- * \param conference_bridge The conference bridge with a single active user joined
+ * \param conference The conference bridge with a single active user joined
* \retval 0 success
* \retval -1 failure
*/
-void conf_handle_first_join(struct conference_bridge *conference_bridge);
+void conf_handle_first_join(struct confbridge_conference *conference);
/*! \brief Handle actions every time a waitmarked user joins w/o a marked user present
- * \param cbu The waitmarked user
+ * \param user The waitmarked user
* \retval 0 success
* \retval -1 failure
*/
-int conf_handle_inactive_waitmarked(struct conference_bridge_user *cbu);
+int conf_handle_inactive_waitmarked(struct confbridge_user *user);
/*! \brief Handle actions whenever an unmarked user joins an inactive conference
* \note These actions seem like they could apply just as well to a marked user
* and possibly be made to happen any time transitioning to a single state.
*
- * \param cbu The unmarked user
+ * \param user The unmarked user
*/
-int conf_handle_only_unmarked(struct conference_bridge_user *cbu);
+int conf_handle_only_unmarked(struct confbridge_user *user);
/*! \brief Handle when a conference moves to having more than one active participant
- * \param conference_bridge The conference bridge with more than one active participant
+ * \param conference The conference bridge with more than one active participant
*/
-void conf_handle_second_active(struct conference_bridge *conference_bridge);
+void conf_handle_second_active(struct confbridge_conference *conference);
/*! \brief Add a conference bridge user as an unmarked active user of the conference
- * \param conference_bridge The conference bridge to add the user to
- * \param cbu The conference bridge user to add to the conference
+ * \param conference The conference bridge to add the user to
+ * \param user The conference bridge user to add to the conference
*/
-void conf_add_user_active(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
+void conf_add_user_active(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Add a conference bridge user as a marked active user of the conference
- * \param conference_bridge The conference bridge to add the user to
- * \param cbu The conference bridge user to add to the conference
+ * \param conference The conference bridge to add the user to
+ * \param user The conference bridge user to add to the conference
*/
-void conf_add_user_marked(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
+void conf_add_user_marked(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Add a conference bridge user as an waiting user of the conference
- * \param conference_bridge The conference bridge to add the user to
- * \param cbu The conference bridge user to add to the conference
+ * \param conference The conference bridge to add the user to
+ * \param user The conference bridge user to add to the conference
*/
-void conf_add_user_waiting(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
+void conf_add_user_waiting(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Remove a conference bridge user from the unmarked active conference users in the conference
- * \param conference_bridge The conference bridge to remove the user from
- * \param cbu The conference bridge user to remove from the conference
+ * \param conference The conference bridge to remove the user from
+ * \param user The conference bridge user to remove from the conference
*/
-void conf_remove_user_active(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
+void conf_remove_user_active(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Remove a conference bridge user from the marked active conference users in the conference
- * \param conference_bridge The conference bridge to remove the user from
- * \param cbu The conference bridge user to remove from the conference
+ * \param conference The conference bridge to remove the user from
+ * \param user The conference bridge user to remove from the conference
*/
-void conf_remove_user_marked(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
+void conf_remove_user_marked(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Remove a conference bridge user from the waiting conference users in the conference
- * \param conference_bridge The conference bridge to remove the user from
- * \param cbu The conference bridge user to remove from the conference
+ * \param conference The conference bridge to remove the user from
+ * \param user The conference bridge user to remove from the conference
*/
-void conf_remove_user_waiting(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
+void conf_remove_user_waiting(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Queue a function to run with the given conference bridge user as an argument once the state transition is complete
- * \param cbu The conference bridge user to pass to the function
+ * \param user The conference bridge user to pass to the function
* \param func The function to queue
* \retval 0 success
* \retval non-zero failure
*/
-int conf_add_post_join_action(struct conference_bridge_user *cbu, int (*func)(struct conference_bridge_user *cbu));
+int conf_add_post_join_action(struct confbridge_user *user, int (*func)(struct confbridge_user *user));
#endif