jsonification into the core and ESL

This commit is contained in:
Anthony Minessale
2010-06-17 11:43:09 -05:00
parent 3026e639fe
commit c5086b1517
11 changed files with 1166 additions and 69 deletions
@@ -61,7 +61,8 @@ typedef enum {
typedef enum {
EVENT_FORMAT_PLAIN,
EVENT_FORMAT_XML
EVENT_FORMAT_XML,
EVENT_FORMAT_JSON
} event_format_t;
struct listener {
@@ -126,6 +127,20 @@ static struct {
} prefs;
static const char *format2str(event_format_t format)
{
switch (format) {
case EVENT_FORMAT_PLAIN:
return "plain";
case EVENT_FORMAT_XML:
return "xml";
case EVENT_FORMAT_JSON:
return "json";
}
return "invalid";
}
static void remove_listener(listener_t *listener);
static void kill_all_listeners(void);
@@ -605,7 +620,7 @@ static void xmlize_listener(listener_t *listener, switch_stream_handle_t *stream
{
stream->write_function(stream, " <listener>\n");
stream->write_function(stream, " <listen-id>%u</listen-id>\n", listener->id);
stream->write_function(stream, " <format>%s</format>\n", listener->format == EVENT_FORMAT_XML ? "xml" : "plain");
stream->write_function(stream, " <format>%s</format>\n", format2str(listener->format));
stream->write_function(stream, " <timeout>%u</timeout>\n", listener->timeout);
stream->write_function(stream, " </listener>\n");
}
@@ -792,6 +807,8 @@ SWITCH_STANDARD_API(event_sink_function)
if (switch_stristr("xml", format)) {
listener->format = EVENT_FORMAT_XML;
} else if (switch_stristr("json", format)) {
listener->format = EVENT_FORMAT_JSON;
} else {
listener->format = EVENT_FORMAT_PLAIN;
}
@@ -931,6 +948,9 @@ SWITCH_STANDARD_API(event_sink_function)
etype = "plain";
switch_event_serialize(pevent, &listener->ebuf, SWITCH_TRUE);
stream->write_function(stream, "<event type=\"plain\">\n%s</event>", listener->ebuf);
} else if (listener->format == EVENT_FORMAT_JSON) {
etype = "json";
switch_event_serialize_json(pevent, &listener->ebuf);
} else {
switch_xml_t xml;
etype = "xml";
@@ -1219,6 +1239,9 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
if (listener->format == EVENT_FORMAT_PLAIN) {
etype = "plain";
switch_event_serialize(pevent, &listener->ebuf, SWITCH_TRUE);
} else if (listener->format == EVENT_FORMAT_JSON) {
etype = "json";
switch_event_serialize_json(pevent, &listener->ebuf);
} else {
switch_xml_t xml;
etype = "xml";
@@ -1846,6 +1869,9 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
if (strstr(cmd, "xml") || strstr(cmd, "XML")) {
listener->format = EVENT_FORMAT_XML;
}
if (strstr(cmd, "json") || strstr(cmd, "JSON")) {
listener->format = EVENT_FORMAT_JSON;
}
switch_snprintf(reply, reply_len, "+OK Events Enabled");
goto done;
}
@@ -2171,6 +2197,9 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
} else if (!strcasecmp(cur, "plain")) {
listener->format = EVENT_FORMAT_PLAIN;
goto end;
} else if (!strcasecmp(cur, "json")) {
listener->format = EVENT_FORMAT_JSON;
goto end;
}
}
@@ -2218,7 +2247,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
switch_set_flag_locked(listener, LFLAG_EVENTS);
}
switch_snprintf(reply, reply_len, "+OK event listener enabled %s", listener->format == EVENT_FORMAT_XML ? "xml" : "plain");
switch_snprintf(reply, reply_len, "+OK event listener enabled %s", format2str(listener->format));
} else if (!strncasecmp(cmd, "nixevent", 8)) {
char *next, *cur;
+230 -22
View File
@@ -3637,7 +3637,7 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_T38VendorInfo_get(void
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_ip_set(void * jarg1, char * jarg2) {
SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_remote_ip_set(void * jarg1, char * jarg2) {
switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
char *arg2 = (char *) 0 ;
@@ -3645,45 +3645,97 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_ip_set(void * jarg1, cha
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->ip = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->ip, (const char *)arg2);
arg1->remote_ip = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->remote_ip, (const char *)arg2);
} else {
arg1->ip = 0;
arg1->remote_ip = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_ip_get(void * jarg1) {
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_remote_ip_get(void * jarg1) {
char * jresult ;
switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
char *result = 0 ;
arg1 = (switch_t38_options_t *)jarg1;
result = (char *) ((arg1)->ip);
result = (char *) ((arg1)->remote_ip);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_port_set(void * jarg1, unsigned long jarg2) {
SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_remote_port_set(void * jarg1, unsigned long jarg2) {
switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
uint32_t arg2 ;
arg1 = (switch_t38_options_t *)jarg1;
arg2 = (uint32_t)jarg2;
if (arg1) (arg1)->port = arg2;
if (arg1) (arg1)->remote_port = arg2;
}
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_port_get(void * jarg1) {
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_remote_port_get(void * jarg1) {
unsigned long jresult ;
switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
uint32_t result;
arg1 = (switch_t38_options_t *)jarg1;
result = (uint32_t) ((arg1)->port);
result = (uint32_t) ((arg1)->remote_port);
jresult = (unsigned long)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_local_ip_set(void * jarg1, char * jarg2) {
switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (switch_t38_options_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg2) {
arg1->local_ip = (char const *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->local_ip, (const char *)arg2);
} else {
arg1->local_ip = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_local_ip_get(void * jarg1) {
char * jresult ;
switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
char *result = 0 ;
arg1 = (switch_t38_options_t *)jarg1;
result = (char *) ((arg1)->local_ip);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_local_port_set(void * jarg1, unsigned long jarg2) {
switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
uint32_t arg2 ;
arg1 = (switch_t38_options_t *)jarg1;
arg2 = (uint32_t)jarg2;
if (arg1) (arg1)->local_port = arg2;
}
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_local_port_get(void * jarg1) {
unsigned long jresult ;
switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
uint32_t result;
arg1 = (switch_t38_options_t *)jarg1;
result = (uint32_t) ((arg1)->local_port);
jresult = (unsigned long)result;
return jresult;
}
@@ -11638,6 +11690,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_number_cmp(char * jarg1, int jarg2) {
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_split_user_domain(char * jarg1, void * jarg2, void * jarg3) {
int jresult ;
char *arg1 = (char *) 0 ;
char **arg2 = (char **) 0 ;
char **arg3 = (char **) 0 ;
int result;
arg1 = (char *)jarg1;
arg2 = (char **)jarg2;
arg3 = (char **)jarg3;
result = (int)switch_split_user_domain(arg1,arg2,arg3);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_username_set(void * jarg1, char * jarg2) {
switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
char *arg2 = (char *) 0 ;
@@ -21966,19 +22034,21 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_answered(void * ja
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_ring_ready(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_ring_ready_value(void * jarg1, int jarg2, char * jarg3, char * jarg4, int jarg5) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
char *arg2 = (char *) 0 ;
switch_ring_ready_t arg2 ;
char *arg3 = (char *) 0 ;
int arg4 ;
char *arg4 = (char *) 0 ;
int arg5 ;
switch_status_t result;
arg1 = (switch_channel_t *)jarg1;
arg2 = (char *)jarg2;
arg2 = (switch_ring_ready_t)jarg2;
arg3 = (char *)jarg3;
arg4 = (int)jarg4;
result = (switch_status_t)switch_channel_perform_ring_ready(arg1,(char const *)arg2,(char const *)arg3,arg4);
arg4 = (char *)jarg4;
arg5 = (int)jarg5;
result = (switch_status_t)switch_channel_perform_ring_ready_value(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
jresult = result;
return jresult;
}
@@ -22020,19 +22090,21 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_pre_answered(void
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_ring_ready(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_ring_ready_value(void * jarg1, int jarg2, char * jarg3, char * jarg4, int jarg5) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
char *arg2 = (char *) 0 ;
switch_ring_ready_t arg2 ;
char *arg3 = (char *) 0 ;
int arg4 ;
char *arg4 = (char *) 0 ;
int arg5 ;
switch_status_t result;
arg1 = (switch_channel_t *)jarg1;
arg2 = (char *)jarg2;
arg2 = (switch_ring_ready_t)jarg2;
arg3 = (char *)jarg3;
arg4 = (int)jarg4;
result = (switch_status_t)switch_channel_perform_mark_ring_ready(arg1,(char const *)arg2,(char const *)arg3,arg4);
arg4 = (char *)jarg4;
arg5 = (int)jarg5;
result = (switch_status_t)switch_channel_perform_mark_ring_ready_value(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
jresult = result;
return jresult;
}
@@ -22484,6 +22556,80 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_cap_string(void * jarg1)
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_state_change_pending(void * jarg1) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
int result;
arg1 = (switch_channel_t *)jarg1;
result = (int)switch_channel_state_change_pending(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_perform_set_callstate(void * jarg1, int jarg2, char * jarg3, char * jarg4, int jarg5) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_channel_callstate_t arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
int arg5 ;
arg1 = (switch_channel_t *)jarg1;
arg2 = (switch_channel_callstate_t)jarg2;
arg3 = (char *)jarg3;
arg4 = (char *)jarg4;
arg5 = (int)jarg5;
switch_channel_perform_set_callstate(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_callstate(void * jarg1) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_channel_callstate_t result;
arg1 = (switch_channel_t *)jarg1;
result = (switch_channel_callstate_t)switch_channel_get_callstate(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_callstate2str(int jarg1) {
char * jresult ;
switch_channel_callstate_t arg1 ;
char *result = 0 ;
arg1 = (switch_channel_callstate_t)jarg1;
result = (char *)switch_channel_callstate2str(arg1);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_str2callstate(char * jarg1) {
int jresult ;
char *arg1 = (char *) 0 ;
switch_call_cause_t result;
arg1 = (char *)jarg1;
result = (switch_call_cause_t)switch_channel_str2callstate((char const *)arg1);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_mark_hold(void * jarg1, int jarg2) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_bool_t arg2 ;
arg1 = (switch_channel_t *)jarg1;
arg2 = (switch_bool_t)jarg2;
switch_channel_mark_hold(arg1,arg2);
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_create(void * jarg1, void * jarg2, void * jarg3) {
int jresult ;
switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
@@ -23389,6 +23535,16 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_dup(void * jarg1, void * jarg2) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_merge(void * jarg1, void * jarg2) {
switch_event_t *arg1 = (switch_event_t *) 0 ;
switch_event_t *arg2 = (switch_event_t *) 0 ;
arg1 = (switch_event_t *)jarg1;
arg2 = (switch_event_t *)jarg2;
switch_event_merge(arg1,arg2);
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_fire_detailed(char * jarg1, char * jarg2, int jarg3, void * jarg4, void * jarg5) {
int jresult ;
char *arg1 = (char *) 0 ;
@@ -23559,6 +23715,34 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_serialize(void * jarg1, void * ja
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_serialize_json(void * jarg1, void * jarg2) {
int jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ;
char **arg2 = (char **) 0 ;
switch_status_t result;
arg1 = (switch_event_t *)jarg1;
arg2 = (char **)jarg2;
result = (switch_status_t)switch_event_serialize_json(arg1,arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_json(void * jarg1, char * jarg2) {
int jresult ;
switch_event_t **arg1 = (switch_event_t **) 0 ;
char *arg2 = (char *) 0 ;
switch_status_t result;
arg1 = (switch_event_t **)jarg1;
arg2 = (char *)jarg2;
result = (switch_status_t)switch_event_create_json(arg1,(char const *)arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_running() {
int jresult ;
switch_status_t result;
@@ -25929,6 +26113,30 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long ja
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_block_dtmf_session(void * jarg1) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
switch_status_t result;
arg1 = (switch_core_session_t *)jarg1;
result = (switch_status_t)switch_ivr_block_dtmf_session(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_unblock_dtmf_session(void * jarg1) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
switch_status_t result;
arg1 = (switch_core_session_t *)jarg1;
result = (switch_status_t)switch_ivr_unblock_dtmf_session(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_bind_dtmf_meta_session(void * jarg1, unsigned long jarg2, unsigned long jarg3, char * jarg4) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+191 -23
View File
@@ -2738,6 +2738,11 @@ public class freeswitch {
return ret;
}
public static int switch_split_user_domain(string arg0, ref string user, ref string domain) {
int ret = freeswitchPINVOKE.switch_split_user_domain(arg0, ref user, ref domain);
return ret;
}
public static switch_caller_extension switch_caller_extension_new(SWIGTYPE_p_switch_core_session session, string extension_name, string extension_number) {
IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_new(SWIGTYPE_p_switch_core_session.getCPtr(session), extension_name, extension_number);
switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
@@ -3057,8 +3062,8 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_channel_perform_ring_ready(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_ring_ready(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
public static switch_status_t switch_channel_perform_ring_ready_value(SWIGTYPE_p_switch_channel channel, switch_ring_ready_t rv, string file, string func, int line) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_ring_ready_value(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)rv, file, func, line);
return ret;
}
@@ -3072,8 +3077,8 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_channel_perform_mark_ring_ready(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_mark_ring_ready(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
public static switch_status_t switch_channel_perform_mark_ring_ready_value(SWIGTYPE_p_switch_channel channel, switch_ring_ready_t rv, string file, string func, int line) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_mark_ring_ready_value(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)rv, file, func, line);
return ret;
}
@@ -3246,6 +3251,34 @@ public class freeswitch {
return ret;
}
public static int switch_channel_state_change_pending(SWIGTYPE_p_switch_channel channel) {
int ret = freeswitchPINVOKE.switch_channel_state_change_pending(SWIGTYPE_p_switch_channel.getCPtr(channel));
return ret;
}
public static void switch_channel_perform_set_callstate(SWIGTYPE_p_switch_channel channel, switch_channel_callstate_t callstate, string file, string func, int line) {
freeswitchPINVOKE.switch_channel_perform_set_callstate(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)callstate, file, func, line);
}
public static switch_channel_callstate_t switch_channel_get_callstate(SWIGTYPE_p_switch_channel channel) {
switch_channel_callstate_t ret = (switch_channel_callstate_t)freeswitchPINVOKE.switch_channel_get_callstate(SWIGTYPE_p_switch_channel.getCPtr(channel));
return ret;
}
public static string switch_channel_callstate2str(switch_channel_callstate_t callstate) {
string ret = freeswitchPINVOKE.switch_channel_callstate2str((int)callstate);
return ret;
}
public static switch_call_cause_t switch_channel_str2callstate(string str) {
switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_channel_str2callstate(str);
return ret;
}
public static void switch_channel_mark_hold(SWIGTYPE_p_switch_channel channel, switch_bool_t on) {
freeswitchPINVOKE.switch_channel_mark_hold(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)on);
}
public static switch_status_t switch_buffer_create(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t max_len) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(max_len));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
@@ -3398,6 +3431,10 @@ public class freeswitch {
return ret;
}
public static void switch_event_merge(switch_event arg0, switch_event tomerge) {
freeswitchPINVOKE.switch_event_merge(switch_event.getCPtr(arg0), switch_event.getCPtr(tomerge));
}
public static switch_status_t switch_event_fire_detailed(string file, string func, int line, SWIGTYPE_p_p_switch_event arg3, SWIGTYPE_p_void user_data) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_fire_detailed(file, func, line, SWIGTYPE_p_p_switch_event.getCPtr(arg3), SWIGTYPE_p_void.getCPtr(user_data));
return ret;
@@ -3452,6 +3489,16 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_event_serialize_json(switch_event arg0, ref string str) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_serialize_json(switch_event.getCPtr(arg0), ref str);
return ret;
}
public static switch_status_t switch_event_create_json(SWIGTYPE_p_p_switch_event arg0, string json) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_json(SWIGTYPE_p_p_switch_event.getCPtr(arg0), json);
return ret;
}
public static switch_status_t switch_event_running() {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_running();
return ret;
@@ -3965,6 +4012,16 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_ivr_block_dtmf_session(SWIGTYPE_p_switch_core_session session) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_block_dtmf_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
return ret;
}
public static switch_status_t switch_ivr_unblock_dtmf_session(SWIGTYPE_p_switch_core_session session) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_unblock_dtmf_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
return ret;
}
public static switch_status_t switch_ivr_bind_dtmf_meta_session(SWIGTYPE_p_switch_core_session session, uint key, uint bind_flags, string app) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_bind_dtmf_meta_session(SWIGTYPE_p_switch_core_session.getCPtr(session), key, bind_flags, app);
return ret;
@@ -6023,17 +6080,29 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38VendorInfo_get")]
public static extern string switch_t38_options_t_T38VendorInfo_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_ip_set")]
public static extern void switch_t38_options_t_ip_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_remote_ip_set")]
public static extern void switch_t38_options_t_remote_ip_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_ip_get")]
public static extern string switch_t38_options_t_ip_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_remote_ip_get")]
public static extern string switch_t38_options_t_remote_ip_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_port_set")]
public static extern void switch_t38_options_t_port_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_remote_port_set")]
public static extern void switch_t38_options_t_remote_port_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_port_get")]
public static extern uint switch_t38_options_t_port_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_remote_port_get")]
public static extern uint switch_t38_options_t_remote_port_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_local_ip_set")]
public static extern void switch_t38_options_t_local_ip_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_local_ip_get")]
public static extern string switch_t38_options_t_local_ip_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_local_port_set")]
public static extern void switch_t38_options_t_local_port_set(HandleRef jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_local_port_get")]
public static extern uint switch_t38_options_t_local_port_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_t38_options_t")]
public static extern IntPtr new_switch_t38_options_t();
@@ -7853,6 +7922,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_number_cmp")]
public static extern int switch_number_cmp(string jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_split_user_domain")]
public static extern int switch_split_user_domain(string jarg1, ref string jarg2, ref string jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_username_set")]
public static extern void switch_caller_profile_username_set(HandleRef jarg1, string jarg2);
@@ -10409,8 +10481,8 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_answered")]
public static extern int switch_channel_perform_mark_answered(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_ring_ready")]
public static extern int switch_channel_perform_ring_ready(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_ring_ready_value")]
public static extern int switch_channel_perform_ring_ready_value(HandleRef jarg1, int jarg2, string jarg3, string jarg4, int jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_pre_answer")]
public static extern int switch_channel_perform_pre_answer(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
@@ -10418,8 +10490,8 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_pre_answered")]
public static extern int switch_channel_perform_mark_pre_answered(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_ring_ready")]
public static extern int switch_channel_perform_mark_ring_ready(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_ring_ready_value")]
public static extern int switch_channel_perform_mark_ring_ready_value(HandleRef jarg1, int jarg2, string jarg3, string jarg4, int jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_add_state_handler")]
public static extern int switch_channel_add_state_handler(HandleRef jarg1, HandleRef jarg2);
@@ -10526,6 +10598,24 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_cap_string")]
public static extern string switch_channel_get_cap_string(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_state_change_pending")]
public static extern int switch_channel_state_change_pending(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_set_callstate")]
public static extern void switch_channel_perform_set_callstate(HandleRef jarg1, int jarg2, string jarg3, string jarg4, int jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_callstate")]
public static extern int switch_channel_get_callstate(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_callstate2str")]
public static extern string switch_channel_callstate2str(int jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_str2callstate")]
public static extern int switch_channel_str2callstate(string jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_mark_hold")]
public static extern void switch_channel_mark_hold(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create")]
public static extern int switch_buffer_create(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
@@ -10724,6 +10814,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_dup")]
public static extern int switch_event_dup(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_merge")]
public static extern void switch_event_merge(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_fire_detailed")]
public static extern int switch_event_fire_detailed(string jarg1, string jarg2, int jarg3, HandleRef jarg4, HandleRef jarg5);
@@ -10757,6 +10850,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_serialize")]
public static extern int switch_event_serialize(HandleRef jarg1, ref string jarg2, int jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_serialize_json")]
public static extern int switch_event_serialize_json(HandleRef jarg1, ref string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_json")]
public static extern int switch_event_create_json(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_running")]
public static extern int switch_event_running();
@@ -11225,6 +11324,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_read")]
public static extern int switch_ivr_read(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7, uint jarg8, string jarg9);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_block_dtmf_session")]
public static extern int switch_ivr_block_dtmf_session(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_unblock_dtmf_session")]
public static extern int switch_ivr_unblock_dtmf_session(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_bind_dtmf_meta_session")]
public static extern int switch_ivr_bind_dtmf_meta_session(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4);
@@ -19852,6 +19957,27 @@ public enum switch_channel_app_flag_t {
namespace FreeSWITCH.Native {
public enum switch_channel_callstate_t {
CCS_DOWN,
CCS_DIALING,
CCS_RINGING,
CCS_EARLY,
CCS_ACTIVE,
CCS_HELD,
CCS_HANGUP
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.35
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
public enum switch_channel_cap_t {
CC_MEDIA_ACK = 1,
CC_BYPASS_MEDIA,
@@ -19922,6 +20048,7 @@ public enum switch_channel_flag_t {
CF_BROADCAST_DROP_MEDIA,
CF_EARLY_HANGUP,
CF_MEDIA_SET,
CF_CONSUME_ON_ORIGINATE,
CF_FLAG_MAX
}
@@ -22975,11 +23102,14 @@ public enum switch_event_types_t {
SWITCH_EVENT_CHANNEL_CREATE,
SWITCH_EVENT_CHANNEL_DESTROY,
SWITCH_EVENT_CHANNEL_STATE,
SWITCH_EVENT_CHANNEL_CALLSTATE,
SWITCH_EVENT_CHANNEL_ANSWER,
SWITCH_EVENT_CHANNEL_HANGUP,
SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE,
SWITCH_EVENT_CHANNEL_EXECUTE,
SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE,
SWITCH_EVENT_CHANNEL_HOLD,
SWITCH_EVENT_CHANNEL_UNHOLD,
SWITCH_EVENT_CHANNEL_BRIDGE,
SWITCH_EVENT_CHANNEL_UNBRIDGE,
SWITCH_EVENT_CHANNEL_PROGRESS,
@@ -25947,6 +26077,23 @@ public enum switch_priority_t {
namespace FreeSWITCH.Native {
public enum switch_ring_ready_t {
SWITCH_RING_READY_NONE,
SWITCH_RING_READY_RINGING,
SWITCH_RING_READY_QUEUED
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.35
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
@@ -26047,7 +26194,8 @@ namespace FreeSWITCH.Native {
public enum switch_rtp_bug_flag_t {
RTP_BUG_NONE = 0,
RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0),
RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1)
RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1),
RTP_BUG_IGNORE_MARK_BIT = (1 << 2)
}
}
@@ -28090,22 +28238,42 @@ public class switch_t38_options_t : IDisposable {
}
}
public string ip {
public string remote_ip {
set {
freeswitchPINVOKE.switch_t38_options_t_ip_set(swigCPtr, value);
freeswitchPINVOKE.switch_t38_options_t_remote_ip_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_t38_options_t_ip_get(swigCPtr);
string ret = freeswitchPINVOKE.switch_t38_options_t_remote_ip_get(swigCPtr);
return ret;
}
}
public uint port {
public uint remote_port {
set {
freeswitchPINVOKE.switch_t38_options_t_port_set(swigCPtr, value);
freeswitchPINVOKE.switch_t38_options_t_remote_port_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_t38_options_t_port_get(swigCPtr);
uint ret = freeswitchPINVOKE.switch_t38_options_t_remote_port_get(swigCPtr);
return ret;
}
}
public string local_ip {
set {
freeswitchPINVOKE.switch_t38_options_t_local_ip_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.switch_t38_options_t_local_ip_get(swigCPtr);
return ret;
}
}
public uint local_port {
set {
freeswitchPINVOKE.switch_t38_options_t_local_port_set(swigCPtr, value);
}
get {
uint ret = freeswitchPINVOKE.switch_t38_options_t_local_port_get(swigCPtr);
return ret;
}
}
+3 -3
View File
@@ -9708,17 +9708,17 @@ XS(SWIG_init) {
SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
SvREADONLY_on(sv);
@@ -627,7 +627,7 @@ static JSBool event_serialize(JSContext * cx, JSObject * obj, uintN argc, jsval
{
struct event_obj *eo = JS_GetPrivate(cx, obj);
char *buf;
uint8_t isxml = 0;
uint8_t isxml = 0, isjson = 0;
if (!eo) {
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
@@ -638,6 +638,8 @@ static JSBool event_serialize(JSContext * cx, JSObject * obj, uintN argc, jsval
char *arg = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
if (!strcasecmp(arg, "xml")) {
isxml++;
} else if (!strcasecmp(arg, "json")) {
isjson++;
}
}
@@ -652,6 +654,11 @@ static JSBool event_serialize(JSContext * cx, JSObject * obj, uintN argc, jsval
} else {
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
}
} else if (isjson) {
if (switch_event_serialize_json(eo->event, &buf) == SWITCH_STATUS_SUCCESS) {
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buf));
switch_safe_free(buf);
}
} else {
if (switch_event_serialize(eo->event, &buf, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buf));