diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 2126cb2152..56ceda78df 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -947,7 +947,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_opal", "src\mod\endpoin {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_skinny", "src\mod\endpoints\mod_skinny\mod_skinny_2008.vcproj", "{CC1DD008-9406-448d-A0AD-33C3186CFADB}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_skinny", "src\mod\endpoints\mod_skinny\mod_skinny_2008.vcproj", "{CC1DD008-9406-448D-A0AD-33C3186CFADB}" ProjectSection(ProjectDependencies) = postProject {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} EndProjectSection @@ -1098,6 +1098,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_silk", "src\mod\codecs\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Silk_FIX", "libs\silk\src\Silk_FIX.2008.vcproj", "{56B91D01-9150-4BBF-AFA1-5B68AB991B76}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_avmd", "src\mod\applications\mod_avmd\mod_avmd.2008.vcproj", "{990BAA76-89D3-4E38-8479-C7B28784EFC8}" + ProjectSection(ProjectDependencies) = postProject + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2399,13 +2404,12 @@ Global {05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|x64.ActiveCfg = Debug|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|x64.ActiveCfg = Release|Win32 - {CC1DD008-9406-448d-A0AD-33C3186CFADB}.All|Win32.ActiveCfg = Release|Win32 - {CC1DD008-9406-448d-A0AD-33C3186CFADB}.All|Win32.Build.0 = Release|Win32 - {CC1DD008-9406-448d-A0AD-33C3186CFADB}.All|x64.ActiveCfg = Release|Win32 - {CC1DD008-9406-448d-A0AD-33C3186CFADB}.Debug|Win32.ActiveCfg = Debug|Win32 - {CC1DD008-9406-448d-A0AD-33C3186CFADB}.Debug|x64.ActiveCfg = Debug|Win32 - {CC1DD008-9406-448d-A0AD-33C3186CFADB}.Release|Win32.ActiveCfg = Release|Win32 - {CC1DD008-9406-448d-A0AD-33C3186CFADB}.Release|x64.ActiveCfg = Release|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|Win32.ActiveCfg = Release|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|x64.ActiveCfg = Release|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|Win32.ActiveCfg = Debug|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x64.ActiveCfg = Debug|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|Win32.ActiveCfg = Release|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x64.ActiveCfg = Release|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32 @@ -2761,6 +2765,17 @@ Global {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|Win32.Build.0 = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|x64.ActiveCfg = Release|x64 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|x64.Build.0 = Release|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|Win32.ActiveCfg = Release|Win32 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|Win32.Build.0 = Release|Win32 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|x64.ActiveCfg = Release|Win32 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|Win32.ActiveCfg = Debug|Win32 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|Win32.Build.0 = Debug|Win32 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|x64.ActiveCfg = Debug|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|x64.Build.0 = Debug|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|Win32.ActiveCfg = Release|Win32 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|Win32.Build.0 = Release|Win32 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|x64.ActiveCfg = Release|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2782,7 +2797,7 @@ Global {0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {B3F424EC-3D8F-417C-B244-3919D5E1A577} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {05C9FB27-480E-4D53-B3B7-6338E2526666} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} - {CC1DD008-9406-448d-A0AD-33C3186CFADB} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} + {CC1DD008-9406-448D-A0AD-33C3186CFADB} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} @@ -2804,6 +2819,7 @@ Global {3C977801-FE88-48F2-83D3-FA2EBFF6688E} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {432DB165-1EB2-4781-A9C0-71E62610B20A} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} + {990BAA76-89D3-4E38-8479-C7B28784EFC8} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} diff --git a/src/mod/applications/mod_avmd/buffer.h b/src/mod/applications/mod_avmd/buffer.h index cadf76d733..bb5b1b1d84 100644 --- a/src/mod/applications/mod_avmd/buffer.h +++ b/src/mod/applications/mod_avmd/buffer.h @@ -3,6 +3,13 @@ #include #include +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif + #define BUFF_TYPE double typedef struct { @@ -18,20 +25,20 @@ typedef struct { extern size_t next_power_of_2(size_t v); #define INC_POS(b) \ - do{ \ + { \ (b)->pos++; \ (b)->pos &= (b)->mask; \ (b)->lpos++; \ if((b)->backlog < (b)->buf_len) (b)->backlog++; \ - }while(0) + } #define DEC_POS(b) \ - do{ \ + { \ (b)->pos--; \ (b)->pos &= (b)->mask; \ (b)->lpos--; \ if(((b)->backlog - 1) < (b)->backlog) (b)->backlog--; \ - }while(0) + } #define GET_SAMPLE(b, i) ((b)->buf[(i) & (b)->mask]) #define SET_SAMPLE(b, i, v) ((b)->buf[(i) & (b)->mask] = (v)) @@ -49,7 +56,7 @@ extern size_t next_power_of_2(size_t v); }while(0) #define INSERT_INT16_FRAME(b, f, l) \ - do{ \ + { \ for((b)->i = 0; (b)->i < (l); (b)->i++){ \ SET_SAMPLE( \ (b), \ @@ -66,13 +73,13 @@ extern size_t next_power_of_2(size_t v); (b)->pos &= (b)->mask; \ (b)->backlog += (l); \ if((b)->backlog > (b)->buf_len) (b)->backlog = (b)->buf_len; \ - }while(0) + } #define CALC_BUFF_LEN(fl, bl) (((fl) >= (bl))? next_power_of_2((fl) << 1): next_power_of_2((bl) << 1)) #define INIT_CIRC_BUFFER(bf, bl, fl) \ - do{ \ + { \ (bf)->buf_len = CALC_BUFF_LEN((fl), (bl)); \ (bf)->mask = (bf)->buf_len - 1; \ (bf)->buf = (BUFF_TYPE *)calloc((bf)->buf_len, sizeof(BUFF_TYPE)); \ @@ -80,7 +87,7 @@ extern size_t next_power_of_2(size_t v); (bf)->pos = 0; \ (bf)->lpos = 0; \ (bf)->backlog = 0; \ - }while(0) + } #define DESTROY_CIRC_BUFFER(b) free((b)->buf) #define GET_BACKLOG_POS(b) ((b)->lpos - (b)->backlog) diff --git a/src/mod/applications/mod_avmd/fast_acosf.c b/src/mod/applications/mod_avmd/fast_acosf.c index e19a41d75e..8f6fd0df88 100644 --- a/src/mod/applications/mod_avmd/fast_acosf.c +++ b/src/mod/applications/mod_avmd/fast_acosf.c @@ -1,14 +1,20 @@ #include #include +#ifndef _MSC_VER #include +#endif #include #include #include +#ifndef _MSC_VER #include +#endif #include #include #include +#ifndef _MSC_VER #include +#endif #include "fast_acosf.h" #include "options.h" diff --git a/src/mod/applications/mod_avmd/goertzel.h b/src/mod/applications/mod_avmd/goertzel.h index 6e976662c0..a735cf8ce3 100644 --- a/src/mod/applications/mod_avmd/goertzel.h +++ b/src/mod/applications/mod_avmd/goertzel.h @@ -1,9 +1,16 @@ #ifndef __GOERTZEL_H__ #define __GOERTZEL_H__ +#ifndef _MSC_VER #include +#endif #include "buffer.h" +#if !defined(M_PI) +/* C99 systems may not define M_PI */ +#define M_PI 3.14159265358979323846264338327 +#endif + extern double goertzel(circ_buffer_t *b, size_t pos, double f, size_t num); #endif diff --git a/src/mod/applications/mod_avmd/mod_avmd.2008.vcproj b/src/mod/applications/mod_avmd/mod_avmd.2008.vcproj new file mode 100644 index 0000000000..6480f9b153 --- /dev/null +++ b/src/mod/applications/mod_avmd/mod_avmd.2008.vcproj @@ -0,0 +1,339 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index 77a40de337..74372a0c2d 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -535,8 +535,12 @@ static void avmd_process(avmd_session_t *session, switch_frame_t *frame) else if(s_rate >= 0.99 && avg_a > 0.04) valid = 1; else if(s_rate == 1.00 && avg_a > 0.02) valid = 1; - if(valid) APPEND_SMA_VAL(&session->sma_b, s_rate * avg_a); - else APPEND_SMA_VAL(&session->sma_b, 0.0 ); + if(valid) { + APPEND_SMA_VAL(&session->sma_b, s_rate * avg_a); + } + else { + APPEND_SMA_VAL(&session->sma_b, 0.0 ); + } /*! If sma is higher then 0 we have some kind of detection (increase this value to eliminate false positives ex: 0.01) */ if(session->sma_b.sma > 0.00){ diff --git a/src/mod/applications/mod_avmd/sma_buf.h b/src/mod/applications/mod_avmd/sma_buf.h index e2baabc71e..7e404bf26b 100644 --- a/src/mod/applications/mod_avmd/sma_buf.h +++ b/src/mod/applications/mod_avmd/sma_buf.h @@ -2,7 +2,9 @@ #define __SMA_BUFFER_H__ #include #include +#ifndef _MSC_VER #include +#endif #include #include #include "buffer.h" @@ -16,7 +18,7 @@ typedef struct { } sma_buffer_t; #define INIT_SMA_BUFFER(b, l, s) \ - do{ \ + { \ (void)memset((b), 0, sizeof(sma_buffer_t)); \ (b)->len = (l); \ (b)->data = (BUFF_TYPE *)switch_core_session_alloc((s), sizeof(BUFF_TYPE) * (l)); \ @@ -25,31 +27,31 @@ typedef struct { (b)->sma = 0.0; \ (b)->pos = 0; \ (b)->lpos = 0; \ - }while(0) + } #define GET_SMA_SAMPLE(b, p) ((b)->data[(p) % (b)->len]) #define SET_SMA_SAMPLE(b, p, v) ((b)->data[(p) % (b)->len] = (v)) #define GET_CURRENT_SMA_POS(b) ((b)->lpos) #define INC_SMA_POS(b) \ - do { \ + { \ (b)->lpos++; \ (b)->pos = (b)->lpos % (b)->len; \ - }while(0) + } #define APPEND_SMA_VAL(b, v) \ - do{ \ + { \ INC_SMA_POS(b); \ (b)->sma -= ((b)->data[(b)->pos] / (BUFF_TYPE)(b)->len); \ (b)->data[(b)->pos] = (v); \ (b)->sma += ((b)->data[(b)->pos] / (BUFF_TYPE)(b)->len); \ - }while(0) + } #define RESET_SMA_BUFFER(b) \ - do{ \ + { \ (b)->sma = 0.0; \ (void)memset((b)->data, 0, sizeof(BUFF_TYPE) * (b)->len); \ - }while(0) + } /* #define DESTROY_SMA_BUFFER(b) \