Make cpp code as unmanaged as possible
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10118 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
885c1e6144
commit
67015251ad
|
@ -34,6 +34,10 @@
|
|||
#include <switch_cpp.h>
|
||||
#include "freeswitch_managed.h"
|
||||
|
||||
#ifdef _MANAGED
|
||||
#pragma unmanaged
|
||||
#endif
|
||||
|
||||
ManagedSession::ManagedSession():CoreSession()
|
||||
{
|
||||
|
||||
|
|
|
@ -46,17 +46,31 @@ namespace FreeSWITCH.Demo
|
|||
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()
|
||||
|
|
|
@ -362,6 +362,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef _MANAGED
|
||||
#pragma unmanaged
|
||||
#endif
|
||||
SWITCH_STANDARD_API(managedrun_api_function)
|
||||
{
|
||||
if (switch_strlen_zero(cmd)) {
|
||||
|
|
Loading…
Reference in New Issue