Asterisk - The Open Source Telephony Project  18.5.0
conf_state_single.c
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2012, Terry Wilson
5  *
6  * Terry Wilson <[email protected]>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  *
18  * Please follow coding guidelines
19  * http://svn.digium.com/view/asterisk/trunk/doc/CODING-GUIDELINES
20  */
21 
22 /*! \file
23  *
24  * \brief Confbridge state handling for the SINGLE state
25  *
26  * \author\verbatim Terry Wilson <[email protected]> \endverbatim
27  *
28  * \ingroup applications
29  */
30 
31 /*** MODULEINFO
32  <support_level>core</support_level>
33  ***/
34 
35 #include "include/confbridge.h"
36 #include "include/conf_state.h"
37 
38 static void join_unmarked(struct confbridge_user *user);
39 static void join_marked(struct confbridge_user *user);
40 static void leave_unmarked(struct confbridge_user *user);
41 static void transition_to_single(struct confbridge_user *user);
42 
44  .name = "SINGLE",
45  .join_unmarked = join_unmarked,
46  .join_waitmarked = conf_default_join_waitmarked,
47  .join_marked = join_marked,
48  .leave_unmarked = leave_unmarked,
49  .leave_waitmarked = conf_default_leave_waitmarked,
50  .entry = transition_to_single,
51 };
53 
54 static void join_unmarked(struct confbridge_user *user)
55 {
56  conf_add_user_active(user->conference, user);
59 
61 }
62 
63 static void join_marked(struct confbridge_user *user)
64 {
65  conf_add_user_marked(user->conference, user);
68 
70 }
71 
72 static void leave_unmarked(struct confbridge_user *user)
73 {
75  if (user->playing_moh) {
76  conf_moh_stop(user);
77  }
78 
79  if (user->conference->waitingusers) {
81  } else {
83  }
84 }
85 
87 {
89 }
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.
static void join_unmarked(struct confbridge_user *user)
struct confbridge_state * CONF_STATE_MULTI
Conference state with multiple active users, but no marked users.
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.
static void join_marked(struct confbridge_user *user)
unsigned int playing_moh
Definition: confbridge.h:283
void conf_default_leave_waitmarked(struct confbridge_user *user)
Logic to execute every time a waitmarked user leaves an unmarked conference.
Definition: conf_state.c:74
struct confbridge_conference * conference
Definition: confbridge.h:272
struct confbridge_state STATE_SINGLE
static void transition_to_single(struct confbridge_user *user)
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.
void conf_update_user_mute(struct confbridge_user *user)
Update the actual mute status of the user and set it on the bridge.
const char * name
Definition: conf_state.h:49
struct confbridge_state * CONF_STATE_EMPTY
Conference state with no active or waiting users.
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.
void conf_handle_second_active(struct confbridge_conference *conference)
Handle when a conference moves to having more than one active participant.
unsigned int waitingusers
Definition: confbridge.h:251
void conf_default_join_waitmarked(struct confbridge_user *user)
Logic to execute every time a waitmarked user joins an unmarked conference.
Definition: conf_state.c:67
struct confbridge_state * CONF_STATE_SINGLE
Conference state with only a single unmarked active user.
void conf_moh_stop(struct confbridge_user *user)
Stop MOH for the conference user.
structure to hold users read from users.conf
Confbridge state handling.
A conference state object to hold the various state callback functions.
Definition: conf_state.h:48
struct confbridge_state * CONF_STATE_INACTIVE
Conference state with only waiting users.
The structure that represents a conference bridge user.
Definition: confbridge.h:271
static void leave_unmarked(struct confbridge_user *user)
struct confbridge_state * CONF_STATE_MULTI_MARKED
Conference state with multiple active users and at least one marked user.
void conf_change_state(struct confbridge_user *user, struct confbridge_state *newstate)
Execute conference state transition because of a user action.
Definition: conf_state.c:82