[commit] r9740 - in freeswitch/trunk: . build debian src/mod/applications/mod_commands src/mod/applications/mod_timezone src/mod/applications/mod_voicemail
Author: mikej Date: Mon Sep 29 13:17:26 2008 New Revision: 9740 Removed: freeswitch/trunk/src/mod/applications/mod_timezone/ Modified: freeswitch/trunk/Freeswitch.2008.sln freeswitch/trunk/build/modules.conf.in freeswitch/trunk/debian/freeswitch.install freeswitch/trunk/debian/rules freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Log: move mod_timezone functions into core (part 3/3) Modified: freeswitch/trunk/Freeswitch.2008.sln ============================================================================== --- freeswitch/trunk/Freeswitch.2008.sln (original) +++ freeswitch/trunk/Freeswitch.2008.sln Mon Sep 29 13:17:26 2008 @@ -964,11 +964,6 @@ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_timezone", "src\mod\applications\mod_timezone\mod_timezone.2008.vcproj", "{5CA0F863-CB0F-4250-A863-A5355BDAE224}" - ProjectSection(ProjectDependencies) = postProject - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_mono", "src\mod\languages\mod_mono\mod_mono.vcproj", "{13DB4131-0142-4CAE-A14B-D6726B14A1BC}" ProjectSection(ProjectDependencies) = postProject {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0} = {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0} @@ -1935,14 +1930,6 @@ {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.ActiveCfg = Release|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.Build.0 = Release|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.ActiveCfg = Release|Win32 - {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|Win32.ActiveCfg = Debug|Win32 - {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|Win32.Build.0 = Debug|Win32 - {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Debug|x64.ActiveCfg = Debug|Win32 - {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|Any CPU.ActiveCfg = Release|Win32 - {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|Win32.ActiveCfg = Release|Win32 - {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|Win32.Build.0 = Release|Win32 - {5CA0F863-CB0F-4250-A863-A5355BDAE224}.Release|x64.ActiveCfg = Release|Win32 {13DB4131-0142-4CAE-A14B-D6726B14A1BC}.Debug|Any CPU.ActiveCfg = Debug|Win32 {13DB4131-0142-4CAE-A14B-D6726B14A1BC}.Debug|Win32.ActiveCfg = Debug|Win32 {13DB4131-0142-4CAE-A14B-D6726B14A1BC}.Debug|x64.ActiveCfg = Debug|Win32 @@ -1986,7 +1973,6 @@ {65A6273D-FCAB-4C55-B09E-65100141A5D4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {E3246D17-E29B-4AB5-962A-C69B0C5837BB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} - {5CA0F863-CB0F-4250-A863-A5355BDAE224} = {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} Modified: freeswitch/trunk/build/modules.conf.in ============================================================================== --- freeswitch/trunk/build/modules.conf.in (original) +++ freeswitch/trunk/build/modules.conf.in Mon Sep 29 13:17:26 2008 @@ -2,7 +2,6 @@ loggers/mod_logfile loggers/mod_syslog applications/mod_commands -applications/mod_timezone applications/mod_conference applications/mod_dptools applications/mod_enum Modified: freeswitch/trunk/debian/freeswitch.install ============================================================================== --- freeswitch/trunk/debian/freeswitch.install (original) +++ freeswitch/trunk/debian/freeswitch.install Mon Sep 29 13:17:26 2008 @@ -38,7 +38,6 @@ 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 Modified: freeswitch/trunk/debian/rules ============================================================================== --- freeswitch/trunk/debian/rules (original) +++ freeswitch/trunk/debian/rules Mon Sep 29 13:17:26 2008 @@ -13,7 +13,7 @@ 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 Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original) +++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Mon Sep 29 13:17:26 2008 @@ -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 @@ 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); Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (original) +++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Mon Sep 29 13:17:26 2008 @@ -2223,37 +2223,15 @@ 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) {
participants (1)
-
Freeswitch SVN