From 47985c56835f7d6f20a0dfe14955911d69ba6d1f Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 30 Apr 2008 14:20:31 +0000 Subject: [PATCH] start of msvc build git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8219 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- Freeswitch.2008.sln | 12 ++++ src/include/switch_cpp.h | 80 ++++++++++------------ src/include/switch_platform.h | 1 + src/mod/languages/mod_lua/freeswitch_lua.h | 6 -- src/switch_cpp.cpp | 74 ++++++++++---------- w32/Library/FreeSwitchCore.2008.vcproj | 4 -- 6 files changed, 87 insertions(+), 90 deletions(-) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index d44c7466bc..de96aa06ab 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -866,6 +866,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_curl", "sr {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_lua", "src\mod\languages\mod_lua\mod_lua.2008.vcproj", "{7B077E7F-1BE7-4291-AB86-55E527B25CAC}" + ProjectSection(ProjectDependencies) = postProject + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -1446,6 +1451,12 @@ Global {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.ActiveCfg = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.Build.0 = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.ActiveCfg = Release|Win32 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.ActiveCfg = Debug|Win32 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.Build.0 = Debug|Win32 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.ActiveCfg = Debug|Win32 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.ActiveCfg = Release|Win32 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.Build.0 = Release|Win32 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1493,6 +1504,7 @@ Global {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF} = {0C808854-54D1-4230-BFF5-77B5FD905000} {028C7278-05D7-4E18-82FE-BE231B844F41} = {0C808854-54D1-4230-BFF5-77B5FD905000} {36E854E3-CE12-4348-A125-CCF3F9D74813} = {0C808854-54D1-4230-BFF5-77B5FD905000} + {7B077E7F-1BE7-4291-AB86-55E527B25CAC} = {0C808854-54D1-4230-BFF5-77B5FD905000} {692F6330-4D87-4C82-81DF-40DB5892636E} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0} {E7116F50-2B10-472F-92BD-C8667AA9C1AE} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0} {1C453396-D912-4213-89FD-9B489162B7B5} = {A7AB4405-FDB7-4853-9FBB-1516B1C3D80A} diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index a77e39ccbd..c88651b15d 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -61,12 +61,6 @@ Note that the first parameter to the new operator is implicitly handled by c++.. */ -void console_log(char *level_str, char *msg); -void console_clean_log(char *msg); -char *api_execute(char *cmd, char *arg); -void api_reply_delete(char *reply); - - typedef struct input_callback_state { void *function; // pointer to the language specific callback function // eg, PyObject *pyfunc @@ -130,12 +124,12 @@ class CoreSession { void *on_hangup; // language specific callback function, cast as void * switch_file_handle_t local_fh; switch_file_handle_t *fhp; - switch_status_t process_callback_result(char *ret); + SWITCH_DECLARE(switch_status_t) process_callback_result(char *ret); public: - CoreSession(); - CoreSession(char *uuid); - CoreSession(switch_core_session_t *new_session); - virtual ~CoreSession(); + SWITCH_DECLARE_CONSTRUCTOR CoreSession(); + SWITCH_DECLARE_CONSTRUCTOR CoreSession(char *uuid); + SWITCH_DECLARE_CONSTRUCTOR CoreSession(switch_core_session_t *new_session); + virtual SWITCH_DECLARE_CONSTRUCTOR ~CoreSession(); switch_core_session_t *session; switch_channel_t *channel; unsigned int flags; @@ -144,13 +138,13 @@ class CoreSession { // field in this->args switch_channel_state_t hook_state; // store hookstate for on_hangup callback - int answer(); - int preAnswer(); - virtual void hangup(char *cause = "normal_clearing"); - void setVariable(char *var, char *val); - void setPrivate(char *var, void *val); - void *getPrivate(char *var); - const char *getVariable(char *var); + SWITCH_DECLARE(int) answer(); + SWITCH_DECLARE(int) preAnswer(); + virtual SWITCH_DECLARE(void) hangup(char *cause = "normal_clearing"); + SWITCH_DECLARE(void) setVariable(char *var, char *val); + SWITCH_DECLARE(void) setPrivate(char *var, void *val); + SWITCH_DECLARE(void *)getPrivate(char *var); + SWITCH_DECLARE(const char *)getVariable(char *var); /** \brief Record to a file @@ -160,14 +154,14 @@ class CoreSession { * to be considered silence (500 is a good starting point). * \param <[silence_secs]> seconds of silence to interrupt the record. */ - int recordFile(char *file_name, int max_len=0, int silence_threshold=0, int silence_secs=0); + SWITCH_DECLARE(int) recordFile(char *file_name, int max_len=0, int silence_threshold=0, int silence_secs=0); /** \brief Set attributes of caller data for purposes of outgoing calls * \param var - the variable name, eg, "caller_id_name" * \param val - the data to set, eg, "bob" */ - void setCallerData(char *var, char *val); + SWITCH_DECLARE(void) setCallerData(char *var, char *val); /** \brief Originate a call to a destination * @@ -178,7 +172,7 @@ class CoreSession { * \return an int status code indicating success or failure * */ - int originate(CoreSession *a_leg_session, + SWITCH_DECLARE(int) originate(CoreSession *a_leg_session, char *dest, int timeout=60); @@ -191,16 +185,16 @@ class CoreSession { * certain other methods are executing. * */ - void setDTMFCallback(void *cbfunc, char *funcargs); + SWITCH_DECLARE(void) setDTMFCallback(void *cbfunc, char *funcargs); - int speak(char *text); - void set_tts_parms(char *tts_name, char *voice_name); + SWITCH_DECLARE(int) speak(char *text); + SWITCH_DECLARE(void) set_tts_parms(char *tts_name, char *voice_name); /** * For timeout milliseconds, call the dtmf function set previously * by setDTMFCallback whenever a dtmf or event is received */ - int collectDigits(int timeout); + SWITCH_DECLARE(int) collectDigits(int timeout); /** * Collect up to maxdigits digits worth of digits @@ -209,14 +203,14 @@ class CoreSession { * (see mod_python.i). This does NOT call any callbacks upon * receiving dtmf digits. For that, use collectDigits. */ - int getDigits(char *dtmf_buf, + SWITCH_DECLARE(int) getDigits(char *dtmf_buf, switch_size_t buflen, switch_size_t maxdigits, char *terminators, char *terminator, int timeout); - int transfer(char *extensions, char *dialplan, char *context); + SWITCH_DECLARE(int) transfer(char *extensions, char *dialplan, char *context); /** \brief Play a file into channel and collect dtmfs * @@ -226,7 +220,7 @@ class CoreSession { * setDTMFCallback(..) as it uses its own internal callback * handler. */ - int playAndGetDigits(int min_digits, + SWITCH_DECLARE(int) playAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, @@ -244,28 +238,28 @@ class CoreSession { * \return an int status code indicating success or failure * */ - int streamFile(char *file, int starting_sample_count=0); + SWITCH_DECLARE(int) streamFile(char *file, int starting_sample_count=0); /** \brief flush any pending events */ - int flushEvents(); + SWITCH_DECLARE(int) flushEvents(); /** \brief flush any pending digits */ - int flushDigits(); + SWITCH_DECLARE(int) flushDigits(); - int setAutoHangup(bool val); + SWITCH_DECLARE(int) setAutoHangup(bool val); /** \brief Set the hangup callback function * \param hangup_func - language specific function ptr cast into void * */ - void setHangupHook(void *hangup_func); + SWITCH_DECLARE(void) setHangupHook(void *hangup_func); - bool ready(); + SWITCH_DECLARE(bool) ready(); - void execute(char *app, char *data); + SWITCH_DECLARE(void) execute(char *app, char *data); - void sendEvent(Event *sendME); + SWITCH_DECLARE(void) sendEvent(Event *sendME); virtual bool begin_allow_threads() = 0; virtual bool end_allow_threads() = 0; @@ -292,26 +286,26 @@ class CoreSession { /* ---- functions not bound to CoreSession instance ----- */ -void console_log(char *level_str, char *msg); -void console_clean_log(char *msg); -char *api_execute(char *cmd, char *arg); -void api_reply_delete(char *reply); +SWITCH_DECLARE(void) console_log(char *level_str, char *msg); +SWITCH_DECLARE(void) console_clean_log(char *msg); +SWITCH_DECLARE(char *)api_execute(char *cmd, char *arg); +SWITCH_DECLARE(void) api_reply_delete(char *reply); /** \brief bridge the audio of session_b into session_a * * NOTE: the stuff regarding the dtmf callback might be completely * wrong and has not been reviewed or tested */ -void bridge(CoreSession &session_a, CoreSession &session_b); +SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b); /** \brief the actual hangup hook called back by freeswitch core * which in turn gets the session and calls the appropriate * instance method to complete the callback. */ -switch_status_t hanguphook(switch_core_session_t *session); +SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session); -switch_status_t dtmf_callback(switch_core_session_t *session, +SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h index 38f6c2877f..69e08d2b61 100644 --- a/src/include/switch_platform.h +++ b/src/include/switch_platform.h @@ -175,6 +175,7 @@ typedef int gid_t; #define SWITCH_MOD_DECLARE_DATA #define SWITCH_THREAD_FUNC #endif +#define SWITCH_DECLARE_CONSTRUCTOR SWITCH_DECLARE_DATA #ifdef DOXYGEN #define DoxyDefine(x) x #else diff --git a/src/mod/languages/mod_lua/freeswitch_lua.h b/src/mod/languages/mod_lua/freeswitch_lua.h index 50a88a02f2..67dc81c689 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.h +++ b/src/mod/languages/mod_lua/freeswitch_lua.h @@ -3,12 +3,6 @@ #include -void console_log(char *level_str, char *msg); -void console_clean_log(char *msg); -char *api_execute(char *cmd, char *arg); -void api_reply_delete(char *reply); - - class Session : public CoreSession { public: Session(); diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index ab3d6446c6..1c634248c4 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -206,7 +206,7 @@ const char *Stream::get_data() } -CoreSession::CoreSession() +SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession() { session = NULL; channel = NULL; @@ -232,7 +232,7 @@ CoreSession::CoreSession() } -CoreSession::CoreSession(char *nuuid) +SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid) { memset(&caller_profile, 0, sizeof(caller_profile)); init_vars(); @@ -252,7 +252,7 @@ CoreSession::CoreSession(char *nuuid) } } -CoreSession::CoreSession(switch_core_session_t *new_session) +SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(switch_core_session_t *new_session) { memset(&caller_profile, 0, sizeof(caller_profile)); init_vars(); @@ -264,7 +264,7 @@ CoreSession::CoreSession(switch_core_session_t *new_session) } } -CoreSession::~CoreSession() +SWITCH_DECLARE_CONSTRUCTOR CoreSession::~CoreSession() { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::~CoreSession desctructor\n"); switch_channel_t *channel = NULL; @@ -282,7 +282,7 @@ CoreSession::~CoreSession() switch_safe_free(voice_name); } -int CoreSession::answer() +SWITCH_DECLARE(int) CoreSession::answer() { switch_status_t status; @@ -291,7 +291,7 @@ int CoreSession::answer() return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } -int CoreSession::preAnswer() +SWITCH_DECLARE(int) CoreSession::preAnswer() { switch_status_t status; sanity_check(-1); @@ -299,38 +299,38 @@ int CoreSession::preAnswer() return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } -void CoreSession::hangup(char *cause) +SWITCH_DECLARE(void) CoreSession::hangup(char *cause) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::hangup\n"); sanity_check_noreturn; switch_channel_hangup(channel, switch_channel_str2cause(cause)); } -void CoreSession::setPrivate(char *var, void *val) +SWITCH_DECLARE(void) CoreSession::setPrivate(char *var, void *val) { sanity_check_noreturn; switch_channel_set_private(channel, var, val); } -void *CoreSession::getPrivate(char *var) +SWITCH_DECLARE(void *)CoreSession::getPrivate(char *var) { sanity_check(NULL); return switch_channel_get_private(channel, var); } -void CoreSession::setVariable(char *var, char *val) +SWITCH_DECLARE(void) CoreSession::setVariable(char *var, char *val) { sanity_check_noreturn; switch_channel_set_variable(channel, var, val); } -const char *CoreSession::getVariable(char *var) +SWITCH_DECLARE(const char *)CoreSession::getVariable(char *var) { sanity_check(NULL); return switch_channel_get_variable(channel, var); } -void CoreSession::execute(char *app, char *data) +SWITCH_DECLARE(void) CoreSession::execute(char *app, char *data) { const switch_application_interface_t *application_interface; sanity_check_noreturn; @@ -343,7 +343,7 @@ void CoreSession::execute(char *app, char *data) } } -void CoreSession::setDTMFCallback(void *cbfunc, char *funcargs) { +SWITCH_DECLARE(void) CoreSession::setDTMFCallback(void *cbfunc, char *funcargs) { sanity_check_noreturn; @@ -365,7 +365,7 @@ void CoreSession::setDTMFCallback(void *cbfunc, char *funcargs) { } -void CoreSession::sendEvent(Event *sendME) +SWITCH_DECLARE(void) CoreSession::sendEvent(Event *sendME) { if (sendME->mine) { switch_core_session_receive_event(session, &sendME->event); @@ -374,7 +374,7 @@ void CoreSession::sendEvent(Event *sendME) } } -int CoreSession::speak(char *text) +SWITCH_DECLARE(int) CoreSession::speak(char *text) { switch_status_t status; @@ -402,7 +402,7 @@ int CoreSession::speak(char *text) return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } -void CoreSession::set_tts_parms(char *tts_name_p, char *voice_name_p) +SWITCH_DECLARE(void) CoreSession::set_tts_parms(char *tts_name_p, char *voice_name_p) { sanity_check_noreturn; switch_safe_free(tts_name); @@ -413,7 +413,7 @@ void CoreSession::set_tts_parms(char *tts_name_p, char *voice_name_p) -int CoreSession::collectDigits(int timeout) { +SWITCH_DECLARE(int) CoreSession::collectDigits(int timeout) { sanity_check(-1); begin_allow_threads(); switch_ivr_collect_digits_callback(session, ap, timeout); @@ -421,7 +421,7 @@ int CoreSession::collectDigits(int timeout) { return SWITCH_STATUS_SUCCESS; } -int CoreSession::getDigits(char *dtmf_buf, +SWITCH_DECLARE(int) CoreSession::getDigits(char *dtmf_buf, switch_size_t buflen, switch_size_t maxdigits, char *terminators, @@ -445,7 +445,7 @@ int CoreSession::getDigits(char *dtmf_buf, return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } -int CoreSession::transfer(char *extension, char *dialplan, char *context) +SWITCH_DECLARE(int) CoreSession::transfer(char *extension, char *dialplan, char *context) { switch_status_t status; sanity_check(-1); @@ -456,7 +456,7 @@ int CoreSession::transfer(char *extension, char *dialplan, char *context) return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } -int CoreSession::playAndGetDigits(int min_digits, +SWITCH_DECLARE(int) CoreSession::playAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, @@ -487,7 +487,7 @@ int CoreSession::playAndGetDigits(int min_digits, return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } -int CoreSession::streamFile(char *file, int starting_sample_count) { +SWITCH_DECLARE(int) CoreSession::streamFile(char *file, int starting_sample_count) { switch_status_t status; //switch_file_handle_t fh = { 0 }; @@ -518,7 +518,7 @@ int CoreSession::streamFile(char *file, int starting_sample_count) { } -bool CoreSession::ready() { +SWITCH_DECLARE(bool) CoreSession::ready() { switch_channel_t *channel; @@ -532,7 +532,7 @@ bool CoreSession::ready() { return switch_channel_ready(channel) != 0; } -int CoreSession::originate(CoreSession *a_leg_session, +SWITCH_DECLARE(int) CoreSession::originate(CoreSession *a_leg_session, char *dest, int timeout) { @@ -585,7 +585,7 @@ int CoreSession::originate(CoreSession *a_leg_session, return SWITCH_STATUS_FALSE; } -int CoreSession::recordFile(char *file_name, int max_len, int silence_threshold, int silence_secs) +SWITCH_DECLARE(int) CoreSession::recordFile(char *file_name, int max_len, int silence_threshold, int silence_secs) { switch_file_handle_t fh = { 0 }; switch_status_t status; @@ -600,7 +600,7 @@ int CoreSession::recordFile(char *file_name, int max_len, int silence_threshold, } -int CoreSession::flushEvents() +SWITCH_DECLARE(int) CoreSession::flushEvents() { switch_event_t *event; switch_channel_t *channel; @@ -616,13 +616,13 @@ int CoreSession::flushEvents() return SWITCH_STATUS_SUCCESS; } -int CoreSession::flushDigits() +SWITCH_DECLARE(int) CoreSession::flushDigits() { switch_channel_flush_dtmf(switch_core_session_get_channel(session)); return SWITCH_STATUS_SUCCESS; } -int CoreSession::setAutoHangup(bool val) +SWITCH_DECLARE(int) CoreSession::setAutoHangup(bool val) { if (!session) { return SWITCH_STATUS_FALSE; @@ -635,7 +635,7 @@ int CoreSession::setAutoHangup(bool val) return SWITCH_STATUS_SUCCESS; } -void CoreSession::setCallerData(char *var, char *val) { +SWITCH_DECLARE(void) CoreSession::setCallerData(char *var, char *val) { if (strcmp(var, "dialplan") == 0) { caller_profile.dialplan = val; @@ -667,7 +667,7 @@ void CoreSession::setCallerData(char *var, char *val) { } -void CoreSession::setHangupHook(void *hangup_func) { +SWITCH_DECLARE(void) CoreSession::setHangupHook(void *hangup_func) { sanity_check_noreturn; @@ -699,7 +699,7 @@ void CoreSession::store_file_handle(switch_file_handle_t *fh) { /* ---- methods not bound to CoreSession instance ---- */ -void console_log(char *level_str, char *msg) +SWITCH_DECLARE(void) console_log(char *level_str, char *msg) { switch_log_level_t level = SWITCH_LOG_DEBUG; if (level_str) { @@ -711,13 +711,13 @@ void console_log(char *level_str, char *msg) switch_log_printf(SWITCH_CHANNEL_LOG, level, "%s", switch_str_nil(msg)); } -void console_clean_log(char *msg) +SWITCH_DECLARE(void) console_clean_log(char *msg) { switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN,SWITCH_LOG_DEBUG, "%s", switch_str_nil(msg)); } -char *api_execute(char *cmd, char *arg) +SWITCH_DECLARE(char *)api_execute(char *cmd, char *arg) { switch_stream_handle_t stream = { 0 }; SWITCH_STANDARD_STREAM(stream); @@ -725,7 +725,7 @@ char *api_execute(char *cmd, char *arg) return (char *) stream.data; } -void api_reply_delete(char *reply) +SWITCH_DECLARE(void) api_reply_delete(char *reply) { if (!switch_strlen_zero(reply)) { free(reply); @@ -733,7 +733,7 @@ void api_reply_delete(char *reply) } -void bridge(CoreSession &session_a, CoreSession &session_b) +SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bridge called, session_a uuid: %s\n", session_a.get_uuid()); switch_input_callback_function_t dtmf_func = NULL; @@ -748,7 +748,7 @@ void bridge(CoreSession &session_a, CoreSession &session_b) } -switch_status_t hanguphook(switch_core_session_t *session_hungup) +SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session_hungup) { switch_channel_t *channel = switch_core_session_get_channel(session_hungup); CoreSession *coresession = NULL; @@ -768,7 +768,7 @@ switch_status_t hanguphook(switch_core_session_t *session_hungup) } -switch_status_t dtmf_callback(switch_core_session_t *session_cb, +SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session_cb, void *input, switch_input_type_t itype, void *buf, @@ -800,7 +800,7 @@ switch_status_t dtmf_callback(switch_core_session_t *session_cb, -switch_status_t CoreSession::process_callback_result(char *ret) +SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *ret) { switch_file_handle_t *fh = NULL; diff --git a/w32/Library/FreeSwitchCore.2008.vcproj b/w32/Library/FreeSwitchCore.2008.vcproj index 29e90327f4..4ebfde59e9 100644 --- a/w32/Library/FreeSwitchCore.2008.vcproj +++ b/w32/Library/FreeSwitchCore.2008.vcproj @@ -389,8 +389,6 @@