using System;\r
using System.Reflection;\r
\r
-namespace FreeSwitch.NET\r
+namespace FreeSwitch\r
{\r
public class Common\r
{\r
<ProjectGuid>{251CAABC-16C3-4593-A491-603B908094E0}</ProjectGuid>\r
<OutputType>Library</OutputType>\r
<AppDesignerFolder>Properties</AppDesignerFolder>\r
- <RootNamespace>FreeSwitch.NET</RootNamespace>\r
- <AssemblyName>Freeswitch</AssemblyName>\r
+ <RootNamespace>FreeSwitch</RootNamespace>\r
+ <AssemblyName>FreeSwitch.NET</AssemblyName>\r
<StartupObject>\r
</StartupObject>\r
<SignAssembly>true</SignAssembly>\r
</ItemGroup>\r
<ItemGroup>\r
<Compile Include="Common.cs" />\r
+ <Compile Include="Log.cs" />\r
+ <Compile Include="Ivr.cs" />\r
<Compile Include="Marshaling\BufferMarshaler.cs" />\r
<Compile Include="Marshaling\CallerExtensionMarshaler.cs" />\r
<Compile Include="Marshaling\CallerProfileMarshaler.cs" />\r
<Compile Include="Marshaling\ChannelMarshaler.cs" />\r
<Compile Include="Marshaling\ChannelTimetableMarshaler.cs" />\r
+ <Compile Include="Marshaling\CodecMarshaler.cs" />\r
+ <Compile Include="Marshaling\StateHandlerTableMarshaler.cs" />\r
+ <Compile Include="Marshaling\TimerMarshaler.cs" />\r
+ <Compile Include="Marshaling\SpeechHandleMarshaler.cs" />\r
<Compile Include="Marshaling\StreamHandleMarshaler.cs" />\r
<Compile Include="Marshaling\CoreSessionMarshaler.cs" />\r
<Compile Include="Marshaling\EventMarshaler.cs" />\r
<Compile Include="Marshaling\Types\CodecInterfaceMarshal.cs" />\r
<Compile Include="Marshaling\Types\CodecMarshal.cs" />\r
<Compile Include="Marshaling\Types\CodecTypeMarshal.cs" />\r
+ <Compile Include="Marshaling\Types\StateHandlerTableMarshal.cs" />\r
+ <Compile Include="Marshaling\Types\TimerMarshal.cs" />\r
+ <Compile Include="Marshaling\Types\SpeechHandleMarshal.cs" />\r
<Compile Include="Marshaling\Types\StreamHandleMarshal.cs" />\r
<Compile Include="Marshaling\Types\TypesMarshal.cs" />\r
<Compile Include="Marshaling\Types\FileHandleMarshal.cs" />\r
<Compile Include="Switch\CallerProfile.cs" />\r
<Compile Include="Switch\Channel.cs" />\r
<Compile Include="Switch\Console.cs" />\r
+ <Compile Include="Switch\Log.cs" />\r
+ <Compile Include="Switch\Event.cs" />\r
<Compile Include="Switch\StreamHandle.cs" />\r
<Compile Include="Switch\CoreSession.cs" />\r
<Compile Include="Switch\Ivr.cs" />\r
<Compile Include="Modules\Application.cs" />\r
<Compile Include="Types\ApplicationFunction.cs" />\r
<Compile Include="Types\CallCause.cs" />\r
+ <Compile Include="Types\Codec.cs" />\r
+ <Compile Include="Types\LogLevel.cs" />\r
+ <Compile Include="Types\StateHandlerTable.cs" />\r
+ <Compile Include="Types\Timer.cs" />\r
+ <Compile Include="Types\SpeechHandle.cs" />\r
+ <Compile Include="Types\EventCallback.cs" />\r
+ <Compile Include="Types\EventType.cs" />\r
<Compile Include="Types\InputCallbackFunction.cs" />\r
<Compile Include="Types\InputType.cs" />\r
<Compile Include="Types\ModuleInterfaces.cs" />\r
--- /dev/null
+using System;\r
+using System.Runtime.InteropServices;\r
+using System.Text;\r
+using FreeSwitch.Types;\r
+using FreeSwitch.Marshaling.Types;\r
+\r
+namespace FreeSwitch\r
+{\r
+ public class Ivr\r
+ {\r
+ public static Status MultiThreadedBridge(CoreSession session, CoreSession peerSession, InputCallbackFunction dtmfCallback)\r
+ {\r
+ return Switch.switch_ivr_multi_threaded_bridge(session, peerSession, dtmfCallback, IntPtr.Zero, IntPtr.Zero);\r
+ }\r
+\r
+ public static Status Originate(CoreSession session, CoreSession peerSession, CallCause callCause, string data, uint timelimit)\r
+ {\r
+ IntPtr callCausePtr = Marshal.AllocHGlobal(4);\r
+ IntPtr dataPtr = Marshal.StringToHGlobalAnsi(data);\r
+\r
+ Marshal.StructureToPtr(callCause, callCausePtr, true);\r
+\r
+ return Switch.switch_ivr_originate(session, ref peerSession, callCausePtr, dataPtr, timelimit, null, null, null, null);\r
+ }\r
+\r
+ public static Status RecordFile(CoreSession coreSession, FileHandle fileHandle, string file, DtmfCallbackFunction dtmfCallbackFunction)\r
+ {\r
+ Byte[] filename = Encoding.Default.GetBytes(file);\r
+\r
+ Console.WriteLine("File: {0}", file);\r
+\r
+ dtmfCallbackFunction(coreSession, "1");\r
+ dtmfCallbackFunction(coreSession, "2");\r
+ dtmfCallbackFunction(coreSession, "3");\r
+\r
+ Encoding ansiEncoding = Encoding.GetEncoding(1252);\r
+ //filename = Encoding.Convert(Encoding.Default, ansiEncoding, filename);\r
+\r
+ Console.WriteLine("Filename: {0}", file);\r
+ //Console.WriteLine("Status record: {0}", status.ToString());\r
+ return Status.Success;\r
+ }\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+using System;\r
+using System.Runtime.InteropServices;\r
+using System.Text;\r
+using FreeSwitch.Types;\r
+using FreeSwitch.Marshaling.Types;\r
+\r
+namespace FreeSwitch\r
+{\r
+ public class Log\r
+ {\r
+ public static void Printf(LogLevel level, string message)\r
+ {\r
+ Switch.switch_log_printf(null, "File", "Func.NET", 123, level, message);\r
+ }\r
+ }\r
+}
\ No newline at end of file
$(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 \
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 \
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/
--- /dev/null
+/*
+ * 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 --
+ *
+ */\r
+using System;\r
+using System.Collections;\r
+using FreeSwitch.Marshaling.Types;\r
+using FreeSwitch.Types;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace FreeSwitch.Marshaling\r
+{\r
+ class CodecMarshaler : ICustomMarshaler\r
+ {\r
+ private static CodecMarshaler Instance = new CodecMarshaler();\r
+\r
+ public static ICustomMarshaler GetInstance(string s)\r
+ {\r
+ return Instance;\r
+ }\r
+\r
+ public void CleanUpManagedData(object o)\r
+ {\r
+ }\r
+\r
+ public void CleanUpNativeData(IntPtr pNativeData)\r
+ {\r
+ }\r
+\r
+ public int GetNativeDataSize()\r
+ {\r
+ return IntPtr.Size;\r
+ }\r
+\r
+ public IntPtr MarshalManagedToNative(object obj)\r
+ {\r
+ Codec streamHandleObj = (Codec)obj;\r
+\r
+ return streamHandleObj.marshaledObject.Handle;\r
+ }\r
+\r
+ public object MarshalNativeToManaged(IntPtr codecPtr)\r
+ {\r
+ CodecMarshal codecMarshal = new CodecMarshal();\r
+ Codec codecObj = new Codec();\r
+\r
+\r
+ Marshal.PtrToStructure(codecPtr, codecMarshal);\r
+\r
+ codecObj.marshaledObject = new HandleRef(codecMarshal, codecPtr);\r
+\r
+ return codecObj;\r
+ }\r
+ }\r
+}
\ No newline at end of file
public IntPtr MarshalManagedToNative(object obj)\r
{\r
CoreSession coreSession = (CoreSession)obj;\r
- \r
- return coreSession.marshaledObject.Handle;\r
+\r
+ Console.WriteLine("CoreSession: Marshalling Managed to Native");\r
+\r
+ if (coreSession.marshaledObject.Handle != IntPtr.Zero)\r
+ {\r
+\r
+ Console.WriteLine("Returning: 0x{0:x}", coreSession.marshaledObject.Handle.ToInt32());\r
+ return coreSession.marshaledObject.Handle;\r
+ }\r
+ else\r
+ {\r
+ CoreSessionMarshal coreSessionMarshal = new CoreSessionMarshal();\r
+ IntPtr coreSessionPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CoreSessionMarshal)));\r
+\r
+ Marshal.StructureToPtr(coreSessionMarshal, coreSessionPtr, true);\r
+\r
+ coreSession.marshaledObject = new HandleRef(coreSessionMarshal, coreSessionPtr);\r
+\r
+ Console.WriteLine("CoreSession: NO OBJECT EXISTS OMG");\r
+ Console.WriteLine("Returning: 0x{0:x}", coreSession.marshaledObject.Handle.ToInt32());\r
+ return coreSession.marshaledObject.Handle;\r
+ }\r
}\r
\r
public object MarshalNativeToManaged(IntPtr coreSessionPtr)\r
CoreSessionMarshal coreSessionMarshal = new CoreSessionMarshal();\r
CoreSession coreSession = new CoreSession();\r
\r
+ Console.WriteLine("CoreSession: Marshalling Native to Managed");\r
+\r
Marshal.PtrToStructure(coreSessionPtr, coreSessionMarshal);\r
\r
coreSession.marshaledObject = new HandleRef(coreSessionMarshal, coreSessionPtr);\r
--- /dev/null
+/*
+ * 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 --
+ *
+ */\r
+using System;\r
+using System.Collections;\r
+using FreeSwitch.Marshaling.Types;\r
+using FreeSwitch.Types;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace FreeSwitch.Marshaling\r
+{\r
+ class SpeechHandleMarshaler : ICustomMarshaler\r
+ {\r
+ private static SpeechHandleMarshaler Instance = new SpeechHandleMarshaler();\r
+\r
+ public static ICustomMarshaler GetInstance(string s)\r
+ {\r
+ return Instance;\r
+ }\r
+\r
+ public void CleanUpManagedData(object o)\r
+ {\r
+ }\r
+\r
+ public void CleanUpNativeData(IntPtr pNativeData)\r
+ {\r
+ }\r
+\r
+ public int GetNativeDataSize()\r
+ {\r
+ return IntPtr.Size;\r
+ }\r
+\r
+ public IntPtr MarshalManagedToNative(object obj)\r
+ {\r
+ SpeechHandle speechHandleObj = (SpeechHandle)obj;\r
+\r
+ return speechHandleObj.marshaledObject.Handle;\r
+ }\r
+\r
+ public object MarshalNativeToManaged(IntPtr speechHandlePtr)\r
+ {\r
+ SpeechHandleMarshal speechHandleMarshal = new SpeechHandleMarshal();\r
+ SpeechHandle speechHandleObj = new SpeechHandle();\r
+\r
+ Marshal.PtrToStructure(speechHandlePtr, speechHandleMarshal);\r
+\r
+ speechHandleObj.marshaledObject = new HandleRef(speechHandleMarshal, speechHandlePtr);\r
+\r
+ return speechHandleObj;\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/*
+ * 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 --
+ *
+ */\r
+using System;\r
+using System.Collections;\r
+using FreeSwitch.Marshaling.Types;\r
+using FreeSwitch.Types;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace FreeSwitch.Marshaling\r
+{\r
+ class StateHandlerTableMarshaler : ICustomMarshaler\r
+ {\r
+ private static StateHandlerTableMarshaler Instance = new StateHandlerTableMarshaler();\r
+\r
+ public static ICustomMarshaler GetInstance(string s)\r
+ {\r
+ return Instance;\r
+ }\r
+\r
+ public void CleanUpManagedData(object o)\r
+ {\r
+ }\r
+\r
+ public void CleanUpNativeData(IntPtr pNativeData)\r
+ {\r
+ }\r
+\r
+ public int GetNativeDataSize()\r
+ {\r
+ return IntPtr.Size;\r
+ }\r
+\r
+ public IntPtr MarshalManagedToNative(object obj)\r
+ {\r
+ StateHandlerTable stateHandlerTableObj = (StateHandlerTable)obj;\r
+\r
+ return stateHandlerTableObj.marshaledObject.Handle;\r
+ }\r
+\r
+ public object MarshalNativeToManaged(IntPtr stateHandlerTablePtr)\r
+ {\r
+ StateHandlerTableMarshal stateHandlerTableMarshal = new StateHandlerTableMarshal();\r
+ StateHandlerTable stateHandlerTableObj = new StateHandlerTable();\r
+\r
+ Marshal.PtrToStructure(stateHandlerTablePtr, stateHandlerTableMarshal);\r
+\r
+ stateHandlerTableObj.marshaledObject = new HandleRef(stateHandlerTableMarshal, stateHandlerTablePtr);\r
+\r
+ return stateHandlerTableObj;\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/*
+ * 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 --
+ *
+ */\r
+using System;\r
+using System.Collections;\r
+using FreeSwitch.Marshaling.Types;\r
+using FreeSwitch.Types;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace FreeSwitch.Marshaling\r
+{\r
+ class TimerMarshaler : ICustomMarshaler\r
+ {\r
+ private static TimerMarshaler Instance = new TimerMarshaler();\r
+\r
+ public static ICustomMarshaler GetInstance(string s)\r
+ {\r
+ return Instance;\r
+ }\r
+\r
+ public void CleanUpManagedData(object o)\r
+ {\r
+ }\r
+\r
+ public void CleanUpNativeData(IntPtr pNativeData)\r
+ {\r
+ }\r
+\r
+ public int GetNativeDataSize()\r
+ {\r
+ return IntPtr.Size;\r
+ }\r
+\r
+ public IntPtr MarshalManagedToNative(object obj)\r
+ {\r
+ Timer timerObj = (Timer)obj;\r
+\r
+ return timerObj.marshaledObject.Handle;\r
+ }\r
+\r
+ public object MarshalNativeToManaged(IntPtr timerPtr)\r
+ {\r
+ TimerMarshal timerMarshal = new TimerMarshal();\r
+ Timer timerObj = new Timer();\r
+\r
+ Marshal.PtrToStructure(timerPtr, timerMarshal);\r
+\r
+ timerObj.marshaledObject = new HandleRef(timerMarshal, timerPtr);\r
+\r
+ return timerObj;\r
+ }\r
+ }\r
+}\r
{
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;
}
}
--- /dev/null
+/*
+ * 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;
+ }
+}
--- /dev/null
+/*
+ * 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;\r
+ internal IntPtr on_ring;\r
+ internal IntPtr on_execute;\r
+ internal IntPtr on_hangup;\r
+ internal IntPtr on_loopback;\r
+ internal IntPtr on_transmit;\r
+ internal IntPtr on_hold;
+ }
+}
\ No newline at end of file
internal IntPtr end;
internal int data_size;
internal int data_len;
+ internal int alloc_len;
+ internal int alloc_chunk;
internal IntPtr _event;
}
}
--- /dev/null
+/*
+ * 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;\r
+ IntPtr memory_pool;\r
+ IntPtr private_info;\r
+ }
+}
using System.Reflection;\r
using System.Runtime.InteropServices;\r
using System.Text;\r
-using FreeSwitch.NET;\r
using FreeSwitch.Types;\r
using FreeSwitch.Modules;\r
using FreeSwitch.Marshaling.Types;\r
\r
-namespace FreeSwitch.NET\r
+namespace FreeSwitch\r
{\r
/// <summary>\r
/// Base class for all Freeswitch.NET modules\r
/* Set the module_name field of the LoadableModuleInterface */\r
module_interface.module_name = Marshal.StringToHGlobalAnsi(filename);\r
\r
- /* Grab the first ApiInterface in our array and add a pointer to this in our ModuleInterface*/\r
- Api apiIndex = (Api)apiInterfaces[0];\r
- \r
- module_interface.api_interface = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ApiInterfaceMarshal)));\r
- \r
- Marshal.StructureToPtr(apiIndex.handle.Wrapper, module_interface.api_interface, true);\r
- \r
- /* For each Application interface */\r
- Application applicationIndex = (Application)applicationInterfaces[0];\r
- \r
- module_interface.application_interface = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ApplicationInterfaceMarshal)));\r
- \r
- Marshal.StructureToPtr(applicationIndex.handle.Wrapper, module_interface.application_interface, true); \r
+ if (apiInterfaces.Count > 0)\r
+ {\r
+ /* Grab the first ApiInterface in our array and add a pointer to this in our ModuleInterface*/\r
+ Api apiIndex = (Api)apiInterfaces[0];\r
+\r
+ module_interface.api_interface = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ApiInterfaceMarshal)));\r
+\r
+ Marshal.StructureToPtr(apiIndex.handle.Wrapper, module_interface.api_interface, true);\r
+ }\r
+\r
+ if (applicationInterfaces.Count > 0)\r
+ {\r
+ /* For each Application interface */\r
+ Application applicationIndex = (Application)applicationInterfaces[0];\r
+\r
+ module_interface.application_interface = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ApplicationInterfaceMarshal)));\r
+\r
+ Marshal.StructureToPtr(applicationIndex.handle.Wrapper, module_interface.application_interface, true);\r
+ }\r
\r
/* Finally, marshal the moduleinterface class and return */\r
Marshal.StructureToPtr(module_interface, module, true);\r
module.module_shutdown);\r
}\r
\r
- \r
+ public string Name\r
+ {\r
+ set { name = value; }\r
+ get { return name; }\r
+ }\r
}\r
} \r
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ChannelMarshaler))]\r
Channel channel);\r
\r
+ [DllImport("freeswitch")]\r
+ [return: MarshalAs(UnmanagedType.LPStr)]\r
+ public extern static\r
+ string switch_channel_get_variable(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ChannelMarshaler))]\r
+ Channel channel,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string varname);\r
+\r
[DllImport("freeswitch")]\r
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CallerProfileMarshaler))]\r
public extern static\r
--- /dev/null
+/* \r
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application\r
+ * Copyright (C) 2006, James Martelletti <james@nerdc0re.com>\r
+ *\r
+ * Version: MPL 1.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * James Martelletti <james@nerdc0re.com>\r
+ * Portions created by the Initial Developer are Copyright (C)\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * \r
+ * James Martelletti <james@nerdc0re.com>\r
+ *\r
+ *\r
+ * Channel.cs -- \r
+ *\r
+ */\r
+using System;\r
+using System.Runtime.CompilerServices;\r
+using System.Runtime.InteropServices;\r
+using FreeSwitch.Types;\r
+using FreeSwitch.Marshaling;\r
+\r
+namespace FreeSwitch\r
+{\r
+ public partial class Switch\r
+ {\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_event_bind(\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string id,\r
+ EventType eventType,\r
+ string subClassName,\r
+ EventCallback callback,\r
+ IntPtr userData);\r
+ }\r
+}\r
{\r
public partial class Switch\r
{\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_ivr_sleep(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ CoreSession session,\r
+ UInt32 ms);\r
+\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_ivr_park(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ CoreSession session);\r
+\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_ivr_collect_digits_callback(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ CoreSession session,\r
+ InputCallbackFunction dtmfCallback,\r
+ IntPtr buf,\r
+ uint buflen);\r
+\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_ivr_collect_digits_count(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ CoreSession session,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string buffer,\r
+ uint buflen,\r
+ uint maxdigits,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string terminators,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string terminator,\r
+ uint timeout);\r
+\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_ivr_record_session(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ CoreSession session,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string file,\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileHandleMarshaler))]\r
+ FileHandle fh);\r
+\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_ivr_stop_record_session(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ CoreSession session,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string file);\r
+\r
[DllImport("freeswitch")]\r
extern public static\r
Status switch_ivr_play_file(\r
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CoreSessionMarshaler))]\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
CoreSession session,\r
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(FileHandleMarshaler))]\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileHandleMarshaler))]\r
FileHandle fh,\r
[MarshalAs(UnmanagedType.LPStr)]\r
string file,\r
IntPtr buf,\r
uint buflen);\r
\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_ivr_record_file(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ CoreSession session,\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileHandleMarshaler))]\r
+ FileHandle fh,\r
+ IntPtr file,\r
+ InputCallbackFunction input_callback,\r
+ IntPtr buf,\r
+ uint buflen);\r
+\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_ivr_speak_text_handle(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ CoreSession session,\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(SpeechHandleMarshaler))]\r
+ SpeechHandle sh,\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CodecMarshaler))]\r
+ Codec codec,\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(TimerMarshaler))]\r
+ Timer timer,\r
+ InputCallbackFunction dtmfCallback,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string text,\r
+ IntPtr buf,\r
+ uint buflen);\r
+\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_ivr_speak_text(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ CoreSession session,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string tts_name,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string voice_name,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string timer_name,\r
+ uint rate,\r
+ InputCallbackFunction dtmfCallback,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string text,\r
+ IntPtr buf,\r
+ uint buflen);\r
+\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ Status switch_ivr_originate(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ CoreSession session,\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
+ ref CoreSession bleg,\r
+ IntPtr cause,\r
+ IntPtr bridgeto,\r
+ UInt32 timelimit_sec,\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(StateHandlerTableMarshaler))]\r
+ StateHandlerTable table,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string cid_name_override,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string cid_num_override,\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CallerProfileMarshaler))]\r
+ CallerProfile caller_profile_override);\r
+\r
[DllImport("freeswitch")]\r
public extern static\r
Status switch_ivr_multi_threaded_bridge(\r
CoreSession session,\r
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
CoreSession peer_session,\r
- uint timelimit,\r
- IntPtr dtmf_callback,\r
+ InputCallbackFunction dtmfCallback,\r
IntPtr session_data,\r
IntPtr peer_session_data);\r
\r
[DllImport("freeswitch")]\r
public extern static\r
- Status switch_ivr_record_file(\r
+ Status switch_ivr_session_transfer(\r
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(CoreSessionMarshaler))]\r
CoreSession session,\r
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(FileHandleMarshaler))]\r
- FileHandle fh,\r
- IntPtr file,\r
- InputCallbackFunction input_callback,\r
- IntPtr buf,\r
- uint buflen);\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string extension,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string dialplan,\r
+ [MarshalAs(UnmanagedType.LPStr)]\r
+ string context);\r
}\r
}\r
--- /dev/null
+/* \r
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application\r
+ * Copyright (C) 2006, James Martelletti <james@nerdc0re.com>\r
+ *\r
+ * Version: MPL 1.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * James Martelletti <james@nerdc0re.com>\r
+ * Portions created by the Initial Developer are Copyright (C)\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * \r
+ * James Martelletti <james@nerdc0re.com>\r
+ *\r
+ *\r
+ * Log.cs -- \r
+ *\r
+ */\r
+using System;\r
+using System.Runtime.CompilerServices;\r
+using System.Runtime.InteropServices;\r
+using FreeSwitch.Types;\r
+using FreeSwitch.Marshaling;\r
+using FreeSwitch.Marshaling.Types;\r
+\r
+namespace FreeSwitch\r
+{\r
+ /*\r
+ src/switch_log.c:SWITCH_DECLARE(const char *) switch_log_level2str(switch_log_level_t level)\r
+ src/switch_log.c:SWITCH_DECLARE(switch_log_level_t) switch_log_str2level(const char *str)\r
+ src/switch_log.c:SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(switch_log_function_t function, switch_log_level_t level)\r
+ 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, ...)\r
+ src/switch_log.c:SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool)\r
+ src/switch_log.c:SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void)\r
+ */\r
+ public partial class Switch\r
+ {\r
+ [DllImport("freeswitch")]\r
+ public extern static\r
+ void switch_log_printf(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(ChannelMarshaler))]\r
+ Channel channel,\r
+ string file,\r
+ string func,\r
+ int line,\r
+ LogLevel level,\r
+ string format);\r
+ }\r
+}\r
{\r
return Switch.switch_channel_answer(this);\r
}\r
+\r
+ public ChannelState Hangup(CallCause cause)\r
+ {\r
+ return Switch.switch_channel_perform_hangup(this, "file", "func", 666, cause);\r
+ }\r
+\r
+ public string GetVariable(string varname)\r
+ {\r
+ return Switch.switch_channel_get_variable(this, varname);\r
+ }\r
}\r
}\r
--- /dev/null
+/*
+ * 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;\r
+using FreeSwitch.Marshaling;
+using FreeSwitch.Marshaling.Types;
+
+namespace FreeSwitch.Types
+{\r
+ public class Codec
+ {
+ internal HandleRef marshaledObject;
+
+ }
+}
\ No newline at end of file
get\r
{\r
CoreSessionMarshal coreSessionMarshal = (CoreSessionMarshal)marshaledObject.Wrapper;\r
-\r
+ \r
if (coreSessionMarshal.thread_running <= 0)\r
return false;\r
else\r
public string Name;\r
public string Value;\r
}\r
-\r
- public enum EventType\r
- {\r
- SWITCH_EVENT_CUSTOM,\r
- SWITCH_EVENT_CHANNEL_STATE,\r
- SWITCH_EVENT_CHANNEL_ANSWER,\r
- SWITCH_EVENT_CHANNEL_HANGUP,\r
- SWITCH_EVENT_API,\r
- SWITCH_EVENT_LOG,\r
- SWITCH_EVENT_INBOUND_CHAN,\r
- SWITCH_EVENT_OUTBOUND_CHAN,\r
- SWITCH_EVENT_STARTUP,\r
- SWITCH_EVENT_SHUTDOWN,\r
- SWITCH_EVENT_ALL\r
- }\r
-\r
}\r
--- /dev/null
+/*
+ * 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 --
+ *
+ */\r
+using System;\r
+using System.Runtime.InteropServices;\r
+using FreeSwitch.Marshaling;\r
+\r
+namespace FreeSwitch.Types\r
+{\r
+ public delegate void EventCallback(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(EventMarshaler))]
+ Event _event);\r
+}
\ No newline at end of file
--- /dev/null
+/* \r
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application\r
+ * Copyright (C) 2006, James Martelletti <james@nerdc0re.com>\r
+ *\r
+ * Version: MPL 1.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * James Martelletti <james@nerdc0re.com>\r
+ * Portions created by the Initial Developer are Copyright (C)\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * \r
+ * James Martelletti <james@nerdc0re.com>\r
+ *\r
+ *\r
+ * EventType.cs -- \r
+ *\r
+ */\r
+using System;\r
+using System.Collections;\r
+using System.Text;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace FreeSwitch.Types\r
+{\r
+ public enum EventType\r
+ {\r
+ Custom,\r
+ Create,\r
+ Destroy,\r
+ State,\r
+ Answer,\r
+ Hangup,\r
+ Execute,\r
+ Bridge,\r
+ UnBridge,\r
+ Progress,\r
+ Outgoing,\r
+ Park,\r
+ UnPark,\r
+ Api,\r
+ Log,\r
+ InboundChan,\r
+ OutboundChan,\r
+ Startup,\r
+ Shutdown,\r
+ Publish,\r
+ UnPublish,\r
+ Talk,\r
+ NoTalk,\r
+ SessionCrash,\r
+ ModuleLoad,\r
+ Dtmf,\r
+ Message,\r
+ Codec,\r
+ BackgroundJob,\r
+ All\r
+ }\r
+}
\ No newline at end of file
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,
namespace FreeSwitch.Types
{
- public delegate Status WriteFunction(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StreamHandleMarshaler))]
- StreamHandle streamHandle,
- [MarshalAs(UnmanagedType.LPStr)]
- string fmt);
+
//public delegate void ModuleLoad();
--- /dev/null
+/* \r
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application\r
+ * Copyright (C) 2006, James Martelletti <james@nerdc0re.com>\r
+ *\r
+ * Version: MPL 1.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * James Martelletti <james@nerdc0re.com>\r
+ * Portions created by the Initial Developer are Copyright (C)\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * \r
+ * James Martelletti <james@nerdc0re.com>\r
+ *\r
+ *\r
+ * LogLevel.cs -- \r
+ *\r
+ */\r
+using System;\r
+using System.Collections;\r
+using System.Text;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace FreeSwitch.Types\r
+{\r
+ public enum LogLevel\r
+ {\r
+ Console,\r
+ Debug,\r
+ Info,\r
+ Notice,\r
+ Warning,\r
+ Error,\r
+ Crit,\r
+ Alert,\r
+ Emerg\r
+ }\r
+}
\ No newline at end of file
CoreSession session,
[MarshalAs(UnmanagedType.LPStr)]
string data);
-
+
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);
}
--- /dev/null
+/*
+ * 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;\r
+using FreeSwitch.Marshaling;
+using FreeSwitch.Marshaling.Types;
+
+namespace FreeSwitch.Types
+{
+ /*\r
+ internal IntPtr speech_interface;\r
+ internal UInt32 flags;\r
+ internal IntPtr name;\r
+ internal UInt32 rate;\r
+ internal UInt32 speed;\r
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)]\r
+ internal byte[] voice;\r
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)]\r
+ internal byte[] engine;\r
+ internal IntPtr memory_pool;\r
+ internal IntPtr private_info;\r
+ */
+ public class SpeechHandle
+ {
+ internal HandleRef marshaledObject;\r
+ \r
+ public UInt32 flags\r
+ {\r
+ get\r
+ {\r
+ SpeechHandleMarshal speechHandleMarshal = (SpeechHandleMarshal)marshaledObject.Wrapper;\r
+\r
+ return speechHandleMarshal.flags;\r
+ }\r
+ }\r
+ }
+}
--- /dev/null
+/*
+ * 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;\r
+using FreeSwitch.Marshaling;
+using FreeSwitch.Marshaling.Types;
+
+namespace FreeSwitch.Types
+{\r
+ public class StateHandlerTable
+ {
+ internal HandleRef marshaledObject;
+
+ }
+}
*
*/
using System;
-using System.Runtime.InteropServices;
+using System.Runtime.InteropServices;\r
+using FreeSwitch.Marshaling;
using FreeSwitch.Marshaling.Types;
namespace FreeSwitch.Types
-{
+{\r
+ public delegate Status StreamHandleWriteFunction(\r
+ [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(StreamHandleMarshaler))]
+ StreamHandle streamHandle,\r
+ [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));\r
writeFunction(this, data);
}
--- /dev/null
+/*
+ * 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;\r
+using FreeSwitch.Marshaling;
+using FreeSwitch.Marshaling.Types;
+
+namespace FreeSwitch.Types
+{\r
+ public class Timer
+ {
+ internal HandleRef marshaledObject;
+
+ }
+}