add curl and teletone to mod_spidermonkey. fix /tmp/ dir for windows, added global temp dir var. Multiple type fixes.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@713 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1588f9e767
commit
92a326c1da
|
@ -65,7 +65,9 @@ extern "C" {
|
|||
*/
|
||||
|
||||
#define FALSE 0
|
||||
#ifndef TRUE
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
/* Basic DTMF specs:
|
||||
*
|
||||
|
|
|
@ -140,7 +140,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session
|
|||
char *tts_name,
|
||||
char *voice_name,
|
||||
char *timer_name,
|
||||
unsigned int rate,
|
||||
size_t rate,
|
||||
switch_dtmf_callback_function dtmf_callback,
|
||||
char *text,
|
||||
void *buf,
|
||||
|
|
|
@ -77,6 +77,11 @@ typedef __int64 int64_t;
|
|||
typedef unsigned long in_addr_t;
|
||||
#endif
|
||||
#define PACKED
|
||||
#include <io.h>
|
||||
#define write _write
|
||||
#define open _open
|
||||
#define close _close
|
||||
#define read _read
|
||||
#else
|
||||
/* packed attribute */
|
||||
#ifndef PACKED
|
||||
|
@ -88,7 +93,6 @@ typedef unsigned long in_addr_t;
|
|||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
||||
|
|
|
@ -78,10 +78,11 @@ struct switch_directories {
|
|||
char *log_dir;
|
||||
char *db_dir;
|
||||
char *script_dir;
|
||||
char *temp_dir;
|
||||
};
|
||||
|
||||
typedef struct switch_directories switch_directories;
|
||||
extern switch_directories SWITCH_GLOBAL_dirs;
|
||||
SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs;
|
||||
|
||||
#define SWITCH_RECCOMMENDED_BUFFER_SIZE 131072
|
||||
#define SWITCH_MAX_CODECS 30
|
||||
|
|
|
@ -29,7 +29,11 @@
|
|||
* mod_spidermonkey.c -- Javascript Module
|
||||
*
|
||||
*/
|
||||
#ifndef HAVE_CURL
|
||||
#define HAVE_CURL
|
||||
#endif
|
||||
|
||||
#include <switch.h>
|
||||
|
||||
#include "jstypes.h"
|
||||
#include "jsarena.h"
|
||||
|
@ -48,7 +52,6 @@
|
|||
#include "jsscope.h"
|
||||
#include "jsscript.h"
|
||||
#include <libteletone.h>
|
||||
#include <switch.h>
|
||||
#ifdef HAVE_CURL
|
||||
#include <curl/curl.h>
|
||||
#endif
|
||||
|
@ -572,7 +575,7 @@ struct config_data {
|
|||
|
||||
static size_t realtime_callback(void *ptr, size_t size, size_t nmemb, void *data)
|
||||
{
|
||||
register int realsize = size * nmemb;
|
||||
register size_t realsize = size * nmemb;
|
||||
char *line, lineb[2048], *nextline = NULL, *val = NULL, *p = NULL;
|
||||
jsval rval;
|
||||
struct config_data *config_data = data;
|
||||
|
@ -1025,7 +1028,7 @@ static const char c64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy
|
|||
|
||||
static int write_buf(int fd, char *buf) {
|
||||
|
||||
size_t len = strlen(buf);
|
||||
int len = (int)strlen(buf);
|
||||
if (fd && write(fd, buf, len) != len) {
|
||||
close(fd);
|
||||
return 0;
|
||||
|
@ -1056,9 +1059,8 @@ static JSBool js_email(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
) {
|
||||
if ( argc > 4)
|
||||
file = JS_GetStringBytes(JS_ValueToString(cx, argv[4]));
|
||||
|
||||
|
||||
snprintf(filename, 80, "/tmp/mail.%ld", switch_time_now());
|
||||
|
||||
snprintf(filename, 80, "%smail.%ld", SWITCH_GLOBAL_dirs.temp_dir, switch_time_now());
|
||||
|
||||
if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
|
||||
if (file) {
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\js\src""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;XP_WIN;DEBUG;_X86_=1;JSFILE;EXPORT_JS_API"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\js\src";"$(InputDir)..\..\..\..\libs\curl\include";"$(InputDir)..\..\..\..\libs\libteletone\src""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;XP_WIN;DEBUG;_X86_=1;JSFILE;EXPORT_JS_API;HAVE_CURL;CURL_STATICLIB"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
|
@ -64,10 +64,10 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="js32.lib"
|
||||
AdditionalDependencies="js32.lib curllib.lib ws2_32.lib winmm.lib"
|
||||
OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_spidermonkey.dll"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="$(InputDir)..\..\..\..\libs\js\src\Debug"
|
||||
AdditionalLibraryDirectories=""$(InputDir)..\..\..\..\libs\js\src\Debug";"$(InputDir)..\..\..\..\libs\curl\lib\Debug""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/mod_spidermonkey.pdb"
|
||||
SubSystem="2"
|
||||
|
@ -125,8 +125,8 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\js\src""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;XP_WIN;_X86_=1;JSFILE;EXPORT_JS_API"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\js\src";"$(InputDir)..\..\..\..\libs\curl\include";"$(InputDir)..\..\..\..\libs\libteletone\src""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;XP_WIN;_X86_=1;JSFILE;EXPORT_JS_API;HAVE_CURL;CURL_STATICLIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
|
@ -145,10 +145,10 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="js32.lib"
|
||||
AdditionalDependencies="js32.lib curllib.lib ws2_32.lib winmm.lib"
|
||||
OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_spidermonkey.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="$(InputDir)..\..\..\..\libs\js\Release"
|
||||
AdditionalLibraryDirectories=""$(InputDir)..\..\..\..\libs\js\Release";"$(InputDir)..\..\..\..\libs\curl\lib\Release""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
|
|
|
@ -76,7 +76,7 @@ struct switch_core_session {
|
|||
void *private_info;
|
||||
};
|
||||
|
||||
switch_directories SWITCH_GLOBAL_dirs;
|
||||
SWITCH_DECLARE_DATA switch_directories SWITCH_GLOBAL_dirs;
|
||||
|
||||
struct switch_core_runtime {
|
||||
time_t initiated;
|
||||
|
@ -2182,6 +2182,11 @@ static void core_event_handler(switch_event *event)
|
|||
|
||||
SWITCH_DECLARE(switch_status) switch_core_init(char *console)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#define BUFSIZE 50
|
||||
char lpPathBuffer[BUFSIZE];
|
||||
DWORD dwBufSize=BUFSIZE;
|
||||
#endif
|
||||
memset(&runtime, 0, sizeof(runtime));
|
||||
|
||||
SWITCH_GLOBAL_dirs.base_dir = SWITCH_PREFIX_DIR;
|
||||
|
@ -2190,6 +2195,16 @@ SWITCH_DECLARE(switch_status) switch_core_init(char *console)
|
|||
SWITCH_GLOBAL_dirs.log_dir = SWITCH_LOG_DIR;
|
||||
SWITCH_GLOBAL_dirs.db_dir = SWITCH_DB_DIR;
|
||||
SWITCH_GLOBAL_dirs.script_dir = SWITCH_SCRIPT_DIR;
|
||||
#ifdef SWITCH_TEMP_DIR
|
||||
SWITCH_GLOBAL_dirs.temp_dir = SWITCH_TEMP_DIR;
|
||||
#else
|
||||
#ifdef WIN32
|
||||
GetTempPath(dwBufSize, lpPathBuffer);
|
||||
SWITCH_GLOBAL_dirs.temp_dir = lpPathBuffer;
|
||||
#else
|
||||
SWITCH_GLOBAL_dirs.temp_dir = "/tmp/";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef EMBED_PERL
|
||||
|
|
|
@ -109,7 +109,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_collect_digits_count(switch_core_sessio
|
|||
switch_frame *read_frame;
|
||||
|
||||
if (timeout) {
|
||||
elapsed = (switch_time_now() - started) / 1000;
|
||||
elapsed = (unsigned int)((switch_time_now() - started) / 1000);
|
||||
if (elapsed >= timeout) {
|
||||
break;
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session
|
|||
char *tts_name,
|
||||
char *voice_name,
|
||||
char *timer_name,
|
||||
unsigned int rate,
|
||||
size_t rate,
|
||||
switch_dtmf_callback_function dtmf_callback,
|
||||
char *text,
|
||||
void *buf,
|
||||
|
@ -484,7 +484,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session
|
|||
short abuf[960];
|
||||
char dtmf[128];
|
||||
int interval = 0;
|
||||
unsigned int samples = 0;
|
||||
size_t samples = 0;
|
||||
size_t len = 0;
|
||||
size_t ilen = 0;
|
||||
switch_frame write_frame;
|
||||
|
@ -511,7 +511,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session
|
|||
if (switch_core_speech_open(&sh,
|
||||
tts_name,
|
||||
voice_name,
|
||||
rate,
|
||||
(unsigned int)rate,
|
||||
flags,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid TTS module!\n");
|
||||
|
@ -534,7 +534,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session
|
|||
|
||||
if (switch_core_codec_init(&codec,
|
||||
codec_name,
|
||||
rate,
|
||||
(int)rate,
|
||||
interval,
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
|
@ -550,7 +550,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session
|
|||
}
|
||||
|
||||
if (timer_name) {
|
||||
if (switch_core_timer_init(&timer, timer_name, interval, samples, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_timer_init(&timer, timer_name, interval, (int)samples, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "setup timer failed!\n");
|
||||
switch_core_codec_destroy(&codec);
|
||||
flags = 0;
|
||||
|
@ -562,7 +562,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session
|
|||
|
||||
flags = 0;
|
||||
switch_core_speech_feed_tts(&sh, text, &flags);
|
||||
write_frame.rate = rate;
|
||||
write_frame.rate = (int)rate;
|
||||
|
||||
memset(write_frame.data, 0, len);
|
||||
write_frame.datalen = len;
|
||||
|
|
|
@ -152,6 +152,7 @@ EndProject
|
|||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey", "..\..\src\mod\languages\mod_spidermonkey\mod_spidermonkey.vcproj", "{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
|
||||
{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ASR-TTS", "ASR-TTS", "{4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}"
|
||||
|
|
|
@ -204,6 +204,7 @@ End If
|
|||
|
||||
If BuildModSpiderMonkey Then
|
||||
BuildLibs_SpiderMonkey BuildDebug, BuildRelease
|
||||
BuildLibs_curl BuildDebug, BuildRelease
|
||||
End If
|
||||
|
||||
WScript.Echo "Complete"
|
||||
|
@ -656,6 +657,28 @@ Sub BuildLibs_pcre(BuildDebug, BuildRelease)
|
|||
End If
|
||||
End Sub
|
||||
|
||||
Sub BuildLibs_curl(BuildDebug, BuildRelease)
|
||||
If Not FSO.FolderExists(LibDestDir & "curl") Then
|
||||
WgetUnTarGz LibsBase & "curl-7.15.2.tar.gz", LibDestDir
|
||||
RenameFolder LibDestDir & "curl-7.15.2", "curl"
|
||||
FSO.CopyFile Utilsdir & "curl\curllib.vcproj", LibDestDir & "curl\lib\", True
|
||||
End If
|
||||
If FSO.FolderExists(LibDestDir & "curl") Then
|
||||
If BuildDebug Then
|
||||
If Not FSO.FileExists(LibDestDir & "curl\lib\Debug\curllib.lib") Then
|
||||
BuildViaVCBuild LibDestDir & "curl\lib\curllib.vcproj", "Debug"
|
||||
End If
|
||||
End If
|
||||
If BuildRelease Then
|
||||
If Not FSO.FileExists(LibDestDir & "curl\lib\Release\curllib.lib") Then
|
||||
BuildViaVCBuild LibDestDir & "curl\lib\curllib.vcproj", "Release"
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Wscript.echo "Unable to download curl"
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub BuildLibs_ldap(BuildDebug, BuildRelease)
|
||||
If Not FSO.FolderExists(LibDestDir & "openldap") Then
|
||||
WgetUnTarGz LibsBase & "openldap-2.3.19.tar.gz", LibDestDir
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue