diff --git a/conf/directory/default/default.xml b/conf/directory/default/default.xml index 5db60112dc..aa138f18d9 100644 --- a/conf/directory/default/default.xml +++ b/conf/directory/default/default.xml @@ -1,7 +1,7 @@ <include> <user id="default"> <!--if id is numeric mailbox param is not necessary--> <!-- - ATTENTION PLEASE READ THIS... (I know you won't but you've been warrned) + ATTENTION PLEASE READ THIS... (I know you won't but you've been warned) Let it be known that this user can register without a password but since we do not assign this user a user_context and we don't authenticate this user they will be put in context 'public'. diff --git a/conf/vars.xml b/conf/vars.xml index f17540c93a..0e8782cff0 100644 --- a/conf/vars.xml +++ b/conf/vars.xml @@ -206,6 +206,7 @@ <X-PRE-PROCESS cmd="set" data="ru-ring=%(800,3200,425,0)"/> <X-PRE-PROCESS cmd="set" data="de-ring=%(1000,4000,425,0)"/> <X-PRE-PROCESS cmd="set" data="dz-ring=%(1500,3500,425.0,0.0)"/> + <X-PRE-PROCESS cmd="set" data="pl-ring=%(1000,4000,425,0)"/> <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/> <X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/> <!-- diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index b7df8ea870..d2c443a9e7 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -100,7 +100,9 @@ struct stfu_instance { uint32_t sync_out; uint32_t sync_in; - + int32_t ts_offset; + int32_t ts_drift; + int32_t ts_diff; int32_t last_ts_diff; int32_t same_ts; @@ -126,6 +128,11 @@ static void default_logger(const char *file, const char *func, int line, int lev stfu_logger_t stfu_log = null_logger; +int32_t stfu_n_get_drift(stfu_instance_t *i) +{ + return i->ts_drift; +} + void stfu_global_set_logger(stfu_logger_t logger) { if (logger) { @@ -376,7 +383,7 @@ static void stfu_n_swap(stfu_instance_t *i) i->out_queue->last_jitter = 0; } -stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last) +stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last) { uint32_t index = 0; stfu_frame_t *frame; @@ -402,6 +409,12 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void } } + if (timer_ts && ts && !i->ts_offset) { + i->ts_offset = timer_ts - ts; + } + + i->ts_drift = ts + (i->ts_offset - timer_ts); + if (i->sync_in) { good_ts = 1; i->sync_in = 0; @@ -480,12 +493,12 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void if (stfu_log != null_logger && i->debug) { - stfu_log(STFU_LOG_EMERG, "%s %u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u:%u - %u %d %u %u %d %d\n", i->name, - i->qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count, - i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count, - ts, ts / i->samples_per_packet, - i->period_missing_count, i->period_need_range_avg, - i->last_wr_ts, ts, i->diff, i->diff_total / least1(i->period_packet_in_count)); + stfu_log(STFU_LOG_EMERG, "I: %s %u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u:%u - %u %d %u %u %d %d %d\n", i->name, + i->qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count, + i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count, + ts, ts / i->samples_per_packet, + i->period_missing_count, i->period_need_range_avg, + i->last_wr_ts, ts, i->diff, i->diff_total / least1(i->period_packet_in_count), i->ts_drift); } if (last || i->in_queue->array_len == i->in_queue->array_size) { diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h index ad769c62e2..b92bb3f839 100644 --- a/libs/stfu/stfu.h +++ b/libs/stfu/stfu.h @@ -181,15 +181,16 @@ void stfu_n_report(stfu_instance_t *i, stfu_report_t *r); void stfu_n_destroy(stfu_instance_t **i); stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second); stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen); -stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last); +stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last); stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i); void stfu_n_reset(stfu_instance_t *i); stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets); void stfu_n_call_me(stfu_instance_t *i, stfu_n_call_me_t callback, void *udata); void stfu_n_debug(stfu_instance_t *i, const char *name); +int32_t stfu_n_get_drift(stfu_instance_t *i); -#define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 1) -#define stfu_n_eat(i,t,p,d,l) stfu_n_add_data(i, t, p, d, l, 0) +#define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 0, 1) +#define stfu_n_eat(i,t,p,d,l,tt) stfu_n_add_data(i, t, p, d, l, tt, 0) #ifdef __cplusplus } diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index e2a7335226..3360f33fe5 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -622,7 +622,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(_In_ char *buf, char delim, SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen); SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str); -SWITCH_DECLARE(char *) switch_strip_spaces(const char *str); +SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup); SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str); SWITCH_DECLARE(char *) switch_strip_commas(char *in, char *out, switch_size_t len); SWITCH_DECLARE(char *) switch_strip_nonnumerics(char *in, char *out, switch_size_t len); diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index dba86e3103..2deb437948 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1428,8 +1428,8 @@ SWITCH_STANDARD_API(cond_function) int a_is_num, b_is_num; *expr++ = '\0'; b = expr; - s_a = switch_strip_spaces(a); - s_b = switch_strip_spaces(b); + s_a = switch_strip_spaces(a, SWITCH_TRUE); + s_b = switch_strip_spaces(b, SWITCH_TRUE); a_is_num = switch_is_number(s_a); b_is_num = switch_is_number(s_b); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index cf8ae96da0..fa1f12c13f 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -30,6 +30,7 @@ * Chris Danielson <chris at maxpowersoft dot com> * Rupa Schomaker <rupa@rupa.com> * David Weekly <david@weekly.org> + * Joao Mesquita <jmesquita@gmail.com> * * mod_conference.c -- Software Conference Bridge * @@ -689,8 +690,14 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe } if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ) && !zstr(conference->enter_sound)) { - conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), - switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + const char * enter_sound = switch_channel_get_variable(channel, "conference_enter_sound"); + if (!zstr(enter_sound)) { + conference_play_file(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN, + switch_core_session_get_channel(member->session), !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + } else { + conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), + !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + } } } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 945740eb57..961eaa3ea0 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1065,6 +1065,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (exptime && v_event && *v_event) { char *exp_var; char *allow_multireg = NULL; + int force_connectile = 0; allow_multireg = switch_event_get_header(*v_event, "sip-allow-multiple-registrations"); if (allow_multireg && switch_false(allow_multireg)) { @@ -1081,8 +1082,13 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand to_user = force_user; } - if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) { - if (!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0")) { + if (profile->rport_level == 3 && sip->sip_user_agent && + sip->sip_user_agent->g_string && !strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7)) { + force_connectile = 1; + } + + if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact")) || force_connectile) { + if ((!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0")) || force_connectile) { char *path_encoded; size_t path_encoded_len; char my_contact_str[1024]; diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 1ad1b16b9a..6ffeeed517 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -12406,13 +12406,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) { } -SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) { +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1, int jarg2) { char * jresult ; char *arg1 = (char *) 0 ; + switch_bool_t arg2 ; char *result = 0 ; arg1 = (char *)jarg1; - result = (char *)switch_strip_spaces((char const *)arg1); + arg2 = (switch_bool_t)jarg2; + result = (char *)switch_strip_spaces(arg1,arg2); jresult = SWIG_csharp_string_callback((const char *)result); return jresult; } @@ -22969,6 +22971,16 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_extension(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_sort_cid(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_sort_cid(arg1,arg2); +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_extension(void * jarg1) { void * jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -28310,6 +28322,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_debug_jitter_buffer(void * jarg1, char * jarg2) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_rtp_debug_jitter_buffer(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jarg1) { int jresult ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 1d3c5d60ce..2c88f65ab6 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -12726,13 +12726,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) { } -SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) { +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1, int jarg2) { char * jresult ; char *arg1 = (char *) 0 ; + switch_bool_t arg2 ; char *result = 0 ; arg1 = (char *)jarg1; - result = (char *)switch_strip_spaces((char const *)arg1); + arg2 = (switch_bool_t)jarg2; + result = (char *)switch_strip_spaces(arg1,arg2); jresult = SWIG_csharp_string_callback((const char *)result); return jresult; } @@ -23624,6 +23626,16 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_extension(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_sort_cid(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_sort_cid(arg1,arg2); +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_extension(void * jarg1) { void * jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -29013,6 +29025,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_debug_jitter_buffer(void * jarg1, char * jarg2) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_rtp_debug_jitter_buffer(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jarg1) { int jresult ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 4b9ce71e60..d0d09b6121 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2877,8 +2877,8 @@ public class freeswitch { return ret; } - public static string switch_strip_spaces(string str) { - string ret = freeswitchPINVOKE.switch_strip_spaces(str); + public static string switch_strip_spaces(string str, switch_bool_t dup) { + string ret = freeswitchPINVOKE.switch_strip_spaces(str, (int)dup); return ret; } @@ -3328,6 +3328,10 @@ public class freeswitch { freeswitchPINVOKE.switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_extension.getCPtr(caller_extension)); } + public static void switch_channel_sort_cid(SWIGTYPE_p_switch_channel channel, switch_bool_t arg1) { + freeswitchPINVOKE.switch_channel_sort_cid(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)arg1); + } + public static switch_caller_extension switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel channel) { IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel)); switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false); @@ -4645,6 +4649,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, string name) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), name); + return ret; + } + public static switch_status_t switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); return ret; @@ -8661,7 +8670,7 @@ class freeswitchPINVOKE { public static extern int switch_is_number(string jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")] - public static extern string switch_strip_spaces(string jarg1); + public static extern string switch_strip_spaces(string jarg1, int jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_whitespace")] public static extern string switch_strip_whitespace(string jarg1); @@ -11327,6 +11336,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_extension")] public static extern void switch_channel_set_caller_extension(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_sort_cid")] + public static extern void switch_channel_sort_cid(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_extension")] public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1); @@ -12455,6 +12467,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")] public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_debug_jitter_buffer")] + public static extern int switch_rtp_debug_jitter_buffer(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")] public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1); @@ -21563,6 +21578,7 @@ public enum switch_channel_flag_t { CF_BRIDGE_NOWRITE, CF_RECOVERED, CF_JITTERBUFFER, + CF_DIALPLAN, CF_FLAG_MAX } diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 9decf74045..bf328811dd 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2867,8 +2867,8 @@ public class freeswitch { return ret; } - public static string switch_strip_spaces(string str) { - string ret = freeswitchPINVOKE.switch_strip_spaces(str); + public static string switch_strip_spaces(string str, switch_bool_t dup) { + string ret = freeswitchPINVOKE.switch_strip_spaces(str, (int)dup); return ret; } @@ -3318,6 +3318,10 @@ public class freeswitch { freeswitchPINVOKE.switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_extension.getCPtr(caller_extension)); } + public static void switch_channel_sort_cid(SWIGTYPE_p_switch_channel channel, switch_bool_t arg1) { + freeswitchPINVOKE.switch_channel_sort_cid(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)arg1); + } + public static switch_caller_extension switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel channel) { IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel)); switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false); @@ -4635,6 +4639,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, string name) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), name); + return ret; + } + public static switch_status_t switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); return ret; @@ -8647,7 +8656,7 @@ class freeswitchPINVOKE { public static extern int switch_is_number(string jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")] - public static extern string switch_strip_spaces(string jarg1); + public static extern string switch_strip_spaces(string jarg1, int jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_whitespace")] public static extern string switch_strip_whitespace(string jarg1); @@ -11313,6 +11322,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_extension")] public static extern void switch_channel_set_caller_extension(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_sort_cid")] + public static extern void switch_channel_sort_cid(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_extension")] public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1); @@ -12441,6 +12453,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")] public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_debug_jitter_buffer")] + public static extern int switch_rtp_debug_jitter_buffer(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")] public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1); @@ -21509,6 +21524,7 @@ public enum switch_channel_flag_t { CF_BRIDGE_NOWRITE, CF_RECOVERED, CF_JITTERBUFFER, + CF_DIALPLAN, CF_FLAG_MAX } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 370c88bc99..2efbdf1abc 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -9732,17 +9732,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); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index cd74c332b7..68d5a55b40 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2285,7 +2285,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 break; } - stfu_n_eat(jb, ts, read_frame->payload, read_frame->data, read_frame->datalen); + stfu_n_eat(jb, ts, read_frame->payload, read_frame->data, read_frame->datalen, 0); ts += interval; if ((jb_frame = stfu_n_read_a_frame(jb))) { diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 710c0a738c..b983d5ed91 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1874,6 +1874,11 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t status = SWITCH_STATUS_SUCCESS; } + if ((min_digits == 0) && (strlen(digit_buffer) == 0) && switch_channel_get_variable(channel, SWITCH_READ_TERMINATOR_USED_VARIABLE) != 0) + { + return SWITCH_STATUS_SUCCESS; + } + if (!(status == SWITCH_STATUS_TOO_SMALL && strlen(digit_buffer) == 0)) { if (status == SWITCH_STATUS_SUCCESS) { if (!zstr(digit_buffer)) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 4e667fb49b..1600e2858f 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -174,6 +174,7 @@ struct switch_rtp { void *private_data; uint32_t ts; uint32_t last_write_ts; + uint32_t last_read_ts; uint32_t last_write_samplecount; uint32_t next_write_samplecount; switch_time_t last_write_timestamp; @@ -2135,19 +2136,6 @@ static void do_flush(switch_rtp_t *rtp_session) flushed++; -#ifdef _MSC_VER -#pragma warning(push) /* remove this stuff when "if (0" is removed */ -#pragma warning(disable:4127) -#endif - if (0 && rtp_session->jb) { - stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), - rtp_session->recv_msg.header.pt, - rtp_session->recv_msg.body, bytes - rtp_header_len); - } -#ifdef _MSC_VER -#pragma warning(pop) -#endif - rtp_session->stats.inbound.raw_bytes += bytes; rtp_session->stats.inbound.flush_packet_count++; rtp_session->stats.inbound.packet_count++; @@ -2196,12 +2184,15 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t rtp_session->stats.inbound.packet_count++; } + if ((rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) || - *bytes < rtp_header_len || + (*bytes < rtp_header_len && *bytes > 0) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) { return SWITCH_STATUS_SUCCESS; } - + + + rtp_session->last_read_ts = ntohl(rtp_session->recv_msg.header.ts); if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) { if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->recv_te && @@ -2209,16 +2200,17 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t stfu_n_reset(rtp_session->jb); } - stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), + stfu_n_eat(rtp_session->jb, rtp_session->last_read_ts, rtp_session->recv_msg.header.pt, - rtp_session->recv_msg.body, *bytes - rtp_header_len); + rtp_session->recv_msg.body, *bytes - rtp_header_len, rtp_session->timer.samplecount); *bytes = 0; status = SWITCH_STATUS_FALSE; } - if (rtp_session->jb) { + if (rtp_session->jb && !rtp_session->checked_jb) { if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) { memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen); + if (jb_frame->plc) { (*flags) |= SFF_PLC; } else { @@ -2229,6 +2221,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t rtp_session->recv_msg.header.pt = jb_frame->pt; status = SWITCH_STATUS_SUCCESS; } + rtp_session->checked_jb++; } @@ -2385,7 +2378,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ rtp_session->read_pollfd) { if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) { rtp_session->hot_hits += rtp_session->samples_per_interval; - + if (rtp_session->hot_hits >= rtp_session->samples_per_second * 5) { switch_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH); hot_socket = 1; @@ -2927,12 +2920,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (do_cng) { uint8_t *data = (uint8_t *) rtp_session->recv_msg.body; - int fdr; - - if ((poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, 0)) == SWITCH_STATUS_SUCCESS) { - goto recvfrom; - } - + memset(data, 0, 2); data[0] = 65; rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD; diff --git a/src/switch_utils.c b/src/switch_utils.c index 1a29e2b715..7331a971b3 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -831,9 +831,9 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str) return s; } -SWITCH_DECLARE(char *) switch_strip_spaces(const char *str) +SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup) { - const char *sp = str; + char *sp = str; char *p, *s = NULL; if (!sp) @@ -843,7 +843,11 @@ SWITCH_DECLARE(char *) switch_strip_spaces(const char *str) sp++; } - s = strdup(sp); + if (dup) { + s = strdup(sp); + } else { + s = sp; + } if (!s) return NULL;