Updated mod_opal to latest stable OPAL version.
Enhancements to trace logging, include threads and context ID. Changed default opal_conf.xml to allow more than just G.711 uLaw and not to clutter log file with debug logs. Added to opal_conf.xml item for "disable-transcoding". Updated build/buildopal.sh to use correct ./configure items for PTLib, allow for something other than standard install directory for PTLib/OPAL and be able to easily bind to a specific release of PTLib/OPAL.
This commit is contained in:
parent
a7fadffc16
commit
bfe4c17743
|
@ -1,20 +1,61 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
INSTALLDIR=/usr/local
|
||||||
|
else
|
||||||
|
INSTALLDIR="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z `which svn` ]; then
|
||||||
|
echo "Need SVN installed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
uname -a | grep -qi bsd && MAKE=gmake || MAKE=make
|
uname -a | grep -qi bsd && MAKE=gmake || MAKE=make
|
||||||
|
|
||||||
|
#Locate our script, then go up one directory to be in FreeSWITCH root
|
||||||
|
cd `dirname $0`
|
||||||
|
cd ..
|
||||||
FS_DIR=`pwd`
|
FS_DIR=`pwd`
|
||||||
|
|
||||||
cd /root
|
export PKG_CONFIG_PATH=$INSTALLDIR/lib/pkgconfig
|
||||||
svn co https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/ptlib/trunk ptlib
|
|
||||||
cd ptlib
|
|
||||||
./configure --prefix=/usr
|
|
||||||
${MAKE}
|
|
||||||
${MAKE} install
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
svn co https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/opal/branches/v3_6 opal
|
# Version and patch for PTLib and OPAL. These are almost always in lock
|
||||||
cd opal
|
# step so shoud be the same unless you really know ehat you are doing!
|
||||||
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
|
# The PATCH should be set to a specific"snapshot release" when things
|
||||||
./configure --prefix=/usr
|
# are nice and stable.
|
||||||
|
|
||||||
|
VERSION=10
|
||||||
|
#PATCH=6
|
||||||
|
|
||||||
|
if [ -z "$PATCH" ]; then
|
||||||
|
PTLIB_VERSION=branches/v2_$VERSION
|
||||||
|
OPAL_VERSION=branches/v3_$VERSION
|
||||||
|
else
|
||||||
|
PTLIB_VERSION=tags/v2_${VERSION}_$PATCH
|
||||||
|
OPAL_VERSION=tags/v3_${VERSION}_$PATCH
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
cd $FS_DIR/libs
|
||||||
|
svn co https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/ptlib/$PTLIB_VERSION ptlib
|
||||||
|
cd $FS_DIR/libs/ptlib
|
||||||
|
# LDAP disabled due to conflict wit libs in spidermonkey
|
||||||
|
./configure --disable-plugins --disable-openldap --prefix=$INSTALLDIR
|
||||||
${MAKE}
|
${MAKE}
|
||||||
${MAKE} install
|
sudo ${MAKE} install
|
||||||
cd ${FS_DIR}
|
|
||||||
${MAKE} mod_opal-install
|
cd $FS_DIR/libs
|
||||||
|
svn co https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/opal/$OPAL_VERSION opal
|
||||||
|
cd $FS_DIR/libs/opal
|
||||||
|
./configure --disable-plugins --prefix=$INSTALLDIR
|
||||||
|
$MAKE
|
||||||
|
sudo $MAKE install
|
||||||
|
|
||||||
|
echo "======================================"
|
||||||
|
echo "PTLib/OPAL build and install completed"
|
||||||
|
echo "======================================"
|
||||||
|
|
||||||
|
cd $FS_DIR
|
||||||
|
$MAKE mod_opal-install
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
<configuration name="opal.conf" description="Opal Endpoints">
|
<configuration name="opal.conf" description="Opal Endpoints">
|
||||||
<settings>
|
<settings>
|
||||||
<param name="trace-level" value="4"/>
|
<param name="trace-level" value="3"/>
|
||||||
<param name="context" value="default"/>
|
<param name="context" value="default"/>
|
||||||
<param name="dialplan" value="XML"/>
|
<param name="dialplan" value="XML"/>
|
||||||
<param name="codec-prefs" value="PCMU"/>
|
<param name="jitter-size" value="40,100"/> <!-- Jitter buffer min/max size, milliseconds -->
|
||||||
|
<!-- <param name="codec-prefs" value="PCMU,PCMA"/> --> <!-- list, and preferecnce order, of codecs -->
|
||||||
|
<!-- <param name="disable-transcoding" value="true"/> --> <!-- do not transcode, use source channel codec only -->
|
||||||
<param name="gk-address" value=""/> <!-- empty to disable, "*" to search LAN -->
|
<param name="gk-address" value=""/> <!-- empty to disable, "*" to search LAN -->
|
||||||
<param name="gk-identifer" value=""/> <!-- optional name of gk -->
|
<param name="gk-identifer" value=""/> <!-- optional name of gk -->
|
||||||
<param name="gk-interface" value=""/> <!-- optional listener interface name -->
|
<param name="gk-interface" value="$${local_ip_v4}"/> <!-- optional listener interface name -->
|
||||||
</settings>
|
</settings>
|
||||||
<listeners>
|
<listeners>
|
||||||
<listener name="default">
|
<listener name="default">
|
||||||
|
|
|
@ -13,6 +13,9 @@ libtool
|
||||||
ltmain.sh
|
ltmain.sh
|
||||||
missing
|
missing
|
||||||
|
|
||||||
|
ptlib
|
||||||
|
opal
|
||||||
|
|
||||||
*_manifest.rc
|
*_manifest.rc
|
||||||
*.pc
|
*.pc
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,19 @@
|
||||||
BASE=../../../..
|
BASE=../../../..
|
||||||
LOCAL_INSERT_CFLAGS= pkg-config opal --cflags
|
|
||||||
LOCAL_CFLAGS+=-g -ggdb -I.
|
PKG_DIR:=/usr/local/lib/pkgconfig
|
||||||
LOCAL_INSERT_LDFLAGS= pkg-config opal --libs
|
ifeq ($(PKG_CONFIG_PATH),)
|
||||||
|
export PKG_CONFIG_PATH:=$(PKG_DIR)
|
||||||
|
else
|
||||||
|
ifeq ($(findstring $(PKG_DIR),$(PKG_CONFIG_PATH)),)
|
||||||
|
export PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH):$(PKG_DIR)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
#DEBUG_SUFFIX:=--define-variable=suffix=_d
|
||||||
|
|
||||||
|
LOCAL_INSERT_CFLAGS= pkg-config opal $(DEBUG_SUFFIX) --cflags
|
||||||
|
LOCAL_CFLAGS+=-g -ggdb
|
||||||
|
LOCAL_INSERT_LDFLAGS= pkg-config opal $(DEBUG_SUFFIX) --libs
|
||||||
|
|
||||||
include $(BASE)/build/modmake.rules
|
include $(BASE)/build/modmake.rules
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,6 +4,7 @@
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007 Tuyan Ozipek (tuyanozipek@gmail.com)
|
* Copyright (c) 2007 Tuyan Ozipek (tuyanozipek@gmail.com)
|
||||||
|
* Copyright (c) 2008-2012 Vox Lucida Pty. Ltd. (robertj@voxlucida.com.au)
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
@ -43,9 +44,32 @@
|
||||||
#undef strcasecmp
|
#undef strcasecmp
|
||||||
#undef strncasecmp
|
#undef strncasecmp
|
||||||
|
|
||||||
|
|
||||||
|
#if _MSC_VER < 1600
|
||||||
|
/*The following insanity is because libteletone_generate.h defines int8_t in
|
||||||
|
a slightly different manner to most other cases (SDL, PCAP, Java V8, stdint.h
|
||||||
|
etc) and does not provide a mechanism to prevent it's inclusion. Then, to
|
||||||
|
cap it off, VS2008 barfs on the difference. VS2010 seems OK with it.
|
||||||
|
|
||||||
|
Sigh.
|
||||||
|
*/
|
||||||
|
#pragma include_alias(<libteletone.h>, <../../libs/libteletone/src/libteletone.h>)
|
||||||
|
#pragma include_alias(<libteletone_generate.h>, <../../libs/libteletone/src/libteletone_generate.h>)
|
||||||
|
#pragma include_alias(<libteletone_detect.h>, <../../libs/libteletone/src/libteletone_detect.h>)
|
||||||
|
#define int8_t signed int8_t
|
||||||
|
#include <libteletone_generate.h>
|
||||||
|
#undef int8_t
|
||||||
|
#endif // End of insanity
|
||||||
|
|
||||||
|
|
||||||
#define HAVE_APR
|
#define HAVE_APR
|
||||||
|
#define uint32_t uint32_t // Avoid conflict in stdint definitions
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
#undef uint32_t
|
||||||
|
|
||||||
#include <switch_version.h>
|
#include <switch_version.h>
|
||||||
|
|
||||||
|
|
||||||
#define MODNAME "mod_opal"
|
#define MODNAME "mod_opal"
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,50 +77,37 @@ class FSEndPoint;
|
||||||
class FSManager;
|
class FSManager;
|
||||||
|
|
||||||
|
|
||||||
struct mod_opal_globals {
|
class FSProcess : public PLibraryProcess
|
||||||
int trace_level;
|
{
|
||||||
char *codec_string;
|
|
||||||
char *context;
|
|
||||||
char *dialplan;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct mod_opal_globals mod_opal_globals;
|
|
||||||
|
|
||||||
|
|
||||||
class FSProcess:public PLibraryProcess {
|
|
||||||
PCLASSINFO(FSProcess, PLibraryProcess);
|
PCLASSINFO(FSProcess, PLibraryProcess);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FSProcess();
|
FSProcess();
|
||||||
~FSProcess();
|
~FSProcess();
|
||||||
|
|
||||||
bool Initialise(switch_loadable_module_interface_t *iface);
|
bool Initialise(switch_loadable_module_interface_t *iface);
|
||||||
|
|
||||||
FSManager & GetManager() const {
|
FSManager & GetManager() const
|
||||||
|
{
|
||||||
return *m_manager;
|
return *m_manager;
|
||||||
} protected:
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
FSManager * m_manager;
|
FSManager * m_manager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct FSListener {
|
struct FSListener
|
||||||
FSListener() {
|
{
|
||||||
} PString name;
|
FSListener() : m_port(H323EndPoint::DefaultTcpSignalPort) { }
|
||||||
OpalTransportAddress listenAddress;
|
|
||||||
PString localUserName;
|
PString m_name;
|
||||||
PString gatekeeper;
|
PIPSocket::Address m_address;
|
||||||
|
uint16_t m_port;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class FSCall:public OpalCall {
|
class FSManager : public OpalManager
|
||||||
PCLASSINFO(FSCall, OpalCall);
|
{
|
||||||
public:
|
|
||||||
FSCall(OpalManager & manager);
|
|
||||||
virtual PBoolean OnSetUp(OpalConnection & connection);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class FSManager:public OpalManager {
|
|
||||||
PCLASSINFO(FSManager, OpalManager);
|
PCLASSINFO(FSManager, OpalManager);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -106,9 +117,11 @@ class FSManager:public OpalManager {
|
||||||
|
|
||||||
switch_status_t ReadConfig(int reload);
|
switch_status_t ReadConfig(int reload);
|
||||||
|
|
||||||
switch_endpoint_interface_t *GetSwitchInterface() const {
|
switch_endpoint_interface_t *GetSwitchInterface() const { return m_FreeSwitch; }
|
||||||
return m_FreeSwitch;
|
const PString & GetContext() const { return m_context; }
|
||||||
} virtual OpalCall *CreateCall(void *userData);
|
const PString & GetDialPlan() const { return m_dialplan; }
|
||||||
|
const PString & GetCodecPrefs() const { return m_codecPrefs; }
|
||||||
|
bool GetDisableTranscoding() const { return m_disableTranscoding; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
switch_endpoint_interface_t *m_FreeSwitch;
|
switch_endpoint_interface_t *m_FreeSwitch;
|
||||||
|
@ -117,85 +130,125 @@ class FSManager:public OpalManager {
|
||||||
IAX2EndPoint *m_iaxep;
|
IAX2EndPoint *m_iaxep;
|
||||||
FSEndPoint *m_fsep;
|
FSEndPoint *m_fsep;
|
||||||
|
|
||||||
|
PString m_context;
|
||||||
|
PString m_dialplan;
|
||||||
|
PString m_codecPrefs;
|
||||||
|
bool m_disableTranscoding;
|
||||||
PString m_gkAddress;
|
PString m_gkAddress;
|
||||||
PString m_gkIdentifer;
|
PString m_gkIdentifer;
|
||||||
PString m_gkInterface;
|
PString m_gkInterface;
|
||||||
|
|
||||||
list < FSListener > m_listeners;
|
list <FSListener> m_listeners;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class FSConnection;
|
class FSEndPoint : public OpalLocalEndPoint
|
||||||
typedef struct {
|
{
|
||||||
switch_timer_t read_timer;
|
|
||||||
switch_codec_t read_codec;
|
|
||||||
switch_codec_t write_codec;
|
|
||||||
|
|
||||||
switch_timer_t vid_read_timer;
|
|
||||||
switch_codec_t vid_read_codec;
|
|
||||||
switch_codec_t vid_write_codec;
|
|
||||||
FSConnection *me;
|
|
||||||
} opal_private_t;
|
|
||||||
|
|
||||||
|
|
||||||
class FSEndPoint:public OpalLocalEndPoint {
|
|
||||||
PCLASSINFO(FSEndPoint, OpalLocalEndPoint);
|
PCLASSINFO(FSEndPoint, OpalLocalEndPoint);
|
||||||
public:
|
public:
|
||||||
FSEndPoint(FSManager & manager);
|
FSEndPoint(FSManager & manager);
|
||||||
|
|
||||||
virtual bool OnIncomingCall(OpalLocalConnection &);
|
|
||||||
virtual OpalLocalConnection *CreateConnection(OpalCall & call, void *userData, unsigned options, OpalConnection::StringOptions * stringOptions);
|
virtual OpalLocalConnection *CreateConnection(OpalCall & call, void *userData, unsigned options, OpalConnection::StringOptions * stringOptions);
|
||||||
|
|
||||||
|
FSManager & GetManager() const { return m_manager; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
FSManager & m_manager;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class FSConnection;
|
||||||
|
|
||||||
|
|
||||||
|
class FSMediaStream : public OpalMediaStream
|
||||||
|
{
|
||||||
|
PCLASSINFO(FSMediaStream, OpalMediaStream);
|
||||||
|
public:
|
||||||
|
FSMediaStream(
|
||||||
|
FSConnection & conn,
|
||||||
|
const OpalMediaFormat & mediaFormat, ///< Media format for stream
|
||||||
|
unsigned sessionID, ///< Session number for stream
|
||||||
|
bool isSource ///< Is a source stream
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual PBoolean Open();
|
||||||
|
virtual PBoolean IsSynchronous() const;
|
||||||
|
virtual PBoolean RequiresPatchThread(OpalMediaStream *) const;
|
||||||
|
|
||||||
|
switch_status_t read_frame(switch_frame_t **frame, switch_io_flag_t flags);
|
||||||
|
switch_status_t write_frame(const switch_frame_t *frame, switch_io_flag_t flags);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void InternalClose();
|
||||||
|
int StartReadWrite(PatchPtr & mediaPatch) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool CheckPatchAndLock();
|
||||||
|
|
||||||
|
FSConnection &m_connection;
|
||||||
|
switch_timer_t *m_switchTimer;
|
||||||
|
switch_codec_t *m_switchCodec;
|
||||||
|
switch_frame_t m_readFrame;
|
||||||
|
RTP_DataFrame m_readRTP;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define DECLARE_CALLBACK0(name) \
|
#define DECLARE_CALLBACK0(name) \
|
||||||
static switch_status_t name(switch_core_session_t *session) { \
|
static switch_status_t name(switch_core_session_t *session) { \
|
||||||
opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session); \
|
FSConnection *tech_pvt = (FSConnection *) switch_core_session_get_private(session); \
|
||||||
return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name() : SWITCH_STATUS_FALSE; } \
|
return tech_pvt != NULL ? tech_pvt->name() : SWITCH_STATUS_FALSE; } \
|
||||||
switch_status_t name()
|
switch_status_t name()
|
||||||
|
|
||||||
#define DECLARE_CALLBACK1(name, type1, name1) \
|
#define DECLARE_CALLBACK1(name, type1, name1) \
|
||||||
static switch_status_t name(switch_core_session_t *session, type1 name1) { \
|
static switch_status_t name(switch_core_session_t *session, type1 name1) { \
|
||||||
opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session); \
|
FSConnection *tech_pvt = (FSConnection *) switch_core_session_get_private(session); \
|
||||||
return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name(name1) : SWITCH_STATUS_FALSE; } \
|
return tech_pvt != NULL ? tech_pvt->name(name1) : SWITCH_STATUS_FALSE; } \
|
||||||
switch_status_t name(type1 name1)
|
switch_status_t name(type1 name1)
|
||||||
|
|
||||||
#define DECLARE_CALLBACK3(name, type1, name1, type2, name2, type3, name3) \
|
#define DECLARE_CALLBACK3(name, type1, name1, type2, name2, type3, name3) \
|
||||||
static switch_status_t name(switch_core_session_t *session, type1 name1, type2 name2, type3 name3) { \
|
static switch_status_t name(switch_core_session_t *session, type1 name1, type2 name2, type3 name3) { \
|
||||||
opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session); \
|
FSConnection *tech_pvt = (FSConnection *) switch_core_session_get_private(session); \
|
||||||
return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name(name1, name2, name3) : SWITCH_STATUS_FALSE; } \
|
return tech_pvt != NULL ? tech_pvt->name(name1, name2, name3) : SWITCH_STATUS_FALSE; } \
|
||||||
switch_status_t name(type1 name1, type2 name2, type3 name3)
|
switch_status_t name(type1 name1, type2 name2, type3 name3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FSConnection:public OpalLocalConnection {
|
class FSConnection : public OpalLocalConnection
|
||||||
|
{
|
||||||
PCLASSINFO(FSConnection, OpalLocalConnection)
|
PCLASSINFO(FSConnection, OpalLocalConnection)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
struct outgoing_params {
|
||||||
|
switch_event_t *var_event;
|
||||||
|
switch_caller_profile_t *outbound_profile;
|
||||||
|
switch_core_session_t **new_session;
|
||||||
|
switch_memory_pool_t **pool;
|
||||||
|
switch_originate_flag_t flags;
|
||||||
|
switch_call_cause_t *cancel_cause;
|
||||||
|
switch_call_cause_t fail_cause;
|
||||||
|
};
|
||||||
|
|
||||||
FSConnection(OpalCall & call,
|
FSConnection(OpalCall & call,
|
||||||
FSEndPoint & endpoint,
|
FSEndPoint & endpoint,
|
||||||
void *userData,
|
|
||||||
unsigned options,
|
unsigned options,
|
||||||
OpalConnection::StringOptions * stringOptions,
|
OpalConnection::StringOptions * stringOptions,
|
||||||
switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel);
|
outgoing_params * params);
|
||||||
|
|
||||||
|
virtual bool OnOutgoingSetUp();
|
||||||
virtual bool OnIncoming();
|
virtual bool OnIncoming();
|
||||||
virtual void OnReleased();
|
virtual void OnReleased();
|
||||||
virtual PBoolean SetAlerting(const PString & calleeName, PBoolean withMedia);
|
virtual PBoolean SetAlerting(const PString & calleeName, PBoolean withMedia);
|
||||||
virtual void OnAlerting();
|
|
||||||
virtual void OnEstablished();
|
|
||||||
virtual OpalMediaStream *CreateMediaStream(const OpalMediaFormat &, unsigned, PBoolean);
|
virtual OpalMediaStream *CreateMediaStream(const OpalMediaFormat &, unsigned, PBoolean);
|
||||||
virtual PBoolean OnOpenMediaStream(OpalMediaStream & stream);
|
virtual void OnPatchMediaStream(PBoolean isSource, OpalMediaPatch & patch);
|
||||||
virtual OpalMediaFormatList GetMediaFormats() const;
|
virtual OpalMediaFormatList GetMediaFormats() const;
|
||||||
virtual PBoolean SendUserInputTone(char tone, unsigned duration);
|
virtual PBoolean SendUserInputTone(char tone, unsigned duration);
|
||||||
virtual PBoolean SendUserInputString(const PString & value);
|
|
||||||
|
|
||||||
void SetCodecs();
|
|
||||||
|
|
||||||
DECLARE_CALLBACK0(on_init);
|
DECLARE_CALLBACK0(on_init);
|
||||||
|
DECLARE_CALLBACK0(on_destroy);
|
||||||
DECLARE_CALLBACK0(on_routing);
|
DECLARE_CALLBACK0(on_routing);
|
||||||
DECLARE_CALLBACK0(on_execute);
|
DECLARE_CALLBACK0(on_execute);
|
||||||
|
DECLARE_CALLBACK0(on_hangup);
|
||||||
|
|
||||||
DECLARE_CALLBACK0(on_exchange_media);
|
DECLARE_CALLBACK0(on_exchange_media);
|
||||||
DECLARE_CALLBACK0(on_soft_execute);
|
DECLARE_CALLBACK0(on_soft_execute);
|
||||||
|
@ -210,49 +263,56 @@ class FSConnection:public OpalLocalConnection {
|
||||||
DECLARE_CALLBACK3(read_video_frame, switch_frame_t **, frame, switch_io_flag_t, flag, int, stream_id);
|
DECLARE_CALLBACK3(read_video_frame, switch_frame_t **, frame, switch_io_flag_t, flag, int, stream_id);
|
||||||
DECLARE_CALLBACK3(write_video_frame, switch_frame_t *, frame, switch_io_flag_t, flag, int, stream_id);
|
DECLARE_CALLBACK3(write_video_frame, switch_frame_t *, frame, switch_io_flag_t, flag, int, stream_id);
|
||||||
|
|
||||||
|
__inline switch_core_session_t *GetSession() const
|
||||||
|
{
|
||||||
|
return m_fsSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
__inline switch_channel_t *GetChannel() const
|
||||||
|
{
|
||||||
|
return m_fsChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsChannelReady() const
|
||||||
|
{
|
||||||
|
return m_fsChannel != NULL && switch_channel_ready(m_fsChannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NeedFlushAudio()
|
||||||
|
{
|
||||||
|
if (!m_flushAudio)
|
||||||
|
return false;
|
||||||
|
m_flushAudio = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void SetCodecs();
|
||||||
|
bool WaitForMedia();
|
||||||
|
|
||||||
switch_status_t read_frame(const OpalMediaType & mediaType, switch_frame_t **frame, switch_io_flag_t flags);
|
switch_status_t read_frame(const OpalMediaType & mediaType, switch_frame_t **frame, switch_io_flag_t flags);
|
||||||
switch_status_t write_frame(const OpalMediaType & mediaType, const switch_frame_t *frame, switch_io_flag_t flags);
|
switch_status_t write_frame(const OpalMediaType & mediaType, const switch_frame_t *frame, switch_io_flag_t flags);
|
||||||
|
|
||||||
switch_core_session_t *GetSession() const {
|
private:
|
||||||
return m_fsSession;
|
FSEndPoint &m_endpoint;
|
||||||
} private:
|
|
||||||
FSEndPoint & m_endpoint;
|
|
||||||
switch_core_session_t *m_fsSession;
|
switch_core_session_t *m_fsSession;
|
||||||
switch_channel_t *m_fsChannel;
|
switch_channel_t *m_fsChannel;
|
||||||
PSyncPoint m_rxAudioOpened;
|
PSyncPoint m_rxAudioOpened;
|
||||||
PSyncPoint m_txAudioOpened;
|
PSyncPoint m_txAudioOpened;
|
||||||
OpalMediaFormatList m_switchMediaFormats;
|
OpalMediaFormatList m_switchMediaFormats;
|
||||||
};
|
|
||||||
|
|
||||||
|
// If FS ever supports more than one audio and one video, this needs to change
|
||||||
|
switch_timer_t m_read_timer;
|
||||||
|
switch_codec_t m_read_codec;
|
||||||
|
switch_codec_t m_write_codec;
|
||||||
|
|
||||||
class FSMediaStream:public OpalMediaStream {
|
switch_timer_t m_vid_read_timer;
|
||||||
PCLASSINFO(FSMediaStream, OpalMediaStream);
|
switch_codec_t m_vid_read_codec;
|
||||||
public:
|
switch_codec_t m_vid_write_codec;
|
||||||
FSMediaStream(FSConnection & conn, const OpalMediaFormat & mediaFormat, ///< Media format for stream
|
|
||||||
unsigned sessionID, ///< Session number for stream
|
|
||||||
bool isSource ///< Is a source stream
|
|
||||||
);
|
|
||||||
|
|
||||||
virtual PBoolean Open();
|
bool m_flushAudio;
|
||||||
virtual PBoolean Close();
|
|
||||||
virtual PBoolean IsSynchronous() const;
|
|
||||||
virtual PBoolean RequiresPatchThread(OpalMediaStream *) const;
|
|
||||||
|
|
||||||
switch_status_t read_frame(switch_frame_t **frame, switch_io_flag_t flags);
|
friend PBoolean FSMediaStream::Open();
|
||||||
switch_status_t write_frame(const switch_frame_t *frame, switch_io_flag_t flags);
|
|
||||||
|
|
||||||
private:
|
|
||||||
switch_core_session_t *m_fsSession;
|
|
||||||
switch_channel_t *m_fsChannel;
|
|
||||||
switch_timer_t *m_switchTimer;
|
|
||||||
switch_codec_t *m_switchCodec;
|
|
||||||
switch_frame_t m_readFrame;
|
|
||||||
unsigned char m_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
|
||||||
RTP_DataFrame m_readRTP;
|
|
||||||
bool m_callOnStart;
|
|
||||||
uint32_t m_timeStamp;
|
|
||||||
|
|
||||||
bool CheckPatchAndLock();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue