Fix documentation replication issues
[asterisk/asterisk.git] / apps / confbridge / conf_state_empty.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2012, Terry Wilson
5  *
6  * Terry Wilson <twilson@digium.com>
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 EMPTY state
25  *
26  * \author\verbatim Terry Wilson <twilson@digium.com> \endverbatim
27  *
28  * \ingroup applications
29  */
30
31 /*** MODULEINFO
32         <support_level>core</support_level>
33  ***/
34
35 #include "asterisk.h"
36 #include "asterisk/devicestate.h"
37 #include "include/confbridge.h"
38 #include "include/conf_state.h"
39
40 static void join_unmarked(struct confbridge_user *user);
41 static void join_waitmarked(struct confbridge_user *user);
42 static void join_marked(struct confbridge_user *user);
43 static void transition_to_empty(struct confbridge_user *user);
44
45 struct confbridge_state STATE_EMPTY = {
46         .name = "EMPTY",
47         .join_unmarked = join_unmarked,
48         .join_waitmarked = join_waitmarked,
49         .join_marked = join_marked,
50         .entry = transition_to_empty,
51 };
52
53 struct confbridge_state *CONF_STATE_EMPTY = &STATE_EMPTY;
54
55 static void join_unmarked(struct confbridge_user *user)
56 {
57         conf_add_user_active(user->conference, user);
58         conf_handle_first_join(user->conference);
59         conf_add_post_join_action(user, conf_handle_only_unmarked);
60
61         conf_change_state(user, CONF_STATE_SINGLE);
62 }
63
64 static void join_waitmarked(struct confbridge_user *user)
65 {
66         conf_default_join_waitmarked(user);
67         conf_handle_first_join(user->conference);
68
69         conf_change_state(user, CONF_STATE_INACTIVE);
70 }
71
72 static void join_marked(struct confbridge_user *user)
73 {
74         conf_add_user_marked(user->conference, user);
75         conf_handle_first_join(user->conference);
76         conf_add_post_join_action(user, conf_handle_first_marked_common);
77
78         conf_change_state(user, CONF_STATE_SINGLE_MARKED);
79 }
80
81 static void transition_to_empty(struct confbridge_user *user)
82 {
83         /* Set device state to "not in use" */
84         ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "confbridge:%s", user->conference->name);
85         conf_ended(user->conference);
86 }