]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
move mod_timezone functions into core (part 3/3)
authorMichael Jerris <mike@jerris.com>
Mon, 29 Sep 2008 17:17:26 +0000 (17:17 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 29 Sep 2008 17:17:26 +0000 (17:17 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9740 d0543943-73ff-0310-b7d9-9358b9ac24b2

Freeswitch.2008.sln
build/modules.conf.in
debian/freeswitch.install
debian/rules
src/mod/applications/mod_commands/mod_commands.c
src/mod/applications/mod_timezone/mod_timezone.2008.vcproj [deleted file]
src/mod/applications/mod_timezone/mod_timezone.c [deleted file]
src/mod/applications/mod_voicemail/mod_voicemail.c

index a7e00aad2bc2ad1fda4c7fb923b129c1e550a596..0d2522b34a2e9e538f410e65b037f4ba3be935df 100644 (file)
@@ -964,11 +964,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_zh", "src\mod\say\m
                {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}\r
        EndProjectSection\r
 EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_timezone", "src\mod\applications\mod_timezone\mod_timezone.2008.vcproj", "{5CA0F863-CB0F-4250-A863-A5355BDAE224}"\r
-       ProjectSection(ProjectDependencies) = postProject\r
-               {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}\r
-       EndProjectSection\r
-EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_mono", "src\mod\languages\mod_mono\mod_mono.vcproj", "{13DB4131-0142-4CAE-A14B-D6726B14A1BC}"\r
        ProjectSection(ProjectDependencies) = postProject\r
                {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0} = {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}\r
@@ -1935,14 +1930,6 @@ Global
                {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.ActiveCfg = Release|Win32\r
                {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.Build.0 = Release|Win32\r
                {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.ActiveCfg = Release|Win32\r
-               {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|Any CPU.ActiveCfg = Debug|Win32\r
-               {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|Win32.ActiveCfg = Debug|Win32\r
-               {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|Win32.Build.0 = Debug|Win32\r
-               {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|x64.ActiveCfg = Debug|Win32\r
-               {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|Any CPU.ActiveCfg = Release|Win32\r
-               {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|Win32.ActiveCfg = Release|Win32\r
-               {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|Win32.Build.0 = Release|Win32\r
-               {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|x64.ActiveCfg = Release|Win32\r
                {13DB4131-0142-4CAE-A14B-D6726B14A1BC}.Debug|Any CPU.ActiveCfg = Debug|Win32\r
                {13DB4131-0142-4CAE-A14B-D6726B14A1BC}.Debug|Win32.ActiveCfg = Debug|Win32\r
                {13DB4131-0142-4CAE-A14B-D6726B14A1BC}.Debug|x64.ActiveCfg = Debug|Win32\r
@@ -1986,7 +1973,6 @@ Global
                {65A6273D-FCAB-4C55-B09E-65100141A5D4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}\r
                {E3246D17-E29B-4AB5-962A-C69B0C5837BB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}\r
                {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}\r
-               {5CA0F863-CB0F-4250-A863-A5355BDAE224} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}\r
                {07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}\r
                {A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}\r
                {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}\r
index c3bcc416891c53f6c3448137bb59ab683704aa2f..fd1cbc17efa9c8737e5510907b9c8df7c11307e2 100644 (file)
@@ -2,7 +2,6 @@ loggers/mod_console
 loggers/mod_logfile
 loggers/mod_syslog
 applications/mod_commands
-applications/mod_timezone
 applications/mod_conference
 applications/mod_dptools
 applications/mod_enum
index fd984d23f60ff5e346a30c693ac36d5194e9cf55..d842af6f4cdf7f7fdc425db63da8060505d4bd37 100644 (file)
@@ -38,7 +38,6 @@ opt/freeswitch/mod/mod_xml_*.so*
 opt/freeswitch/mod/mod_fsv.so*
 opt/freeswitch/mod/mod_tone_stream.so*
 opt/freeswitch/mod/mod_fax.so*
-opt/freeswitch/mod/mod_timezone.so*
 opt/freeswitch/mod/mod_loopback.so*
 opt/freeswitch/conf/vars.xml
 opt/freeswitch/conf/mime.types
index baa514ec7e4e974bc48947809a6beae2c91e495a..76c8d608814f94b0d706b391154103a7ab176f46 100755 (executable)
@@ -13,7 +13,7 @@ export SPIDERMONKEY_MODULES=languages/mod_spidermonkey languages/mod_spidermonke
 export APPLICATIONS_MODULES=applications/mod_commands applications/mod_conference applications/mod_dptools applications/mod_enum \
                            applications/mod_esf applications/mod_expr applications/mod_fifo applications/mod_limit \
                            applications/mod_rss applications/mod_voicemail applications/mod_fsv \
-                           applications/mod_timezone applications/mod_fax
+                           applications/mod_fax
 export ASR_TTS_MODULES=asr_tts/mod_openmrcp
 export CODECS_MODULES=codecs/mod_ilbc codecs/mod_h26x codecs/mod_speex codecs/mod_voipcodecs
 export DIALPLANS_MODULES=dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml
index 69f4bac15f5f290c12c25ab216998f9510b90a34..055ceb592c7d4d0f8dba73d37ac4398f1f9c1046 100644 (file)
@@ -30,6 +30,7 @@
  * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Cesar Cepeda <cesar@auronix.com>
+ * Massimo Cetra <devel@navynet.it>
  *
  * 
  * mod_commands.c -- Misc. Command Module
@@ -2541,12 +2542,35 @@ SWITCH_STANDARD_API(system_function)
     return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_STANDARD_API(strftime_tz_api_function)
+{
+       char *format = NULL;
+       const char *tz_name = NULL;
+       char date[80] = "";
+
+       if (!switch_strlen_zero(cmd)) {
+               format = strchr(cmd, ' ');
+               tz_name = cmd;
+               if (format) {
+                       *format++ = '\0';
+               }
+       }
+       
+       if (switch_strftime_tz(tz_name, format, date, sizeof(date)) == SWITCH_STATUS_SUCCESS) { /* The lookup of the zone may fail. */
+               stream->write_function(stream, "%s", date);
+       } else {
+               stream->write_function(stream, "-ERR Invalid Timezone\n");
+       }
+       
+       return SWITCH_STATUS_SUCCESS;
+}
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
 {
        switch_api_interface_t *commands_api_interface;
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
+       SWITCH_ADD_API(api_interface, "strftime_tz", "strftime_tz", strftime_tz_api_function, "<Timezone_name> [format string]");
        SWITCH_ADD_API(commands_api_interface, "originate", "Originate a Call", originate_function, ORIGINATE_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "tone_detect", "Start Tone Detection on a channel", tone_detect_session_function, TONE_DETECT_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_kill", "Kill Channel", kill_function, KILL_SYNTAX);
diff --git a/src/mod/applications/mod_timezone/mod_timezone.2008.vcproj b/src/mod/applications/mod_timezone/mod_timezone.2008.vcproj
deleted file mode 100644 (file)
index 1fe0a1b..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
-       ProjectType="Visual C++"\r
-       Version="9.00"\r
-       Name="mod_timezone"\r
-       ProjectGUID="{5CA0F863-CB0F-4250-A863-A5355BDAE224}"\r
-       RootNamespace="mod_timezone"\r
-       Keyword="Win32Proj"\r
-       TargetFrameworkVersion="131072"\r
-       >\r
-       <Platforms>\r
-               <Platform\r
-                       Name="Win32"\r
-               />\r
-       </Platforms>\r
-       <ToolFiles>\r
-       </ToolFiles>\r
-       <Configurations>\r
-               <Configuration\r
-                       Name="Debug|Win32"\r
-                       ConfigurationType="2"\r
-                       InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"\r
-                       CharacterSet="2"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"\r
-                               UsePrecompiledHeader="0"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               RandomizedBaseAddress="1"\r
-                               DataExecutionPrevention="0"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManifestTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCAppVerifierTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-               <Configuration\r
-                       Name="Release|Win32"\r
-                       ConfigurationType="2"\r
-                       InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"\r
-                       CharacterSet="2"\r
-                       >\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXMLDataGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"\r
-                               UsePrecompiledHeader="0"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManagedResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               RandomizedBaseAddress="1"\r
-                               DataExecutionPrevention="0"\r
-                       />\r
-                       <Tool\r
-                               Name="VCALinkTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCManifestTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCXDCMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCBscMakeTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCFxCopTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCAppVerifierTool"\r
-                       />\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                       />\r
-               </Configuration>\r
-       </Configurations>\r
-       <References>\r
-       </References>\r
-       <Files>\r
-               <File\r
-                       RelativePath=".\mod_timezone.c"\r
-                       >\r
-               </File>\r
-       </Files>\r
-       <Globals>\r
-       </Globals>\r
-</VisualStudioProject>\r
diff --git a/src/mod/applications/mod_timezone/mod_timezone.c b/src/mod/applications/mod_timezone/mod_timezone.c
deleted file mode 100644 (file)
index dee2879..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/* 
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
- *
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is FreeSWITCH mod_timezone.
- *
- * The Initial Developer of the Original Code is
- * Massimo Cetra <devel@navynet.it>
- * Portions created by the Initial Developer are Copyright (C)
- * the Initial Developer. All Rights Reserved.
- *
- * mod_timezone.c -- Access to timezone informations and time string formatting
- *
- */
-
-#include <switch.h>
-
-
-/* **************************************************************************
-   API FUNCTIONS AND COMMANDS
-   ************************************************************************** */
-
-SWITCH_STANDARD_API(strftime_tz_api_function)
-{
-       char *format = NULL;
-       const char *tz_name = NULL;
-       char date[80] = "";
-
-       if (!switch_strlen_zero(cmd)) {
-               format = strchr(cmd, ' ');
-               tz_name = cmd;
-               if (format) {
-                       *format++ = '\0';
-               }
-       }
-       
-       if (switch_strftime_tz(tz_name, format, date, sizeof(date)) == SWITCH_STATUS_SUCCESS) { /* The lookup of the zone may fail. */
-               stream->write_function(stream, "%s", date);
-       } else {
-               stream->write_function(stream, "-ERR Invalid Timezone\n");
-       }
-       
-       return SWITCH_STATUS_SUCCESS;
-}
-
-
-/* **************************************************************************
-
-************************************************************************** */
-
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_timezone_load);
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_timezone_shutdown);
-SWITCH_MODULE_DEFINITION(mod_timezone, mod_timezone_load, mod_timezone_shutdown, NULL);
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_timezone_load)
-{
-       switch_api_interface_t *api_interface;
-       
-       *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-
-       SWITCH_ADD_API(api_interface, "strftime_tz", "strftime_tz", strftime_tz_api_function, "<Timezone name>,<format string>");
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_timezone_shutdown)
-{
-
-       return SWITCH_STATUS_UNLOAD;
-}
-
-/* For Emacs:
- * Local Variables:
- * mode:c
- * indent-tabs-mode:t
- * tab-width:4
- * c-basic-offset:4
- * End:
- * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
- */
index 6781b67661ce5af92199486cf8d31cd7f2f4d1dd..5f5335e696d76fde9ccdc01ac67b6d514eba875a 100644 (file)
@@ -2223,37 +2223,15 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_file_path", file_path);
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_read_flags", read_flags);
                
-               if(switch_loadable_module_exists("mod_timezone") == SWITCH_STATUS_SUCCESS) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_timezone is loaded... let's try to convert\n");
-                       if(!switch_strlen_zero(vm_timezone)) {
-                               switch_status_t status;
-                               switch_stream_handle_t time_stream = { 0 };
-                               char *reply;
-                               char *args = switch_mprintf("%s %s", vm_timezone, profile->date_fmt);
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "User's timezone is %s\n", vm_timezone);
-                               SWITCH_STANDARD_STREAM(time_stream);
-                               if ((status = switch_api_execute("strftime_tz", args, NULL, &time_stream)) == SWITCH_STATUS_SUCCESS) {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Successfully Converted Timezone\n");
-                                       reply = time_stream.data;
-                                       if(strncasecmp(reply, "-ERR", 4)) {
-                                               if(strlen(reply)) {
-                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "old time was: %s, new time is: %s\n", date, reply);
-                                                       switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_time", reply);
-                                               } else {
-                                                       switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_time", date);
-                                               }
-                                               switch_safe_free(reply);
-                                       }
-                               } else {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed To Successfully Convert Timezone\n");
-                                       switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_time", date);
-                               }
-                               switch_safe_free(args);
+               if(!switch_strlen_zero(vm_timezone)) {
+                       char tz_date[80] = "";
+                       if ((switch_strftime_tz(vm_timezone, profile->date_fmt, tz_date, sizeof(tz_date)) == SWITCH_STATUS_SUCCESS) && !switch_strlen_zero(tz_date)) {
+                               switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_time", tz_date);
+                       } else {
+                               switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_time", date);
                        }
-               } else {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_timezone isn't loaded... we'll only be using system time\n");
-                       switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_time", date);
                }
+
                switch_snprintf(tmpvar, sizeof(tmpvar), "%d", priority);
                switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_priority", tmpvar);
                if (vm_email) {