conf_state_empty.c

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 for the EMPTY state
00025  *
00026  * \author\verbatim Terry Wilson <twilson@digium.com> \endverbatim
00027  *
00028  * \ingroup applications
00029  */
00030 
00031 /*** MODULEINFO
00032    <support_level>core</support_level>
00033  ***/
00034 
00035 #include "asterisk.h"
00036 #include "asterisk/devicestate.h"
00037 #include "include/confbridge.h"
00038 #include "include/conf_state.h"
00039 
00040 static void join_unmarked(struct confbridge_user *user);
00041 static void join_waitmarked(struct confbridge_user *user);
00042 static void join_marked(struct confbridge_user *user);
00043 static void transition_to_empty(struct confbridge_user *user);
00044 
00045 struct confbridge_state STATE_EMPTY = {
00046    .name = "EMPTY",
00047    .join_unmarked = join_unmarked,
00048    .join_waitmarked = join_waitmarked,
00049    .join_marked = join_marked,
00050    .entry = transition_to_empty,
00051 };
00052 
00053 struct confbridge_state *CONF_STATE_EMPTY = &STATE_EMPTY;
00054 
00055 static void join_unmarked(struct confbridge_user *user)
00056 {
00057    conf_add_user_active(user->conference, user);
00058    conf_handle_first_join(user->conference);
00059    conf_add_post_join_action(user, conf_handle_only_unmarked);
00060 
00061    conf_change_state(user, CONF_STATE_SINGLE);
00062 }
00063 
00064 static void join_waitmarked(struct confbridge_user *user)
00065 {
00066    conf_default_join_waitmarked(user);
00067    conf_handle_first_join(user->conference);
00068 
00069    conf_change_state(user, CONF_STATE_INACTIVE);
00070 }
00071 
00072 static void join_marked(struct confbridge_user *user)
00073 {
00074    conf_add_user_marked(user->conference, user);
00075    conf_handle_first_join(user->conference);
00076 
00077    conf_change_state(user, CONF_STATE_SINGLE_MARKED);
00078 }
00079 
00080 static void transition_to_empty(struct confbridge_user *user)
00081 {
00082    /* Set device state to "not in use" */
00083    ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "confbridge:%s", user->conference->name);
00084    conf_ended(user->conference);
00085 }

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