* $Id: AmConferenceStatus.h,v 2005/03/07 21:34:45 sayer Exp $
 * Copyright (C) 2002-2003 Fhg Fokus
 * This file is part of sems, a free SIP media server.
 * sems is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * For a license to use the sems software under conditions
 * other than those described here, or to purchase support for this
 * software, please contact iptel.org by e-mail at the following addresses:
 *    info@iptel.org
 * sems is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License 
 * along with this program; if not, write to the Free Software 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#ifndef _ConferenceStatus_h_
#define _ConferenceStatus_h_

#include "AmThread.h"
#include "AmRtpStream.h"
#include "AmMultiPartyMixer.h"
#include "AmEventQueue.h"

#include <map>
#include <string>
using std::map;
using std::string;

class AmConferenceChannel;

enum { ConfNewParticipant = 1,
       ConfParticipantLeft };

/** \brief event in a conference*/
struct ConferenceEvent: public AmEvent
    unsigned int participants;
    string       conf_id;

    ConferenceEvent(int event_id, 
		    unsigned int participants,
		    const string& conf_id)
	: AmEvent(event_id),

 * \brief One conference (room).
 * The ConferenceStatus manages one conference.
class AmConferenceStatus
    static map<string,AmConferenceStatus*> cid2status;
    static AmMutex                         cid2s_mut;

    struct SessInfo {

	string       sess_id;
	unsigned int ch_id;

	SessInfo(const string& local_tag,
		 unsigned int  ch_id)
	    : sess_id(local_tag),

    string                 conf_id;
    AmMultiPartyMixer      mixer;
    // sess_id -> ch_id
    map<string, unsigned int> sessions;

    // ch_id -> sess_id
    map<unsigned int, SessInfo*> channels;

    AmMutex                      sessions_mut;

    AmConferenceStatus(const string& conference_id);

    AmConferenceChannel* getChannel(const string& sess_id);

    int releaseChannel(unsigned int ch_id);

    const string&      getConfID() { return conf_id; }
    AmMultiPartyMixer* getMixer()  { return &mixer; }

    static AmConferenceChannel* getChannel(const string& cid, 
					   const string& local_tag);

    static void releaseChannel(const string& cid, unsigned int ch_id);

// Local Variables:
// mode:C++
// End: