diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 968b2baccd..4a9a11219e 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -439,8 +439,8 @@ typedef struct { } switch_rtp_numbers_t; typedef struct { - switch_rtp_numbers_t in; - switch_rtp_numbers_t out; + switch_rtp_numbers_t inbound; + switch_rtp_numbers_t outbound; } switch_rtp_stats_t; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 8dba858c82..fe9ae02d27 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1702,23 +1702,23 @@ static void set_stats(switch_rtp_t *rtp_session, private_object_t *tech_pvt, con if (stats) { - add_stat(stats->in.raw_bytes, "in_raw_bytes"); - add_stat(stats->in.media_bytes, "in_media_bytes"); - add_stat(stats->in.packet_count, "in_packet_count"); - add_stat(stats->in.media_packet_count, "in_media_packet_count"); - add_stat(stats->in.skip_packet_count, "in_skip_packet_count"); - add_stat(stats->in.jb_packet_count, "in_jb_packet_count"); - add_stat(stats->in.dtmf_packet_count, "in_dtmf_packet_count"); - add_stat(stats->in.cng_packet_count, "in_cng_packet_count"); - add_stat(stats->in.cng_packet_count, "in_flush_packet_count"); + add_stat(stats->inbound.raw_bytes, "in_raw_bytes"); + add_stat(stats->inbound.media_bytes, "in_media_bytes"); + add_stat(stats->inbound.packet_count, "in_packet_count"); + add_stat(stats->inbound.media_packet_count, "in_media_packet_count"); + add_stat(stats->inbound.skip_packet_count, "in_skip_packet_count"); + add_stat(stats->inbound.jb_packet_count, "in_jb_packet_count"); + add_stat(stats->inbound.dtmf_packet_count, "in_dtmf_packet_count"); + add_stat(stats->inbound.cng_packet_count, "in_cng_packet_count"); + add_stat(stats->inbound.cng_packet_count, "in_flush_packet_count"); - add_stat(stats->out.raw_bytes, "out_raw_bytes"); - add_stat(stats->out.media_bytes, "out_media_bytes"); - add_stat(stats->out.packet_count, "out_packet_count"); - add_stat(stats->out.media_packet_count, "out_media_packet_count"); - add_stat(stats->out.skip_packet_count, "out_skip_packet_count"); - add_stat(stats->out.dtmf_packet_count, "out_dtmf_packet_count"); - add_stat(stats->out.cng_packet_count, "out_cng_packet_count"); + add_stat(stats->outbound.raw_bytes, "out_raw_bytes"); + add_stat(stats->outbound.media_bytes, "out_media_bytes"); + add_stat(stats->outbound.packet_count, "out_packet_count"); + add_stat(stats->outbound.media_packet_count, "out_media_packet_count"); + add_stat(stats->outbound.skip_packet_count, "out_skip_packet_count"); + add_stat(stats->outbound.dtmf_packet_count, "out_dtmf_packet_count"); + add_stat(stats->outbound.cng_packet_count, "out_cng_packet_count"); } } diff --git a/src/mod/languages/mod_lua/freeswitch.i b/src/mod/languages/mod_lua/freeswitch.i index 6e62daf657..febea567a0 100644 --- a/src/mod/languages/mod_lua/freeswitch.i +++ b/src/mod/languages/mod_lua/freeswitch.i @@ -25,7 +25,44 @@ * build all sorts of c wrappers and lua shadows of the c wrappers. */ %include switch_swigable_cpp.h -%include freeswitch_lua.h + + +namespace LUA { +class Session : public CoreSession { + private: + virtual void do_hangup_hook(); + lua_State *getLUA(); + lua_State *L; + int hh; + int mark; + public: + Session(); + Session(char *uuid, CoreSession *a_leg = NULL); + Session(switch_core_session_t *session); + ~Session(); + virtual void destroy(void); + + virtual bool begin_allow_threads(); + virtual bool end_allow_threads(); + virtual void check_hangup_hook(); + + virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype); + void unsetInputCallback(void); + void setInputCallback(char *cbfunc, char *funcargs = NULL); + void setHangupHook(char *func, char *arg = NULL); + bool ready(); + int originate(CoreSession *a_leg_session, char *dest, int timeout); + + char *cb_function; + char *cb_arg; + char *hangup_func_str; + char *hangup_func_arg; + void setLUA(lua_State *state); + +}; +} + + diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 7cf63c31ba..5949b210f1 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -2698,47 +2698,47 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_numbers_t(void * jarg1) { } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_in_set(void * jarg1, void * jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_inbound_set(void * jarg1, void * jarg2) { switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; switch_rtp_numbers_t *arg2 = (switch_rtp_numbers_t *) 0 ; arg1 = (switch_rtp_stats_t *)jarg1; arg2 = (switch_rtp_numbers_t *)jarg2; - if (arg1) (arg1)->in = *arg2; + if (arg1) (arg1)->inbound = *arg2; } -SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_in_get(void * jarg1) { +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_inbound_get(void * jarg1) { void * jresult ; switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; switch_rtp_numbers_t *result = 0 ; arg1 = (switch_rtp_stats_t *)jarg1; - result = (switch_rtp_numbers_t *)& ((arg1)->in); + result = (switch_rtp_numbers_t *)& ((arg1)->inbound); jresult = (void *)result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_out_set(void * jarg1, void * jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_outbound_set(void * jarg1, void * jarg2) { switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; switch_rtp_numbers_t *arg2 = (switch_rtp_numbers_t *) 0 ; arg1 = (switch_rtp_stats_t *)jarg1; arg2 = (switch_rtp_numbers_t *)jarg2; - if (arg1) (arg1)->out = *arg2; + if (arg1) (arg1)->outbound = *arg2; } -SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_out_get(void * jarg1) { +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_outbound_get(void * jarg1) { void * jresult ; switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; switch_rtp_numbers_t *result = 0 ; arg1 = (switch_rtp_stats_t *)jarg1; - result = (switch_rtp_numbers_t *)& ((arg1)->out); + result = (switch_rtp_numbers_t *)& ((arg1)->outbound); jresult = (void *)result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 3b3a75263b..9e60c8f7ea 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -5103,17 +5103,17 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_numbers_t")] public static extern void delete_switch_rtp_numbers_t(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_in_set")] - public static extern void switch_rtp_stats_t_in_set(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_inbound_set")] + public static extern void switch_rtp_stats_t_inbound_set(HandleRef jarg1, HandleRef jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_in_get")] - public static extern IntPtr switch_rtp_stats_t_in_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_inbound_get")] + public static extern IntPtr switch_rtp_stats_t_inbound_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_out_set")] - public static extern void switch_rtp_stats_t_out_set(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_outbound_set")] + public static extern void switch_rtp_stats_t_outbound_set(HandleRef jarg1, HandleRef jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_out_get")] - public static extern IntPtr switch_rtp_stats_t_out_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_outbound_get")] + public static extern IntPtr switch_rtp_stats_t_outbound_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_stats_t")] public static extern IntPtr new_switch_rtp_stats_t(); @@ -23713,23 +23713,23 @@ public class switch_rtp_stats_t : IDisposable { } } - public switch_rtp_numbers_t in { + public switch_rtp_numbers_t inbound { set { - freeswitchPINVOKE.switch_rtp_stats_t_in_set(swigCPtr, switch_rtp_numbers_t.getCPtr(value)); + freeswitchPINVOKE.switch_rtp_stats_t_inbound_set(swigCPtr, switch_rtp_numbers_t.getCPtr(value)); } get { - IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_in_get(swigCPtr); + IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_inbound_get(swigCPtr); switch_rtp_numbers_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_numbers_t(cPtr, false); return ret; } } - public switch_rtp_numbers_t out { + public switch_rtp_numbers_t outbound { set { - freeswitchPINVOKE.switch_rtp_stats_t_out_set(swigCPtr, switch_rtp_numbers_t.getCPtr(value)); + freeswitchPINVOKE.switch_rtp_stats_t_outbound_set(swigCPtr, switch_rtp_numbers_t.getCPtr(value)); } get { - IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_out_get(swigCPtr); + IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_outbound_get(swigCPtr); switch_rtp_numbers_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_numbers_t(cPtr, false); return ret; } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 5c0a895048..01d77a2cdc 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1251,8 +1251,8 @@ static void do_2833(switch_rtp_t *rtp_session) rtp_session->dtmf_data.out_digit_packet, 4, 0, rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags); - rtp_session->stats.out.raw_bytes += wrote; - rtp_session->stats.out.dtmf_packet_count++; + rtp_session->stats.outbound.raw_bytes += wrote; + rtp_session->stats.outbound.dtmf_packet_count++; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n", @@ -1316,8 +1316,8 @@ static void do_2833(switch_rtp_t *rtp_session) rtp_session->rtp_bugs & RTP_BUG_CISCO_SKIP_MARK_BIT_2833 ? 0 : 1, rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags); - rtp_session->stats.out.raw_bytes += wrote; - rtp_session->stats.out.dtmf_packet_count++; + rtp_session->stats.outbound.raw_bytes += wrote; + rtp_session->stats.outbound.dtmf_packet_count++; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send start packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n", rtp_session->dtmf_data.out_digit, @@ -1361,9 +1361,9 @@ static void do_flush(switch_rtp_t *rtp_session) bytes = sizeof(rtp_msg_t); status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes); if (bytes) { - rtp_session->stats.in.raw_bytes += bytes; - rtp_session->stats.in.flush_packet_count++; - rtp_session->stats.in.packet_count++; + rtp_session->stats.inbound.raw_bytes += bytes; + rtp_session->stats.inbound.flush_packet_count++; + rtp_session->stats.inbound.packet_count++; } } else { break; @@ -1392,17 +1392,17 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, bytes); if (*bytes) { - rtp_session->stats.in.raw_bytes += *bytes; + rtp_session->stats.inbound.raw_bytes += *bytes; if (rtp_session->te && rtp_session->recv_msg.header.pt == rtp_session->te) { - rtp_session->stats.in.dtmf_packet_count++; + rtp_session->stats.inbound.dtmf_packet_count++; } else if (rtp_session->cng_pt && (rtp_session->recv_msg.header.pt == rtp_session->cng_pt || rtp_session->recv_msg.header.pt == 13)) { - rtp_session->stats.in.cng_packet_count++; + rtp_session->stats.inbound.cng_packet_count++; } else { - rtp_session->stats.in.media_packet_count++; - rtp_session->stats.in.media_bytes += *bytes; + rtp_session->stats.inbound.media_packet_count++; + rtp_session->stats.inbound.media_bytes += *bytes; } - rtp_session->stats.in.packet_count++; + rtp_session->stats.inbound.packet_count++; } if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) { @@ -1421,7 +1421,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t if (jb_frame->plc) { *flags |= SFF_PLC; } else { - rtp_session->stats.in.jb_packet_count++; + rtp_session->stats.inbound.jb_packet_count++; } *bytes = jb_frame->dlen + rtp_header_len; rtp_session->recv_msg.header.ts = htonl(jb_frame->ts); @@ -1772,7 +1772,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ *flags |= SFF_CNG; *payload_type = (switch_payload_t) rtp_session->recv_msg.header.pt; ret = 2 + rtp_header_len; - rtp_session->stats.in.skip_packet_count++; + rtp_session->stats.inbound.skip_packet_count++; goto end; } @@ -2225,14 +2225,14 @@ static int rtp_common_write(switch_rtp_t *rtp_session, goto end; } - rtp_session->stats.out.raw_bytes += bytes; - rtp_session->stats.out.packet_count++; + rtp_session->stats.outbound.raw_bytes += bytes; + rtp_session->stats.outbound.packet_count++; if (send_msg->header.pt == rtp_session->cng_pt) { - rtp_session->stats.out.cng_packet_count++; + rtp_session->stats.outbound.cng_packet_count++; } else { - rtp_session->stats.out.media_packet_count++; - rtp_session->stats.out.media_bytes += bytes; + rtp_session->stats.outbound.media_packet_count++; + rtp_session->stats.outbound.media_bytes += bytes; } if (rtp_session->timer.interval) { @@ -2346,10 +2346,10 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra return -1; } - rtp_session->stats.out.raw_bytes += bytes; - rtp_session->stats.out.media_bytes += bytes; - rtp_session->stats.out.media_packet_count++; - rtp_session->stats.out.packet_count++; + rtp_session->stats.outbound.raw_bytes += bytes; + rtp_session->stats.outbound.media_bytes += bytes; + rtp_session->stats.outbound.media_packet_count++; + rtp_session->stats.outbound.packet_count++; return (int) bytes; } @@ -2369,10 +2369,10 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra switch_size_t wrote = switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, frame->m, frame->payload, (uint32_t) (frame->timestamp), &frame->flags); - rtp_session->stats.out.raw_bytes += wrote; - rtp_session->stats.out.media_bytes += wrote; - rtp_session->stats.out.media_packet_count++; - rtp_session->stats.out.packet_count++; + rtp_session->stats.outbound.raw_bytes += wrote; + rtp_session->stats.outbound.media_bytes += wrote; + rtp_session->stats.outbound.media_packet_count++; + rtp_session->stats.outbound.packet_count++; } if (fwd) {