move mod_timezone functions into core (part 3/3)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9740 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
138184fc93
commit
54ef5547a7
|
@ -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}
|
||||
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 @@ Global
|
|||
{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 @@ Global
|
|||
{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}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="mod_timezone"
|
||||
ProjectGUID="{5CA0F863-CB0F-4250-A863-A5355BDAE224}"
|
||||
RootNamespace="mod_timezone"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\mod_timezone.c"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -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:
|
||||
*/
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue