Asterisk - The Open Source Telephony Project  21.4.1
conf_state_empty.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 <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 
19 /*! \file
20  *
21  * \brief Confbridge state handling for the EMPTY state
22  *
23  * \author\verbatim Terry Wilson <twilson@digium.com> \endverbatim
24  *
25  * \ingroup applications
26  */
27 
28 /*** MODULEINFO
29  <support_level>core</support_level>
30  ***/
31 
32 #include "asterisk.h"
33 #include "asterisk/devicestate.h"
34 #include "include/confbridge.h"
35 #include "include/conf_state.h"
36 
37 static void join_unmarked(struct confbridge_user *user);
38 static void join_waitmarked(struct confbridge_user *user);
39 static void join_marked(struct confbridge_user *user);
40 static void transition_to_empty(struct confbridge_user *user);
41 
42 struct confbridge_state STATE_EMPTY = {
43  .name = "EMPTY",
44  .join_unmarked = join_unmarked,
45  .join_waitmarked = join_waitmarked,
46  .join_marked = join_marked,
47  .entry = transition_to_empty,
48 };
49 
50 struct confbridge_state *CONF_STATE_EMPTY = &STATE_EMPTY;
51 
52 static void join_unmarked(struct confbridge_user *user)
53 {
54  conf_add_user_active(user->conference, user);
57 
59 }
60 
61 static void join_waitmarked(struct confbridge_user *user)
62 {
65 
67 }
68 
69 static void join_marked(struct confbridge_user *user)
70 {
71  conf_add_user_marked(user->conference, user);
74 
76 }
77 
78 static void transition_to_empty(struct confbridge_user *user)
79 {
80  /* Set device state to "not in use" */
82  conf_ended(user->conference);
83 }
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.
conference_event_fn join_unmarked
Definition: conf_state.h:47
int conf_add_post_join_action(struct confbridge_user *user, int(*func)(struct confbridge_user *user))
Queue a function to run with the given conference bridge user as an argument once the state transitio...
Asterisk main include file. File version handling, generic pbx functions.
struct confbridge_conference * conference
Definition: confbridge.h:274
Device state management.
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.
conference_event_fn join_marked
Definition: conf_state.h:49
struct confbridge_state * CONF_STATE_SINGLE_MARKED
Conference state with only a single marked active user.
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.
Definition: devicestate.c:510
void conf_handle_first_join(struct confbridge_conference *conference)
Callback to execute any time we transition from zero to one active users.
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:62
int conf_handle_only_person(struct confbridge_user *user)
Handle actions whenever an user joins an empty conference.
struct confbridge_state * CONF_STATE_SINGLE
Conference state with only a single unmarked active user.
conference_event_fn join_waitmarked
Definition: conf_state.h:48
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:45
struct confbridge_state * CONF_STATE_INACTIVE
Conference state with only waiting users.
The structure that represents a conference bridge user.
Definition: confbridge.h:273
void conf_ended(struct confbridge_conference *conference)
Callback to be called when the conference has become empty.
char name[MAX_CONF_NAME]
Definition: confbridge.h:247
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:77