You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sems/apps/conference/Conference.h

136 lines
3.4 KiB

/*
* $Id$
*
* 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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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 _CONFERENCE_H_
#define _CONFERENCE_H_
#include "AmApi.h"
#include "AmThread.h"
#include "AmSession.h"
#include "AmConferenceChannel.h"
#include "AmPlaylist.h"
#include "AmRingTone.h"
#include <map>
#include <string>
using std::map;
using std::string;
class ConferenceStatus;
class ConferenceStatusContainer;
enum { CS_normal=0,
CS_dialing_out,
CS_dialed_out,
CS_dialout_connected };
enum { DoConfConnect = 100,
DoConfDisconnect,
DoConfRinging,
DoConfError
};
struct DialoutConfEvent : public AmEvent {
string conf_id;
DialoutConfEvent(int event_id,
const string& conf_id)
: AmEvent(event_id),
conf_id(conf_id)
{}
};
class ConferenceFactory : public AmSessionFactory
{
public:
static string LonelyUserFile;
static string JoinSound;
static string DropSound;
static string DialoutSuffix;
//static string RingTone;
ConferenceFactory(const string& _app_name);
virtual AmSession* onInvite(const AmSipRequest&);
virtual AmSession* onRefer(const AmSipRequest& req);
virtual int onLoad();
};
class ConferenceDialog : public AmSession
{
AmPlaylist play_list;
auto_ptr<AmAudioFile> LonelyUserFile;
auto_ptr<AmAudioFile> JoinSound;
auto_ptr<AmAudioFile> DropSound;
auto_ptr<AmRingTone> RingTone;
auto_ptr<AmRingTone> ErrorTone;
string conf_id;
auto_ptr<AmConferenceChannel> channel;
int state;
string dtmf_seq;
bool dialedout;
string dialout_id;
auto_ptr<AmConferenceChannel> dialout_channel;
bool allow_dialout;
auto_ptr<AmSipRequest> transfer_req;
void createDialoutParticipant(const string& uri);
void disconnectDialout();
void connectMainChannel();
void closeChannels();
void setupAudio();
public:
ConferenceDialog(const string& conf_id,
AmConferenceChannel* dialout_channel=0);
~ConferenceDialog();
void process(AmEvent* ev);
void onStart();
void onDtmf(int event, int duration);
void onSessionStart(const AmSipRequest& req);
void onBye(const AmSipRequest& req);
void onSipRequest(const AmSipRequest& req);
void onSipReply(const AmSipReply& reply);
};
#endif
// Local Variables:
// mode:C++
// End: