Asterisk - The Open Source Telephony Project GIT-master-7e7a603
conf_state.h
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
22 *
23 * \author\verbatim Terry Wilson <twilson@digium.com> \endverbatim
24 *
25 * See https://docs.asterisk.org/Development/Reference-Information/Other-Reference-Information/Confbridge-state-changes/ for
26 * a more complete description of how conference states work.
27 */
28
29/*** MODULEINFO
30 <support_level>core</support_level>
31 ***/
32
33#ifndef _CONF_STATE_H_
34#define _CONF_STATE_H_
35
36struct confbridge_state;
38struct confbridge_user;
39
40typedef void (*conference_event_fn)(struct confbridge_user *user);
41typedef void (*conference_entry_fn)(struct confbridge_user *user);
42typedef void (*conference_exit_fn)(struct confbridge_user *user);
43
44/*! \brief A conference state object to hold the various state callback functions */
46 const char *name;
47 conference_event_fn join_unmarked; /*!< Handle an unmarked join event */
48 conference_event_fn join_waitmarked; /*!< Handle a waitmarked join event */
49 conference_event_fn join_marked; /*!< Handle a marked join event */
50 conference_event_fn leave_unmarked; /*!< Handle an unmarked leave event */
51 conference_event_fn leave_waitmarked; /*!< Handle a waitmarked leave event */
52 conference_event_fn leave_marked; /*!< Handle a marked leave event */
53 conference_entry_fn entry; /*!< Function to handle entry to a state */
54 conference_exit_fn exit; /*!< Function to handle exiting from a state */
55};
56
57/*! \brief Conference state with no active or waiting users */
59
60/*! \brief Conference state with only waiting users */
62
63/*! \brief Conference state with only a single unmarked active user */
65
66/*! \brief Conference state with only a single marked active user */
68
69/*! \brief Conference state with multiple active users, but no marked users */
71
72/*! \brief Conference state with multiple active users and at least one marked user */
74
75/*! \brief Execute conference state transition because of a user action
76 * \param user The user that joined/left
77 * \param newstate The state to transition to
78 */
79void conf_change_state(struct confbridge_user *user, struct confbridge_state *newstate);
80
81/* Common event handlers shared between different states */
82
83/*! \brief Logic to execute every time a waitmarked user joins an unmarked conference */
85
86/*! \brief Logic to execute every time a waitmarked user leaves an unmarked conference */
88
89/*! \brief A handler for join/leave events that are invalid in a particular state */
91
92#endif
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:69
void(* conference_entry_fn)(struct confbridge_user *user)
Definition: conf_state.h:41
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
void(* conference_exit_fn)(struct confbridge_user *user)
Definition: conf_state.h:42
struct confbridge_state * CONF_STATE_MULTI_MARKED
Conference state with multiple active users and at least one marked user.
struct confbridge_state * CONF_STATE_EMPTY
Conference state with no active or waiting users.
struct confbridge_state * CONF_STATE_MULTI
Conference state with multiple active users, but no marked 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
void(* conference_event_fn)(struct confbridge_user *user)
Definition: conf_state.h:40
void conf_invalid_event_fn(struct confbridge_user *user)
A handler for join/leave events that are invalid in a particular state.
Definition: conf_state.c:42
struct confbridge_state * CONF_STATE_INACTIVE
Conference state with only waiting users.
struct confbridge_state * CONF_STATE_SINGLE_MARKED
Conference state with only a single marked active user.
struct confbridge_state * CONF_STATE_SINGLE
Conference state with only a single unmarked active user.
static char user[512]
The structure that represents a conference bridge.
Definition: confbridge.h:246
A conference state object to hold the various state callback functions.
Definition: conf_state.h:45
conference_event_fn join_unmarked
Definition: conf_state.h:47
conference_event_fn join_waitmarked
Definition: conf_state.h:48
conference_entry_fn entry
Definition: conf_state.h:53
conference_event_fn leave_waitmarked
Definition: conf_state.h:51
const char * name
Definition: conf_state.h:46
conference_event_fn leave_marked
Definition: conf_state.h:52
conference_event_fn leave_unmarked
Definition: conf_state.h:50
conference_event_fn join_marked
Definition: conf_state.h:49
conference_exit_fn exit
Definition: conf_state.h:54
The structure that represents a conference bridge user.
Definition: confbridge.h:273
structure to hold users read from users.conf