conf_state.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 2012, Terry Wilson
00005  *
00006  * Terry Wilson <twilson@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  *
00018  * Please follow coding guidelines
00019  * http://svn.digium.com/view/asterisk/trunk/doc/CODING-GUIDELINES
00020  */
00021 
00022 /*! \file
00023  *
00024  * \brief Confbridge state handling
00025  *
00026  * \author\verbatim Terry Wilson <twilson@digium.com> \endverbatim
00027  *
00028  * See https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes for
00029  * a more complete description of how conference states work.
00030  */
00031 
00032 /*** MODULEINFO
00033    <support_level>core</support_level>
00034  ***/
00035 
00036 #ifndef _CONF_STATE_H_
00037 #define _CONF_STATE_H_
00038 
00039 struct confbridge_state;
00040 struct confbridge_conference;
00041 struct confbridge_user;
00042 
00043 typedef void (*conference_event_fn)(struct confbridge_user *user);
00044 typedef void (*conference_entry_fn)(struct confbridge_user *user);
00045 typedef void (*conference_exit_fn)(struct confbridge_user *user);
00046 
00047 /*! \brief A conference state object to hold the various state callback functions */
00048 struct confbridge_state {
00049    const char *name;
00050    conference_event_fn join_unmarked;    /*!< Handle an unmarked join event */
00051    conference_event_fn join_waitmarked;  /*!< Handle a waitmarked join event */
00052    conference_event_fn join_marked;      /*!< Handle a marked join event */
00053    conference_event_fn leave_unmarked;   /*!< Handle an unmarked leave event */
00054    conference_event_fn leave_waitmarked; /*!< Handle a waitmarked leave event */
00055    conference_event_fn leave_marked;     /*!< Handle a marked leave event */
00056    conference_entry_fn entry;            /*!< Function to handle entry to a state */
00057    conference_exit_fn exit;              /*!< Function to handle exiting from a state */
00058 };
00059 
00060 /*! \brief Conference state with no active or waiting users */
00061 extern struct confbridge_state *CONF_STATE_EMPTY;
00062 
00063 /*! \brief Conference state with only waiting users */
00064 extern struct confbridge_state *CONF_STATE_INACTIVE;
00065 
00066 /*! \brief Conference state with only a single unmarked active user */
00067 extern struct confbridge_state *CONF_STATE_SINGLE;
00068 
00069 /*! \brief Conference state with only a single marked active user */
00070 extern struct confbridge_state *CONF_STATE_SINGLE_MARKED;
00071 
00072 /*! \brief Conference state with multiple active users, but no marked users */
00073 extern struct confbridge_state *CONF_STATE_MULTI;
00074 
00075 /*! \brief Conference state with multiple active users and at least one marked user */
00076 extern struct confbridge_state *CONF_STATE_MULTI_MARKED;
00077 
00078 /*! \brief Execute conference state transition because of a user action
00079  * \param user The user that joined/left
00080  * \param newstate The state to transition to
00081  */
00082 void conf_change_state(struct confbridge_user *user, struct confbridge_state *newstate);
00083 
00084 /* Common event handlers shared between different states */
00085 
00086 /*! \brief Logic to execute every time a waitmarked user joins an unmarked conference */
00087 void conf_default_join_waitmarked(struct confbridge_user *user);
00088 
00089 /*! \brief Logic to execute every time a waitmarked user leaves an unmarked conference */
00090 void conf_default_leave_waitmarked(struct confbridge_user *user);
00091 
00092 /*! \brief A handler for join/leave events that are invalid in a particular state */
00093 void conf_invalid_event_fn(struct confbridge_user *user);
00094 
00095 #endif

Generated on Thu Apr 16 06:27:31 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6