Update, changing core assembly name to FreeSwitch.NET.dll as to not conflict with the real freeswitch.dll on Windows.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2750 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
ccb32b0eb6
commit
1923ccc8f9
|
@ -32,7 +32,7 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace FreeSwitch.NET
|
||||
namespace FreeSwitch
|
||||
{
|
||||
public class Common
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<ProjectGuid>{251CAABC-16C3-4593-A491-603B908094E0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FreeSwitch.NET</RootNamespace>
|
||||
<AssemblyName>Freeswitch</AssemblyName>
|
||||
<RootNamespace>FreeSwitch</RootNamespace>
|
||||
<AssemblyName>FreeSwitch.NET</AssemblyName>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
|
@ -42,11 +42,17 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Common.cs" />
|
||||
<Compile Include="Log.cs" />
|
||||
<Compile Include="Ivr.cs" />
|
||||
<Compile Include="Marshaling\BufferMarshaler.cs" />
|
||||
<Compile Include="Marshaling\CallerExtensionMarshaler.cs" />
|
||||
<Compile Include="Marshaling\CallerProfileMarshaler.cs" />
|
||||
<Compile Include="Marshaling\ChannelMarshaler.cs" />
|
||||
<Compile Include="Marshaling\ChannelTimetableMarshaler.cs" />
|
||||
<Compile Include="Marshaling\CodecMarshaler.cs" />
|
||||
<Compile Include="Marshaling\StateHandlerTableMarshaler.cs" />
|
||||
<Compile Include="Marshaling\TimerMarshaler.cs" />
|
||||
<Compile Include="Marshaling\SpeechHandleMarshaler.cs" />
|
||||
<Compile Include="Marshaling\StreamHandleMarshaler.cs" />
|
||||
<Compile Include="Marshaling\CoreSessionMarshaler.cs" />
|
||||
<Compile Include="Marshaling\EventMarshaler.cs" />
|
||||
|
@ -65,6 +71,9 @@
|
|||
<Compile Include="Marshaling\Types\CodecInterfaceMarshal.cs" />
|
||||
<Compile Include="Marshaling\Types\CodecMarshal.cs" />
|
||||
<Compile Include="Marshaling\Types\CodecTypeMarshal.cs" />
|
||||
<Compile Include="Marshaling\Types\StateHandlerTableMarshal.cs" />
|
||||
<Compile Include="Marshaling\Types\TimerMarshal.cs" />
|
||||
<Compile Include="Marshaling\Types\SpeechHandleMarshal.cs" />
|
||||
<Compile Include="Marshaling\Types\StreamHandleMarshal.cs" />
|
||||
<Compile Include="Marshaling\Types\TypesMarshal.cs" />
|
||||
<Compile Include="Marshaling\Types\FileHandleMarshal.cs" />
|
||||
|
@ -79,6 +88,8 @@
|
|||
<Compile Include="Switch\CallerProfile.cs" />
|
||||
<Compile Include="Switch\Channel.cs" />
|
||||
<Compile Include="Switch\Console.cs" />
|
||||
<Compile Include="Switch\Log.cs" />
|
||||
<Compile Include="Switch\Event.cs" />
|
||||
<Compile Include="Switch\StreamHandle.cs" />
|
||||
<Compile Include="Switch\CoreSession.cs" />
|
||||
<Compile Include="Switch\Ivr.cs" />
|
||||
|
@ -96,6 +107,13 @@
|
|||
<Compile Include="Modules\Application.cs" />
|
||||
<Compile Include="Types\ApplicationFunction.cs" />
|
||||
<Compile Include="Types\CallCause.cs" />
|
||||
<Compile Include="Types\Codec.cs" />
|
||||
<Compile Include="Types\LogLevel.cs" />
|
||||
<Compile Include="Types\StateHandlerTable.cs" />
|
||||
<Compile Include="Types\Timer.cs" />
|
||||
<Compile Include="Types\SpeechHandle.cs" />
|
||||
<Compile Include="Types\EventCallback.cs" />
|
||||
<Compile Include="Types\EventType.cs" />
|
||||
<Compile Include="Types\InputCallbackFunction.cs" />
|
||||
<Compile Include="Types\InputType.cs" />
|
||||
<Compile Include="Types\ModuleInterfaces.cs" />
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using FreeSwitch.Types;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
|
||||
namespace FreeSwitch
|
||||
{
|
||||
public class Ivr
|
||||
{
|
||||
public static Status MultiThreadedBridge(CoreSession session, CoreSession peerSession, InputCallbackFunction dtmfCallback)
|
||||
{
|
||||
return Switch.switch_ivr_multi_threaded_bridge(session, peerSession, dtmfCallback, IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
public static Status Originate(CoreSession session, CoreSession peerSession, CallCause callCause, string data, uint timelimit)
|
||||
{
|
||||
IntPtr callCausePtr = Marshal.AllocHGlobal(4);
|
||||
IntPtr dataPtr = Marshal.StringToHGlobalAnsi(data);
|
||||
|
||||
Marshal.StructureToPtr(callCause, callCausePtr, true);
|
||||
|
||||
return Switch.switch_ivr_originate(session, ref peerSession, callCausePtr, dataPtr, timelimit, null, null, null, null);
|
||||
}
|
||||
|
||||
public static Status RecordFile(CoreSession coreSession, FileHandle fileHandle, string file, DtmfCallbackFunction dtmfCallbackFunction)
|
||||
{
|
||||
Byte[] filename = Encoding.Default.GetBytes(file);
|
||||
|
||||
Console.WriteLine("File: {0}", file);
|
||||
|
||||
dtmfCallbackFunction(coreSession, "1");
|
||||
dtmfCallbackFunction(coreSession, "2");
|
||||
dtmfCallbackFunction(coreSession, "3");
|
||||
|
||||
Encoding ansiEncoding = Encoding.GetEncoding(1252);
|
||||
//filename = Encoding.Convert(Encoding.Default, ansiEncoding, filename);
|
||||
|
||||
Console.WriteLine("Filename: {0}", file);
|
||||
//Console.WriteLine("Status record: {0}", status.ToString());
|
||||
return Status.Success;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using FreeSwitch.Types;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
|
||||
namespace FreeSwitch
|
||||
{
|
||||
public class Log
|
||||
{
|
||||
public static void Printf(LogLevel level, string message)
|
||||
{
|
||||
Switch.switch_log_printf(null, "File", "Func.NET", 123, level, message);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ all: $(MODNAME).so
|
|||
|
||||
$(MODNAME).so:
|
||||
/usr/local/freeswitch/bin/gmcs -debug -unsafe -t:library -keyfile:public.snk \
|
||||
-out:FreeSwitch.dll -reference:Mono.Posix.dll \
|
||||
-out:FreeSwitch.NET.dll -reference:Mono.Posix.dll \
|
||||
Properties/AssemblyInfo.cs \
|
||||
Marshaling/Types/ApiInterfaceMarshal.cs \
|
||||
Marshaling/Types/ApplicationInterfaceMarshal.cs \
|
||||
|
@ -24,26 +24,35 @@ $(MODNAME).so:
|
|||
Marshaling/Types/IOEventHooksMarshal.cs \
|
||||
Marshaling/Types/LoadableModuleInterfaceMarshal.cs \
|
||||
Marshaling/Types/LoadableModuleMarshal.cs \
|
||||
Marshaling/Types/SpeechHandleMarshal.cs \
|
||||
Marshaling/Types/StateHandlerTableMarshal.cs \
|
||||
Marshaling/Types/StreamHandleMarshal.cs \
|
||||
Marshaling/Types/TypesMarshal.cs \
|
||||
Marshaling/Types/TimerMarshal.cs \
|
||||
Marshaling/BufferMarshaler.cs \
|
||||
Marshaling/CallerExtensionMarshaler.cs \
|
||||
Marshaling/CallerProfileMarshaler.cs \
|
||||
Marshaling/ChannelMarshaler.cs \
|
||||
Marshaling/ChannelTimetableMarshaler.cs \
|
||||
Marshaling/CodecMarshaler.cs \
|
||||
Marshaling/CoreSessionMarshaler.cs \
|
||||
Marshaling/EventMarshaler.cs \
|
||||
Marshaling/FileHandleMarshaler.cs \
|
||||
Marshaling/MemoryPoolMarshaler.cs \
|
||||
Marshaling/SpeechHandleMarshaler.cs \
|
||||
Marshaling/StateHandlerTableMarshaler.cs \
|
||||
Marshaling/StreamHandleMarshaler.cs \
|
||||
Marshaling/TimerMarshaler.cs \
|
||||
Modules/Api.cs \
|
||||
Modules/Application.cs \
|
||||
Switch/CallerProfile.cs \
|
||||
Switch/Channel.cs \
|
||||
Switch/Console.cs \
|
||||
Switch/CoreSession.cs \
|
||||
Switch/Event.cs \
|
||||
Switch/Ivr.cs \
|
||||
Switch/LoadableModule.cs \
|
||||
Switch/Log.cs \
|
||||
Switch/StreamHandle.cs \
|
||||
Types/ApiFunction.cs \
|
||||
Types/ApplicationFunction.cs \
|
||||
|
@ -56,24 +65,33 @@ $(MODNAME).so:
|
|||
Types/ChannelFlag.cs \
|
||||
Types/ChannelState.cs \
|
||||
Types/ChannelTimetable.cs \
|
||||
Types/Codec.cs \
|
||||
Types/CoreSession.cs \
|
||||
Types/DtmfCallbackFunction.cs \
|
||||
Types/InputCallbackFunction.cs \
|
||||
Types/InputType.cs \
|
||||
Types/Event.cs \
|
||||
Types/EventCallback.cs \
|
||||
Types/EventType.cs \
|
||||
Types/FileHandle.cs \
|
||||
Types/LoadableModule.cs \
|
||||
Types/LoadableModuleInterface.cs \
|
||||
Types/LogLevel.cs \
|
||||
Types/MemoryPool.cs \
|
||||
Types/Module.cs \
|
||||
Types/Status.cs \
|
||||
Types/SpeechHandle.cs \
|
||||
Types/StateHandlerTable.cs \
|
||||
Types/StreamHandle.cs \
|
||||
Types/TextChannel.cs \
|
||||
Types/Timer.cs \
|
||||
Common.cs \
|
||||
Module.cs \
|
||||
Ivr.cs \
|
||||
Log.cs \
|
||||
|
||||
clean:
|
||||
rm -fr *.dll
|
||||
|
||||
install:
|
||||
cp -f FreeSwitch.dll /usr/local/freeswitch/lib/
|
||||
cp -f FreeSwitch.NET.dll /usr/local/freeswitch/lib/
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* CodecMarshaler.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
using FreeSwitch.Types;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace FreeSwitch.Marshaling
|
||||
{
|
||||
class CodecMarshaler : ICustomMarshaler
|
||||
{
|
||||
private static CodecMarshaler Instance = new CodecMarshaler();
|
||||
|
||||
public static ICustomMarshaler GetInstance(string s)
|
||||
{
|
||||
return Instance;
|
||||
}
|
||||
|
||||
public void CleanUpManagedData(object o)
|
||||
{
|
||||
}
|
||||
|
||||
public void CleanUpNativeData(IntPtr pNativeData)
|
||||
{
|
||||
}
|
||||
|
||||
public int GetNativeDataSize()
|
||||
{
|
||||
return IntPtr.Size;
|
||||
}
|
||||
|
||||
public IntPtr MarshalManagedToNative(object obj)
|
||||
{
|
||||
Codec streamHandleObj = (Codec)obj;
|
||||
|
||||
return streamHandleObj.marshaledObject.Handle;
|
||||
}
|
||||
|
||||
public object MarshalNativeToManaged(IntPtr codecPtr)
|
||||
{
|
||||
CodecMarshal codecMarshal = new CodecMarshal();
|
||||
Codec codecObj = new Codec();
|
||||
|
||||
|
||||
Marshal.PtrToStructure(codecPtr, codecMarshal);
|
||||
|
||||
codecObj.marshaledObject = new HandleRef(codecMarshal, codecPtr);
|
||||
|
||||
return codecObj;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -62,14 +62,36 @@ namespace FreeSwitch.Marshaling
|
|||
{
|
||||
CoreSession coreSession = (CoreSession)obj;
|
||||
|
||||
Console.WriteLine("CoreSession: Marshalling Managed to Native");
|
||||
|
||||
if (coreSession.marshaledObject.Handle != IntPtr.Zero)
|
||||
{
|
||||
|
||||
Console.WriteLine("Returning: 0x{0:x}", coreSession.marshaledObject.Handle.ToInt32());
|
||||
return coreSession.marshaledObject.Handle;
|
||||
}
|
||||
else
|
||||
{
|
||||
CoreSessionMarshal coreSessionMarshal = new CoreSessionMarshal();
|
||||
IntPtr coreSessionPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CoreSessionMarshal)));
|
||||
|
||||
Marshal.StructureToPtr(coreSessionMarshal, coreSessionPtr, true);
|
||||
|
||||
coreSession.marshaledObject = new HandleRef(coreSessionMarshal, coreSessionPtr);
|
||||
|
||||
Console.WriteLine("CoreSession: NO OBJECT EXISTS OMG");
|
||||
Console.WriteLine("Returning: 0x{0:x}", coreSession.marshaledObject.Handle.ToInt32());
|
||||
return coreSession.marshaledObject.Handle;
|
||||
}
|
||||
}
|
||||
|
||||
public object MarshalNativeToManaged(IntPtr coreSessionPtr)
|
||||
{
|
||||
CoreSessionMarshal coreSessionMarshal = new CoreSessionMarshal();
|
||||
CoreSession coreSession = new CoreSession();
|
||||
|
||||
Console.WriteLine("CoreSession: Marshalling Native to Managed");
|
||||
|
||||
Marshal.PtrToStructure(coreSessionPtr, coreSessionMarshal);
|
||||
|
||||
coreSession.marshaledObject = new HandleRef(coreSessionMarshal, coreSessionPtr);
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* SpeechHandleMarshaler.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
using FreeSwitch.Types;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace FreeSwitch.Marshaling
|
||||
{
|
||||
class SpeechHandleMarshaler : ICustomMarshaler
|
||||
{
|
||||
private static SpeechHandleMarshaler Instance = new SpeechHandleMarshaler();
|
||||
|
||||
public static ICustomMarshaler GetInstance(string s)
|
||||
{
|
||||
return Instance;
|
||||
}
|
||||
|
||||
public void CleanUpManagedData(object o)
|
||||
{
|
||||
}
|
||||
|
||||
public void CleanUpNativeData(IntPtr pNativeData)
|
||||
{
|
||||
}
|
||||
|
||||
public int GetNativeDataSize()
|
||||
{
|
||||
return IntPtr.Size;
|
||||
}
|
||||
|
||||
public IntPtr MarshalManagedToNative(object obj)
|
||||
{
|
||||
SpeechHandle speechHandleObj = (SpeechHandle)obj;
|
||||
|
||||
return speechHandleObj.marshaledObject.Handle;
|
||||
}
|
||||
|
||||
public object MarshalNativeToManaged(IntPtr speechHandlePtr)
|
||||
{
|
||||
SpeechHandleMarshal speechHandleMarshal = new SpeechHandleMarshal();
|
||||
SpeechHandle speechHandleObj = new SpeechHandle();
|
||||
|
||||
Marshal.PtrToStructure(speechHandlePtr, speechHandleMarshal);
|
||||
|
||||
speechHandleObj.marshaledObject = new HandleRef(speechHandleMarshal, speechHandlePtr);
|
||||
|
||||
return speechHandleObj;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* StateHandlerTableMarshaler.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
using FreeSwitch.Types;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace FreeSwitch.Marshaling
|
||||
{
|
||||
class StateHandlerTableMarshaler : ICustomMarshaler
|
||||
{
|
||||
private static StateHandlerTableMarshaler Instance = new StateHandlerTableMarshaler();
|
||||
|
||||
public static ICustomMarshaler GetInstance(string s)
|
||||
{
|
||||
return Instance;
|
||||
}
|
||||
|
||||
public void CleanUpManagedData(object o)
|
||||
{
|
||||
}
|
||||
|
||||
public void CleanUpNativeData(IntPtr pNativeData)
|
||||
{
|
||||
}
|
||||
|
||||
public int GetNativeDataSize()
|
||||
{
|
||||
return IntPtr.Size;
|
||||
}
|
||||
|
||||
public IntPtr MarshalManagedToNative(object obj)
|
||||
{
|
||||
StateHandlerTable stateHandlerTableObj = (StateHandlerTable)obj;
|
||||
|
||||
return stateHandlerTableObj.marshaledObject.Handle;
|
||||
}
|
||||
|
||||
public object MarshalNativeToManaged(IntPtr stateHandlerTablePtr)
|
||||
{
|
||||
StateHandlerTableMarshal stateHandlerTableMarshal = new StateHandlerTableMarshal();
|
||||
StateHandlerTable stateHandlerTableObj = new StateHandlerTable();
|
||||
|
||||
Marshal.PtrToStructure(stateHandlerTablePtr, stateHandlerTableMarshal);
|
||||
|
||||
stateHandlerTableObj.marshaledObject = new HandleRef(stateHandlerTableMarshal, stateHandlerTablePtr);
|
||||
|
||||
return stateHandlerTableObj;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* TimerMarshaler.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
using FreeSwitch.Types;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace FreeSwitch.Marshaling
|
||||
{
|
||||
class TimerMarshaler : ICustomMarshaler
|
||||
{
|
||||
private static TimerMarshaler Instance = new TimerMarshaler();
|
||||
|
||||
public static ICustomMarshaler GetInstance(string s)
|
||||
{
|
||||
return Instance;
|
||||
}
|
||||
|
||||
public void CleanUpManagedData(object o)
|
||||
{
|
||||
}
|
||||
|
||||
public void CleanUpNativeData(IntPtr pNativeData)
|
||||
{
|
||||
}
|
||||
|
||||
public int GetNativeDataSize()
|
||||
{
|
||||
return IntPtr.Size;
|
||||
}
|
||||
|
||||
public IntPtr MarshalManagedToNative(object obj)
|
||||
{
|
||||
Timer timerObj = (Timer)obj;
|
||||
|
||||
return timerObj.marshaledObject.Handle;
|
||||
}
|
||||
|
||||
public object MarshalNativeToManaged(IntPtr timerPtr)
|
||||
{
|
||||
TimerMarshal timerMarshal = new TimerMarshal();
|
||||
Timer timerObj = new Timer();
|
||||
|
||||
Marshal.PtrToStructure(timerPtr, timerMarshal);
|
||||
|
||||
timerObj.marshaledObject = new HandleRef(timerMarshal, timerPtr);
|
||||
|
||||
return timerObj;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,9 +38,9 @@ namespace FreeSwitch.Marshaling.Types
|
|||
{
|
||||
internal IntPtr codec_interface;
|
||||
internal IntPtr implementation;
|
||||
//internal CodecSettingsMarshal codec_settings;
|
||||
internal IntPtr codec_settings;
|
||||
internal UInt32 flags;
|
||||
//internal MemoryPoolMarshal memory_pool;
|
||||
internal IntPtr memory_pool;
|
||||
internal IntPtr private_info;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* SpeechHandleMarshal.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Types;
|
||||
|
||||
namespace FreeSwitch.Marshaling.Types
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class SpeechHandleMarshal
|
||||
{
|
||||
internal IntPtr speech_interface;
|
||||
internal UInt32 flags;
|
||||
internal IntPtr name;
|
||||
internal UInt32 rate;
|
||||
internal UInt32 speed;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=80)]
|
||||
internal byte[] voice;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=80)]
|
||||
internal byte[] engine;
|
||||
internal IntPtr memory_pool;
|
||||
internal IntPtr private_info;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* StateHandlerTableMarshal.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Types;
|
||||
|
||||
namespace FreeSwitch.Marshaling.Types
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class StateHandlerTableMarshal
|
||||
{
|
||||
internal IntPtr on_init;
|
||||
internal IntPtr on_ring;
|
||||
internal IntPtr on_execute;
|
||||
internal IntPtr on_hangup;
|
||||
internal IntPtr on_loopback;
|
||||
internal IntPtr on_transmit;
|
||||
internal IntPtr on_hold;
|
||||
}
|
||||
}
|
|
@ -43,6 +43,8 @@ namespace FreeSwitch.Marshaling.Types
|
|||
internal IntPtr end;
|
||||
internal int data_size;
|
||||
internal int data_len;
|
||||
internal int alloc_len;
|
||||
internal int alloc_chunk;
|
||||
internal IntPtr _event;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* TimerMarshal.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Types;
|
||||
|
||||
namespace FreeSwitch.Marshaling.Types
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal class TimerMarshal
|
||||
{
|
||||
int interval;
|
||||
UInt32 flags;
|
||||
uint samples;
|
||||
uint samplecount;
|
||||
IntPtr timer_interface;
|
||||
IntPtr memory_pool;
|
||||
IntPtr private_info;
|
||||
}
|
||||
}
|
|
@ -34,12 +34,11 @@ using System.Collections;
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using FreeSwitch.NET;
|
||||
using FreeSwitch.Types;
|
||||
using FreeSwitch.Modules;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
|
||||
namespace FreeSwitch.NET
|
||||
namespace FreeSwitch
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for all Freeswitch.NET modules
|
||||
|
@ -92,19 +91,25 @@ namespace FreeSwitch.NET
|
|||
/* Set the module_name field of the LoadableModuleInterface */
|
||||
module_interface.module_name = Marshal.StringToHGlobalAnsi(filename);
|
||||
|
||||
if (apiInterfaces.Count > 0)
|
||||
{
|
||||
/* Grab the first ApiInterface in our array and add a pointer to this in our ModuleInterface*/
|
||||
Api apiIndex = (Api)apiInterfaces[0];
|
||||
|
||||
module_interface.api_interface = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ApiInterfaceMarshal)));
|
||||
|
||||
Marshal.StructureToPtr(apiIndex.handle.Wrapper, module_interface.api_interface, true);
|
||||
}
|
||||
|
||||
if (applicationInterfaces.Count > 0)
|
||||
{
|
||||
/* For each Application interface */
|
||||
Application applicationIndex = (Application)applicationInterfaces[0];
|
||||
|
||||
module_interface.application_interface = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ApplicationInterfaceMarshal)));
|
||||
|
||||
Marshal.StructureToPtr(applicationIndex.handle.Wrapper, module_interface.application_interface, true);
|
||||
}
|
||||
|
||||
/* Finally, marshal the moduleinterface class and return */
|
||||
Marshal.StructureToPtr(module_interface, module, true);
|
||||
|
@ -200,6 +205,10 @@ namespace FreeSwitch.NET
|
|||
module.module_shutdown);
|
||||
}
|
||||
|
||||
|
||||
public string Name
|
||||
{
|
||||
set { name = value; }
|
||||
get { return name; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,15 @@ namespace FreeSwitch
|
|||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ChannelMarshaler))]
|
||||
Channel channel);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
[return: MarshalAs(UnmanagedType.LPStr)]
|
||||
public extern static
|
||||
string switch_channel_get_variable(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ChannelMarshaler))]
|
||||
Channel channel,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string varname);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CallerProfileMarshaler))]
|
||||
public extern static
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* Channel.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Types;
|
||||
using FreeSwitch.Marshaling;
|
||||
|
||||
namespace FreeSwitch
|
||||
{
|
||||
public partial class Switch
|
||||
{
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_event_bind(
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string id,
|
||||
EventType eventType,
|
||||
string subClassName,
|
||||
EventCallback callback,
|
||||
IntPtr userData);
|
||||
}
|
||||
}
|
|
@ -40,6 +40,61 @@ namespace FreeSwitch
|
|||
{
|
||||
public partial class Switch
|
||||
{
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_sleep(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
UInt32 ms);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_park(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_collect_digits_callback(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
InputCallbackFunction dtmfCallback,
|
||||
IntPtr buf,
|
||||
uint buflen);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_collect_digits_count(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string buffer,
|
||||
uint buflen,
|
||||
uint maxdigits,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string terminators,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string terminator,
|
||||
uint timeout);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_record_session(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string file,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileHandleMarshaler))]
|
||||
FileHandle fh);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_stop_record_session(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string file);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
extern public static
|
||||
Status switch_ivr_play_file(
|
||||
|
@ -55,18 +110,6 @@ namespace FreeSwitch
|
|||
IntPtr buf,
|
||||
uint buflen);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_multi_threaded_bridge(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession peer_session,
|
||||
uint timelimit,
|
||||
IntPtr dtmf_callback,
|
||||
IntPtr session_data,
|
||||
IntPtr peer_session_data);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_record_file(
|
||||
|
@ -78,5 +121,82 @@ namespace FreeSwitch
|
|||
InputCallbackFunction input_callback,
|
||||
IntPtr buf,
|
||||
uint buflen);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_speak_text_handle(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(SpeechHandleMarshaler))]
|
||||
SpeechHandle sh,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CodecMarshaler))]
|
||||
Codec codec,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(TimerMarshaler))]
|
||||
Timer timer,
|
||||
InputCallbackFunction dtmfCallback,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
IntPtr buf,
|
||||
uint buflen);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_speak_text(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string tts_name,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string voice_name,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string timer_name,
|
||||
uint rate,
|
||||
InputCallbackFunction dtmfCallback,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string text,
|
||||
IntPtr buf,
|
||||
uint buflen);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_originate(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
ref CoreSession bleg,
|
||||
IntPtr cause,
|
||||
IntPtr bridgeto,
|
||||
UInt32 timelimit_sec,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(StateHandlerTableMarshaler))]
|
||||
StateHandlerTable table,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string cid_name_override,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string cid_num_override,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CallerProfileMarshaler))]
|
||||
CallerProfile caller_profile_override);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_multi_threaded_bridge(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession peer_session,
|
||||
InputCallbackFunction dtmfCallback,
|
||||
IntPtr session_data,
|
||||
IntPtr peer_session_data);
|
||||
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
Status switch_ivr_session_transfer(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string extension,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string dialplan,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string context);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* Log.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Types;
|
||||
using FreeSwitch.Marshaling;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
|
||||
namespace FreeSwitch
|
||||
{
|
||||
/*
|
||||
src/switch_log.c:SWITCH_DECLARE(const char *) switch_log_level2str(switch_log_level_t level)
|
||||
src/switch_log.c:SWITCH_DECLARE(switch_log_level_t) switch_log_str2level(const char *str)
|
||||
src/switch_log.c:SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(switch_log_function_t function, switch_log_level_t level)
|
||||
src/switch_log.c:SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, char *file, const char *func, int line, switch_log_level_t level, char *fmt, ...)
|
||||
src/switch_log.c:SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool)
|
||||
src/switch_log.c:SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void)
|
||||
*/
|
||||
public partial class Switch
|
||||
{
|
||||
[DllImport("freeswitch")]
|
||||
public extern static
|
||||
void switch_log_printf(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(ChannelMarshaler))]
|
||||
Channel channel,
|
||||
string file,
|
||||
string func,
|
||||
int line,
|
||||
LogLevel level,
|
||||
string format);
|
||||
}
|
||||
}
|
|
@ -219,5 +219,15 @@ namespace FreeSwitch.Types
|
|||
{
|
||||
return Switch.switch_channel_answer(this);
|
||||
}
|
||||
|
||||
public ChannelState Hangup(CallCause cause)
|
||||
{
|
||||
return Switch.switch_channel_perform_hangup(this, "file", "func", 666, cause);
|
||||
}
|
||||
|
||||
public string GetVariable(string varname)
|
||||
{
|
||||
return Switch.switch_channel_get_variable(this, varname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* Codec.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Marshaling;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
|
||||
namespace FreeSwitch.Types
|
||||
{
|
||||
public class Codec
|
||||
{
|
||||
internal HandleRef marshaledObject;
|
||||
|
||||
}
|
||||
}
|
|
@ -101,20 +101,4 @@ namespace FreeSwitch.Types
|
|||
public string Name;
|
||||
public string Value;
|
||||
}
|
||||
|
||||
public enum EventType
|
||||
{
|
||||
SWITCH_EVENT_CUSTOM,
|
||||
SWITCH_EVENT_CHANNEL_STATE,
|
||||
SWITCH_EVENT_CHANNEL_ANSWER,
|
||||
SWITCH_EVENT_CHANNEL_HANGUP,
|
||||
SWITCH_EVENT_API,
|
||||
SWITCH_EVENT_LOG,
|
||||
SWITCH_EVENT_INBOUND_CHAN,
|
||||
SWITCH_EVENT_OUTBOUND_CHAN,
|
||||
SWITCH_EVENT_STARTUP,
|
||||
SWITCH_EVENT_SHUTDOWN,
|
||||
SWITCH_EVENT_ALL
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* EventCallback.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Marshaling;
|
||||
|
||||
namespace FreeSwitch.Types
|
||||
{
|
||||
public delegate void EventCallback(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(EventMarshaler))]
|
||||
Event _event);
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* EventType.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace FreeSwitch.Types
|
||||
{
|
||||
public enum EventType
|
||||
{
|
||||
Custom,
|
||||
Create,
|
||||
Destroy,
|
||||
State,
|
||||
Answer,
|
||||
Hangup,
|
||||
Execute,
|
||||
Bridge,
|
||||
UnBridge,
|
||||
Progress,
|
||||
Outgoing,
|
||||
Park,
|
||||
UnPark,
|
||||
Api,
|
||||
Log,
|
||||
InboundChan,
|
||||
OutboundChan,
|
||||
Startup,
|
||||
Shutdown,
|
||||
Publish,
|
||||
UnPublish,
|
||||
Talk,
|
||||
NoTalk,
|
||||
SessionCrash,
|
||||
ModuleLoad,
|
||||
Dtmf,
|
||||
Message,
|
||||
Codec,
|
||||
BackgroundJob,
|
||||
All
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ using FreeSwitch.Marshaling;
|
|||
namespace FreeSwitch.Types
|
||||
{
|
||||
public delegate Status InputCallbackFunction(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StreamHandleMarshaler))]
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string input,
|
||||
|
|
|
@ -37,11 +37,7 @@ using FreeSwitch.Marshaling;
|
|||
|
||||
namespace FreeSwitch.Types
|
||||
{
|
||||
public delegate Status WriteFunction(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StreamHandleMarshaler))]
|
||||
StreamHandle streamHandle,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string fmt);
|
||||
|
||||
|
||||
//public delegate void ModuleLoad();
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* LogLevel.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace FreeSwitch.Types
|
||||
{
|
||||
public enum LogLevel
|
||||
{
|
||||
Console,
|
||||
Debug,
|
||||
Info,
|
||||
Notice,
|
||||
Warning,
|
||||
Error,
|
||||
Crit,
|
||||
Alert,
|
||||
Emerg
|
||||
}
|
||||
}
|
|
@ -53,7 +53,9 @@ namespace FreeSwitch.Types
|
|||
public delegate Status
|
||||
ApiFunction(
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string command,
|
||||
string input,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]
|
||||
CoreSession session,
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(StreamHandleMarshaler))]
|
||||
StreamHandle streamHandle);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* SpeechHandle.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Marshaling;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
|
||||
namespace FreeSwitch.Types
|
||||
{
|
||||
/*
|
||||
internal IntPtr speech_interface;
|
||||
internal UInt32 flags;
|
||||
internal IntPtr name;
|
||||
internal UInt32 rate;
|
||||
internal UInt32 speed;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)]
|
||||
internal byte[] voice;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)]
|
||||
internal byte[] engine;
|
||||
internal IntPtr memory_pool;
|
||||
internal IntPtr private_info;
|
||||
*/
|
||||
public class SpeechHandle
|
||||
{
|
||||
internal HandleRef marshaledObject;
|
||||
|
||||
public UInt32 flags
|
||||
{
|
||||
get
|
||||
{
|
||||
SpeechHandleMarshal speechHandleMarshal = (SpeechHandleMarshal)marshaledObject.Wrapper;
|
||||
|
||||
return speechHandleMarshal.flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* StateHandlerTable.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Marshaling;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
|
||||
namespace FreeSwitch.Types
|
||||
{
|
||||
public class StateHandlerTable
|
||||
{
|
||||
internal HandleRef marshaledObject;
|
||||
|
||||
}
|
||||
}
|
|
@ -31,19 +31,25 @@
|
|||
*/
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Marshaling;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
|
||||
namespace FreeSwitch.Types
|
||||
{
|
||||
public delegate Status StreamHandleWriteFunction(
|
||||
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(StreamHandleMarshaler))]
|
||||
StreamHandle streamHandle,
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
string fmt);
|
||||
|
||||
public class StreamHandle
|
||||
{
|
||||
internal HandleRef marshaledObject;
|
||||
internal WriteFunction writeFunction;
|
||||
|
||||
public void Write(string data)
|
||||
{
|
||||
StreamHandleMarshal streamHandleMarshal = (StreamHandleMarshal)marshaledObject.Wrapper;
|
||||
WriteFunction writeFunction = (WriteFunction)Marshal.GetDelegateForFunctionPointer(streamHandleMarshal.write_function, typeof(WriteFunction));
|
||||
StreamHandleWriteFunction writeFunction = (StreamHandleWriteFunction)Marshal.GetDelegateForFunctionPointer(streamHandleMarshal.write_function, typeof(StreamHandleWriteFunction));
|
||||
|
||||
writeFunction(this, data);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2006, James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* James Martelletti <james@nerdc0re.com>
|
||||
*
|
||||
*
|
||||
* Timer.cs --
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FreeSwitch.Marshaling;
|
||||
using FreeSwitch.Marshaling.Types;
|
||||
|
||||
namespace FreeSwitch.Types
|
||||
{
|
||||
public class Timer
|
||||
{
|
||||
internal HandleRef marshaledObject;
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue