r3462 - in trunk: libminisip libminisip/include libminisip/include/libminisip libminisip/include/libminisip/gui libminisip/include/libminisip/media libminisip/include/libminisip/signaling/conference libminisip/include/libminisip/signaling/sip libminisip/source libminisip/source/conference libminisip/source/subsystem_media libminisip/source/subsystem_signaling/sip libminisip/tests minisip/minisip/gui/gtkgui
erik at minisip.org
erik at minisip.org
Mon Nov 12 17:06:41 CET 2007
Author: erik
Date: 2007-11-12 17:06:41 +0100 (Mon, 12 Nov 2007)
New Revision: 3462
Added:
trunk/libminisip/source/subsystem_media/MediaHandler.h
trunk/libminisip/source/subsystem_media/MediaStream.h
trunk/libminisip/source/subsystem_media/RtpReceiver.h
trunk/libminisip/source/subsystem_media/Session.h
trunk/libminisip/source/subsystem_media/SessionRegistry.h
Removed:
trunk/libminisip/include/libminisip/media/MediaHandler.h
trunk/libminisip/include/libminisip/media/MediaStream.h
trunk/libminisip/include/libminisip/media/RtpReceiver.h
trunk/libminisip/include/libminisip/media/Session.h
trunk/libminisip/include/libminisip/media/SessionRegistry.h
Modified:
trunk/libminisip/Makefile.am
trunk/libminisip/include/Makefile.am
trunk/libminisip/include/libminisip/Minisip.h
trunk/libminisip/include/libminisip/gui/ConsoleDebugger.h
trunk/libminisip/include/libminisip/media/CallRecorder.h
trunk/libminisip/include/libminisip/media/Media.h
trunk/libminisip/include/libminisip/media/MediaCommandString.h
trunk/libminisip/include/libminisip/media/SubsystemMedia.h
trunk/libminisip/include/libminisip/signaling/conference/ConfMessageRouter.h
trunk/libminisip/include/libminisip/signaling/sip/DefaultDialogHandler.h
trunk/libminisip/include/libminisip/signaling/sip/Sip.h
trunk/libminisip/include/libminisip/signaling/sip/SipDialogVoip.h
trunk/libminisip/source/Minisip.cxx
trunk/libminisip/source/conference/ConfMessageRouter.cxx
trunk/libminisip/source/subsystem_media/AudioMedia.cxx
trunk/libminisip/source/subsystem_media/AudioPlugin.cxx
trunk/libminisip/source/subsystem_media/DtmfSender.cxx
trunk/libminisip/source/subsystem_media/Media.cxx
trunk/libminisip/source/subsystem_media/MediaCommandString.cxx
trunk/libminisip/source/subsystem_media/MediaHandler.cxx
trunk/libminisip/source/subsystem_media/MediaStream.cxx
trunk/libminisip/source/subsystem_media/RtpReceiver.cxx
trunk/libminisip/source/subsystem_media/Session.cxx
trunk/libminisip/source/subsystem_media/SessionRegistry.cxx
trunk/libminisip/source/subsystem_media/SubsystemMedia.cxx
trunk/libminisip/source/subsystem_signaling/sip/DefaultDialogHandler.cxx
trunk/libminisip/source/subsystem_signaling/sip/Sip.cxx
trunk/libminisip/source/subsystem_signaling/sip/SipDialogConfVoip.cxx
trunk/libminisip/source/subsystem_signaling/sip/SipDialogPresenceClient.cxx
trunk/libminisip/source/subsystem_signaling/sip/SipDialogPresenceServer.cxx
trunk/libminisip/source/subsystem_signaling/sip/SipSoftPhoneConfiguration.cxx
trunk/libminisip/tests/000_compile.cxx
trunk/minisip/minisip/gui/gtkgui/CallWidget.cxx
trunk/minisip/minisip/gui/gtkgui/ConferenceWidget.cxx
Log:
* Moved a few header files that are only used in the media handling
from the "include" directory to "source".
There are a few includes from "include" to "source"
(#include"../../../source/...") because not all files that should
be moved are moved yet.
* Use SubsystemMedia instead of MediaHandler in a few places.
* It's now possible to send DTMF events by sending a
CommandString to the media subsystem.
I need to test this version a some, and move some more files.
Modified: trunk/libminisip/Makefile.am
===================================================================
--- trunk/libminisip/Makefile.am 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/Makefile.am 2007-11-12 16:06:41 UTC (rev 3462)
@@ -70,16 +70,21 @@
libmediahandler_src = source/subsystem_media/MediaHandler.cxx \
+ source/subsystem_media/MediaHandler.h \
source/subsystem_media/SubsystemMedia.cxx \
source/subsystem_media/Session.cxx \
+ source/subsystem_media/Session.h \
source/subsystem_media/MediaStream.cxx \
+ source/subsystem_media/MediaStream.h \
source/subsystem_media/Media.cxx \
source/subsystem_media/RtpReceiver.cxx \
+ source/subsystem_media/RtpReceiver.h \
source/subsystem_media/MediaCommandString.cxx \
source/subsystem_media/AudioMedia.cxx \
source/subsystem_media/AudioPlugin.cxx \
source/subsystem_media/AudioPlugin.h \
source/subsystem_media/SessionRegistry.cxx \
+ source/subsystem_media/SessionRegistry.h \
source/subsystem_media/CallRecorder.cxx \
source/subsystem_media/DtmfSender.cxx
Modified: trunk/libminisip/include/Makefile.am
===================================================================
--- trunk/libminisip/include/Makefile.am 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/Makefile.am 2007-11-12 16:06:41 UTC (rev 3462)
@@ -6,15 +6,10 @@
libminisip/gui/Bell.h \
libminisip/gui/ConsoleDebugger.h \
libminisip/media/MediaCommandString.h \
- libminisip/media/RtpReceiver.h \
libminisip/media/DtmfSender.h \
- libminisip/media/MediaStream.h \
libminisip/media/AudioMedia.h \
- libminisip/media/SessionRegistry.h \
- libminisip/media/MediaHandler.h \
libminisip/media/SubsystemMedia.h \
libminisip/media/Media.h \
- libminisip/media/Session.h \
libminisip/media/CallRecorder.h \
libminisip/signaling/p2t/SipDialogP2Tuser.h \
libminisip/signaling/p2t/SipDialogP2T.h \
Modified: trunk/libminisip/include/libminisip/Minisip.h
===================================================================
--- trunk/libminisip/include/libminisip/Minisip.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/Minisip.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -4,8 +4,8 @@
#include<libminisip/libminisip_config.h>
#include<libmutil/MemObject.h>
+#include<libminisip/media/SubsystemMedia.h>
-class MediaHandler;
class Gui;
class SipSoftPhoneConfiguration;
class Sip;
@@ -14,7 +14,6 @@
class ConsoleDebugger;
class MessageRouter;
class ConfMessageRouter;
-class SubsystemMedia;
class LIBMINISIP_API Minisip : public MObject{
@@ -63,7 +62,6 @@
int initParseConfig();
std::string confPath;
- MRef<MediaHandler *> mediaHandler;
MRef<SubsystemMedia *> subsystemMedia;
MRef<Gui *> gui;
MRef<SipSoftPhoneConfiguration *> phoneConf;
Modified: trunk/libminisip/include/libminisip/gui/ConsoleDebugger.h
===================================================================
--- trunk/libminisip/include/libminisip/gui/ConsoleDebugger.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/gui/ConsoleDebugger.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -31,7 +31,7 @@
#include<libmutil/Thread.h>
#include<libminisip/signaling/sip/SipSoftPhoneConfiguration.h>
-#include<libminisip/media/MediaHandler.h>
+#include<libminisip/media/SubsystemMedia.h>
#include<string>
@@ -59,7 +59,7 @@
void join();
- void setMediaHandler( MRef<MediaHandler *> r ) {
+ void setMediaHandler( MRef<SubsystemMedia*> r ) {
mediaHandler = r;
if (mediaHandler)
std::cerr << "EEEE: mediaHandler set!"<<std::endl;
@@ -69,7 +69,7 @@
private:
MRef<SipStack*> sipStack;
- MRef<MediaHandler *> mediaHandler;
+ MRef<SubsystemMedia *> mediaHandler;
MRef<Thread *> thread;
bool keepRunning;
Modified: trunk/libminisip/include/libminisip/media/CallRecorder.h
===================================================================
--- trunk/libminisip/include/libminisip/media/CallRecorder.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/media/CallRecorder.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -27,7 +27,7 @@
#define CALLREC_BUFF_SIZE 16000
-#include<libminisip/media/MediaStream.h>
+#include"../../../source/subsystem_media/MediaStream.h"
#include<libminisip/media/soundcard/SoundRecorderCallback.h>
#include<libminisip/media/soundcard/FileSoundDevice.h>
Modified: trunk/libminisip/include/libminisip/media/Media.h
===================================================================
--- trunk/libminisip/include/libminisip/media/Media.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/media/Media.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -42,6 +42,7 @@
class MediaStreamReceiver;
class SdpHeaderM;
class SipSoftPhoneConfiguration;
+class SubsystemMedia;
class MediaHandler;
/**
@@ -181,6 +182,7 @@
MRef<CodecState *> createCodecInstance( uint8_t payloadType );
void setMediaHandler(MRef<MediaHandler*> reg);
+
MRef<MediaHandler*> getMediaHandler();
protected:
@@ -227,4 +229,4 @@
#endif
#include<libminisip/signaling/sip/SipSoftPhoneConfiguration.h>
-#include<libminisip/media/MediaHandler.h>
+#include<libminisip/media/SubsystemMedia.h>
Modified: trunk/libminisip/include/libminisip/media/MediaCommandString.h
===================================================================
--- trunk/libminisip/include/libminisip/media/MediaCommandString.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/media/MediaCommandString.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -57,6 +57,8 @@
*/
static const std::string audio_forwarding_enable;
static const std::string audio_forwarding_disable;
+
+ static const std::string send_dtmf;
};
Deleted: trunk/libminisip/include/libminisip/media/MediaHandler.h
===================================================================
--- trunk/libminisip/include/libminisip/media/MediaHandler.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/media/MediaHandler.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -1,163 +0,0 @@
-/*
- Copyright (C) 2004-2006 the Minisip Team
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* Copyright (C) 2004
- *
- * Authors: Erik Eliasson <eliasson at it.kth.se>
- * Johan Bilien <jobi at via.ecp.fr>
-*/
-
-#ifndef MEDIA_HANDLER_H
-#define MEDIA_HANDLER_H
-
-#include<libminisip/libminisip_config.h>
-
-#include<libmutil/MemObject.h>
-
-#include<libminisip/media/AudioMedia.h>
-#include<libminisip/media/Media.h>
-/*#include<libminisip/media/MediaStream.h>*/
-#include<libminisip/media/Session.h>
-#include<libminisip/media/SessionRegistry.h>
-#include<libminisip/ipprovider/IpProvider.h>
-#include<libmutil/CommandString.h>
-#include<libmutil/MessageRouter.h>
-
-
-class SipSoftPhoneConfiguration;
-class IpProvider;
-class AudioMedia;
-
-
-class LIBMINISIP_API MediaHandler : public virtual MObject, public SessionRegistry, public CommandReceiver {
-
- public:
- /**
- * Constructor, created on startup
- * @param config reference to the softphone configuration
- * @param ipProvider reference to the public IP provider, used
- * for NAT traversal mechanisms
- */
- MediaHandler( MRef<SipSoftPhoneConfiguration *> config, MRef<IpProvider *> ipProvider, MRef<IpProvider *> ip6Provider = NULL );
- virtual ~MediaHandler();
-
- /**
- * Creates a new media session, for use in a new VoIP call
- * @param config the call specific configuration
- * @param callId identifier shared with the SIP stack
- * @returns a reference to the session created
- */
- MRef<Session *> createSession( MRef<SipIdentity*> ident, std::string callId );
-
- /**
- * Registers a new media type (audio or video
- * @param media a reference to the representation of the
- * medium to add
- */
- void registerMedia( MRef<Media *> media );
-
- /**
- * Handles a command sent by the user interface
- * @param command the command to handle
- */
- void handleCommand(std::string subsystem, const CommandString & command );
-
-
- CommandString handleCommandResp(std::string subsystem, const CommandString& command);
-
- /**
- * Provides the IP address given as contact to the external
- * peers
- * @returns a string containing the IP address
- */
- std::string getExtIP();
-
- /**
- * Set the callback (interface) to Minisip's message router.
- *
- * The Media handler uses this callback to send message to other subsystems
- * of Minisip.
- *
- * @param callback
- * The pointer to the message router object.
- */
- void setMessageRouterCallback(MRef<CommandReceiver*> callback) {
- messageRouterCallback = callback; }
-
- /**
- * Get the callback (interface) to Minisip's message router.
- *
- * The Media handler uses this callback to send message to other subsystems
- * of Minisip.
- *
- * @returns
- * The pointer to the message router object.
- */
- MRef<CommandReceiver *> getMessageRouterCallback() { return messageRouterCallback;}
-
- virtual std::string getMemObjectType() const {return "MediaHandler";}
-
-#ifdef DEBUG_OUTPUT
- virtual std::string getDebugString();
-#endif
-
-#if 0
- /**
- True if all but one sender/media sessions are muted.
- If turned off, all ongoing sessions receive the audio from our mic.
- If turned on, only one source (the active one) will receive it.
- */
- bool muteAllButOne;
-#endif
-
- private:
- void init();
-
- std::list< MRef<Media *> > media;
-
- std::string ringtoneFile;
-
- MRef<AudioMedia *> audioMedia;
- MRef<IpProvider *> ipProvider;
- MRef<IpProvider *> ip6Provider;
- MRef<SipSoftPhoneConfiguration *> config;
-
- MRef<CommandReceiver*> messageRouterCallback;
-
-
- /**
- Looks for a Session with callid. If found, set the audio settings
- of that Session (side = "receivers" or "senders") to either be on
- or off.
- @param callid callid of the Session whose settings we want to deal with
- @param side either "receivers" (audio received from the network and heard
- on the headsets) or "senders" (audio read from the mic/soundcard and
- sent over the net).
- @param turnOn whether to turn on or off the setting of the specified session.
- If turnOn = true -> the receivers are actived (un-silenced) or the
- are activated (un-muted).
- */
- void setSessionSoundSettings( std::string callid, std::string side, bool turnOn );
-
- /**
- Used to start/stop the call recorder ...
- */
- void sessionCallRecorderStart( std::string callid, bool start );
-};
-
-#endif
Deleted: trunk/libminisip/include/libminisip/media/MediaStream.h
===================================================================
--- trunk/libminisip/include/libminisip/media/MediaStream.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/media/MediaStream.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -1,493 +0,0 @@
-/*
- Copyright (C) 2004-2006 the Minisip Team
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* Copyright (C) 2004, 2005
- *
- * Authors: Erik Eliasson <eliasson at it.kth.se>
- * Johan Bilien <jobi at via.ecp.fr>
-*/
-
-#ifndef MEDIA_STREAM_H
-#define MEDIA_STREAM_H
-
-#include<libminisip/libminisip_config.h>
-
-#include<libmutil/MemObject.h>
-
-#include<libminisip/media/rtp/CryptoContext.h>
-#include<libminisip/media/Media.h>
-#include<libminisip/media/Session.h>
-#include<libminisip/media/RtpReceiver.h>
-#include<libminisip/media/rtp/SRtpPacket.h>
-
-#ifdef ZRTP_SUPPORT
-#include <libminisip/media/zrtp/ZrtpHostBridgeMinisip.h>
-#include <time.h>
-class ZrtpHostBridgeMinisip;
-#endif
-
-class KeyAgreement;
-class UDPSocket;
-class SdpHeaderM;
-class IpProvider;
-class Media;
-
-/**
- * Abstract class that implements common functions to a
- * MediaStreamSender and MediaStreamReceiver
- */
-
-class LIBMINISIP_API MediaStream : public MObject{
- public:
- /**
- * Starts the transmission or reception of a the stream.
- */
- virtual void start() = 0;
-
- /**
- * Stops the transmission or reception of a the stream.
- */
- virtual void stop() = 0;
-
-#ifdef DEBUG_OUTPUT
- virtual std::string getDebugString();
-#endif
-
- /**
- * Returns the media type corresponding to this stream
- * (video, audio...) as it appears in the session
- * description (SDP).
- * @returns the type as a string
- */
- std::string getSdpMediaType();/* audio, video, application... */
-
- /**
- * Returns additional media attributes that are to appear
- * in the session description (SDP) as a: header.
- * @returns the attributes as a list of string, each
- * of them should go into a a: header
- */
- std::list<std::string> getSdpAttributes();
-
- virtual std::string getMemObjectType() const {return "MediaStream";}
- bool disabled;
-
- std::string getCallId(){return callId;}
-
- /**
- * Used to query the port on which the media is received for
- * a receiver, respectively where it is sent to for a sender
- * @returns the port.
- */
- virtual uint16_t getPort()=0;
-
- /**
- * Used to check a m: header in a session description
- * against the media stream for compatibility
- * @param m a reference to the object representing the m:
- * SDP header
- * @param formatIndex is the index of the CODEC
- * in the m: header against which we should compare the
- * MediaStream
- * @returns whether or not this media stream corresponds
- * to the description in the m: header.
- */
- virtual bool matches( MRef<SdpHeaderM *> m,
- uint32_t formatIndex );
-
- /**
- * Used by the media session to pass the result of
- * the key exchange performed during the session
- * initiaton.
- * @param ka a reference to the KeyAgreement object.
- */
- void setKeyAgreement( MRef<KeyAgreement *> ka );
-
- /**
- Returns an MRef to the Media object used by this media stream.
- Use with care.
- */
- MRef<Media *> getMedia() { return media; }
-#ifdef ZRTP_SUPPORT
- /**
- * Set the ZRTP implementation host brigde for this media stream.
- *
- * The ZRTP host bridge implements the Minisip specific functions
- * to connect Minisip to the ZRTP protocol / key agreement. Please
- * note that the same host bridge instance must be used for a pair
- * of sender/receiver objects that form a RTP session.
- *
- * @param zsb
- * The pointer to the host bridge object for this RTP session.
- *
- * TODO: make it a list because the receiver may have several hostbridges
- * in case of e.g. conferences.
- */
- virtual void setZrtpHostBridge(MRef<ZrtpHostBridgeMinisip *> zsb);
-
- /**
- * Get the ZRTP implementation host brigde for this media stream.
- *
- * @return zsb
- * The pointer to the host bridge object for this RTP session.
- */
- virtual MRef<ZrtpHostBridgeMinisip *> getZrtpHostBridge();
-
- /**
- * Used by ZRTP host bridge to set the crypto context for this RTP session.
- *
- * @param cx
- * The initialized CryptoContext to use for this RTP session.
- * @param ssrc
- * The ssrc of this RTP stream (sender or receiver)
- */
- void setKeyAgreementZrtp(MRef<CryptoContext *>cx);
-#endif
-
- protected:
- MRef<CryptoContext *> getCryptoContext( uint32_t ssrc, uint16_t seq_no );
- MediaStream( std::string callId, MRef<Media *> );
- std::string callId;
- MRef<Media *> media;
- uint32_t csbId;
-
- uint8_t localPayloadType;
-
- MRef<CryptoContext *> initCrypto( uint32_t ssrc, uint16_t seq_no );
- MRef<KeyAgreement *> ka;
- Mutex kaLock;
- std::list< MRef<CryptoContext *> > cryptoContexts;
-#ifdef ZRTP_SUPPORT
- MRef<ZrtpHostBridgeMinisip *> zrtpBridge;
-#endif
-};
-
-/**
- * The MediaStreamReceiver receives media for a given medium on a
- * given session. It is responsible for decryption and replay protection
- * in the case of SRTP.
- */
-class LIBMINISIP_API MediaStreamReceiver : public MediaStream{
- public:
- /**
- * Constructor, called by the MediaHandler when creating
- * a new media session.
- * @param media a reference to the Media object
- * that will process
- * incoming data on this receiver.
- * @param rtpReceiver a reference to the RtpReceiver object
- * to which this MediaStreamReceiver should register when
- * the session starts
- * @param ipProvider reference to the IpProvider object,
- * used to obtain contact IP address and port in NAT
- * traversal mechanism
- */
- MediaStreamReceiver( std::string callId,
- MRef<Media *> media,
- MRef<RtpReceiver *> rtpReceiver,
- MRef<RtpReceiver *> rtp6Receiver = NULL );
-
-#ifdef DEBUG_OUTPUT
- virtual std::string getDebugString();
-#endif
-
- virtual std::string getMemObjectType() const {return "MediaStreamReceiver";}
-
- /**
- * Starts the reception of a the stream, by subscribing to
- * the RtpReceiver.
- */
- virtual void start();
-
- /**
- * Stops the reception of a stream, by unsubscribing to
- * the RtpReceiver.
- */
- virtual void stop();
-
- /**
- * Used to query which port should be advertised as
- * the contact port in the session description.
- * @returns the port to use
- */
- virtual uint16_t getPort();
-
- /**
- * Used to query which port should be advertised as
- * the contact port in the session description.
- * @param addrType IP4 or IP6
- * @returns the port to use
- */
- uint16_t getPort( const std::string &addrType );
-
- /**
- * Handles incoming RTP packets, decrypts them
- * and send them to the corresponding media for
- * playback.
- * @param packet the (S)RTP packet to handle
- */
- virtual void handleRtpPacket( MRef<SRtpPacket *> packet, std::string callId, MRef<IPAddress *> from );
-
- /**
- * Returns a unique identifier for this Receiver. Used
- * to register or unregister receivers to RtpReceiver objects.
- * @returns the identifier
- */
- uint32_t getId();
-
- /**
- * Used to query the available CODECs for this media type,
- * during this session. Used by the Session to create
- * the session description (SDP).
- *
- * @returns a list of references to Codec objects, sorted
- * according to the user's preference, first being preferred
- */
- std::list<MRef<Codec *> > getAvailableCodecs();
-
- std::list<uint32_t> getSsrcList() {
- return ssrcList;
- }
-
-#ifdef ZRTP_SUPPORT
- /**
- * Process a received packet with an extension header
- * and unknown payload type.
- *
- * This packet has an extension header and does not
- * contain payload data to process. The method checks
- * if it is a ZRTP packet, if yes process
- * it. Otherwise just return to the caller. Because
- * the payload type is unknown the caller usually
- * dismisses the packet.
- *
- * <p/>
- *
- * This method is called only if a ZRTP host bridge is
- * enabled.
- *
- * @param packet
- * A (S)Rtp packet to process
- */
- virtual void handleRtpPacketExt(MRef<SRtpPacket *> packet);
-#endif
- protected:
- std::list<MRef<Codec *> > codecList;
- MRef<RtpReceiver *> rtpReceiver;
- MRef<RtpReceiver *> rtp6Receiver;
- uint32_t id;
- uint16_t externalPort;
-
- void gotSsrc( uint32_t ssrc, std::string callId );
-
- std::list<uint32_t> ssrcList;
- Mutex ssrcListLock;
-
- bool running;
-
-};
-
-/**
- * The MediaStreamSender is used to send media to a specific peer, during
- * a specific media Session. It holds the CODEC instance selected for
- * this peer, and is responsible for encryption.
- */
-class LIBMINISIP_API MediaStreamSender : public MediaStream{
- public:
- /**
- * Constructor, used by the MediaHandler during the
- * creation of the media Session.
- * @param media a reference to the Media object from
- * which the MediaStreamSender is receiving data
- * @param senderSock a reference to the UDPSocket object
- * to which the data should be sent. If NULL a new one
- * is created
- */
- MediaStreamSender( std::string callId,
- MRef<Media *> media,
- MRef<UDPSocket *> senderSock=NULL,
- MRef<UDPSocket *> sender6Sock=NULL );
-
-#ifdef DEBUG_OUTPUT
- virtual std::string getDebugString();
-#endif
-
- virtual std::string getMemObjectType() const {return "MediaStreamSender";}
-
- /**
- * Returns the CODEC instance currently selected for
- * this peer.
- * @returns a reference to the CodecState object
- */
- MRef<CodecState *> getSelectedCodec(){return selectedCodec;};
-
- /**
- * Starts the transmission of the stream, by
- * subscribing to the Media for data.
- */
- virtual void start();
-
- /**
- * Stops the transmission, by unsubscribing to the
- * Media.
- */
- virtual void stop();
-
- /**
- * Used by the Session to set the port on which the
- * the peer is expecting to receive the data. This
- * is extracted from the received session description
- * (SDP).
- * @param port the port to which the MediaStreamSender should
- * send
- */
- virtual void setPort( uint16_t port );
-
- /**
- * Returns the port to which data is sent.
- * @retunrs the port to which the MediaStreamSender is sending
- * data, or 0 if it was not set
- */
- virtual uint16_t getPort();
-
- /**
- * Used by the Media to send data, if the MediaStreamSender
- * has subscribed to the Media. The data will be encrypted
- * if required, and encapsulated in an RTP packet.
- * @param data a pointer to the data to send
- * @param length the lenght of the data to send
- * @param ts the timestamp to use in RTP header, or
- * NULL if the MediaStreamSender should decide it
- * @param marker whether or not the marker should be set
- * in the RTP header
- * @param dtmf whether or not the data is a DTMF signal
- */
- void send( byte_t * data, uint32_t length, uint32_t * ts, bool marker = false, bool dtmf = false );
-
-#ifdef ZRTP_SUPPORT
- /**
- * Used by the ZRTP host bridge to send ZRTP data.
- *
- * This method sets up a ZRTP packet with a specific
- * payload type and sends the data to our peer. These
- * packets shall not go into normal payload processing
- * at the receiver because of the specific payload
- * type setting.
- *
- * @param data
- * The pointer to the extension header to send.
- * @param length
- * Length of the extension header in bytes.
- * @param payload
- * Pointer to the payload or NULL if no payload required
- * @param payLen
- * Length of payload in bytes
- */
- void sendZrtp(unsigned char* data, int length,
- unsigned char* payload, int payLen);
-
- /**
- * Get the current Seq number of this packet
- *
- * @return
- * The sender current sequence number.
- */
- uint16_t getSeqNo() { return seqNo; };
-#endif
-
- /**
- * Used by the Session to specify the IP address
- * on which the data should be sent to the peer. This
- * information is extracted from the received session
- * description (SDP)
- * @param remoteAddress a pointer to the IPAddress object
- * which represents the peer's contact IP address
- */
- void setRemoteAddress( MRef<IPAddress *> remoteAddress );
-
- /**
- * Used to mute or unmute this sender, resulting
- * in it sending or not sending the data it receives
- * from the Media.
- * @param mute whether or not this MediaStreamSender should
- * be muted
- */
- void setMuted( bool mute ) { muted = mute;}
-
- /**
- * Queries the muted state of this MediaStreamSender
- * @returns whether or not this MediaStreamSender is muted
- */
- bool isMuted() { return muted;}
-
- /**
- * Used to know whether or not a packet should be sent
- * even if the MediaStreamSender is muted, for the
- * Session to be kept alive.
- * @param max specifies after how many muted packets a
- * keep alive packet should be sent
- */
- bool muteKeepAlive( uint32_t max);
-
- /**
- * Used to check a m: header in a session description
- * against the media stream for compatibility. In
- * case the MediaStreamSender is compatible, the
- * CODEC is selected, if it wasn't already.
- * @param m a reference to the object representing the m:
- * SDP header
- * @param formatIndex is the index of the CODEC
- * in the m: header against which we should compare the
- * MediaStream
- * @returns whether or not this media stream corresponds
- * to the description in the m: header.
- */
- virtual bool matches( MRef<SdpHeaderM *> m,
- uint32_t formatIndex );
-
- /**
- * Used to query the SSRC identifier used in RTP headers.
- * It is created randomly upon creation of the
- * MediaStreamSender.
- * @returns the SSRC identifier used by this MediaStreamSender
- */
- uint32_t getSsrc();
-
- void increaseLastTs( ) { lastTs += 160; };
- uint32_t getLastTs() { return lastTs; };
-
- private:
- uint32_t ssrc;
- MRef<UDPSocket *> senderSock;
- MRef<UDPSocket *> sender6Sock;
- uint16_t remotePort;
- uint16_t seqNo;
- uint32_t lastTs;
- MRef<IPAddress *> remoteAddress;
- Mutex senderLock;
-
- uint8_t payloadType;
- MRef<CodecState *> selectedCodec;
-
- //Cesc -- does it conflict with bool disabled???
- bool muted;
- uint32_t muteCounter;
-
-};
-
-#endif
Deleted: trunk/libminisip/include/libminisip/media/RtpReceiver.h
===================================================================
--- trunk/libminisip/include/libminisip/media/RtpReceiver.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/media/RtpReceiver.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -1,124 +0,0 @@
-/*
- Copyright (C) 2004-2006 the Minisip Team
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* Copyright (C) 2004, 2005
- *
- * Authors: Erik Eliasson <eliasson at it.kth.se>
- * Johan Bilien <jobi at via.ecp.fr>
-*/
-
-#ifndef RTPRECEIVER_H
-#define RTPRECEIVER_H
-
-#include<libminisip/libminisip_config.h>
-
-#include<libmutil/Mutex.h>
-#include<libmutil/MemObject.h>
-#include<libmutil/Thread.h>
-
-#include<libminisip/ipprovider/IpProvider.h>
-
-class UDPSocket;
-class MediaStreamReceiver;
-class CryptoContext;
-
-/**
- * The RtpReceiver is used to listen on a UDPSocket and demultiplex
- * several incoming streams, depending on their payload type.
- * MediaStreamReceiver objects register to it when they are ready
- * to receive a specific media type.
- */
-class LIBMINISIP_API RtpReceiver : public Runnable{
- public:
- /**
- * Constructor, called by the MediaHandler upon
- * creation of a media Session.
- * @param ipprovider reference to an IpProvider object,
- * used to query the external IP address and UDP port
- * on which the peer should send data (used by
- * NAT traversal mechanisms).
- */
- RtpReceiver( MRef<IpProvider *> ipProvider, std::string callId );
-
- /**
- * Used for a MediaStreamReceiver to subscribe to data
- * incoming on this RtpReceiver. If the payload type
- * is handled by the MediaStreamReceiver, the data
- * is sent to it.
- * @param mediaStream a reference to the MediaStreamReceiver
- * object to subscribe
- */
- void registerMediaStream( MRef<MediaStreamReceiver *> mediaStream );
-
- /**
- * Used to signify that a MediaStreamReceiver should no
- * longer receive data from this RtpReceiver. Used
- * when the media Session is stopped.
- * @param mediaStream a reference to the MediaStreamReceiver
- * object that should be unsubscribed
- */
- void unregisterMediaStream( MRef<MediaStreamReceiver *> mediaStream);
-
- /**
- * Listening thread main loop.
- */
- virtual void run();
-
- void stop();
-
- void join();
-
- /**
- * Used to query the port that should be given as contact
- * information to the peer in the session description (SDP).
- * It may be different from the local port of the UDPSocket,
- * in case of NAT traversal mechanisms.
- * @returns the port number to use as contact information
- */
- uint16_t getPort();
-
- /**
- * Destructor. Will wait for the running thread
- * to be terminated.
- */
- ~RtpReceiver();
-
- /**
- * Used to query the UDPSocket on which the RtpReceiver is
- * listening.
- * @returns a reference to the UDPSocket object
- */
- MRef<UDPSocket *> getSocket();
-
- virtual std::string getMemObjectType() const {return "RtpReceiver";}
-
- private:
- MRef<UDPSocket *> socket;
- uint16_t externalPort;
- bool kill;
-
- std::list< MRef<MediaStreamReceiver *> > mediaStreams;
-
- Mutex mediaStreamsLock;
-
- Thread * thread;
-
- std::string callId;
-};
-
-#endif
Deleted: trunk/libminisip/include/libminisip/media/Session.h
===================================================================
--- trunk/libminisip/include/libminisip/media/Session.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/media/Session.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -1,295 +0,0 @@
-/*
- Copyright (C) 2004-2006 the Minisip Team
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* Copyright (C) 2004
- *
- * Authors: Erik Eliasson <eliasson at it.kth.se>
- * Johan Bilien <jobi at via.ecp.fr>
-*/
-
-#ifndef SESSION_H
-#define SESSION_H
-
-#include<libminisip/libminisip_config.h>
-
-#include<libmutil/MemObject.h>
-#include<libmutil/TimeoutProvider.h>
-
-#include<libmikey/Mikey.h>
-
-#include<libminisip/media/DtmfSender.h>
-#include<libminisip/signaling/sdp/SdpPacket.h>
-#include<libminisip/media/MediaStream.h>
-#include<libmsip/SipDialogConfig.h>
-
-class MediaStreamReceiver;
-class MediaStreamSender;
-class SdpHeaderM;
-class IPAddress;
-class SessionRegistry;
-
-/**
- * The session class is a representation of the media session associated
- * with a VoIP call. It holds MediaStreams that handles incoming and
- * outgoing streams for a given medium. The session is also the interface
- * used by the SIP stack to send and receive session descriptions (SDP)
- * and to start or stop the media transmission
- */
-class LIBMINISIP_API Session : public MObject{
- public:
-
- /**
- * Global registry holding all the current media sessions, for
- * access for instance from the user interface */
- static SessionRegistry * registry;
-
- /**
- * Pre-computed parameters to optimize the next key exchange
- */
- static MRef<KeyAgreement *> precomputedKa;
-
- /**
- * Constructor, called by MediaHandler::createSession only
- * @param localIp IP address to give as contact in session
- * description
- * @param config security related configuration for the call
- */
- Session( std::string localIp, MRef<SipIdentity*> ident, std::string localIp6 = "" );
-
- /**
- * Destructor.
- */
- ~Session();
-
- /**
- * Removes this session from the global session registry
- */
- void unregister();
-
- /**
- * Starts the media transmission. Called by the SIP stack.
- */
- void start();
-
- /**
- * Stops the media transmission. Called by the SIP stack.
- */
- void stop();
-
- /**
- * Used by the SIP stack to query the session description
- * offer (SDP offer), upon session initiation.
- * @param anatSupported Use ANAT (RFC 4091)
- * @returns a reference to the SDP object
- */
- MRef<SdpPacket *> getSdpOffer( const std::string &peerUri = "",
- bool anatSupported = false );
-
- /**
- * Used by the SIP stack to query the session description
- * answer (SDP answer), when answering a call.
- * @returns a reference to the SDP object
- */
- MRef<SdpPacket *> getSdpAnswer();
-
- /**
- * Used by the SIP stack to provide the media session
- * with the peer's session description answer (SDP answer).
- * The media session configures the media streams accordingly.
- * @returns whether or not we can accept this session.
- */
- bool setSdpAnswer( MRef<SdpPacket *> answer, std::string peerUri );
- /**
- * Used by the SIP stack to provide the media session
- * with the peer's session description offer (SDP offer).
- * The media session configures the media streams accordingly.
- * @returns whether or not we can accept this session.
- */
- bool setSdpOffer ( MRef<SdpPacket *> offer, std::string peerUri );
-
- /**
- * Adds a MediaStreamReceiver to this media session. Used
- * by the media handler to add a media stream per
- * available medium.
- * @param r a reference to the MediaStreamReceiver object to add
- */
- void addMediaStreamReceiver( MRef<MediaStreamReceiver *> r );
-
- /**
- * Adds a MediaStreamSender to this media session. Used
- * by the media handler to add a media stream per
- * available medium.
- * @param s a reference to the MediaStreamSender object to add
- */
- void addMediaStreamSender( MRef<MediaStreamSender *> s );
-
- /**
- * Returns an error description suitable for use
- * in a SIP Warning: header, to explain why the
- * session could not be accepted.
- * @returns the description as a string
- */
- std::string getErrorString();
-
- /**
- * Returns an error code suitable for use in a SIP
- * Warning: header, to explain why the session could not
- * be accepted.
- * @returns the error code
- */
- uint16_t getErrorCode();
-
- /**
- * Used to query whether or not the session is considered
- * "secure".
- * @returns whether or not the session is "secure"
- */
- bool isSecure();
-
- virtual std::string getMemObjectType() const {return "Session";}
-
- /**
- * Returns the CallId identifier shared with the SIP
- * stack.
- * @returns the identifier as a string
- */
- std::string getCallId();
-
- /**
- * Change the CallId identifier for the session. Used
- * during session transfer.
- * @param callId the new identifier, as a string
- */
- void setCallId( const std::string callId );
-
- friend class DtmfSender;
-
- /**
- * Asks the media session to send a DTMF symbol to all
- * the peers.
- * @param symbol the DTMF symbol to send
- */
- void sendDtmf( uint8_t symbol );
-
- /**
- * Used to mute all the input to this session.
- * @param mute whether or not the peers in this
- * session should receive the media transmission
- */
- void muteSenders (bool mute);
-
- /**
- Indicates whether the media stream senders are in muted
- state or not.
- IMPORTANT: it is not 100% reliable, as the senders may have
- been modified somewhere else (not via this Session)
- */
- bool mutedSenders;
-
- /**
- Used to silence all the sources associated to this
- Session. SoundSources receive the audio from the
- MediaStreamReceiver and act as a buffer. They are identified
- by the ssrc (SoundSource::getId)
- @param silence whether or not we want the sources silenced
- */
- void silenceSources ( bool silence );
-
- /**
- Indicates whether the audio media sources are in silenced
- state or not.
- IMPORTANT: it is not 100% reliable, as the sources may have
- been modified somewhere else (not via this Session)
- */
- bool silencedSources;
-
-#ifdef DEBUG_OUTPUT
- /**
- Return a debug string containing info about this Session
- */
- virtual std::string getDebugString();
-#endif
-
- /**
- Empty the media stream receivers list.
- */
- void clearMediaStreamReceivers();
-
- /**
- Return a copy of the list to the media stream receivers
- */
- std::list< MRef<MediaStreamReceiver *> > getMediaStreamReceivers() {
- return mediaStreamReceivers;
- }
-
- /**
- Return a copy of the list to the media stream senders
- */
- std::list< MRef<MediaStreamSender *> > getMediaStreamSenders() {
- return mediaStreamSenders;
- }
-
- /**
- * Return authenticated peer URI
- */
- const std::string &getPeerUri() const;
-
- /**
- CallRecorder object ... we store it as MObject because it creates
- header file dependency problems when building. No comment.
- */
- MRef<MObject *> callRecorder;
-
- private:
- bool started;
- void addStreams();
-
- std::string peerUri;
-
-
- MRef<SdpPacket *> emptySdp();
- MRef<MediaStreamReceiver *> matchFormat( MRef<SdpHeaderM *> m,
- uint32_t iFormat, MRef<IPAddress *> &remoteAddress );
-
- typedef std::list< MRef<MediaStreamSender *> > MediaStreamSenders;
- std::list< MRef<MediaStreamReceiver *> > mediaStreamReceivers;
- std::list< MRef<MediaStreamSender *> > mediaStreamSenders;
- Mutex mediaStreamSendersLock;
-
- MRef<Mikey *> mikey;
- std::string localIpString;
- std::string localIp6String;
- MRef<SdpPacket *> sdpAnswer;
-
- std::string errorString;
- uint16_t errorCode;
- MRef<SipIdentity*> identity;
-
- int ka_type;
-
-
- std::string callId;
-
- //DtmfSender dtmfSender;
- MRef<TimeoutProvider<DtmfEvent *, MRef<DtmfSender *> > *> dtmfTOProvider;
-};
-
-
-#include<libminisip/media/SessionRegistry.h>
-
-#endif
Deleted: trunk/libminisip/include/libminisip/media/SessionRegistry.h
===================================================================
--- trunk/libminisip/include/libminisip/media/SessionRegistry.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/media/SessionRegistry.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -1,53 +0,0 @@
-/*
- Copyright (C) 2004-2006 the Minisip Team
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* Copyright (C) 2004, 2005
- *
- * Authors: Erik Eliasson <eliasson at it.kth.se>
- * Johan Bilien <jobi at via.ecp.fr>
-*/
-
-#ifndef SESSIONREGISTRY_H
-#define SESSIONREGISTRY_H
-
-#include<libminisip/libminisip_config.h>
-
-#include<libmutil/MemObject.h>
-#include<libmutil/Mutex.h>
-
-class Session;
-
-class LIBMINISIP_API SessionRegistry{
- friend class Session;
-
- public:
- MRef<Session *> getSession( std::string callId );
- std::list<MRef<Session *> > getAllSessions();
-
- protected:
- void registerSession( MRef<Session *> session );
- void unregisterSession( MRef<Session *> session );
-
- std::list<MRef<Session *> > sessions;
- Mutex sessionsLock;
-};
-
-#include<libminisip/media/Session.h>
-
-
-#endif
Modified: trunk/libminisip/include/libminisip/media/SubsystemMedia.h
===================================================================
--- trunk/libminisip/include/libminisip/media/SubsystemMedia.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/media/SubsystemMedia.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -30,6 +30,8 @@
class SipSoftPhoneConfiguration;
class IpProvider;
+class Session;
+class SipIdentity;
class LIBMINISIP_API SubsystemMedia: public CommandReceiver {
@@ -76,6 +78,15 @@
MRef<CommandReceiver *> getMessageRouterCallback() { return messageRouterCallback;}
#endif
+ /**
+ * Creates a new media session, for use in a new VoIP call
+ * @param config the call specific configuration
+ * @param callId identifier shared with the SIP stack
+ * @returns a reference to the session created
+ */
+ MRef<Session *> createSession( MRef<SipIdentity*> ident, std::string callId );
+
+
virtual std::string getMemObjectType() const {return "SubsystemMedia";}
Modified: trunk/libminisip/include/libminisip/signaling/conference/ConfMessageRouter.h
===================================================================
--- trunk/libminisip/include/libminisip/signaling/conference/ConfMessageRouter.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/signaling/conference/ConfMessageRouter.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -62,8 +62,8 @@
void setGui(MRef<Gui *> g){gui = g;};
virtual void setConferenceController(ConferenceControl *conf);
virtual void removeConferenceController(ConferenceControl *conf);
- void setMediaHandler(MRef<MediaHandler *> mh){
- this->mediaHandler = mh;}
+ void setMediaHandler(MRef<SubsystemMedia*> sm){
+ this->subsystemMedia = sm;}
virtual void sipcb_handleCommand(const CommandString &command);
virtual void sipcb_handleConfCommand(const CommandString &command);
@@ -83,7 +83,7 @@
MRef<Gui *> gui;
minilist<ConferenceControl *> confrout;//bm
MRef<Sip*> sip;
- MRef<MediaHandler *> mediaHandler;
+ MRef<SubsystemMedia*> subsystemMedia;
};
#endif
Modified: trunk/libminisip/include/libminisip/signaling/sip/DefaultDialogHandler.h
===================================================================
--- trunk/libminisip/include/libminisip/signaling/sip/DefaultDialogHandler.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/signaling/sip/DefaultDialogHandler.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -57,7 +57,7 @@
*/
DefaultDialogHandler(MRef<SipStack*> stack,
MRef<SipSoftPhoneConfiguration*> pconf,
- MRef<MediaHandler *> mediaHandler);
+ MRef<SubsystemMedia*> subsystemMedia);
virtual ~DefaultDialogHandler();
@@ -85,7 +85,7 @@
bool handleCommandString(CommandString &command );
MRef<SipSoftPhoneConfiguration*> phoneconf;
- MRef<MediaHandler*> mediaHandler;
+ MRef<SubsystemMedia*> subsystemMedia;
#ifdef P2T_SUPPORT
/**
Modified: trunk/libminisip/include/libminisip/signaling/sip/Sip.h
===================================================================
--- trunk/libminisip/include/libminisip/signaling/sip/Sip.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/signaling/sip/Sip.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -36,16 +36,15 @@
#include<libminisip/signaling/sdp/SdpPacket.h>
#include<libminisip/signaling/conference/ConfMember.h>
#include<libminisip/gui/LogEntry.h>
-#include<libminisip/media/MediaHandler.h>
+#include<libminisip/media/SubsystemMedia.h>
class SipSoftPhoneConfiguration;
-class MediaHandler;
class LIBMINISIP_API Sip: public Runnable{
public:
Sip(MRef<SipSoftPhoneConfiguration*> phoneconfig,
- MRef<MediaHandler*> mediaHandler);
+ MRef<SubsystemMedia*> subsystemMedia);
virtual ~Sip();
@@ -83,12 +82,12 @@
std::string confconnect(std::string &user, std::string confId);
MRef<SipStack*> getSipStack(){return sipstack;}
- void setMediaHandler( MRef<MediaHandler *> mediaHandler );
+ void setMediaHandler( MRef<SubsystemMedia*> subsystemMedia);
private:
MRef<SipStack *> sipstack;
MRef<SipSoftPhoneConfiguration*> phoneconfig;
- MRef<MediaHandler *> mediaHandler;
+ MRef<SubsystemMedia *> subsystemMedia;
MRef<Thread *> thread;
};
Modified: trunk/libminisip/include/libminisip/signaling/sip/SipDialogVoip.h
===================================================================
--- trunk/libminisip/include/libminisip/signaling/sip/SipDialogVoip.h 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/include/libminisip/signaling/sip/SipDialogVoip.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -41,7 +41,7 @@
#include<libmsip/SipResponse.h>
#include<libmutil/StateMachine.h>
-#include<libminisip/media/Session.h>
+#include"../../../../source/subsystem_media/Session.h"
class LogEntry;
Modified: trunk/libminisip/source/Minisip.cxx
===================================================================
--- trunk/libminisip/source/Minisip.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/Minisip.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -70,8 +70,9 @@
#include<libminisip/signaling/sip/Sip.h>
#include<libminisip/gui/LogEntry.h>
#include<libminisip/contacts/ContactDb.h>
-#include<libminisip/media/MediaHandler.h>
#include<libminisip/media/SubsystemMedia.h>
+#include<libminisip/media/Media.h>
+#include<libminisip/ipprovider/IpProvider.h>
#include<libminisip/signaling/conference/ConferenceControl.h>
#include<libminisip/signaling/conference/ConfCallback.h>
#include<libminisip/config/ConfBackend.h>
@@ -293,7 +294,7 @@
messageRouter=NULL;
phoneConf = NULL;
- mediaHandler = NULL;
+ //mediaHandler = NULL;
confMessageRouter->setGui(NULL);
confMessageRouter = NULL;
gui = NULL;
@@ -369,10 +370,11 @@
subsystemMedia->setMessageRouterCallback(*messageRouter);
if( consoleDbg ){
- consoleDbg->setMediaHandler( mediaHandler );
+ consoleDbg->setMediaHandler( /*mediaHandler*/ subsystemMedia );
}
- Session::registry = *mediaHandler;
+ //Session::registry = *mediaHandler; Moved to MediaHandler::MediaHandler
+
/* Hack: precompute a KeyAgreementDH */
// Session::precomputedKa = new KeyAgreementDH( phoneConf->securityConfig.cert,
// phoneConf->securityConfig.cert_db, DH_GROUP_OAKLEY5 );
@@ -388,7 +390,7 @@
}
//save Sip object in Minisip::sip ...
- this->sip=new Sip(phoneConf,mediaHandler);
+ this->sip=new Sip(phoneConf,/*mediaHandler*/ subsystemMedia);
//sip->init();
// phoneConf->sip = sip;
Modified: trunk/libminisip/source/conference/ConfMessageRouter.cxx
===================================================================
--- trunk/libminisip/source/conference/ConfMessageRouter.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/conference/ConfMessageRouter.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -165,7 +165,7 @@
*/
void ConfMessageRouter::guicb_handleMediaCommand(const CommandString &cmd){
- mediaHandler->handleCommand("media",cmd);
+ subsystemMedia->handleCommand("media",cmd);
}
//string ConfMessageRouter::guicb_doInvite(string user){
Modified: trunk/libminisip/source/subsystem_media/AudioMedia.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/AudioMedia.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/AudioMedia.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -27,7 +27,7 @@
#include<libminisip/media/AudioMedia.h>
#include<libminisip/media/rtp/RtpHeader.h>
-#include<libminisip/media/MediaStream.h>
+#include"MediaStream.h"
#include<libminisip/media/soundcard/FileSoundSource.h>
#include<libminisip/media/soundcard/Resampler.h>
Modified: trunk/libminisip/source/subsystem_media/AudioPlugin.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/AudioPlugin.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/AudioPlugin.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -26,6 +26,7 @@
#include<libminisip/signaling/sip/SipSoftPhoneConfiguration.h>
#include<libminisip/media/Media.h>
+#include<libminisip/media/AudioMedia.h>
#include<libminisip/media/soundcard/SoundDevice.h>
Modified: trunk/libminisip/source/subsystem_media/DtmfSender.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/DtmfSender.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/DtmfSender.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -26,8 +26,8 @@
#include<libminisip/media/DtmfSender.h>
-#include<libminisip/media/Session.h>
-#include<libminisip/media/MediaStream.h>
+#include"Session.h"
+#include"MediaStream.h"
#ifdef _WIN32_WCE
# include"../include/minisip_wce_extra_includes.h"
Modified: trunk/libminisip/source/subsystem_media/Media.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/Media.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/Media.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -29,11 +29,12 @@
#include<libminisip/media/codecs/Codec.h>
#include<libminisip/media/soundcard/SoundIO.h>
#include<libminisip/ipprovider/IpProvider.h>
-#include<libminisip/media/MediaStream.h>
-#include<libminisip/media/RtpReceiver.h>
+#include"MediaStream.h"
+#include"RtpReceiver.h"
#include<libmutil/stringutils.h>
#include<libminisip/signaling/sdp/SdpHeaderM.h>
#include<libminisip/signaling/sdp/SdpHeaderA.h>
+#include"MediaHandler.h"
#ifdef _WIN32_WCE
# include"../include/minisip_wce_extra_includes.h"
Modified: trunk/libminisip/source/subsystem_media/MediaCommandString.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/MediaCommandString.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/MediaCommandString.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -39,3 +39,5 @@
const string MediaCommandString::audio_forwarding_enable="audio_forwarding_enable";
const string MediaCommandString::audio_forwarding_disable="audio_forwarding_disable";
+
+const string MediaCommandString::send_dtmf="send_dtmf";
Modified: trunk/libminisip/source/subsystem_media/MediaHandler.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/MediaHandler.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/MediaHandler.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -24,7 +24,7 @@
#include <config.h>
-#include<libminisip/media/MediaHandler.h>
+#include"MediaHandler.h"
#include<string.h>
#include<libminisip/signaling/sdp/SdpPacket.h>
@@ -32,11 +32,11 @@
#include<libminisip/signaling/sip/SipSoftPhoneConfiguration.h>
#include<libminisip/ipprovider/IpProvider.h>
#include<libminisip/media/codecs/Codec.h>
-#include<libminisip/media/Session.h>
-#include<libminisip/media/MediaStream.h>
+#include"Session.h"
+#include"MediaStream.h"
#include<libminisip/media/Media.h>
-#include<libminisip/media/RtpReceiver.h>
+#include"RtpReceiver.h"
#include<libminisip/media/MediaCommandString.h>
#include<libmnetutil/UDPSocket.h>
@@ -45,7 +45,7 @@
#include<libminisip/media/codecs/Codec.h>
#include<libminisip/media/CallRecorder.h>
-#include<libminisip/media/SessionRegistry.h>
+#include"SessionRegistry.h"
#ifdef _WIN32_WCE
# include"../include/minisip_wce_extra_includes.h"
@@ -92,6 +92,8 @@
}
}
+ Session::registry = this;
+
// muteAllButOne = config->muteAllButOne;
ringtoneFile = config->ringtone;
@@ -239,6 +241,21 @@
return;
}
+ if( command.getOp() == MediaCommandString::send_dtmf){
+ MRef<Session *> session = Session::registry->getSession( command.getDestinationId() );
+ if( session ){
+ string tmp = command.getParam();
+ if (tmp.length()==1){
+ uint8_t c = tmp[0];
+ session->sendDtmf( c );
+ }else{
+ merr("media/dtmf") << "Error: DTMF formar error. Ignored."<<endl;
+ }
+ }
+ return;
+ }
+
+
if( command.getOp() == MediaCommandString::set_session_sound_settings ){
bool turnOn;
Copied: trunk/libminisip/source/subsystem_media/MediaHandler.h (from rev 3461, trunk/libminisip/include/libminisip/media/MediaHandler.h)
===================================================================
--- trunk/libminisip/source/subsystem_media/MediaHandler.h (rev 0)
+++ trunk/libminisip/source/subsystem_media/MediaHandler.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -0,0 +1,163 @@
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+#ifndef MEDIA_HANDLER_H
+#define MEDIA_HANDLER_H
+
+#include<libminisip/libminisip_config.h>
+
+#include<libmutil/MemObject.h>
+
+#include<libminisip/media/AudioMedia.h>
+#include<libminisip/media/Media.h>
+/*#include<libminisip/media/MediaStream.h>*/
+#include"Session.h"
+#include"SessionRegistry.h"
+#include<libminisip/ipprovider/IpProvider.h>
+#include<libmutil/CommandString.h>
+#include<libmutil/MessageRouter.h>
+
+
+class SipSoftPhoneConfiguration;
+class IpProvider;
+class AudioMedia;
+
+
+class LIBMINISIP_API MediaHandler : public virtual MObject, public SessionRegistry, public CommandReceiver {
+
+ public:
+ /**
+ * Constructor, created on startup
+ * @param config reference to the softphone configuration
+ * @param ipProvider reference to the public IP provider, used
+ * for NAT traversal mechanisms
+ */
+ MediaHandler( MRef<SipSoftPhoneConfiguration *> config, MRef<IpProvider *> ipProvider, MRef<IpProvider *> ip6Provider = NULL );
+ virtual ~MediaHandler();
+
+ /**
+ * Creates a new media session, for use in a new VoIP call
+ * @param config the call specific configuration
+ * @param callId identifier shared with the SIP stack
+ * @returns a reference to the session created
+ */
+ MRef<Session *> createSession( MRef<SipIdentity*> ident, std::string callId );
+
+ /**
+ * Registers a new media type (audio or video
+ * @param media a reference to the representation of the
+ * medium to add
+ */
+ void registerMedia( MRef<Media *> media );
+
+ /**
+ * Handles a command sent by the user interface
+ * @param command the command to handle
+ */
+ void handleCommand(std::string subsystem, const CommandString & command );
+
+
+ CommandString handleCommandResp(std::string subsystem, const CommandString& command);
+
+ /**
+ * Provides the IP address given as contact to the external
+ * peers
+ * @returns a string containing the IP address
+ */
+ std::string getExtIP();
+
+ /**
+ * Set the callback (interface) to Minisip's message router.
+ *
+ * The Media handler uses this callback to send message to other subsystems
+ * of Minisip.
+ *
+ * @param callback
+ * The pointer to the message router object.
+ */
+ void setMessageRouterCallback(MRef<CommandReceiver*> callback) {
+ messageRouterCallback = callback; }
+
+ /**
+ * Get the callback (interface) to Minisip's message router.
+ *
+ * The Media handler uses this callback to send message to other subsystems
+ * of Minisip.
+ *
+ * @returns
+ * The pointer to the message router object.
+ */
+ MRef<CommandReceiver *> getMessageRouterCallback() { return messageRouterCallback;}
+
+ virtual std::string getMemObjectType() const {return "MediaHandler";}
+
+#ifdef DEBUG_OUTPUT
+ virtual std::string getDebugString();
+#endif
+
+#if 0
+ /**
+ True if all but one sender/media sessions are muted.
+ If turned off, all ongoing sessions receive the audio from our mic.
+ If turned on, only one source (the active one) will receive it.
+ */
+ bool muteAllButOne;
+#endif
+
+ private:
+ void init();
+
+ std::list< MRef<Media *> > media;
+
+ std::string ringtoneFile;
+
+ MRef<AudioMedia *> audioMedia;
+ MRef<IpProvider *> ipProvider;
+ MRef<IpProvider *> ip6Provider;
+ MRef<SipSoftPhoneConfiguration *> config;
+
+ MRef<CommandReceiver*> messageRouterCallback;
+
+
+ /**
+ Looks for a Session with callid. If found, set the audio settings
+ of that Session (side = "receivers" or "senders") to either be on
+ or off.
+ @param callid callid of the Session whose settings we want to deal with
+ @param side either "receivers" (audio received from the network and heard
+ on the headsets) or "senders" (audio read from the mic/soundcard and
+ sent over the net).
+ @param turnOn whether to turn on or off the setting of the specified session.
+ If turnOn = true -> the receivers are actived (un-silenced) or the
+ are activated (un-muted).
+ */
+ void setSessionSoundSettings( std::string callid, std::string side, bool turnOn );
+
+ /**
+ Used to start/stop the call recorder ...
+ */
+ void sessionCallRecorderStart( std::string callid, bool start );
+};
+
+#endif
Modified: trunk/libminisip/source/subsystem_media/MediaStream.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/MediaStream.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/MediaStream.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -25,7 +25,7 @@
#include <config.h>
-#include<libminisip/media/MediaStream.h>
+#include"MediaStream.h"
#include<libmikey/MikeyPayloadSP.h>
#include<libmikey/KeyAgreement.h>
@@ -36,7 +36,7 @@
#include<libmutil/stringutils.h>
#include<libmutil/Timestamp.h>
#include<libminisip/media/Media.h>
-#include<libminisip/media/RtpReceiver.h>
+#include"RtpReceiver.h"
#include<libminisip/media/codecs/Codec.h>
#include<libminisip/ipprovider/IpProvider.h>
#include<iostream>
Copied: trunk/libminisip/source/subsystem_media/MediaStream.h (from rev 3461, trunk/libminisip/include/libminisip/media/MediaStream.h)
===================================================================
--- trunk/libminisip/source/subsystem_media/MediaStream.h (rev 0)
+++ trunk/libminisip/source/subsystem_media/MediaStream.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -0,0 +1,493 @@
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004, 2005
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+#ifndef MEDIA_STREAM_H
+#define MEDIA_STREAM_H
+
+#include<libminisip/libminisip_config.h>
+
+#include<libmutil/MemObject.h>
+
+#include<libminisip/media/rtp/CryptoContext.h>
+#include<libminisip/media/Media.h>
+#include"Session.h"
+#include"RtpReceiver.h"
+#include<libminisip/media/rtp/SRtpPacket.h>
+
+#ifdef ZRTP_SUPPORT
+#include <libminisip/media/zrtp/ZrtpHostBridgeMinisip.h>
+#include <time.h>
+class ZrtpHostBridgeMinisip;
+#endif
+
+class KeyAgreement;
+class UDPSocket;
+class SdpHeaderM;
+class IpProvider;
+class Media;
+
+/**
+ * Abstract class that implements common functions to a
+ * MediaStreamSender and MediaStreamReceiver
+ */
+
+class LIBMINISIP_API MediaStream : public MObject{
+ public:
+ /**
+ * Starts the transmission or reception of a the stream.
+ */
+ virtual void start() = 0;
+
+ /**
+ * Stops the transmission or reception of a the stream.
+ */
+ virtual void stop() = 0;
+
+#ifdef DEBUG_OUTPUT
+ virtual std::string getDebugString();
+#endif
+
+ /**
+ * Returns the media type corresponding to this stream
+ * (video, audio...) as it appears in the session
+ * description (SDP).
+ * @returns the type as a string
+ */
+ std::string getSdpMediaType();/* audio, video, application... */
+
+ /**
+ * Returns additional media attributes that are to appear
+ * in the session description (SDP) as a: header.
+ * @returns the attributes as a list of string, each
+ * of them should go into a a: header
+ */
+ std::list<std::string> getSdpAttributes();
+
+ virtual std::string getMemObjectType() const {return "MediaStream";}
+ bool disabled;
+
+ std::string getCallId(){return callId;}
+
+ /**
+ * Used to query the port on which the media is received for
+ * a receiver, respectively where it is sent to for a sender
+ * @returns the port.
+ */
+ virtual uint16_t getPort()=0;
+
+ /**
+ * Used to check a m: header in a session description
+ * against the media stream for compatibility
+ * @param m a reference to the object representing the m:
+ * SDP header
+ * @param formatIndex is the index of the CODEC
+ * in the m: header against which we should compare the
+ * MediaStream
+ * @returns whether or not this media stream corresponds
+ * to the description in the m: header.
+ */
+ virtual bool matches( MRef<SdpHeaderM *> m,
+ uint32_t formatIndex );
+
+ /**
+ * Used by the media session to pass the result of
+ * the key exchange performed during the session
+ * initiaton.
+ * @param ka a reference to the KeyAgreement object.
+ */
+ void setKeyAgreement( MRef<KeyAgreement *> ka );
+
+ /**
+ Returns an MRef to the Media object used by this media stream.
+ Use with care.
+ */
+ MRef<Media *> getMedia() { return media; }
+#ifdef ZRTP_SUPPORT
+ /**
+ * Set the ZRTP implementation host brigde for this media stream.
+ *
+ * The ZRTP host bridge implements the Minisip specific functions
+ * to connect Minisip to the ZRTP protocol / key agreement. Please
+ * note that the same host bridge instance must be used for a pair
+ * of sender/receiver objects that form a RTP session.
+ *
+ * @param zsb
+ * The pointer to the host bridge object for this RTP session.
+ *
+ * TODO: make it a list because the receiver may have several hostbridges
+ * in case of e.g. conferences.
+ */
+ virtual void setZrtpHostBridge(MRef<ZrtpHostBridgeMinisip *> zsb);
+
+ /**
+ * Get the ZRTP implementation host brigde for this media stream.
+ *
+ * @return zsb
+ * The pointer to the host bridge object for this RTP session.
+ */
+ virtual MRef<ZrtpHostBridgeMinisip *> getZrtpHostBridge();
+
+ /**
+ * Used by ZRTP host bridge to set the crypto context for this RTP session.
+ *
+ * @param cx
+ * The initialized CryptoContext to use for this RTP session.
+ * @param ssrc
+ * The ssrc of this RTP stream (sender or receiver)
+ */
+ void setKeyAgreementZrtp(MRef<CryptoContext *>cx);
+#endif
+
+ protected:
+ MRef<CryptoContext *> getCryptoContext( uint32_t ssrc, uint16_t seq_no );
+ MediaStream( std::string callId, MRef<Media *> );
+ std::string callId;
+ MRef<Media *> media;
+ uint32_t csbId;
+
+ uint8_t localPayloadType;
+
+ MRef<CryptoContext *> initCrypto( uint32_t ssrc, uint16_t seq_no );
+ MRef<KeyAgreement *> ka;
+ Mutex kaLock;
+ std::list< MRef<CryptoContext *> > cryptoContexts;
+#ifdef ZRTP_SUPPORT
+ MRef<ZrtpHostBridgeMinisip *> zrtpBridge;
+#endif
+};
+
+/**
+ * The MediaStreamReceiver receives media for a given medium on a
+ * given session. It is responsible for decryption and replay protection
+ * in the case of SRTP.
+ */
+class LIBMINISIP_API MediaStreamReceiver : public MediaStream{
+ public:
+ /**
+ * Constructor, called by the MediaHandler when creating
+ * a new media session.
+ * @param media a reference to the Media object
+ * that will process
+ * incoming data on this receiver.
+ * @param rtpReceiver a reference to the RtpReceiver object
+ * to which this MediaStreamReceiver should register when
+ * the session starts
+ * @param ipProvider reference to the IpProvider object,
+ * used to obtain contact IP address and port in NAT
+ * traversal mechanism
+ */
+ MediaStreamReceiver( std::string callId,
+ MRef<Media *> media,
+ MRef<RtpReceiver *> rtpReceiver,
+ MRef<RtpReceiver *> rtp6Receiver = NULL );
+
+#ifdef DEBUG_OUTPUT
+ virtual std::string getDebugString();
+#endif
+
+ virtual std::string getMemObjectType() const {return "MediaStreamReceiver";}
+
+ /**
+ * Starts the reception of a the stream, by subscribing to
+ * the RtpReceiver.
+ */
+ virtual void start();
+
+ /**
+ * Stops the reception of a stream, by unsubscribing to
+ * the RtpReceiver.
+ */
+ virtual void stop();
+
+ /**
+ * Used to query which port should be advertised as
+ * the contact port in the session description.
+ * @returns the port to use
+ */
+ virtual uint16_t getPort();
+
+ /**
+ * Used to query which port should be advertised as
+ * the contact port in the session description.
+ * @param addrType IP4 or IP6
+ * @returns the port to use
+ */
+ uint16_t getPort( const std::string &addrType );
+
+ /**
+ * Handles incoming RTP packets, decrypts them
+ * and send them to the corresponding media for
+ * playback.
+ * @param packet the (S)RTP packet to handle
+ */
+ virtual void handleRtpPacket( MRef<SRtpPacket *> packet, std::string callId, MRef<IPAddress *> from );
+
+ /**
+ * Returns a unique identifier for this Receiver. Used
+ * to register or unregister receivers to RtpReceiver objects.
+ * @returns the identifier
+ */
+ uint32_t getId();
+
+ /**
+ * Used to query the available CODECs for this media type,
+ * during this session. Used by the Session to create
+ * the session description (SDP).
+ *
+ * @returns a list of references to Codec objects, sorted
+ * according to the user's preference, first being preferred
+ */
+ std::list<MRef<Codec *> > getAvailableCodecs();
+
+ std::list<uint32_t> getSsrcList() {
+ return ssrcList;
+ }
+
+#ifdef ZRTP_SUPPORT
+ /**
+ * Process a received packet with an extension header
+ * and unknown payload type.
+ *
+ * This packet has an extension header and does not
+ * contain payload data to process. The method checks
+ * if it is a ZRTP packet, if yes process
+ * it. Otherwise just return to the caller. Because
+ * the payload type is unknown the caller usually
+ * dismisses the packet.
+ *
+ * <p/>
+ *
+ * This method is called only if a ZRTP host bridge is
+ * enabled.
+ *
+ * @param packet
+ * A (S)Rtp packet to process
+ */
+ virtual void handleRtpPacketExt(MRef<SRtpPacket *> packet);
+#endif
+ protected:
+ std::list<MRef<Codec *> > codecList;
+ MRef<RtpReceiver *> rtpReceiver;
+ MRef<RtpReceiver *> rtp6Receiver;
+ uint32_t id;
+ uint16_t externalPort;
+
+ void gotSsrc( uint32_t ssrc, std::string callId );
+
+ std::list<uint32_t> ssrcList;
+ Mutex ssrcListLock;
+
+ bool running;
+
+};
+
+/**
+ * The MediaStreamSender is used to send media to a specific peer, during
+ * a specific media Session. It holds the CODEC instance selected for
+ * this peer, and is responsible for encryption.
+ */
+class LIBMINISIP_API MediaStreamSender : public MediaStream{
+ public:
+ /**
+ * Constructor, used by the MediaHandler during the
+ * creation of the media Session.
+ * @param media a reference to the Media object from
+ * which the MediaStreamSender is receiving data
+ * @param senderSock a reference to the UDPSocket object
+ * to which the data should be sent. If NULL a new one
+ * is created
+ */
+ MediaStreamSender( std::string callId,
+ MRef<Media *> media,
+ MRef<UDPSocket *> senderSock=NULL,
+ MRef<UDPSocket *> sender6Sock=NULL );
+
+#ifdef DEBUG_OUTPUT
+ virtual std::string getDebugString();
+#endif
+
+ virtual std::string getMemObjectType() const {return "MediaStreamSender";}
+
+ /**
+ * Returns the CODEC instance currently selected for
+ * this peer.
+ * @returns a reference to the CodecState object
+ */
+ MRef<CodecState *> getSelectedCodec(){return selectedCodec;};
+
+ /**
+ * Starts the transmission of the stream, by
+ * subscribing to the Media for data.
+ */
+ virtual void start();
+
+ /**
+ * Stops the transmission, by unsubscribing to the
+ * Media.
+ */
+ virtual void stop();
+
+ /**
+ * Used by the Session to set the port on which the
+ * the peer is expecting to receive the data. This
+ * is extracted from the received session description
+ * (SDP).
+ * @param port the port to which the MediaStreamSender should
+ * send
+ */
+ virtual void setPort( uint16_t port );
+
+ /**
+ * Returns the port to which data is sent.
+ * @retunrs the port to which the MediaStreamSender is sending
+ * data, or 0 if it was not set
+ */
+ virtual uint16_t getPort();
+
+ /**
+ * Used by the Media to send data, if the MediaStreamSender
+ * has subscribed to the Media. The data will be encrypted
+ * if required, and encapsulated in an RTP packet.
+ * @param data a pointer to the data to send
+ * @param length the lenght of the data to send
+ * @param ts the timestamp to use in RTP header, or
+ * NULL if the MediaStreamSender should decide it
+ * @param marker whether or not the marker should be set
+ * in the RTP header
+ * @param dtmf whether or not the data is a DTMF signal
+ */
+ void send( byte_t * data, uint32_t length, uint32_t * ts, bool marker = false, bool dtmf = false );
+
+#ifdef ZRTP_SUPPORT
+ /**
+ * Used by the ZRTP host bridge to send ZRTP data.
+ *
+ * This method sets up a ZRTP packet with a specific
+ * payload type and sends the data to our peer. These
+ * packets shall not go into normal payload processing
+ * at the receiver because of the specific payload
+ * type setting.
+ *
+ * @param data
+ * The pointer to the extension header to send.
+ * @param length
+ * Length of the extension header in bytes.
+ * @param payload
+ * Pointer to the payload or NULL if no payload required
+ * @param payLen
+ * Length of payload in bytes
+ */
+ void sendZrtp(unsigned char* data, int length,
+ unsigned char* payload, int payLen);
+
+ /**
+ * Get the current Seq number of this packet
+ *
+ * @return
+ * The sender current sequence number.
+ */
+ uint16_t getSeqNo() { return seqNo; };
+#endif
+
+ /**
+ * Used by the Session to specify the IP address
+ * on which the data should be sent to the peer. This
+ * information is extracted from the received session
+ * description (SDP)
+ * @param remoteAddress a pointer to the IPAddress object
+ * which represents the peer's contact IP address
+ */
+ void setRemoteAddress( MRef<IPAddress *> remoteAddress );
+
+ /**
+ * Used to mute or unmute this sender, resulting
+ * in it sending or not sending the data it receives
+ * from the Media.
+ * @param mute whether or not this MediaStreamSender should
+ * be muted
+ */
+ void setMuted( bool mute ) { muted = mute;}
+
+ /**
+ * Queries the muted state of this MediaStreamSender
+ * @returns whether or not this MediaStreamSender is muted
+ */
+ bool isMuted() { return muted;}
+
+ /**
+ * Used to know whether or not a packet should be sent
+ * even if the MediaStreamSender is muted, for the
+ * Session to be kept alive.
+ * @param max specifies after how many muted packets a
+ * keep alive packet should be sent
+ */
+ bool muteKeepAlive( uint32_t max);
+
+ /**
+ * Used to check a m: header in a session description
+ * against the media stream for compatibility. In
+ * case the MediaStreamSender is compatible, the
+ * CODEC is selected, if it wasn't already.
+ * @param m a reference to the object representing the m:
+ * SDP header
+ * @param formatIndex is the index of the CODEC
+ * in the m: header against which we should compare the
+ * MediaStream
+ * @returns whether or not this media stream corresponds
+ * to the description in the m: header.
+ */
+ virtual bool matches( MRef<SdpHeaderM *> m,
+ uint32_t formatIndex );
+
+ /**
+ * Used to query the SSRC identifier used in RTP headers.
+ * It is created randomly upon creation of the
+ * MediaStreamSender.
+ * @returns the SSRC identifier used by this MediaStreamSender
+ */
+ uint32_t getSsrc();
+
+ void increaseLastTs( ) { lastTs += 160; };
+ uint32_t getLastTs() { return lastTs; };
+
+ private:
+ uint32_t ssrc;
+ MRef<UDPSocket *> senderSock;
+ MRef<UDPSocket *> sender6Sock;
+ uint16_t remotePort;
+ uint16_t seqNo;
+ uint32_t lastTs;
+ MRef<IPAddress *> remoteAddress;
+ Mutex senderLock;
+
+ uint8_t payloadType;
+ MRef<CodecState *> selectedCodec;
+
+ //Cesc -- does it conflict with bool disabled???
+ bool muted;
+ uint32_t muteCounter;
+
+};
+
+#endif
Modified: trunk/libminisip/source/subsystem_media/RtpReceiver.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/RtpReceiver.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/RtpReceiver.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -24,7 +24,7 @@
#include <config.h>
-#include<libminisip/media/RtpReceiver.h>
+#include"RtpReceiver.h"
#include<libmnetutil/UDPSocket.h>
#include<libmnetutil/NetworkException.h>
@@ -33,7 +33,7 @@
#include<libminisip/media/rtp/SRtpPacket.h>
#include<libminisip/media/codecs/Codec.h>
#include<iostream>
-#include<libminisip/media/MediaStream.h>
+#include"MediaStream.h"
#include<libminisip/ipprovider/IpProvider.h>
#include<stdio.h>
Copied: trunk/libminisip/source/subsystem_media/RtpReceiver.h (from rev 3461, trunk/libminisip/include/libminisip/media/RtpReceiver.h)
===================================================================
--- trunk/libminisip/source/subsystem_media/RtpReceiver.h (rev 0)
+++ trunk/libminisip/source/subsystem_media/RtpReceiver.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -0,0 +1,124 @@
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004, 2005
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+#ifndef RTPRECEIVER_H
+#define RTPRECEIVER_H
+
+#include<libminisip/libminisip_config.h>
+
+#include<libmutil/Mutex.h>
+#include<libmutil/MemObject.h>
+#include<libmutil/Thread.h>
+
+#include<libminisip/ipprovider/IpProvider.h>
+
+class UDPSocket;
+class MediaStreamReceiver;
+class CryptoContext;
+
+/**
+ * The RtpReceiver is used to listen on a UDPSocket and demultiplex
+ * several incoming streams, depending on their payload type.
+ * MediaStreamReceiver objects register to it when they are ready
+ * to receive a specific media type.
+ */
+class LIBMINISIP_API RtpReceiver : public Runnable{
+ public:
+ /**
+ * Constructor, called by the MediaHandler upon
+ * creation of a media Session.
+ * @param ipprovider reference to an IpProvider object,
+ * used to query the external IP address and UDP port
+ * on which the peer should send data (used by
+ * NAT traversal mechanisms).
+ */
+ RtpReceiver( MRef<IpProvider *> ipProvider, std::string callId );
+
+ /**
+ * Used for a MediaStreamReceiver to subscribe to data
+ * incoming on this RtpReceiver. If the payload type
+ * is handled by the MediaStreamReceiver, the data
+ * is sent to it.
+ * @param mediaStream a reference to the MediaStreamReceiver
+ * object to subscribe
+ */
+ void registerMediaStream( MRef<MediaStreamReceiver *> mediaStream );
+
+ /**
+ * Used to signify that a MediaStreamReceiver should no
+ * longer receive data from this RtpReceiver. Used
+ * when the media Session is stopped.
+ * @param mediaStream a reference to the MediaStreamReceiver
+ * object that should be unsubscribed
+ */
+ void unregisterMediaStream( MRef<MediaStreamReceiver *> mediaStream);
+
+ /**
+ * Listening thread main loop.
+ */
+ virtual void run();
+
+ void stop();
+
+ void join();
+
+ /**
+ * Used to query the port that should be given as contact
+ * information to the peer in the session description (SDP).
+ * It may be different from the local port of the UDPSocket,
+ * in case of NAT traversal mechanisms.
+ * @returns the port number to use as contact information
+ */
+ uint16_t getPort();
+
+ /**
+ * Destructor. Will wait for the running thread
+ * to be terminated.
+ */
+ ~RtpReceiver();
+
+ /**
+ * Used to query the UDPSocket on which the RtpReceiver is
+ * listening.
+ * @returns a reference to the UDPSocket object
+ */
+ MRef<UDPSocket *> getSocket();
+
+ virtual std::string getMemObjectType() const {return "RtpReceiver";}
+
+ private:
+ MRef<UDPSocket *> socket;
+ uint16_t externalPort;
+ bool kill;
+
+ std::list< MRef<MediaStreamReceiver *> > mediaStreams;
+
+ Mutex mediaStreamsLock;
+
+ Thread * thread;
+
+ std::string callId;
+};
+
+#endif
Modified: trunk/libminisip/source/subsystem_media/Session.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/Session.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/Session.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -26,13 +26,13 @@
#include <config.h>
-#include<libminisip/media/Session.h>
+#include"Session.h"
#include<libminisip/media/CallRecorder.h>
-#include<libminisip/media/MediaStream.h>
+#include"MediaStream.h"
#include<libminisip/media/Media.h>
#include<libminisip/media/AudioMedia.h>
-#include<libminisip/media/RtpReceiver.h>
+#include"RtpReceiver.h"
#include<libminisip/media/DtmfSender.h>
#include<libminisip/media/codecs/Codec.h>
#include<libminisip/signaling/sdp/SdpPacket.h>
Copied: trunk/libminisip/source/subsystem_media/Session.h (from rev 3461, trunk/libminisip/include/libminisip/media/Session.h)
===================================================================
--- trunk/libminisip/source/subsystem_media/Session.h (rev 0)
+++ trunk/libminisip/source/subsystem_media/Session.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -0,0 +1,295 @@
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+#ifndef SESSION_H
+#define SESSION_H
+
+#include<libminisip/libminisip_config.h>
+
+#include<libmutil/MemObject.h>
+#include<libmutil/TimeoutProvider.h>
+
+#include<libmikey/Mikey.h>
+
+#include<libminisip/media/DtmfSender.h>
+#include<libminisip/signaling/sdp/SdpPacket.h>
+#include"MediaStream.h"
+#include<libmsip/SipDialogConfig.h>
+
+class MediaStreamReceiver;
+class MediaStreamSender;
+class SdpHeaderM;
+class IPAddress;
+class SessionRegistry;
+
+/**
+ * The session class is a representation of the media session associated
+ * with a VoIP call. It holds MediaStreams that handles incoming and
+ * outgoing streams for a given medium. The session is also the interface
+ * used by the SIP stack to send and receive session descriptions (SDP)
+ * and to start or stop the media transmission
+ */
+class LIBMINISIP_API Session : public MObject{
+ public:
+
+ /**
+ * Global registry holding all the current media sessions, for
+ * access for instance from the user interface */
+ static SessionRegistry * registry;
+
+ /**
+ * Pre-computed parameters to optimize the next key exchange
+ */
+ static MRef<KeyAgreement *> precomputedKa;
+
+ /**
+ * Constructor, called by MediaHandler::createSession only
+ * @param localIp IP address to give as contact in session
+ * description
+ * @param config security related configuration for the call
+ */
+ Session( std::string localIp, MRef<SipIdentity*> ident, std::string localIp6 = "" );
+
+ /**
+ * Destructor.
+ */
+ ~Session();
+
+ /**
+ * Removes this session from the global session registry
+ */
+ void unregister();
+
+ /**
+ * Starts the media transmission. Called by the SIP stack.
+ */
+ void start();
+
+ /**
+ * Stops the media transmission. Called by the SIP stack.
+ */
+ void stop();
+
+ /**
+ * Used by the SIP stack to query the session description
+ * offer (SDP offer), upon session initiation.
+ * @param anatSupported Use ANAT (RFC 4091)
+ * @returns a reference to the SDP object
+ */
+ MRef<SdpPacket *> getSdpOffer( const std::string &peerUri = "",
+ bool anatSupported = false );
+
+ /**
+ * Used by the SIP stack to query the session description
+ * answer (SDP answer), when answering a call.
+ * @returns a reference to the SDP object
+ */
+ MRef<SdpPacket *> getSdpAnswer();
+
+ /**
+ * Used by the SIP stack to provide the media session
+ * with the peer's session description answer (SDP answer).
+ * The media session configures the media streams accordingly.
+ * @returns whether or not we can accept this session.
+ */
+ bool setSdpAnswer( MRef<SdpPacket *> answer, std::string peerUri );
+ /**
+ * Used by the SIP stack to provide the media session
+ * with the peer's session description offer (SDP offer).
+ * The media session configures the media streams accordingly.
+ * @returns whether or not we can accept this session.
+ */
+ bool setSdpOffer ( MRef<SdpPacket *> offer, std::string peerUri );
+
+ /**
+ * Adds a MediaStreamReceiver to this media session. Used
+ * by the media handler to add a media stream per
+ * available medium.
+ * @param r a reference to the MediaStreamReceiver object to add
+ */
+ void addMediaStreamReceiver( MRef<MediaStreamReceiver *> r );
+
+ /**
+ * Adds a MediaStreamSender to this media session. Used
+ * by the media handler to add a media stream per
+ * available medium.
+ * @param s a reference to the MediaStreamSender object to add
+ */
+ void addMediaStreamSender( MRef<MediaStreamSender *> s );
+
+ /**
+ * Returns an error description suitable for use
+ * in a SIP Warning: header, to explain why the
+ * session could not be accepted.
+ * @returns the description as a string
+ */
+ std::string getErrorString();
+
+ /**
+ * Returns an error code suitable for use in a SIP
+ * Warning: header, to explain why the session could not
+ * be accepted.
+ * @returns the error code
+ */
+ uint16_t getErrorCode();
+
+ /**
+ * Used to query whether or not the session is considered
+ * "secure".
+ * @returns whether or not the session is "secure"
+ */
+ bool isSecure();
+
+ virtual std::string getMemObjectType() const {return "Session";}
+
+ /**
+ * Returns the CallId identifier shared with the SIP
+ * stack.
+ * @returns the identifier as a string
+ */
+ std::string getCallId();
+
+ /**
+ * Change the CallId identifier for the session. Used
+ * during session transfer.
+ * @param callId the new identifier, as a string
+ */
+ void setCallId( const std::string callId );
+
+ friend class DtmfSender;
+
+ /**
+ * Asks the media session to send a DTMF symbol to all
+ * the peers.
+ * @param symbol the DTMF symbol to send
+ */
+ void sendDtmf( uint8_t symbol );
+
+ /**
+ * Used to mute all the input to this session.
+ * @param mute whether or not the peers in this
+ * session should receive the media transmission
+ */
+ void muteSenders (bool mute);
+
+ /**
+ Indicates whether the media stream senders are in muted
+ state or not.
+ IMPORTANT: it is not 100% reliable, as the senders may have
+ been modified somewhere else (not via this Session)
+ */
+ bool mutedSenders;
+
+ /**
+ Used to silence all the sources associated to this
+ Session. SoundSources receive the audio from the
+ MediaStreamReceiver and act as a buffer. They are identified
+ by the ssrc (SoundSource::getId)
+ @param silence whether or not we want the sources silenced
+ */
+ void silenceSources ( bool silence );
+
+ /**
+ Indicates whether the audio media sources are in silenced
+ state or not.
+ IMPORTANT: it is not 100% reliable, as the sources may have
+ been modified somewhere else (not via this Session)
+ */
+ bool silencedSources;
+
+#ifdef DEBUG_OUTPUT
+ /**
+ Return a debug string containing info about this Session
+ */
+ virtual std::string getDebugString();
+#endif
+
+ /**
+ Empty the media stream receivers list.
+ */
+ void clearMediaStreamReceivers();
+
+ /**
+ Return a copy of the list to the media stream receivers
+ */
+ std::list< MRef<MediaStreamReceiver *> > getMediaStreamReceivers() {
+ return mediaStreamReceivers;
+ }
+
+ /**
+ Return a copy of the list to the media stream senders
+ */
+ std::list< MRef<MediaStreamSender *> > getMediaStreamSenders() {
+ return mediaStreamSenders;
+ }
+
+ /**
+ * Return authenticated peer URI
+ */
+ const std::string &getPeerUri() const;
+
+ /**
+ CallRecorder object ... we store it as MObject because it creates
+ header file dependency problems when building. No comment.
+ */
+ MRef<MObject *> callRecorder;
+
+ private:
+ bool started;
+ void addStreams();
+
+ std::string peerUri;
+
+
+ MRef<SdpPacket *> emptySdp();
+ MRef<MediaStreamReceiver *> matchFormat( MRef<SdpHeaderM *> m,
+ uint32_t iFormat, MRef<IPAddress *> &remoteAddress );
+
+ typedef std::list< MRef<MediaStreamSender *> > MediaStreamSenders;
+ std::list< MRef<MediaStreamReceiver *> > mediaStreamReceivers;
+ std::list< MRef<MediaStreamSender *> > mediaStreamSenders;
+ Mutex mediaStreamSendersLock;
+
+ MRef<Mikey *> mikey;
+ std::string localIpString;
+ std::string localIp6String;
+ MRef<SdpPacket *> sdpAnswer;
+
+ std::string errorString;
+ uint16_t errorCode;
+ MRef<SipIdentity*> identity;
+
+ int ka_type;
+
+
+ std::string callId;
+
+ //DtmfSender dtmfSender;
+ MRef<TimeoutProvider<DtmfEvent *, MRef<DtmfSender *> > *> dtmfTOProvider;
+};
+
+
+#include"SessionRegistry.h"
+
+#endif
Modified: trunk/libminisip/source/subsystem_media/SessionRegistry.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/SessionRegistry.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/SessionRegistry.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -24,10 +24,10 @@
#include <config.h>
-#include<libminisip/media/SessionRegistry.h>
+#include"SessionRegistry.h"
-#include<libminisip/media/Session.h>
-#include<libminisip/media/MediaStream.h>
+#include"Session.h"
+#include"MediaStream.h"
#ifdef _WIN32_WCE
# include"../include/minisip_wce_extra_includes.h"
Copied: trunk/libminisip/source/subsystem_media/SessionRegistry.h (from rev 3461, trunk/libminisip/include/libminisip/media/SessionRegistry.h)
===================================================================
--- trunk/libminisip/source/subsystem_media/SessionRegistry.h (rev 0)
+++ trunk/libminisip/source/subsystem_media/SessionRegistry.h 2007-11-12 16:06:41 UTC (rev 3462)
@@ -0,0 +1,53 @@
+/*
+ Copyright (C) 2004-2006 the Minisip Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Copyright (C) 2004, 2005
+ *
+ * Authors: Erik Eliasson <eliasson at it.kth.se>
+ * Johan Bilien <jobi at via.ecp.fr>
+*/
+
+#ifndef SESSIONREGISTRY_H
+#define SESSIONREGISTRY_H
+
+#include<libminisip/libminisip_config.h>
+
+#include<libmutil/MemObject.h>
+#include<libmutil/Mutex.h>
+
+class Session;
+
+class LIBMINISIP_API SessionRegistry{
+ friend class Session;
+
+ public:
+ MRef<Session *> getSession( std::string callId );
+ std::list<MRef<Session *> > getAllSessions();
+
+ protected:
+ void registerSession( MRef<Session *> session );
+ void unregisterSession( MRef<Session *> session );
+
+ std::list<MRef<Session *> > sessions;
+ Mutex sessionsLock;
+};
+
+#include"Session.h"
+
+
+#endif
Modified: trunk/libminisip/source/subsystem_media/SubsystemMedia.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/SubsystemMedia.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_media/SubsystemMedia.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -25,7 +25,7 @@
#include <config.h>
#include<libminisip/media/SubsystemMedia.h>
-#include<libminisip/media/MediaHandler.h>
+#include"MediaHandler.h"
#include<string.h>
#if 0
@@ -93,3 +93,9 @@
}
+
+MRef<Session *> SubsystemMedia::createSession( MRef<SipIdentity*> ident, std::string callId ){
+ return MH->createSession(ident, callId);
+
+}
+
Modified: trunk/libminisip/source/subsystem_signaling/sip/DefaultDialogHandler.cxx
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/DefaultDialogHandler.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_signaling/sip/DefaultDialogHandler.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -64,7 +64,7 @@
#endif
-#include<libminisip/media/MediaHandler.h>
+#include<libminisip/media/SubsystemMedia.h>
#include<libmutil/dbg.h>
@@ -73,10 +73,10 @@
DefaultDialogHandler::DefaultDialogHandler(MRef<SipStack*> stack,
MRef<SipSoftPhoneConfiguration*> pconf,
- MRef<MediaHandler *>mh):
+ MRef<SubsystemMedia*> sm):
sipStack(stack),
phoneconf(pconf),
- mediaHandler(mh)
+ subsystemMedia(sm)
{
outsideDialogSeqNo=1;
@@ -179,7 +179,7 @@
//string prot = sdp->getSessionLevelAttribute("p2tGroupListProt");
// get a session from the mediaHandler
MRef<Session *> mediaSession =
- mediaHandler->createSession(/*phoneconf->securityConfig*/ id, pkt->getCallId() );
+ subsystemMedia->createSession(/*phoneconf->securityConfig*/ id, pkt->getCallId() );
/* MRef<SipDialogConfig*> callConf = new SipDialogConfig(phoneconf->inherited);
if( id ){
@@ -213,7 +213,7 @@
MRef<SdpPacket*> sdp = (SdpPacket*)*inv->getContent();
string confid = sdp->getSessionLevelAttribute("confId");
MRef<Session *> mediaSession =
- mediaHandler->createSession(/*phoneconf->securityConfig*/ id, pkt->getCallId() );
+ subsystemMedia->createSession(/*phoneconf->securityConfig*/ id, pkt->getCallId() );
/* MRef<SipDialogConfig*> callConf = new SipDialogConfig(phoneconf->inherited);
@@ -249,7 +249,7 @@
// get a session from the mediaHandler
MRef<Session *> mediaSession =
- mediaHandler->createSession(/*phoneconf->securityConfig*/ id, pkt->getCallId() );
+ subsystemMedia->createSession(/*phoneconf->securityConfig*/ id, pkt->getCallId() );
MRef<SipDialog*> voipCall;
voipCall = new SipDialogVoipServer(sipStack,
@@ -604,7 +604,7 @@
MRef<SipDialogVoip*> voipCall = new SipDialogVoipClient(sipStack, id, phoneconf->useSTUN, phoneconf->useAnat, NULL);
- MRef<Session *> mediaSession = mediaHandler->createSession( id, voipCall->getCallId() );
+ MRef<Session *> mediaSession = subsystemMedia->createSession( id, voipCall->getCallId() );
voipCall->setMediaSession( mediaSession );
sipStack->addDialog(*voipCall);
Modified: trunk/libminisip/source/subsystem_signaling/sip/Sip.cxx
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/Sip.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_signaling/sip/Sip.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -59,10 +59,10 @@
using namespace std;
-Sip::Sip(MRef<SipSoftPhoneConfiguration*> pconfig, MRef<MediaHandler*>mh){
+Sip::Sip(MRef<SipSoftPhoneConfiguration*> pconfig, MRef<SubsystemMedia*> sm){
this->phoneconfig = pconfig;
- this->mediaHandler = mh;
+ this->subsystemMedia = sm;
MRef<SipStackConfig *> stackConfig /*= new SipStackConfig()*/;
// // Deep copy
@@ -74,7 +74,7 @@
MRef<DefaultDialogHandler*> defaultDialogHandler =
new DefaultDialogHandler(sipstack,
phoneconfig,
- mediaHandler);
+ subsystemMedia);
sipstack->setDefaultDialogCommandHandler(*defaultDialogHandler);
@@ -171,7 +171,7 @@
MRef<Session *> mediaSession =
- mediaHandler->createSession( /*securityConfig*/ identity, "" );
+ subsystemMedia->createSession( /*securityConfig*/ identity, "" );
MRef<SipDialog*> voipConfCall( new SipDialogConfVoip(dynamic_cast<ConfMessageRouter*>(*sipstack->getConfCallback()), sipstack, identity, phoneconfig, mediaSession, conflist, confId, ""));
@@ -260,7 +260,7 @@
MRef<Session *> mediaSession =
- mediaHandler->createSession( /*securityConfig*/ identity, "" );
+ subsystemMedia->createSession( /*securityConfig*/ identity, "" );
MRef<SipDialog*> voipConfCall( new SipDialogConfVoip(dynamic_cast<ConfMessageRouter*>(*sipstack->getConfCallback()), sipstack, identity, phoneconfig, mediaSession, confId));
@@ -370,6 +370,7 @@
sipstack->run();
}
-void Sip::setMediaHandler( MRef<MediaHandler *> mh ){
- this->mediaHandler = mh;
+void Sip::setMediaHandler( MRef<SubsystemMedia*> sm ){
+ this->subsystemMedia = sm;
}
+
Modified: trunk/libminisip/source/subsystem_signaling/sip/SipDialogConfVoip.cxx
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/SipDialogConfVoip.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_signaling/sip/SipDialogConfVoip.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -48,6 +48,7 @@
#include<libmsip/SipMessageContentMime.h>
#include<libmsip/SipMessageContent.h>
#include<libminisip/signaling/sip/DefaultDialogHandler.h>
+#include"../../../source/subsystem_media/Session.h"
#include<libminisip/signaling/conference/ConfMessageRouter.h>
#include<libmutil/stringutils.h>
#include<libmutil/Timestamp.h>
@@ -57,7 +58,7 @@
#include <time.h>
#include<libminisip/gui/LogEntry.h>
#include<libmsip/SipCommandString.h>
-#include<libminisip/media/MediaHandler.h>
+#include<libminisip/media/SubsystemMedia.h>
#include<libmutil/MemObject.h>
#include <iostream>
#include<time.h>
Modified: trunk/libminisip/source/subsystem_signaling/sip/SipDialogPresenceClient.cxx
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/SipDialogPresenceClient.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_signaling/sip/SipDialogPresenceClient.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -50,7 +50,7 @@
#include <time.h>
#include<libminisip/gui/LogEntry.h>
#include<libmsip/SipCommandString.h>
-#include<libminisip/media/MediaHandler.h>
+#include<libminisip/media/SubsystemMedia.h>
#include<libmutil/MemObject.h>
#include<libmsip/SipHeaderSubscriptionState.h>
Modified: trunk/libminisip/source/subsystem_signaling/sip/SipDialogPresenceServer.cxx
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/SipDialogPresenceServer.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_signaling/sip/SipDialogPresenceServer.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -48,7 +48,7 @@
#include <time.h>
#include<libminisip/gui/LogEntry.h>
#include<libmsip/SipCommandString.h>
-#include<libminisip/media/MediaHandler.h>
+#include<libminisip/media/SubsystemMedia.h>
#include<libmutil/MemObject.h>
#include<libmsip/SipHeaderExpires.h>
#include<libminisip/signaling/sip/PresenceMessageContent.h>
Modified: trunk/libminisip/source/subsystem_signaling/sip/SipSoftPhoneConfiguration.cxx
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/SipSoftPhoneConfiguration.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/source/subsystem_signaling/sip/SipSoftPhoneConfiguration.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -40,7 +40,8 @@
#include<libminisip/signaling/sip/SipSoftPhoneConfiguration.h>
#include<libminisip/media/soundcard/SoundIO.h>
-#include<libminisip/media/MediaHandler.h>
+#include<libminisip/media/SubsystemMedia.h>
+#include<libminisip/media/codecs/Codec.h>
#include<libminisip/contacts/PhoneBook.h>
#include<libminisip/config/ConfBackend.h>
#include<libminisip/config/UserConfig.h>
Modified: trunk/libminisip/tests/000_compile.cxx
===================================================================
--- trunk/libminisip/tests/000_compile.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/libminisip/tests/000_compile.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -1,5 +1,4 @@
-#include <libminisip/media/Session.h>
-#include <libminisip/media/MediaStream.h>
+#include <libminisip/media/SubsystemMedia.h>
int main(int argc, char *argv[]){
}
Modified: trunk/minisip/minisip/gui/gtkgui/CallWidget.cxx
===================================================================
--- trunk/minisip/minisip/gui/gtkgui/CallWidget.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/minisip/minisip/gui/gtkgui/CallWidget.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -28,8 +28,8 @@
#include<libmsip/SipCommandString.h>
#include<libminisip/gui/Bell.h>
#include<libminisip/media/MediaCommandString.h>
-#include<libminisip/media/Session.h>
-#include<libminisip/media/MediaStream.h>
+//#include<libminisip/media/Session.h>
+//#include<libminisip/media/MediaStream.h>
#ifdef OLDLIBGLADEMM
#define SLOT(a,b) SigC::slot(a,b)
@@ -552,11 +552,21 @@
}
void CallWidget::dtmfPressed( uint8_t symbol ){
+ char s[2];
+ s[0]=symbol;
+ s[1]=0;
+ CommandString cmd( mainCallId,
+ MediaCommandString::send_dtmf,
+ s );
+ mainWindow->getCallback()->handleCommand( "media", cmd );
+
+#if 0
MRef<Session *> session = Session::registry->getSession( mainCallId );
if( session ){
session->sendDtmf( symbol );
}
+#endif
}
#endif
Modified: trunk/minisip/minisip/gui/gtkgui/ConferenceWidget.cxx
===================================================================
--- trunk/minisip/minisip/gui/gtkgui/ConferenceWidget.cxx 2007-11-12 10:58:50 UTC (rev 3461)
+++ trunk/minisip/minisip/gui/gtkgui/ConferenceWidget.cxx 2007-11-12 16:06:41 UTC (rev 3462)
@@ -31,8 +31,8 @@
#include<libmsip/SipCommandString.h>
#include<libminisip/gui/Bell.h>
#include<libminisip/media/MediaCommandString.h>
-#include<libminisip/media/Session.h>
-#include<libminisip/media/MediaStream.h>
+//#include<libminisip/media/Session.h>
+//#include<libminisip/media/MediaStream.h>
#include<libminisip/signaling/conference/ConfMessageRouter.h>
#ifdef OLDLIBGLADEMM
More information about the Minisip-devel
mailing list