diff --git a/Makefile.am b/Makefile.am index a47000bf5c..16b56a6dab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -251,6 +251,7 @@ libfreeswitch_la_SOURCES = \ src/switch_core_rwlock.c \ src/switch_core_port_allocator.c \ src/switch_core.c \ + src/switch_version.c \ src/switch_core_media.c \ src/switch_sdp.c \ src/switch_scheduler.c \ @@ -307,8 +308,6 @@ if ENABLE_CPP libfreeswitch_la_SOURCES += src/switch_cpp.cpp endif -$(top_builddir)/libfreeswitch_la-switch_console.lo: src/include/switch_version.h - $(libfreeswitch_la_SOURCES): $(CORE_LIBS) $(switch_builddir)/quiet_libtool $(switch_builddir)/modules.conf src/include/switch_swigable_cpp.h: $(switch_srcdir)/src/include/switch_cpp.h diff --git a/build/swigall.sh b/build/swigall.sh index 04bd51088d..b36c1c6152 100755 --- a/build/swigall.sh +++ b/build/swigall.sh @@ -6,7 +6,7 @@ cd ../../../.. cd src/mod/legacy/languages/mod_lua make swigclean make lua_wrap -cd ../../../.. +cd ../../../../.. cd src/mod/languages/mod_perl make swigclean diff --git a/src/fs_encode.c b/src/fs_encode.c index 417ff7dc2f..d89f2030eb 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -40,8 +40,6 @@ #endif #include -#include - /* Picky compiler */ #ifdef __ICC diff --git a/src/include/switch_core.h b/src/include/switch_core.h index e2c5749e7d..f1512aeaa7 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2603,6 +2603,15 @@ SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t SWITCH_DECLARE(switch_call_direction_t) switch_ice_direction(switch_core_session_t *session); SWITCH_DECLARE(void) switch_core_session_debug_pool(switch_stream_handle_t *stream); +SWITCH_DECLARE(const char *)switch_version_major(void); +SWITCH_DECLARE(const char *)switch_version_minor(void); +SWITCH_DECLARE(const char *)switch_version_micro(void); + +SWITCH_DECLARE(const char *)switch_version_revision(void); +SWITCH_DECLARE(const char *)switch_version_revision_human(void); +SWITCH_DECLARE(const char *)switch_version_full(void); +SWITCH_DECLARE(const char *)switch_version_full_human(void); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 2767644559..4b7b32ffc2 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -42,7 +42,6 @@ */ #include #include -#include SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown); @@ -536,7 +535,7 @@ SWITCH_STANDARD_API(version_function) char *mydata = NULL, *argv[2]; if (zstr(cmd)) { - stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN); + stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", switch_version_full(), switch_version_revision_human()); goto end; } @@ -546,9 +545,9 @@ SWITCH_STANDARD_API(version_function) argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); if (argc > 0 && switch_stristr("short", argv[0])) { - stream->write_function(stream, "%s.%s.%s\n", SWITCH_VERSION_MAJOR,SWITCH_VERSION_MINOR,SWITCH_VERSION_MICRO); + stream->write_function(stream, "%s.%s.%s\n", switch_version_major(),switch_version_minor(),switch_version_micro()); } else { - stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_FULL_HUMAN); + stream->write_function(stream, "FreeSWITCH Version %s (%s)\n", switch_version_full(), switch_version_full_human()); } switch_safe_free(mydata); @@ -2106,7 +2105,7 @@ SWITCH_STANDARD_API(status_function) duration.sec, duration.sec == 1 ? "" : "s", duration.ms , duration.ms == 1 ? "" : "s", duration.mms, duration.mms == 1 ? "" : "s", nl); - stream->write_function(stream, "FreeSWITCH (Version %s) is %s%s", SWITCH_VERSION_FULL_HUMAN, + stream->write_function(stream, "FreeSWITCH (Version %s) is %s%s", switch_version_full_human(), switch_core_ready() ? "ready" : "not ready", nl); stream->write_function(stream, "%" SWITCH_SIZE_T_FMT " session(s) since startup%s", switch_core_session_id() - 1, nl); @@ -6268,7 +6267,7 @@ SWITCH_STANDARD_JSON_API(json_api_function) } -#include + SWITCH_STANDARD_JSON_API(json_status_function) { cJSON *o, *oo, *reply = cJSON_CreateObject(); @@ -6298,7 +6297,7 @@ SWITCH_STANDARD_JSON_API(json_status_function) cJSON_AddItemToObject(o, "microseconds", cJSON_CreateNumber(duration.mms)); cJSON_AddItemToObject(reply, "uptime", o); - cJSON_AddItemToObject(reply, "version", cJSON_CreateString(SWITCH_VERSION_FULL_HUMAN)); + cJSON_AddItemToObject(reply, "version", cJSON_CreateString(switch_version_full_human())); o = cJSON_CreateObject(); cJSON_AddItemToObject(reply, "sessions", o); diff --git a/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h index 01388575b0..ee5a4f7235 100644 --- a/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/gsmopen.h @@ -76,7 +76,6 @@ #define GSMOPEN_ALSA #endif // NO_ALSA #include -#include #ifndef WIN32 #include #include @@ -132,7 +131,7 @@ //#define SAMPLES_PER_FRAME SAMPLERATE_GSMOPEN/50 #ifndef GSMOPEN_SVN_VERSION -#define GSMOPEN_SVN_VERSION SWITCH_VERSION_FULL +#define GSMOPEN_SVN_VERSION switch_version_full() #endif /* GSMOPEN_SVN_VERSION */ typedef enum { diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index b37fa77834..ed1d229c4e 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -66,7 +66,6 @@ #define SAMPLERATE_GSMOPEN 8000 #include -#include #ifndef WIN32 #include #include @@ -104,7 +103,7 @@ #endif #ifndef GSMOPEN_SVN_VERSION -#define GSMOPEN_SVN_VERSION SWITCH_VERSION_FULL +#define GSMOPEN_SVN_VERSION switch_version_full() #endif /* GSMOPEN_SVN_VERSION */ #include "ctb-0.16/ctb.h" diff --git a/src/mod/endpoints/mod_h323/mod_h323.h b/src/mod/endpoints/mod_h323/mod_h323.h index 3e046d1093..085f061d62 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.h +++ b/src/mod/endpoints/mod_h323/mod_h323.h @@ -61,7 +61,6 @@ #define HAVE_APR #include -#include #define MODNAME "mod_h323" #define OpalT38_IFP_COR GetOpalT38_IFP_COR() #define OpalT38_IFP_PRE GetOpalT38_IFP_PRE() diff --git a/src/mod/endpoints/mod_khomp/include/defs.h b/src/mod/endpoints/mod_khomp/include/defs.h index bcd5c3ce7b..5d72c95b72 100644 --- a/src/mod/endpoints/mod_khomp/include/defs.h +++ b/src/mod/endpoints/mod_khomp/include/defs.h @@ -45,7 +45,6 @@ #define _DEFS_H_ /* formatation macros */ -#include "switch_version.h" #include "revision.h" #define KHOMP_LOG __FILE__, __SWITCH_FUNC__, __LINE__ diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 69cda02b9a..55737368b5 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -33,7 +33,6 @@ #include -#include #ifndef WIN32 #include @@ -85,7 +84,7 @@ #endif #ifndef SKYPOPEN_SVN_VERSION -#define SKYPOPEN_SVN_VERSION SWITCH_VERSION_FULL +#define SKYPOPEN_SVN_VERSION switch_version_full() #endif /* SKYPOPEN_SVN_VERSION */ typedef enum { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index f80539684a..752dd8671b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -47,7 +47,6 @@ #define SOFIA_QUEUE_SIZE 50000 #define HAVE_APR #include -#include #define SOFIA_NAT_SESSION_TIMEOUT 90 #define SOFIA_MAX_ACL 100 #ifdef _MSC_VER @@ -96,7 +95,6 @@ typedef struct private_object private_object_t; #define MULTICAST_EVENT "multicast::event" #define SOFIA_REPLACES_HEADER "_sofia_replaces_" -#define SOFIA_USER_AGENT "FreeSWITCH-mod_sofia/" SWITCH_VERSION_FULL #define SOFIA_CHAT_PROTO "sip" #define SOFIA_MULTIPART_PREFIX "sip_mp_" #define SOFIA_MULTIPART_PREFIX_T "~sip_mp_" diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index ad581d877e..a5308f0459 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3742,7 +3742,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) profile->auto_rtp_bugs = RTP_BUG_CISCO_SKIP_MARK_BIT_2833;// | RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833; profile->pool = pool; - profile->user_agent = SOFIA_USER_AGENT; + + profile->user_agent = switch_core_sprintf(profile->pool, "FreeSWITCH-mod_sofia/%s", switch_version_full()); profile->name = switch_core_strdup(profile->pool, xprofilename); switch_snprintf(url, sizeof(url), "sofia_reg_%s", xprofilename); diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c index e5921b7381..b8fda31b92 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.c +++ b/src/mod/event_handlers/mod_snmp/subagent.c @@ -31,7 +31,6 @@ * */ #include -#include #include #include @@ -175,7 +174,7 @@ int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration * { netsnmp_request_info *request = NULL; oid subid; - static char const version[] = SWITCH_VERSION_FULL; + static char const version[] = switch_version_full(); char uuid[40] = ""; switch(reqinfo->mode) { diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 88d3c7abfb..4377d593dd 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -14626,6 +14626,76 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_debug_pool(void * jarg1) } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_major() { + char * jresult ; + char *result = 0 ; + + result = (char *)switch_version_major(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_minor() { + char * jresult ; + char *result = 0 ; + + result = (char *)switch_version_minor(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_micro() { + char * jresult ; + char *result = 0 ; + + result = (char *)switch_version_micro(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_revision() { + char * jresult ; + char *result = 0 ; + + result = (char *)switch_version_revision(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_revision_human() { + char * jresult ; + char *result = 0 ; + + result = (char *)switch_version_revision_human(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_full() { + char * jresult ; + char *result = 0 ; + + result = (char *)switch_version_full(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_version_full_human() { + char * jresult ; + char *result = 0 ; + + result = (char *)switch_version_full_human(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 46c72e92d2..5f9fe31b50 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -3150,6 +3150,41 @@ public class freeswitch { freeswitchPINVOKE.switch_core_session_debug_pool(switch_stream_handle.getCPtr(stream)); } + public static string switch_version_major() { + string ret = freeswitchPINVOKE.switch_version_major(); + return ret; + } + + public static string switch_version_minor() { + string ret = freeswitchPINVOKE.switch_version_minor(); + return ret; + } + + public static string switch_version_micro() { + string ret = freeswitchPINVOKE.switch_version_micro(); + return ret; + } + + public static string switch_version_revision() { + string ret = freeswitchPINVOKE.switch_version_revision(); + return ret; + } + + public static string switch_version_revision_human() { + string ret = freeswitchPINVOKE.switch_version_revision_human(); + return ret; + } + + public static string switch_version_full() { + string ret = freeswitchPINVOKE.switch_version_full(); + return ret; + } + + public static string switch_version_full_human() { + string ret = freeswitchPINVOKE.switch_version_full_human(); + return ret; + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -10712,6 +10747,27 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_debug_pool")] public static extern void switch_core_session_debug_pool(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_version_major")] + public static extern string switch_version_major(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_version_minor")] + public static extern string switch_version_minor(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_version_micro")] + public static extern string switch_version_micro(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_version_revision")] + public static extern string switch_version_revision(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_version_revision_human")] + public static extern string switch_version_revision_human(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_version_full")] + public static extern string switch_version_full(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_version_full_human")] + public static extern string switch_version_full_human(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -35105,6 +35161,7 @@ namespace FreeSWITCH.Native { public enum switch_rtp_flag_t { SWITCH_RTP_FLAG_NOBLOCK = 0, + SWITCH_RTP_FLAG_DTMF_ON, SWITCH_RTP_FLAG_IO, SWITCH_RTP_FLAG_USE_TIMER, SWITCH_RTP_FLAG_RTCP_PASSTHRU, diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index 9d9e3fbb14..d5f803cee6 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -57,7 +57,6 @@ * */ #include -#include #ifdef _MSC_VER #pragma warning(disable:4142) #endif @@ -811,6 +810,7 @@ abyss_bool handler_hook(TSession * r) const char *uri = 0; TRequestInfo *info = 0; switch_event_t *evnt = 0; /* shortcut to stream.param_event */ + char v[256] = ""; if (!r || !(info = &r->requestInfo) || !(uri = info->uri)) { return FALSE; @@ -1008,7 +1008,8 @@ abyss_bool handler_hook(TSession * r) } /* Generation of the server field */ - ResponseAddField(r, "Server", "FreeSWITCH-" SWITCH_VERSION_FULL "-mod_xml_rpc"); + switch_sprintf(v, sizeof(v), "FreeSWITCH-%s-mod_xml_rpc", switch_version_full()); + ResponseAddField(r, "Server", v); if (html) { ResponseAddField(r, "Content-Type", "text/html"); diff --git a/src/switch.c b/src/switch.c index 5a16fca2b3..19e2a97b01 100644 --- a/src/switch.c +++ b/src/switch.c @@ -49,7 +49,6 @@ #endif #include -#include #include "private/switch_core_pvt.h" /* pid filename: Stores the process id of the freeswitch process */ @@ -676,7 +675,7 @@ int main(int argc, char *argv[]) } else if (!strcmp(local_argv[x], "-version")) { - fprintf(stdout, "FreeSWITCH version: %s (%s)\n", SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN); + fprintf(stdout, "FreeSWITCH version: %s (%s)\n", switch_version_full(), switch_version_revision_human()); exit(EXIT_SUCCESS); } #endif diff --git a/src/switch_console.c b/src/switch_console.c index d43f7702e1..e1c1448d03 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -32,7 +32,6 @@ #include #include -#include #ifndef _MSC_VER #include #endif diff --git a/src/switch_core.c b/src/switch_core.c index 848fbf2150..ca8a7539c6 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -40,7 +40,6 @@ #include #include #include -#include #include "private/switch_core_pvt.h" #include #ifndef WIN32 @@ -83,7 +82,7 @@ static void send_heartbeat(void) duration.sec, duration.sec == 1 ? "" : "s", duration.ms, duration.ms == 1 ? "" : "s", duration.mms, duration.mms == 1 ? "" : "s"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Version", SWITCH_VERSION_FULL); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Version", switch_version_full()); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Uptime-msec", "%"SWITCH_TIME_T_FMT, switch_core_uptime() / 1000); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Session-Count", "%u", switch_core_session_count()); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Max-Sessions", "%u", switch_core_session_limit(0)); @@ -2142,7 +2141,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\nFreeSWITCH Version %s (%s)\n\nFreeSWITCH Started\nMax Sessions [%u]\nSession Rate [%d]\nSQL [%s]\n", - SWITCH_VERSION_FULL, SWITCH_VERSION_REVISION_HUMAN, + switch_version_full(), switch_version_revision_human(), switch_core_session_limit(0), switch_core_sessions_per_second(0), switch_test_flag((&runtime), SCF_USE_SQL) ? "Enabled" : "Disabled"); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 9216d2950a..2faa17f135 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -33,7 +33,6 @@ #include #include #include -#include #include "private/switch_core_pvt.h" #include #include diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 6cda585057..2bde4cd3f6 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -51,7 +51,6 @@ #include #include #include -#include #include #define FIR_COUNTDOWN 50 @@ -757,7 +756,7 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice) switch_stun_packet_attribute_add_priority(packet, ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].priority); - switch_snprintf(sw, sizeof(sw), "FreeSWITCH (%s)", SWITCH_VERSION_REVISION_HUMAN); + switch_snprintf(sw, sizeof(sw), "FreeSWITCH (%s)", switch_version_revision_human()); switch_stun_packet_attribute_add_software(packet, sw, (uint16_t)strlen(sw)); if ((ice->type & ICE_CONTROLLED)) { diff --git a/src/tone2wav.c b/src/tone2wav.c index 2754a0ff83..de2ff97f67 100644 --- a/src/tone2wav.c +++ b/src/tone2wav.c @@ -44,9 +44,6 @@ #endif #include -#include - - /* Picky compiler */ #ifdef __ICC