]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Update, changing core assembly name to FreeSwitch.NET.dll as to not conflict with...
authorJames Green <james.green@stealthnet.net>
Tue, 19 Sep 2006 12:47:44 +0000 (12:47 +0000)
committerJames Green <james.green@stealthnet.net>
Tue, 19 Sep 2006 12:47:44 +0000 (12:47 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2750 d0543943-73ff-0310-b7d9-9358b9ac24b2

34 files changed:
src/dotnet/Common.cs
src/dotnet/FreeSwitch.NET.csproj
src/dotnet/Ivr.cs [new file with mode: 0644]
src/dotnet/Log.cs [new file with mode: 0644]
src/dotnet/Makefile
src/dotnet/Marshaling/CodecMarshaler.cs [new file with mode: 0644]
src/dotnet/Marshaling/CoreSessionMarshaler.cs
src/dotnet/Marshaling/SpeechHandleMarshaler.cs [new file with mode: 0644]
src/dotnet/Marshaling/StateHandlerTableMarshaler.cs [new file with mode: 0644]
src/dotnet/Marshaling/TimerMarshaler.cs [new file with mode: 0644]
src/dotnet/Marshaling/Types/CodecMarshal.cs
src/dotnet/Marshaling/Types/SpeechHandleMarshal.cs [new file with mode: 0644]
src/dotnet/Marshaling/Types/StateHandlerTableMarshal.cs [new file with mode: 0644]
src/dotnet/Marshaling/Types/StreamHandleMarshal.cs
src/dotnet/Marshaling/Types/TimerMarshal.cs [new file with mode: 0644]
src/dotnet/Module.cs
src/dotnet/Switch/Channel.cs
src/dotnet/Switch/Event.cs [new file with mode: 0644]
src/dotnet/Switch/Ivr.cs
src/dotnet/Switch/Log.cs [new file with mode: 0644]
src/dotnet/Types/Channel.cs
src/dotnet/Types/Codec.cs [new file with mode: 0644]
src/dotnet/Types/CoreSession.cs
src/dotnet/Types/Event.cs
src/dotnet/Types/EventCallback.cs [new file with mode: 0644]
src/dotnet/Types/EventType.cs [new file with mode: 0644]
src/dotnet/Types/InputCallbackFunction.cs
src/dotnet/Types/LoadableModuleInterface.cs
src/dotnet/Types/LogLevel.cs [new file with mode: 0644]
src/dotnet/Types/Module.cs
src/dotnet/Types/SpeechHandle.cs [new file with mode: 0644]
src/dotnet/Types/StateHandlerTable.cs [new file with mode: 0644]
src/dotnet/Types/StreamHandle.cs
src/dotnet/Types/Timer.cs [new file with mode: 0644]

index aa3849ea6685f23f8963395c1a9a89dfc1040675..411b4189f9211955be28e4b7e7e17d3f5a77c9a5 100755 (executable)
@@ -32,7 +32,7 @@
 using System;\r
 using System.Reflection;\r
 \r
-namespace FreeSwitch.NET\r
+namespace FreeSwitch\r
 {\r
     public class Common\r
     {\r
index 872a79a498c61d4037bdaac80720edd86d8e1b8a..0f3369451367211b99465a6c497f058561fc18f8 100755 (executable)
@@ -7,8 +7,8 @@
     <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
@@ -65,6 +71,9 @@
     <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
@@ -79,6 +88,8 @@
     <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
diff --git a/src/dotnet/Ivr.cs b/src/dotnet/Ivr.cs
new file mode 100644 (file)
index 0000000..49fffb3
--- /dev/null
@@ -0,0 +1,44 @@
+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
diff --git a/src/dotnet/Log.cs b/src/dotnet/Log.cs
new file mode 100644 (file)
index 0000000..7991df6
--- /dev/null
@@ -0,0 +1,16 @@
+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
index a3d06096e1f865fa3248391213cc6bf774227082..53670e7f594f52b96a8447fcdbffddb6b95ac362 100644 (file)
@@ -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/
diff --git a/src/dotnet/Marshaling/CodecMarshaler.cs b/src/dotnet/Marshaling/CodecMarshaler.cs
new file mode 100644 (file)
index 0000000..7313c38
--- /dev/null
@@ -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 -- 
+ *
+ */\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
index 981b15a1ff6b5aa81f2622ad13786c269a8bb537..11c537928d064d704ebff7df99eec98fc679744d 100755 (executable)
@@ -61,8 +61,28 @@ namespace FreeSwitch.Marshaling
         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
@@ -70,6 +90,8 @@ namespace FreeSwitch.Marshaling
             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
diff --git a/src/dotnet/Marshaling/SpeechHandleMarshaler.cs b/src/dotnet/Marshaling/SpeechHandleMarshaler.cs
new file mode 100644 (file)
index 0000000..9c25384
--- /dev/null
@@ -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 -- 
+ *
+ */\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
diff --git a/src/dotnet/Marshaling/StateHandlerTableMarshaler.cs b/src/dotnet/Marshaling/StateHandlerTableMarshaler.cs
new file mode 100644 (file)
index 0000000..db4fe3f
--- /dev/null
@@ -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 -- 
+ *
+ */\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
diff --git a/src/dotnet/Marshaling/TimerMarshaler.cs b/src/dotnet/Marshaling/TimerMarshaler.cs
new file mode 100644 (file)
index 0000000..0b85dea
--- /dev/null
@@ -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 -- 
+ *
+ */\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
index 065a9fb744d7462b628027170a2b585cd084f25e..7035c5a8428f572d59e349e8845bcdbc32ea8926 100755 (executable)
@@ -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;
     }
 }
diff --git a/src/dotnet/Marshaling/Types/SpeechHandleMarshal.cs b/src/dotnet/Marshaling/Types/SpeechHandleMarshal.cs
new file mode 100644 (file)
index 0000000..937cbd6
--- /dev/null
@@ -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;
+    }
+}
diff --git a/src/dotnet/Marshaling/Types/StateHandlerTableMarshal.cs b/src/dotnet/Marshaling/Types/StateHandlerTableMarshal.cs
new file mode 100644 (file)
index 0000000..1e7f68c
--- /dev/null
@@ -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;\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
index 33878cc8f75f9e9aa17f99459985953bc36b2395..e50e747b70a2f842a1bf6bbb091b22a4ab01f650 100755 (executable)
@@ -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;
     }
 }
