conf_state_single.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 SINGLE 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 "include/confbridge.h"
00036 #include "include/conf_state.h"
00037 
00038 static void join_unmarked(struct confbridge_user *user);
00039 static void join_marked(struct confbridge_user *user);
00040 static void leave_unmarked(struct confbridge_user *user);
00041 static void transition_to_single(struct confbridge_user *user);
00042 
00043 struct confbridge_state STATE_SINGLE = {
00044    .name = "SINGLE",
00045    .join_unmarked = join_unmarked,
00046    .join_waitmarked = conf_default_join_waitmarked,
00047    .join_marked = join_marked,
00048    .leave_unmarked = leave_unmarked,
00049    .leave_waitmarked = conf_default_leave_waitmarked,
00050    .entry = transition_to_single,
00051 };
00052 struct confbridge_state *CONF_STATE_SINGLE = &STATE_SINGLE;
00053 
00054 static void join_unmarked(struct confbridge_user *user)
00055 {
00056    conf_add_user_active(user->conference, user);
00057    conf_handle_second_active(user->conference);
00058    conf_update_user_mute(user);
00059 
00060    conf_change_state(user, CONF_STATE_MULTI);
00061 }
00062 
00063 static void join_marked(struct confbridge_user *user)
00064 {
00065    conf_add_user_marked(user->conference, user);
00066    conf_handle_second_active(user->conference);
00067    conf_update_user_mute(user);
00068 
00069    conf_change_state(user, CONF_STATE_MULTI_MARKED);
00070 }
00071 
00072 static void leave_unmarked(struct confbridge_user *user)
00073 {
00074    conf_remove_user_active(user->conference, user);
00075    if (user->playing_moh) {
00076       conf_moh_stop(user);
00077    }
00078 
00079    if (user->conference->waitingusers) {
00080       conf_change_state(user, CONF_STATE_INACTIVE);
00081    } else {
00082       conf_change_state(user, CONF_STATE_EMPTY);
00083    }
00084 }
00085 
00086 static void transition_to_single(struct confbridge_user *user)
00087 {
00088    conf_mute_only_active(user->conference);
00089 }

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