| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
#include "include/confbridge.h" |
| 33 |
#include "include/conf_state.h" |
| 34 |
|
| 35 |
static void join_unmarked(struct confbridge_user *user); |
| 36 |
static void join_marked(struct confbridge_user *user); |
| 37 |
static void leave_unmarked(struct confbridge_user *user); |
| 38 |
static void transition_to_single(struct confbridge_user *user); |
| 39 |
|
| 40 |
struct confbridge_state STATE_SINGLE = { |
| 41 |
.name = "SINGLE", |
| 42 |
.join_unmarked = join_unmarked, |
| 43 |
.join_waitmarked = conf_default_join_waitmarked, |
| 44 |
.join_marked = join_marked, |
| 45 |
.leave_unmarked = leave_unmarked, |
| 46 |
.leave_waitmarked = conf_default_leave_waitmarked, |
| 47 |
.entry = transition_to_single, |
| 48 |
}; |
| 49 |
struct confbridge_state *CONF_STATE_SINGLE = &STATE_SINGLE; |
| 50 |
|
| 51 |
static void join_unmarked(struct confbridge_user *user) |
| 52 |
{ |
| 53 |
conf_add_user_active(user->conference, user); |
| 54 |
conf_handle_second_active(user->conference); |
| 55 |
conf_update_user_mute(user); |
| 56 |
|
| 57 |
conf_change_state(user, CONF_STATE_MULTI); |
| 58 |
} |
| 59 |
|
| 60 |
static void join_marked(struct confbridge_user *user) |
| 61 |
{ |
| 62 |
conf_add_user_marked(user->conference, user); |
| 63 |
conf_handle_second_active(user->conference); |
| 64 |
conf_update_user_mute(user); |
| 65 |
|
| 66 |
conf_change_state(user, CONF_STATE_MULTI_MARKED); |
| 67 |
} |
| 68 |
|
| 69 |
static void leave_unmarked(struct confbridge_user *user) |
| 70 |
{ |
| 71 |
conf_remove_user_active(user->conference, user); |
| 72 |
if (user->playing_moh) { |
| 73 |
conf_moh_stop(user); |
| 74 |
} |
| 75 |
|
| 76 |
if (user->conference->waitingusers) { |
| 77 |
conf_change_state(user, CONF_STATE_INACTIVE); |
| 78 |
} else { |
| 79 |
conf_change_state(user, CONF_STATE_EMPTY); |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
static void transition_to_single(struct confbridge_user *user) |
| 84 |
{ |
| 85 |
conf_mute_only_active(user->conference); |
| 86 |
} |