-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfreeswitch.i
More file actions
206 lines (178 loc) · 7.94 KB
/
freeswitch.i
File metadata and controls
206 lines (178 loc) · 7.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
%module freeswitch
#pragma SWIG nowarn=451
%include ../../../../swig_common.i
/** String fix - copied from csharphead.swg with fix for multiple appdomains **/
/* Must pass -DSWIG_CSHARP_NO_STRING_HELPER to swig */
#if defined(SWIG_CSHARP_NO_STRING_HELPER)
%insert(runtime) %{
/* Callback for returning strings to C# without leaking memory */
typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback_real = NULL;
%}
%pragma(csharp) imclasscode=%{
protected class SWIGStringHelper {
public delegate string SWIGStringDelegate(string message);
static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterStringCallback_$module")]
public static extern void SWIGRegisterStringCallback_$module(SWIGStringDelegate stringDelegate);
static string CreateString(string cString) {
return cString;
}
static SWIGStringHelper() {
SWIGRegisterStringCallback_$module(stringDelegate);
}
}
static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
%}
%insert(runtime) %{
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_freeswitch(SWIG_CSharpStringHelperCallback callback) {
/* Set this only once, in the main appdomain */
if (SWIG_csharp_string_callback_real == NULL) SWIG_csharp_string_callback_real = callback;
}
char * SWIG_csharp_string_callback(const char * str) {
return SWIG_csharp_string_callback_real(str);
}
%}
#endif // SWIG_CSHARP_NO_STRING_HELPER
/** insert the following includes into generated code so it compiles */
%{
#include "switch.h"
#include "switch_cpp.h"
#include "freeswitch_core.h"
%}
%typemap(csclassmodifiers) ManagedSession "public partial class"
%typemap(csclassmodifiers) Event "public partial class"
%typemap(csclassmodifiers) Stream "public partial class"
%newobject EventConsumer::pop;
%newobject Session;
%newobject CoreSession;
%newobject Event;
%newobject Stream;
%newobject API::execute;
%newobject API::executeString;
%newobject CoreSession::playAndDetectSpeech;
// Allow bitwise compare on flag fields
%typemap(csclassmodifiers) session_flag_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_application_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_asr_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_bind_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_caller_profile_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_channel_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_codec_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_core_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_core_session_message_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_directory_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_eavesdrop_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_file_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_frame_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_io_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_media_bug_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_media_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_originate_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_port_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_rtp_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_scheduler_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_speech_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_timer_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_unicast_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_vad_flag_enum_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_xml_flag_t "[System.Flags] public enum"
%typemap(csclassmodifiers) switch_xml_section_enum_t "[System.Flags] public enum"
// Some things we dont want exposed to managed users directly, since
// we're gonna handle them with our own internalcall methods
%ignore dtmfDelegate;
%ignore hangupDelegate;
%ignore setHangupHook;
%ignore beginAllowThreads;
%ignore endAllowThreads;
%ignore process_callback_result;
%ignore run_dtmf_callback;
%ignore setDTMFCallback;
// These methods need a bit of wrapping help
%csmethodmodifiers CoreSession::originate "protected";
// Rename some things to make them more .NET-like
%rename (Answer) CoreSession::answer;
%rename (Hangup) CoreSession::hangup;
%rename (Ready) CoreSession::ready;
%rename (Transfer) CoreSession::transfer;
%rename (SetVariable) CoreSession::setVariable;
%rename (GetVariable) CoreSession::getVariable;
%rename (SetPrivate) CoreSession::setPrivate;
%rename (GetPrivate) CoreSession::getPrivate;
%rename (Say) CoreSession::say;
%rename (SayPhrase) CoreSession::sayPhrase;
%rename (RecordFile) CoreSession::recordFile;
%rename (SetCallerData) CoreSession::setCallerData;
%rename (CollectDigits) CoreSession::collectDigits;
%rename (GetDigits) CoreSession::getDigits;
%rename (PlayAndGetDigits) CoreSession::playAndGetDigits;
%rename (StreamFile) CoreSession::streamFile;
%rename (Execute) CoreSession::execute;
%rename (GetUuid) CoreSession::get_uuid;
%rename (HookState) CoreSession::hook_state;
%rename (InternalSession) CoreSession::session;
%rename (Speak) CoreSession::speak;
%rename (SetTtsParameters) CoreSession::set_tts_parms;
%rename (SetAutoHangup) CoreSession::setAutoHangup;
%rename(evt) event;
%rename(parameters) params;
%rename (Serialize) Event::serialize;
%rename (SetPriority) Event::setPriority;
%rename (GetHeader) Event::getHeader;
%rename (GetBody) Event::getBody;
%rename (GetEventType) Event::getType;
%rename (AddBody) Event::addBody;
%rename (AddHeader) Event::addHeader;
%rename (DeleteHeader) Event::delHeader;
%rename (Fire) Event::fire;
%rename (InternalEvent) Event::event;
%rename (Write) Stream::write;
%rename (GetData) Stream::getData;
%rename (Api) API;
%rename (Execute) API::execute;
%rename (ExecuteString) API::executeString;
%rename (IvrMenu) IVRMenu;
%rename (Execute) IVRMenu::execute;
%rename (ExecuteString) API::executeString;
// Causes C2564, todo
%ignore switch_ivr_menu_action_function_t;
// todo, other errors
%ignore switch_core_session_get_event_hooks;
%ignore switch_inet_pton;
%ignore switch_xml_idx;
%ignore switch_xml_pi;
// GCC complains "ISO C++ forbids assignment of arrays"
%ignore switch_vmprintf;
// Real header includes now
%import switch_platform.i // This will give us all the macros we need to compile the other stuff
%include switch.h
%include switch_types.h
//%include switch_apr.h
%include switch_core_db.h
%include switch_regex.h
%include switch_core.h
%ignore switch_module_runtime;
%ignore switch_module_load;
%ignore switch_module_shutdown;
%include switch_loadable_module.h // note: Above three ignore lines sort out some linking issues
%include switch_console.h // Has unsupported varargs functions
%include switch_utils.h
%include switch_caller.h
%include switch_frame.h
%include switch_module_interfaces.h
%include switch_channel.h
%include switch_buffer.h
%include switch_event.h // Varargs omitted
%include switch_resample.h
%include switch_ivr.h
%include switch_rtp.h
%include switch_log.h // switch_log_printf is omitted (varargs)
%include switch_xml.h
%include switch_core_event_hook.h
%include switch_scheduler.h
%include switch_config.h
%include switch_cpp.h
%include freeswitch_core.h