diff --git a/src/dotnet/Marshaling/Types/TimerMarshal.cs b/src/dotnet/Marshaling/Types/TimerMarshal.cs
new file mode 100644 (file)
index 0000000..39d70c2
--- /dev/null
@@ -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;\r
+        IntPtr memory_pool;\r
+        IntPtr private_info;\r
+    }
+}
index 4c649bfa654c52d57d3bcfead3af9902ee224186..59078eceddf75349037728957079f992096de412 100644 (file)
@@ -34,12 +34,11 @@ using System.Collections;
 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
@@ -92,19 +91,25 @@ namespace FreeSwitch.NET
             /* 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
@@ -200,6 +205,10 @@ namespace FreeSwitch.NET
                                                         module.module_shutdown);\r
         }\r
 \r
-        \r
+        public string Name\r
+        {\r
+            set { name = value; }\r
+            get { return name; }\r
+        }\r
        }\r
 }      \r
index 124ef36907519352eee92410a2b78efe2addec52..04711ccb530848f86aefb9e340eccd4eae94c2a8 100755 (executable)
@@ -84,6 +84,15 @@ namespace FreeSwitch
                 [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
diff --git a/src/dotnet/Switch/Event.cs b/src/dotnet/Switch/Event.cs
new file mode 100644 (file)
index 0000000..1e70efa
--- /dev/null
@@ -0,0 +1,52 @@
+/* \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
index 62aaf6712907ab447e60cfaf45ff048c9017141e..f370445819f03b735b3ef6cd7d5d326bde12dd15 100755 (executable)
@@ -40,12 +40,67 @@ namespace FreeSwitch
 {\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
@@ -55,6 +110,72 @@ namespace FreeSwitch
                 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
@@ -62,21 +183,20 @@ namespace FreeSwitch
                 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
diff --git a/src/dotnet/Switch/Log.cs b/src/dotnet/Switch/Log.cs
new file mode 100644 (file)
index 0000000..4c14ef4
--- /dev/null
@@ -0,0 +1,62 @@
+/* \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
index ac9a9032d706ef2031366f6ee7a1368a0451c950..acdd3d3e4e589d5aa19ba58c5f05a42c9bd3f494 100755 (executable)
@@ -219,5 +219,15 @@ namespace FreeSwitch.Types
         {\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
diff --git a/src/dotnet/Types/Codec.cs b/src/dotnet/Types/Codec.cs
new file mode 100644 (file)
index 0000000..9750661
--- /dev/null
@@ -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;\r
+using FreeSwitch.Marshaling;
+using FreeSwitch.Marshaling.Types;
+
+namespace FreeSwitch.Types
+{\r
+    public class Codec
+    {
+        internal HandleRef     marshaledObject;
+
+    }
+}
\ No newline at end of file
index b8083ed0094bfe3791cba9296e05468e9ce8bbba..59ca061bb6b5c920a68dee662d98f8f87d1522e4 100755 (executable)
@@ -109,7 +109,7 @@ namespace FreeSwitch.Types
             get\r
             {\r
                 CoreSessionMarshal coreSessionMarshal = (CoreSessionMarshal)marshaledObject.Wrapper;\r
-\r
+                 \r
                 if (coreSessionMarshal.thread_running <= 0)\r
                     return false;\r
                 else\r
index d2800e992c835cac7fcda002c16a639467c2e2b3..3f726bbb81f904bf44c678d193d70217baf09b3f 100755 (executable)
@@ -101,20 +101,4 @@ namespace FreeSwitch.Types
         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
diff --git a/src/dotnet/Types/EventCallback.cs b/src/dotnet/Types/EventCallback.cs
new file mode 100644 (file)
index 0000000..719964b
--- /dev/null
@@ -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 -- 
+ *
+ */\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
diff --git a/src/dotnet/Types/EventType.cs b/src/dotnet/Types/EventType.cs
new file mode 100644 (file)
index 0000000..16cade1
--- /dev/null
@@ -0,0 +1,72 @@
+/* \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
index c4d8aa50afbd88c9bc75b7e63dd8a138d943db77..e16ecfd5a23a2b7f0de5b26433231bc17f4f796d 100755 (executable)
@@ -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,
index 8bb5bbc5fd1bdb4332186e556403b4581f39cc48..89cdb154a5abdda8f85a9dfd0ddb83981c347574 100755 (executable)
@@ -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();
 
diff --git a/src/dotnet/Types/LogLevel.cs b/src/dotnet/Types/LogLevel.cs
new file mode 100644 (file)
index 0000000..9224adc
--- /dev/null
@@ -0,0 +1,51 @@
+/* \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
index a8cd2060dd72bd35f4a71f8512b20efe8e308a89..760244b0464c52705ea7b4bd6e0bd8006a254df6 100755 (executable)
@@ -49,11 +49,13 @@ namespace FreeSwitch.Types
             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);
 }
diff --git a/src/dotnet/Types/SpeechHandle.cs b/src/dotnet/Types/SpeechHandle.cs
new file mode 100644 (file)
index 0000000..b4d64af
--- /dev/null
@@ -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;\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
+    }
+}
diff --git a/src/dotnet/Types/StateHandlerTable.cs b/src/dotnet/Types/StateHandlerTable.cs
new file mode 100644 (file)
index 0000000..66c99aa
--- /dev/null
@@ -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;\r
+using FreeSwitch.Marshaling;
+using FreeSwitch.Marshaling.Types;
+
+namespace FreeSwitch.Types
+{\r
+    public class StateHandlerTable
+    {
+        internal HandleRef     marshaledObject;
+
+    }
+}
index 72306d607b42a9123864ccacec2dcf4ab76a273f..dacd11664ad060264da52e47037c6bf8cd7ce316 100755 (executable)
  *
  */
 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);
         }
diff --git a/src/dotnet/Types/Timer.cs b/src/dotnet/Types/Timer.cs
new file mode 100644 (file)
index 0000000..8e199e4
--- /dev/null
@@ -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;\r
+using FreeSwitch.Marshaling;
+using FreeSwitch.Marshaling.Types;
+
+namespace FreeSwitch.Types
+{\r
+    public class Timer
+    {
+        internal HandleRef     marshaledObject;
+
+    }
+}