From 8d965c32b2f8e38202fe8af29dadf8d20c7478b1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 3 Mar 2009 20:16:05 +0000 Subject: [PATCH] FSCORE-297 FSCORE-305 FSCORE-315 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12392 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- conf/autoload_configs/xml_rpc.conf.xml | 6 +- libs/esl/perl/ESL.pm | 5 +- libs/esl/perl/esl_wrap.cpp | 303 ++++++++--------------- src/mod/applications/mod_enum/mod_enum.c | 6 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 4 +- src/mod/endpoints/mod_sofia/sofia.c | 41 ++- src/switch_core.c | 15 ++ src/switch_rtp.c | 19 ++ 8 files changed, 171 insertions(+), 228 deletions(-) diff --git a/conf/autoload_configs/xml_rpc.conf.xml b/conf/autoload_configs/xml_rpc.conf.xml index 714a909907..57f790506c 100644 --- a/conf/autoload_configs/xml_rpc.conf.xml +++ b/conf/autoload_configs/xml_rpc.conf.xml @@ -3,8 +3,8 @@ - - - + + + diff --git a/libs/esl/perl/ESL.pm b/libs/esl/perl/ESL.pm index aa523997f7..ba08d1881d 100644 --- a/libs/esl/perl/ESL.pm +++ b/libs/esl/perl/ESL.pm @@ -1,8 +1,5 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.35 -# +# This file was created automatically by SWIG 1.3.29. # Don't modify this file, modify the SWIG interface instead. - package ESL; require Exporter; require DynaLoader; diff --git a/libs/esl/perl/esl_wrap.cpp b/libs/esl/perl/esl_wrap.cpp index 5dbf3cd7a1..86d8e0160b 100644 --- a/libs/esl/perl/esl_wrap.cpp +++ b/libs/esl/perl/esl_wrap.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.35 + * Version 1.3.29 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -12,7 +12,7 @@ #define SWIG_CASTRANK_MODE #ifdef __cplusplus -template class SwigValueWrapper { +template class SwigValueWrapper { T *tt; public: SwigValueWrapper() : tt(0) { } @@ -25,10 +25,6 @@ public: private: SwigValueWrapper& operator=(const SwigValueWrapper& rhs); }; - -template T SwigValueInit() { - return T(); -} #endif /* ----------------------------------------------------------------------------- @@ -38,14 +34,14 @@ template T SwigValueInit() { /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template +# if defined(__SUNPRO_CC) +# if (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif # else -# define SWIGTEMPLATEDISAMBIGUATOR +# define SWIGTEMPLATEDISAMBIGUATOR # endif #endif @@ -124,16 +120,10 @@ template T SwigValueInit() { #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) # define _CRT_SECURE_NO_DEPRECATE #endif -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - - /* ----------------------------------------------------------------------------- * swigrun.swg * @@ -143,7 +133,7 @@ template T SwigValueInit() { /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "2" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -178,7 +168,6 @@ template T SwigValueInit() { /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 -#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -319,10 +308,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { extern "C" { #endif -typedef void *(*swig_converter_func)(void *, int *); +typedef void *(*swig_converter_func)(void *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store information on one type */ +/* Structure to store inforomation on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ @@ -367,7 +356,7 @@ SWIG_TypeNameComp(const char *f1, const char *l1, while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } - return (int)((l1 - f1) - (l2 - f2)); + return (l1 - f1) - (l2 - f2); } /* @@ -449,8 +438,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +SWIG_TypeCast(swig_cast_info *ty, void *ptr) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); } /* @@ -803,10 +792,6 @@ extern "C" { # endif #endif /* !INT2PTR */ -#ifndef SvPV_nolen -# define SvPV_nolen(x) SvPV(x,PL_na) -#endif - #ifndef get_sv # define get_sv perl_get_sv #endif @@ -955,11 +940,6 @@ extern "C" { /* SWIG Perl macros */ -/* Macro to declare an XS function */ -#ifndef XSPROTO -# define XSPROTO(name) void name(pTHX_ CV* cv) -#endif - /* Macro to call an XS function */ #ifdef PERL_OBJECT # define SWIG_CALLXS(_name) _name(cv,pPerl) @@ -971,50 +951,51 @@ extern "C" { # endif #endif +/* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */ + #ifdef PERL_OBJECT #define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this; +typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif -typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *); +typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *); #ifdef __cplusplus } #endif #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) #define SWIGCLASS_STATIC - -#else /* PERL_OBJECT */ - +#else #define MAGIC_PPERL #define SWIGCLASS_STATIC static SWIGUNUSED - #ifndef MULTIPLICITY #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b) +typedef int (*SwigMagicFunc)(SV *, MAGIC *); #ifdef __cplusplus extern "C" { #endif -typedef int (*SwigMagicFunc)(SV *, MAGIC *); +typedef int (*SwigMagicFuncHack)(SV *, MAGIC *); #ifdef __cplusplus } #endif -#else /* MULTIPLICITY */ +#else #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b) - -#ifdef __cplusplus -extern "C" { -#endif typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *); #ifdef __cplusplus +extern "C" { +#endif +typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *); +#ifdef __cplusplus } #endif -#endif /* MULTIPLICITY */ -#endif /* PERL_OBJECT */ +#endif +#endif /* Workaround for bug in perl 5.6.x croak and earlier */ #if (PERL_VERSION < 8) @@ -1038,35 +1019,6 @@ static void SWIG_croak_null() #endif -/* - Define how strict is the cast between strings and integers/doubles - when overloading between these types occurs. - - The default is making it as strict as possible by using SWIG_AddCast - when needed. - - You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to - disable the SWIG_AddCast, making the casting between string and - numbers less strict. - - In the end, we try to solve the overloading between strings and - numerical types in the more natural way, but if you can avoid it, - well, avoid it using %rename, for example. -*/ -#ifndef SWIG_PERL_NO_STRICT_STR2NUM -# ifndef SWIG_PERL_STRICT_STR2NUM -# define SWIG_PERL_STRICT_STR2NUM -# endif -#endif -#ifdef SWIG_PERL_STRICT_STR2NUM -/* string takes precedence */ -#define SWIG_Str2NumCast(x) SWIG_AddCast(x) -#else -/* number takes precedence */ -#define SWIG_Str2NumCast(x) x -#endif - - #include @@ -1083,7 +1035,7 @@ SWIG_Perl_TypeProxyName(const swig_type_info *type) { SWIGRUNTIME swig_cast_info * SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) { - SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) + SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0)) || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty); } @@ -1141,11 +1093,7 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info * if (!tc) { return SWIG_ERROR; } - { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,voidptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } + *ptr = SWIG_TypeCast(tc,voidptr); } else { *ptr = voidptr; } @@ -1235,7 +1183,7 @@ SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_ const char *c = 0; if ((!obj) || (!SvOK(obj))) return SWIG_ERROR; - c = SvPV_nolen(obj); + c = SvPV(obj, PL_na); /* Pointer values must start with leading underscore */ if (*c != '_') return SWIG_ERROR; c++; @@ -1252,7 +1200,7 @@ SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_ #define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; } -typedef XSPROTO(SwigPerlWrapper); +typedef XS(SwigPerlWrapper); typedef SwigPerlWrapper *SwigPerlWrapperPtr; /* Structure for command table */ @@ -1305,8 +1253,8 @@ SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, i sv_magic(sv,sv,'U',(char *) name,strlen(name)); mg = mg_find(sv,'U'); mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL)); - mg->mg_virtual->svt_get = (SwigMagicFunc) get; - mg->mg_virtual->svt_set = (SwigMagicFunc) set; + mg->mg_virtual->svt_get = (SwigMagicFuncHack) get; + mg->mg_virtual->svt_set = (SwigMagicFuncHack) set; mg->mg_virtual->svt_len = 0; mg->mg_virtual->svt_clear = 0; mg->mg_virtual->svt_free = 0; @@ -1320,7 +1268,7 @@ SWIG_Perl_GetModule(void) { /* first check if pointer already created */ if (!type_pointer) { - pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI); + pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE); if (pointer && SvOK(pointer)) { type_pointer = INT2PTR(swig_type_info **, SvIV(pointer)); } @@ -1334,7 +1282,7 @@ SWIG_Perl_SetModule(swig_module_info *module) { SV *pointer; /* create a new pointer */ - pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI); + pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE); sv_setiv(pointer, PTR2IV(module)); } @@ -1429,12 +1377,6 @@ SWIG_Perl_SetModule(swig_module_info *module) { #ifdef check #undef check #endif -#ifdef seekdir - #undef seekdir -#endif -#ifdef open - #undef open -#endif @@ -1463,8 +1405,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0}; #define SWIG_name "ESLc::boot_ESL" #define SWIG_prefix "ESLc::" -#define SWIGVERSION 0x010335 -#define SWIG_VERSION SWIGVERSION +#define SWIGVERSION 0x010329 #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) @@ -1493,7 +1434,7 @@ SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *); SWIGINTERN swig_type_info* -SWIG_pchar_descriptor(void) +SWIG_pchar_descriptor() { static int init = 0; static swig_type_info* info = 0; @@ -1547,8 +1488,16 @@ SWIGINTERNINLINE SV * SWIG_FromCharPtrAndSize(const char* carray, size_t size) { SV *obj = sv_newmortal(); - if (carray) { - sv_setpvn(obj, carray, size); + if (size && carray) { + if (carray[size - 1] == 0) { + sv_setpv(obj, carray); + } else { + char *tmp = (new char[size + 1]); + memcpy(tmp, carray, size); + tmp[size] = 0; + sv_setpv(obj, tmp); + delete[] tmp; + } } else { sv_setsv(obj, &PL_sv_undef); } @@ -1564,12 +1513,14 @@ SWIG_FromCharPtr(const char *cptr) #include -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif +#ifndef LLONG_MIN +# define LLONG_MIN LONG_LONG_MIN +#endif +#ifndef LLONG_MAX +# define LLONG_MAX LONG_LONG_MAX +#endif +#ifndef ULLONG_MAX +# define ULLONG_MAX ULONG_LONG_MAX #endif @@ -1583,7 +1534,7 @@ SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val) if (val) *val = (double) SvIV(obj); return SWIG_AddCast(SWIG_OK); } else { - const char *nptr = SvPV_nolen(obj); + const char *nptr = SvPV(obj, PL_na); if (nptr) { char *endptr; double v = strtod(nptr, &endptr); @@ -1593,7 +1544,7 @@ SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val) } else { if (*endptr == '\0') { if (val) *val = v; - return SWIG_Str2NumCast(SWIG_OK); + return SWIG_AddCast(SWIG_OK); } } } @@ -1646,19 +1597,17 @@ SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val) return SWIG_OK; } else { int dispatch = 0; - const char *nptr = SvPV_nolen(obj); + const char *nptr = SvPV(obj, PL_na); if (nptr) { char *endptr; - long v; - errno = 0; - v = strtol(nptr, &endptr,0); + long v = strtol(nptr, &endptr,0); if (errno == ERANGE) { errno = 0; return SWIG_OverflowError; } else { if (*endptr == '\0') { if (val) *val = v; - return SWIG_Str2NumCast(SWIG_OK); + return SWIG_AddCast(SWIG_OK); } } } @@ -1719,10 +1668,6 @@ SWIG_From_bool SWIG_PERL_DECL_ARGS_1(bool value) return obj; } -#ifdef __cplusplus -extern "C" { -#endif - #ifdef PERL_OBJECT #define MAGIC_CLASS _wrap_ESL_var:: class _wrap_ESL_var : public CPerlObj { @@ -1741,10 +1686,6 @@ SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SW }; #endif -#ifdef __cplusplus -} -#endif - #ifdef __cplusplus extern "C" { #endif @@ -1838,11 +1779,11 @@ XS(_wrap_ESLevent_serialized_string_set) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialized_string_set" "', argument " "2"" of type '" "char *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; if (arg1->serialized_string) delete[] arg1->serialized_string; if (arg2) { - size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; - arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + size_t size = strlen(arg2) + 1; + arg1->serialized_string = reinterpret_cast< char* >(memcpy((new char[size]), arg2, sizeof(char)*(size))); } else { arg1->serialized_string = 0; } @@ -1876,7 +1817,7 @@ XS(_wrap_ESLevent_serialized_string_get) { } arg1 = reinterpret_cast< ESLevent * >(argp1); result = (char *) ((arg1)->serialized_string); - ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + ST(argvi) = SWIG_FromCharPtr(result); argvi++ ; XSRETURN(argvi); fail: @@ -1973,13 +1914,13 @@ XS(_wrap_new_ESLevent__SWIG_0) { if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "char const *""'"); } - arg1 = reinterpret_cast< char * >(buf1); + arg1 = buf1; if (items > 1) { res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; } result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2); ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ; @@ -2222,10 +2163,10 @@ XS(_wrap_ESLevent_serialize) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialize" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; } result = (char *)(arg1)->serialize((char const *)arg2); - ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + ST(argvi) = SWIG_FromCharPtr(result); argvi++ ; if (alloc2 == SWIG_NEWOBJ) delete[] buf2; XSRETURN(argvi); @@ -2306,9 +2247,9 @@ XS(_wrap_ESLevent_getHeader) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; result = (char *)(arg1)->getHeader(arg2); - ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + ST(argvi) = SWIG_FromCharPtr(result); argvi++ ; if (alloc2 == SWIG_NEWOBJ) delete[] buf2; XSRETURN(argvi); @@ -2338,7 +2279,7 @@ XS(_wrap_ESLevent_getBody) { } arg1 = reinterpret_cast< ESLevent * >(argp1); result = (char *)(arg1)->getBody(); - ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + ST(argvi) = SWIG_FromCharPtr(result); argvi++ ; XSRETURN(argvi); fail: @@ -2366,7 +2307,7 @@ XS(_wrap_ESLevent_getType) { } arg1 = reinterpret_cast< ESLevent * >(argp1); result = (char *)(arg1)->getType(); - ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + ST(argvi) = SWIG_FromCharPtr(result); argvi++ ; XSRETURN(argvi); fail: @@ -2401,7 +2342,7 @@ XS(_wrap_ESLevent_addBody) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addBody" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; result = (bool)(arg1)->addBody((char const *)arg2); ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; @@ -2444,12 +2385,12 @@ XS(_wrap_ESLevent_addHeader) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addHeader" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_addHeader" "', argument " "3"" of type '" "char const *""'"); } - arg3 = reinterpret_cast< char * >(buf3); + arg3 = buf3; result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3); ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; @@ -2490,7 +2431,7 @@ XS(_wrap_ESLevent_delHeader) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_delHeader" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; result = (bool)(arg1)->delHeader((char const *)arg2); ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ; @@ -2585,17 +2526,17 @@ XS(_wrap_new_ESLconnection__SWIG_0) { if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'"); } - arg1 = reinterpret_cast< char * >(buf1); + arg1 = buf1; res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'"); } - arg3 = reinterpret_cast< char * >(buf3); + arg3 = buf3; result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3); ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ; if (alloc1 == SWIG_NEWOBJ) delete[] buf1; @@ -2826,7 +2767,7 @@ XS(_wrap_ESLconnection_send) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_send" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; result = (int)(arg1)->send((char const *)arg2); ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; @@ -2865,7 +2806,7 @@ XS(_wrap_ESLconnection_sendRecv) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendRecv" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; result = (ESLevent *)(arg1)->sendRecv((char const *)arg2); ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, 0 | SWIG_SHADOW); argvi++ ; @@ -3116,12 +3057,12 @@ XS(_wrap_ESLconnection_filter) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_filter" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'"); } - arg3 = reinterpret_cast< char * >(buf3); + arg3 = buf3; result = (int)(arg1)->filter((char const *)arg2,(char const *)arg3); ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; @@ -3166,12 +3107,12 @@ XS(_wrap_ESLconnection_events) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_events" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_events" "', argument " "3"" of type '" "char const *""'"); } - arg3 = reinterpret_cast< char * >(buf3); + arg3 = buf3; result = (int)(arg1)->events((char const *)arg2,(char const *)arg3); ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; @@ -3220,20 +3161,20 @@ XS(_wrap_ESLconnection_execute) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_execute" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; if (items > 2) { res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_execute" "', argument " "3"" of type '" "char const *""'"); } - arg3 = reinterpret_cast< char * >(buf3); + arg3 = buf3; } if (items > 3) { res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_execute" "', argument " "4"" of type '" "char const *""'"); } - arg4 = reinterpret_cast< char * >(buf4); + arg4 = buf4; } result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4); ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; @@ -3277,7 +3218,7 @@ XS(_wrap_ESLconnection_setBlockingExecute) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setBlockingExecute" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; result = (int)(arg1)->setBlockingExecute((char const *)arg2); ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; @@ -3316,7 +3257,7 @@ XS(_wrap_ESLconnection_setEventLock) { if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setEventLock" "', argument " "2"" of type '" "char const *""'"); } - arg2 = reinterpret_cast< char * >(buf2); + arg2 = buf2; result = (int)(arg1)->setEventLock((char const *)arg2); ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; @@ -3452,7 +3393,7 @@ static swig_command_info swig_commands[] = { * structures together. * * The generated swig_type_info structures are assigned staticly to an initial - * array. We just loop through that array, and handle each type individually. + * array. We just loop though that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a @@ -3490,58 +3431,32 @@ extern "C" { #define SWIGRUNTIME_DEBUG #endif - SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; - swig_module_info *module_head, *iter; - int found, init; + swig_module_info *module_head; + static int init_run = 0; clientdata = clientdata; - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - init = 1; - } else { - init = 0; - } + if (init_run) return; + init_run = 1; + + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); - if (!module_head) { - /* This is the first module loaded for this interpreter */ - /* so set the swig module into the interpreter */ - SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; - } else { - /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; - iter=module_head; - do { - if (iter==&swig_module) { - found=1; - break; - } - iter=iter->next; - } while (iter!= module_head); - - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ + if (module_head) { swig_module.next = module_head->next; module_head->next = &swig_module; + } else { + /* This is the first module loaded */ + swig_module.next = &swig_module; + SWIG_SetModule(clientdata, &swig_module); } - /* When multiple interpeters are used, a module could have already been initialized in - a different interpreter, but not yet have a pointer in this interpreter. - In this case, we do not want to continue adding types... everything should be - set up already */ - if (init == 0) return; - /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); @@ -3695,7 +3610,7 @@ XS(SWIG_init) { /* Install variables */ for (i = 0; swig_variables[i].name; i++) { SV *sv; - sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI); + sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2); if (swig_variables[i].type) { SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0); } else { @@ -3707,7 +3622,7 @@ XS(SWIG_init) { /* Install constant */ for (i = 0; swig_constants[i].type; i++) { SV *sv; - sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI); + sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2); switch(swig_constants[i].type) { case SWIG_INT: sv_setiv(sv, (IV) swig_constants[i].lvalue); diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index 3c38bebe0a..c4443a25a9 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -93,9 +93,9 @@ static void add_route(char *service, char *regex, char *replace) route = switch_core_alloc(globals.pool, sizeof(*route)); - route->service = strdup(service); - route->regex = strdup(regex); - route->replace = strdup(replace); + route->service = switch_core_strdup(globals.pool, service); + route->regex = switch_core_strdup(globals.pool, regex); + route->replace = switch_core_strdup(globals.pool, replace); switch_mutex_lock(MUTEX); if (!globals.route_order) { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index cab854094f..17abbfb6a6 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2964,12 +2964,12 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown) while (mod_sofia_globals.threads) { switch_cond_next(); - if (++sanity >= 10000) { + if (++sanity >= 60000) { break; } } - switch_yield(1000000); + //switch_yield(1000000); su_deinit(); switch_mutex_lock(mod_sofia_globals.hash_mutex); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d6046ed570..e6ba1f7618 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -662,7 +662,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread return NULL; } -void launch_sofia_worker_thread(sofia_profile_t *profile) +switch_thread_t *launch_sofia_worker_thread(sofia_profile_t *profile) { switch_thread_t *thread; switch_threadattr_t *thd_attr = NULL; @@ -680,6 +680,8 @@ void launch_sofia_worker_thread(sofia_profile_t *profile) break; } } + + return thread; } void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj) @@ -693,6 +695,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void int use_timer = !sofia_test_pflag(profile, PFLAG_DISABLE_TIMER); const char *supported = NULL; int sanity; + switch_thread_t *worker_thread; + switch_status_t st; switch_mutex_lock(mod_sofia_globals.mutex); mod_sofia_globals.threads++; @@ -823,7 +827,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void profile->started = switch_epoch_time_now(NULL); sofia_set_pflag_locked(profile, PFLAG_RUNNING); - launch_sofia_worker_thread(profile); + worker_thread = launch_sofia_worker_thread(profile); switch_yield(1000000); @@ -850,15 +854,11 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void sofia_reg_unregister(profile); nua_shutdown(profile->nua); su_root_run(profile->s_root); - nua_shutdown(profile->nua); - su_root_run(profile->s_root); - + sofia_clear_pflag_locked(profile, PFLAG_RUNNING); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n"); - while (sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) { - switch_yield(100000); - } + switch_thread_join(&st, worker_thread); sanity = 4; while (profile->inuse) { @@ -3243,10 +3243,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, case nua_callstate_terminating: if (status == 488 || switch_channel_get_state(channel) == CS_HIBERNATE) { tech_pvt->q850_cause = SWITCH_CAUSE_MANDATORY_IE_MISSING; - } else if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { - sofia_set_flag_locked(tech_pvt, TFLAG_BYE); } - break; case nua_callstate_terminated: if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { sofia_set_flag_locked(tech_pvt, TFLAG_BYE); @@ -3274,17 +3271,17 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_channel_hangup(channel, cause); } } - - if (tech_pvt->sofia_private) { - tech_pvt->sofia_private = NULL; - } - - tech_pvt->nh = NULL; - - - if (nh) { - nua_handle_bind(nh, NULL); - nua_handle_destroy(nh); + if (ss_state == nua_callstate_terminated) { + if (tech_pvt->sofia_private) { + tech_pvt->sofia_private = NULL; + } + + tech_pvt->nh = NULL; + + if (nh) { + nua_handle_bind(nh, NULL); + nua_handle_destroy(nh); + } } break; } diff --git a/src/switch_core.c b/src/switch_core.c index 30b1353bc2..a1a7736105 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -249,6 +249,20 @@ SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname) return val; } +static void switch_core_unset_variables(void) +{ + switch_hash_index_t *hi; + const void *var; + void *val; + + switch_mutex_lock(runtime.global_var_mutex); + for (hi = switch_hash_first(NULL, runtime.global_vars); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, &var, NULL, &val); + free(val); + } + switch_mutex_unlock(runtime.global_var_mutex); +} + SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *value) { char *val; @@ -1488,6 +1502,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n"); switch_log_shutdown(); + switch_core_unset_variables(); switch_core_memory_stop(); if (runtime.console && runtime.console != stdout && runtime.console != stderr) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index e91a28dbc4..ab935ca449 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -409,7 +409,26 @@ SWITCH_DECLARE(void) switch_rtp_get_random(void *buf, uint32_t len) SWITCH_DECLARE(void) switch_rtp_shutdown(void) { + switch_core_port_allocator_t *alloc = NULL; + switch_hash_index_t *hi; + const void *var; + void *val; + + switch_mutex_lock(port_lock); + + for (hi = switch_hash_first(NULL, alloc_hash); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, &var, NULL, &val); + if ((alloc = (switch_core_port_allocator_t *) val)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy port allocator for %s\n", (char *)var); + switch_core_port_allocator_destroy(&alloc); + } + } + switch_core_hash_destroy(&alloc_hash); + switch_mutex_unlock(port_lock); + + crypto_kernel_shutdown(); + } SWITCH_DECLARE(switch_port_t) switch_rtp_set_start_port(switch_port_t port)