mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-10 18:57:45 +00:00
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 <switch_cpp.h>
|
||||||
#include "freeswitch_managed.h"
|
#include "freeswitch_managed.h"
|
||||||
|
|
||||||
|
#ifdef _MANAGED
|
||||||
|
#pragma unmanaged
|
||||||
|
#endif
|
||||||
|
|
||||||
ManagedSession::ManagedSession():CoreSession()
|
ManagedSession::ManagedSession():CoreSession()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -46,17 +46,31 @@ namespace FreeSWITCH.Demo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Run()
|
protected override void Run() {
|
||||||
{
|
bool isRecording = false;
|
||||||
Session.Answer();
|
|
||||||
Session.DtmfReceivedFunction = (d, t) => {
|
Session.DtmfReceivedFunction = (d, t) => {
|
||||||
|
Log.WriteLine(LogLevel.Critical, "RECORDING is {0}", Session.GetVariable("RECORDING"));
|
||||||
Log.WriteLine(LogLevel.Info, "Received {0} for {1}.", d, t);
|
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.StreamFile(@"C:\freeswitch\Debug\sounds\en\us\callie\voicemail\8000\vm-hello.wav", 0);
|
||||||
Session.CollectDigits(5000); // Hanging up here will cause an abort and the next line won't be written
|
var fn = @"C:\" + Session.GetHashCode() + ".wav";
|
||||||
Log.WriteLine(LogLevel.Info, "AppDemo is finishing its run and will now hang up.");
|
isRecording = true;
|
||||||
Session.Hangup("USER_BUSY");
|
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()
|
void hangupHook()
|
||||||
|
@ -362,6 +362,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MANAGED
|
||||||
|
#pragma unmanaged
|
||||||
|
#endif
|
||||||
SWITCH_STANDARD_API(managedrun_api_function)
|
SWITCH_STANDARD_API(managedrun_api_function)
|
||||||
{
|
{
|
||||||
if (switch_strlen_zero(cmd)) {
|
if (switch_strlen_zero(cmd)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user