mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 21:22:09 +00:00
add windows build for mod_xml_cdr. This probably also fixes the build on several non-linux systems.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4309 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -146,6 +146,12 @@ typedef unsigned long in_addr_t;
|
||||
#define SWITCH_MOD_DECLARE(type) __declspec(dllimport) type __cdecl
|
||||
#endif
|
||||
#define SIGHUP SIGTERM
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR _S_IREAD
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR _S_IWRITE
|
||||
#endif
|
||||
#else //not win32
|
||||
#define SWITCH_DECLARE(type) type
|
||||
#define SWITCH_DECLARE_NONSTD(type) type
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
* mod_xml_cdr.c -- XML CDR Module
|
||||
*
|
||||
*/
|
||||
#include <sys/stat.h>
|
||||
#include <switch.h>
|
||||
|
||||
|
||||
static const char modname[] = "mod_xml_cdr";
|
||||
|
||||
static switch_status_t my_on_hangup(switch_core_session_t *session)
|
||||
@@ -55,13 +55,17 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
|
||||
if ((path = switch_mprintf("%s/xml_cdr/%s.cdr.xml", logdir, uuid_str))) {
|
||||
if ((xml_text = switch_xml_toxml(cdr))) {
|
||||
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
|
||||
write(fd, header, strlen(header));
|
||||
write(fd, xml_text, strlen(xml_text));
|
||||
write(fd, header, (unsigned)strlen(header));
|
||||
write(fd, xml_text, (unsigned)strlen(xml_text));
|
||||
close(fd);
|
||||
fd = -1;
|
||||
} else {
|
||||
char ebuf[512] = {0};
|
||||
#ifdef WIN32
|
||||
strerror_s(ebuf, sizeof(ebuf), errno);
|
||||
#else
|
||||
strerror_r(errno, ebuf, sizeof(ebuf));
|
||||
#endif
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n", ebuf);
|
||||
}
|
||||
free(xml_text);
|
||||
|
||||
@@ -59,14 +59,6 @@
|
||||
#ifdef HAVE_MMAP
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR _S_IREAD
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR _S_IWRITE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SWITCH_XML_WS "\t\r\n " // whitespace
|
||||
#define SWITCH_XML_ERRL 128 // maximum error string length
|
||||
|
||||
Reference in New Issue
Block a user