From 4d7e4f1ec20bb0091ac3a978d3927c0191f93ccd Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 21 Dec 2010 20:30:19 -0600 Subject: [PATCH] change switch_strip_spaces to specify if you want it to dup the string or destroy the current buffer --- src/include/switch_utils.h | 2 +- .../applications/mod_commands/mod_commands.c | 4 +-- .../languages/mod_managed/freeswitch_wrap.cxx | 30 +++++++++++++++++-- src/mod/languages/mod_managed/managed/swig.cs | 22 ++++++++++++-- src/mod/languages/mod_perl/mod_perl_wrap.cpp | 6 ++-- src/switch_utils.c | 10 +++++-- 6 files changed, 60 insertions(+), 14 deletions(-) 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/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.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_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;