move mod_opal into trunk

still needs some work
still needs some FUNDING



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10734 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-12-12 16:44:23 +00:00
parent c94e6a9368
commit 7bf2e6bca4
6 changed files with 1843 additions and 0 deletions

View File

@ -0,0 +1,8 @@
BASE=../../../..
LOCAL_INSERT_CFLAGS= pkg-config opal --cflags
LOCAL_CFLAGS+=-g -ggdb -I.
LOCAL_INSERT_LDFLAGS= pkg-config opal --libs
include $(BASE)/build/modmake.rules

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,233 @@
/* Opal endpoint interface for Freeswitch Modular Media Switching Software Library /
* Soft-Switch Application
*
* Version: MPL 1.1
*
* Copyright (c) 2007 Tuyan Ozipek (tuyanozipek@gmail.com)
*
* 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
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Contributor(s):
* Tuyan Ozipek (tuyanozipek@gmail.com)
* Lukasz Zwierko (lzwierko@gmail.com)
* Robert Jongbloed (robertj@voxlucida.com.au)
*
*/
#ifndef __FREESWITCH_MOD_OPAL__
#define __FREESWITCH_MOD_OPAL__
#define HAVE_APR
#include <switch.h>
#include <switch_version.h>
#define MODNAME "mod_opal"
#undef strcasecmp
#undef strncasecmp
#include <ptlib.h>
#include <opal/manager.h>
#include <opal/localep.h>
#include <h323/h323ep.h>
#include <iax2/iax2ep.h>
class FSEndPoint;
class FSManager;
struct mod_opal_globals {
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);
public:
FSProcess();
~FSProcess();
bool Initialise(switch_loadable_module_interface_t *iface);
FSManager & GetManager() const { return *m_manager; }
protected:
FSManager * m_manager;
};
struct FSListener {
FSListener() {
}
PString name;
OpalTransportAddress listenAddress;
PString localUserName;
PString gatekeeper;
};
class FSManager : public OpalManager {
PCLASSINFO(FSManager, OpalManager);
public:
FSManager();
bool Initialise(switch_loadable_module_interface_t *iface);
switch_status_t ReadConfig(int reload);
switch_endpoint_interface_t *GetSwitchInterface() const {
return m_FreeSwitch;
}
private:
switch_endpoint_interface_t *m_FreeSwitch;
H323EndPoint *m_h323ep;
IAX2EndPoint *m_iaxep;
FSEndPoint *m_fsep;
list < FSListener > m_listeners;
};
class FSEndPoint:public OpalLocalEndPoint {
PCLASSINFO(FSEndPoint, OpalLocalEndPoint);
public:
FSEndPoint(FSManager & manager);
virtual bool OnIncomingCall(OpalLocalConnection &);
virtual OpalLocalConnection *CreateConnection(OpalCall &, void *);
bool AddMediaFormat(const switch_codec_implementation_t *codec);
private:
PList<OpalMediaFormat> m_globalMediaFormats;
};
#define DECLARE_CALLBACK0(name) \
static switch_status_t name(switch_core_session_t *session) { \
FSConnection * conn = (FSConnection *)switch_core_session_get_private(session); \
return conn != NULL ? conn->name() : SWITCH_STATUS_FALSE; } \
switch_status_t name()
#define DECLARE_CALLBACK1(name, type1, name1) \
static switch_status_t name(switch_core_session_t *session, type1 name1) { \
FSConnection * conn = (FSConnection *)switch_core_session_get_private(session); \
return conn != NULL ? conn->name(name1) : SWITCH_STATUS_FALSE; } \
switch_status_t name(type1 name1)
#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) { \
FSConnection * conn = (FSConnection *)switch_core_session_get_private(session); \
return conn != NULL ? conn->name(name1, name2, name3) : SWITCH_STATUS_FALSE; } \
switch_status_t name(type1 name1, type2 name2, type3 name3)
class FSConnection:public OpalLocalConnection {
PCLASSINFO(FSConnection, OpalLocalConnection)
public:
FSConnection(OpalCall & call, FSEndPoint & endpoint);
virtual bool OnIncoming();
virtual void OnReleased();
virtual PBoolean SetAlerting(const PString & calleeName, PBoolean withMedia);
virtual void OnAlerting();
virtual void OnEstablished();
virtual OpalMediaStream *CreateMediaStream(const OpalMediaFormat &, unsigned, PBoolean);
virtual PBoolean OnOpenMediaStream(OpalMediaStream & stream);
virtual OpalMediaFormatList GetMediaFormats() const;
void SetCodecs();
DECLARE_CALLBACK0(on_init);
DECLARE_CALLBACK0(on_routing);
DECLARE_CALLBACK0(on_execute);
DECLARE_CALLBACK0(on_hangup);
DECLARE_CALLBACK0(on_loopback);
DECLARE_CALLBACK0(on_transmit);
DECLARE_CALLBACK1(kill_channel, int, sig);
DECLARE_CALLBACK1(send_dtmf, const switch_dtmf_t *, dtmf);
DECLARE_CALLBACK1(receive_message, switch_core_session_message_t *, msg);
DECLARE_CALLBACK1(receive_event, switch_event_t *, event);
DECLARE_CALLBACK0(state_change);
DECLARE_CALLBACK3(read_audio_frame, switch_frame_t **, frame, switch_io_flag_t, flags, int, stream_id);
DECLARE_CALLBACK3(write_audio_frame, switch_frame_t *, frame, switch_io_flag_t, flags, 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);
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_core_session_t *GetSession() const {
return m_fsSession;
}
private:
FSEndPoint & m_endpoint;
switch_core_session_t *m_fsSession;
switch_channel_t *m_fsChannel;
PSyncPoint m_rxAudioOpened;
PSyncPoint m_txAudioOpened;
OpalMediaFormatList m_switchMediaFormats;
};
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 Close();
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);
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;
RTP_DataFrame m_readRTP;
bool m_callOnStart;
};
#endif /* __FREESWITCH_MOD_OPAL__ */
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4: expandtabs:
*/

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="mod_opal"
ProjectGUID="{426B1369-FDB7-4B18-A7EF-9C6A9097A130}"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="_DEBUG;PTRACING"
BasicRuntimeChecks="0"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(TargetDir)$(TargetName).pdb"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opalsd.lib ptlibsd.lib"
LinkIncremental="2"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="NDEBUG;PTRACING"
UsePrecompiledHeader="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opals.lib ptlibs.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
<ProjectReference
ReferencedProjectIdentifier="{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}"
RelativePathToProject=".\w32\Library\FreeSwitchCore.vcproj"
/>
</References>
<Files>
<File
RelativePath=".\mod_opal.cpp"
>
</File>
<File
RelativePath=".\mod_opal.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="mod_opal"
ProjectGUID="{05C9FB27-480E-4D53-B3B7-6338E2526666}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ALLOW_SMP_DANGERS"
UsePrecompiledHeader="0"
DisableSpecificWarnings="4100;4101"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/NODEFAULTLIB:LIMBCTD"
AdditionalDependencies="opalsd.lib ptlibsd.lib"
AdditionalLibraryDirectories=""
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
UsePrecompiledHeader="0"
DisableSpecificWarnings="4100;4101"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies=""
AdditionalLibraryDirectories=""
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\mod_opal.cpp"
>
</File>
<File
RelativePath=".\mod_opal.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,15 @@
<configuration name="opal.conf" description="Opal Endpoints">
<settings>
<param name="trace-level" value="4"/>
<param name="context" value="default"/>
<param name="dialplan" value="XML"/>
<param name="codec-prefs" value="PCMU"/>
</settings>
<listeners>
<listener name="default">
<param name="h323-ip" value="$${local_ip_v4}"/>
<param name="h323-port" value="1720"/>
</listener>
</listeners>
</configuration>