[Freeswitch-svn] [commit] r10118 - in freeswitch/trunk/src/mod/languages/mod_managed: . managed

Freeswitch SVN michaelgg at freeswitch.org
Wed Oct 22 18:02:58 EDT 2008


Author: michaelgg
Date: Wed Oct 22 18:02:58 2008
New Revision: 10118

Modified:
   freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_managed.cpp
   freeswitch/trunk/src/mod/languages/mod_managed/managed/Demo.cs
   freeswitch/trunk/src/mod/languages/mod_managed/mod_managed.cpp

Log:
Make cpp code as unmanaged as possible

Modified: freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_managed.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_managed.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_managed.cpp	Wed Oct 22 18:02:58 2008
@@ -34,6 +34,10 @@
 #include <switch_cpp.h>
 #include "freeswitch_managed.h"
 
+#ifdef _MANAGED
+#pragma unmanaged
+#endif
+
 ManagedSession::ManagedSession():CoreSession() 
 {
 

Modified: freeswitch/trunk/src/mod/languages/mod_managed/managed/Demo.cs
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_managed/managed/Demo.cs	(original)
+++ freeswitch/trunk/src/mod/languages/mod_managed/managed/Demo.cs	Wed Oct 22 18:02:58 2008
@@ -46,17 +46,31 @@
             return true;
         }
 
-        protected override void Run()
-        {
-            Session.Answer();
+        protected override void Run() {
+            bool isRecording = false;
             Session.DtmfReceivedFunction = (d, t) => {
+                Log.WriteLine(LogLevel.Critical, "RECORDING is {0}", Session.GetVariable("RECORDING"));
                 Log.WriteLine(LogLevel.Info, "Received {0} for {1}.", d, t);
-                return "";
+
+                if (isRecording) {
+                    Log.WriteLine(LogLevel.Info, "Recording: [TRUE]  Returning crap");
+                    return "1";
+                } else {
+                    Log.WriteLine(LogLevel.Info, "Recording: [FALSE] Returning null");
+                    return null;
+                }
             };
-            Log.WriteLine(LogLevel.Info, "Inside AppDemo.Run (args '{0}'); HookState is {1}. Now will collect digits.", Arguments, Session.HookState);
-            Session.CollectDigits(5000); // Hanging up here will cause an abort and the next line won't be written
-            Log.WriteLine(LogLevel.Info, "AppDemo is finishing its run and will now hang up.");
-            Session.Hangup("USER_BUSY");
+            Session.StreamFile(@"C:\freeswitch\Debug\sounds\en\us\callie\voicemail\8000\vm-hello.wav", 0);
+            var fn = @"C:\" + Session.GetHashCode() + ".wav";
+            isRecording = true;
+            Session.SetVariable("RECORDING", "true");
+            Session.RecordFile(fn, 600, 500, 3);
+            isRecording = false;
+            Session.SetVariable("RECORDING", "false");
+            Session.sleep(500);
+            Log.WriteLine(LogLevel.Info, "WW GROUP: Finished Recording file");
+            var res = Session.PlayAndGetDigits(1, 1, 3, 3000, "*", @"C:\freeswitch\libs\sounds\en\us\callie\ivr\8000\ivr-sample_submenu.wav", @"C:\freeswitch\libs\sounds\en\us\callie\ivr\8000\ivr-sample_submenu.wav", "1|2|3|9|#");
+            Log.WriteLine(LogLevel.Info, "WW GROUP: Message Menu [" + res + "]");
         }
         
         void hangupHook()

Modified: freeswitch/trunk/src/mod/languages/mod_managed/mod_managed.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_managed/mod_managed.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_managed/mod_managed.cpp	Wed Oct 22 18:02:58 2008
@@ -362,6 +362,9 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#ifdef _MANAGED
+#pragma unmanaged
+#endif
 SWITCH_STANDARD_API(managedrun_api_function) 
 {
 	if (switch_strlen_zero(cmd)) {



More information about the Freeswitch-svn mailing list