Freeswitch-trunk
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
June 2009
- 21 participants
- 501 discussions
Author: mikej
Date: Wed Jun 24 11:27:28 2009
New Revision: 13941
Log:
fix build failure
Modified:
freeswitch/trunk/src/switch_odbc.c
Modified: freeswitch/trunk/src/switch_odbc.c
==============================================================================
--- freeswitch/trunk/src/switch_odbc.c (original)
+++ freeswitch/trunk/src/switch_odbc.c Wed Jun 24 11:27:28 2009
@@ -215,9 +215,9 @@
#endif
}
+#ifdef SWITCH_HAVE_ODBC
static int db_is_up(switch_odbc_handle_t *handle)
{
-#ifdef SWITCH_HAVE_ODBC
int ret = 0;
SQLHSTMT stmt = NULL;
SQLLEN m = 0;
@@ -316,10 +316,8 @@
}
return ret;
-#else
- return SWITCH_ODBC_FAIL;
-#endif
}
+#endif
SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_statement_handle_free(switch_odbc_statement_handle_t * stmt)
{
1
0
Author: brian
Date: Wed Jun 24 11:26:14 2009
New Revision: 13940
Log:
turn on rollover by default
Modified:
freeswitch/trunk/conf/autoload_configs/logfile.conf.xml
Modified: freeswitch/trunk/conf/autoload_configs/logfile.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/logfile.conf.xml (original)
+++ freeswitch/trunk/conf/autoload_configs/logfile.conf.xml Wed Jun 24 11:26:14 2009
@@ -9,7 +9,7 @@
<!-- File to log to -->
<!--<param name="logfile" value="/var/log/freeswitch.log"/>-->
<!-- At this length in bytes rotate the log file (0 for never) -->
- <!--<param name="rollover" value="10485760"/>-->
+ <param name="rollover" value="10485760"/>
</settings>
<mappings>
<!--
1
0
Author: brian
Date: Wed Jun 24 11:13:00 2009
New Revision: 13939
Log:
FSBUILD-177
Modified:
freeswitch/trunk/libs/win32/pocketsphinx/pocketsphinx.2008.vcproj
Modified: freeswitch/trunk/libs/win32/pocketsphinx/pocketsphinx.2008.vcproj
==============================================================================
--- freeswitch/trunk/libs/win32/pocketsphinx/pocketsphinx.2008.vcproj (original)
+++ freeswitch/trunk/libs/win32/pocketsphinx/pocketsphinx.2008.vcproj Wed Jun 24 11:13:00 2009
@@ -493,7 +493,7 @@
>
</File>
<File
- RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\sdc_mgau.h"
+ RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\phone_loop_search.h"
>
</File>
<File
@@ -1057,7 +1057,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\sdc_mgau.c"
+ RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\phone_loop_search.c"
>
</File>
<File
1
0
[commit] r13938 - in freeswitch/trunk/src/mod/languages: mod_managed mod_perl
by FreeSWITCH SVN 24 Jun '09
by FreeSWITCH SVN 24 Jun '09
24 Jun '09
Author: brian
Date: Wed Jun 24 11:07:38 2009
New Revision: 13938
Log:
swigall
Modified:
freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx
freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
Modified: freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx (original)
+++ freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx Wed Jun 24 11:07:38 2009
@@ -3445,7 +3445,7 @@
int jresult ;
int result;
- result = (int) 3;
+ result = (int) 4;
jresult = result;
return jresult;
Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp Wed Jun 24 11:07:38 2009
@@ -11562,17 +11562,17 @@
SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
- /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+ /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
- /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+ /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
- /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+ /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
SvREADONLY_on(sv);
1
0
24 Jun '09
Author: brian
Date: Wed Jun 24 11:04:05 2009
New Revision: 13937
Log:
mod_sofia: Dereferencing a null pointer causes segfault: sofia_handle_sip_r_invite doesn't check profile->extsipip before use (FSCORE-386)
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 24 11:04:05 2009
@@ -3071,7 +3071,7 @@
p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context);
switch_ivr_session_transfer(a_session, p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context);
} else if ((!strcmp(profile->sipip, p_contact->m_url->url_host))
- || (!strcmp(profile->extsipip, p_contact->m_url->url_host))
+ || (profile->extsipip && !strcmp(profile->extsipip, p_contact->m_url->url_host))
|| (switch_xml_locate_domain(p_contact->m_url->url_host, NULL, &root, &domain) == SWITCH_STATUS_SUCCESS)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Redirect: Transfering to %s\n", p_contact->m_url->url_user);
switch_ivr_session_transfer(a_session, p_contact->m_url->url_user, NULL, NULL);
1
0
Author: mikej
Date: Wed Jun 24 11:02:43 2009
New Revision: 13936
Log:
change odbc handling in code to be runtime instead of build time
Removed:
freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/Makefile
freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/Makefile
freeswitch/trunk/src/mod/applications/mod_easyroute/Makefile
freeswitch/trunk/src/mod/applications/mod_lcr/Makefile
freeswitch/trunk/src/mod/applications/mod_limit/Makefile
freeswitch/trunk/src/mod/applications/mod_nibblebill/Makefile
freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile
Modified:
freeswitch/trunk/Makefile.am
freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c
freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c
freeswitch/trunk/src/include/switch.h
freeswitch/trunk/src/include/switch_odbc.h
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/applications/mod_cidlookup/Makefile
freeswitch/trunk/src/mod/applications/mod_cidlookup/mod_cidlookup.c
freeswitch/trunk/src/mod/applications/mod_easyroute/mod_easyroute.c
freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c
freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c
freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
freeswitch/trunk/src/switch_odbc.c
Modified: freeswitch/trunk/Makefile.am
==============================================================================
--- freeswitch/trunk/Makefile.am (original)
+++ freeswitch/trunk/Makefile.am Wed Jun 24 11:02:43 2009
@@ -97,6 +97,7 @@
src/switch_xml_config.c\
src/switch_config.c\
src/switch_time.c\
+src/switch_odbc.c \
libs/stfu/stfu.c\
src/switch_cpp.cpp\
src/g711.c\
@@ -204,7 +205,6 @@
if ADD_ODBC
CORE_CFLAGS += -DSWITCH_HAVE_ODBC $(ODBC_INC_FLAGS)
-libfreeswitch_la_SOURCES += src/switch_odbc.c
libfreeswitch_la_LDFLAGS += $(ODBC_LIB_FLAGS)
endif
Modified: freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c
==============================================================================
--- freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c (original)
+++ freeswitch/trunk/scripts/contrib/dschreiber/mod_nibblebill/mod_nibblebill.c Wed Jun 24 11:02:43 2009
@@ -50,15 +50,10 @@
#include <switch.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
/* Defaults */
-#ifdef SWITCH_HAVE_ODBC
static char SQL_LOOKUP[] = "SELECT %s FROM %s WHERE %s='%s'";
static char SQL_SAVE[] = "UPDATE %s SET %s=%s-%f WHERE %s='%s'";
-#endif
typedef struct
{
@@ -110,11 +105,7 @@
char *db_table;
char *db_column_cash;
char *db_column_account;
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_t *master_odbc;
-#else
- void *padding1; /* Keep structures same size */
-#endif
} globals;
static void nibblebill_pause(switch_core_session_t *session);
@@ -142,7 +133,6 @@
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_lowbal_action, globals.lowbal_action);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_nobal_action, globals.nobal_action);
-#ifdef SWITCH_HAVE_ODBC
static int nibblebill_callback(void *pArg, int argc, char **argv, char **columnNames)
{
nibblebill_results_t *cbt = (nibblebill_results_t *) pArg;
@@ -151,7 +141,6 @@
return 0;
}
-#endif
static switch_status_t load_config(void)
{
@@ -221,8 +210,7 @@
set_global_nobal_action("hangup");
}
-#ifdef SWITCH_HAVE_ODBC
- if (globals.db_dsn) {
+ if (switch_odbc_available() && globals.db_dsn) {
if (!(globals.master_odbc = switch_odbc_handle_new(globals.db_dsn, globals.db_username, globals.db_password))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot create handle to ODBC Database!\n");
status = SWITCH_STATUS_FALSE;
@@ -230,25 +218,23 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opened ODBC Database handle!\n");
}
-
+
if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot connect to ODBC driver/database %s (user: %s / pass %s)!\n", globals.db_dsn, globals.db_username, globals.db_password);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+ "Cannot connect to ODBC driver/database %s (user: %s / pass %s)!\n",
+ globals.db_dsn, globals.db_username, globals.db_password);
status = SWITCH_STATUS_FALSE;
goto done;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opened ODBC Database!\n");
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.db_dsn);
- } else {
-#endif
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "ODBC does not appear to be installed in the core. You need to run ./configure --enable-core-odbc-support\n");
-#ifdef SWITCH_HAVE_ODBC
+ } else if (globals.db_dsn) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+ "ODBC does not appear to be installed in the core. You need to run ./configure --enable-core-odbc-support\n");
}
-#endif
-#ifdef SWITCH_HAVE_ODBC
done:
-#endif
if (xml) {
switch_xml_free(xml);
@@ -307,49 +293,50 @@
/* At this time, billing never succeeds if you don't have a database. */
static switch_status_t bill_event(float billamount, const char *billaccount)
{
-#ifdef SWITCH_HAVE_ODBC
char sql[1024] = "";
- SQLHSTMT stmt;
+ switch_odbc_statement_handle_t stmt;
+
+ if (!switch_odbc_available()) {
+ return SWITCH_STATUS_SUCCESS;
+ }
snprintf(sql, 1024, SQL_SAVE, globals.db_table, globals.db_column_cash, globals.db_column_cash, billamount, globals.db_column_account, billaccount);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doing update query\n[%s]\n", sql);
-
+
if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
switch_safe_free(err_str);
} else {
-#endif
/* TODO: Failover to a flat/text file if DB is unavailable */
-
+
return SWITCH_STATUS_SUCCESS;
-#ifdef SWITCH_HAVE_ODBC
}
+ switch_odbc_statement_handle_free(&stmt);
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-#endif
return SWITCH_STATUS_SUCCESS;
}
static float get_balance(const char *billaccount)
{
-#ifdef SWITCH_HAVE_ODBC
char sql[1024] = "";
nibblebill_results_t pdata;
float balance = 0.00;
+ if (!switch_odbc_avaliable()) {
+ return -1.0f;
+ }
+
memset(&pdata, 0, sizeof(pdata));
snprintf(sql, 1024, SQL_LOOKUP, globals.db_column_cash, globals.db_table, globals.db_column_account, billaccount);
if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, nibblebill_callback, &pdata) != SWITCH_ODBC_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running this query: [%s]\n", sql);
-#endif
/* TODO: Return -1 for safety */
- return -1.00;
-#ifdef SWITCH_HAVE_ODBC
+ return -1.00f;
} else {
/* Successfully retrieved! */
balance = pdata.balance;
@@ -357,7 +344,6 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Retrieved current balance for account %s (balance = %f)\n", billaccount, balance);
}
-#endif
return balance;
}
@@ -879,10 +865,7 @@
{
switch_event_unbind(&globals.node);
switch_core_remove_state_handler(&nibble_state_handler);
-
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_disconnect(globals.master_odbc);
-#endif
return SWITCH_STATUS_UNLOAD;
}
Modified: freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c
==============================================================================
--- freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c (original)
+++ freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c Wed Jun 24 11:02:43 2009
@@ -33,9 +33,6 @@
*
*/
#include <switch.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
typedef enum {
XML_ODBC_CONFIG = 0,
@@ -68,11 +65,7 @@
switch_xml_t templates_tag;
switch_mutex_t *mutex;
switch_memory_pool_t *pool;
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_t *master_odbc;
-#else
- void *filler1;
-#endif
} globals;
@@ -406,8 +399,7 @@
binding = NULL;
}
-#ifdef SWITCH_HAVE_ODBC
- if (globals.odbc_dsn) {
+ if (switch_odbc_available() && globals.odbc_dsn) {
if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
@@ -423,7 +415,6 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.odbc_dsn);
}
-#endif
done:
@@ -441,11 +432,11 @@
switch_api_interface_t *xml_odbc_api_interface;
-#ifndef SWITCH_HAVE_ODBC
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must have ODBC support in FreeSWITCH to use this module\n");
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\t./configure --enable-core-odbc-support\n");
- return SWITCH_STATUS_FALSE;
-#endif
+ if (!switch_odbc_available()) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must have ODBC support in FreeSWITCH to use this module\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\t./configure --enable-core-odbc-support\n");
+ return SWITCH_STATUS_FALSE;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "XML ODBC module loading...\n");
Modified: freeswitch/trunk/src/include/switch.h
==============================================================================
--- freeswitch/trunk/src/include/switch.h (original)
+++ freeswitch/trunk/src/include/switch.h Wed Jun 24 11:02:43 2009
@@ -130,6 +130,8 @@
#include "switch_scheduler.h"
#include "switch_config.h"
#include "switch_nat.h"
+#include "switch_odbc.h"
+
#include <libteletone.h>
/** \mainpage FreeSWITCH
Modified: freeswitch/trunk/src/include/switch_odbc.h
==============================================================================
--- freeswitch/trunk/src/include/switch_odbc.h (original)
+++ freeswitch/trunk/src/include/switch_odbc.h Wed Jun 24 11:02:43 2009
@@ -33,18 +33,11 @@
#define SWITCH_ODBC_H
#include <switch.h>
-#include <sql.h>
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable:4201)
-#include <sqlext.h>
-#pragma warning(pop)
-#else
-#include <sqlext.h>
-#endif
-#include <sqltypes.h>
-SWITCH_BEGIN_EXTERN_C struct switch_odbc_handle;
+SWITCH_BEGIN_EXTERN_C
+
+struct switch_odbc_handle;
+typedef void * switch_odbc_statement_handle_t;
typedef enum {
SWITCH_ODBC_STATE_INIT,
@@ -63,7 +56,13 @@
SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_handle_t *handle);
SWITCH_DECLARE(void) switch_odbc_handle_destroy(switch_odbc_handle_t **handlep);
SWITCH_DECLARE(switch_odbc_state_t) switch_odbc_handle_get_state(switch_odbc_handle_t *handle);
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, SQLHSTMT * rstmt);
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, switch_odbc_statement_handle_t * rstmt);
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_handle_t *handle,
+ char *sql,
+ char *resbuf,
+ size_t len);
+SWITCH_DECLARE(switch_bool_t) switch_odbc_available(void);
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_statement_handle_free(switch_odbc_statement_handle_t * stmt);
/*!
\brief Execute the sql query and issue a callback for each row returned
@@ -93,7 +92,7 @@
handle, sql, callback, pdata)
-SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, SQLHSTMT stmt);
+SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, switch_odbc_statement_handle_t stmt);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Wed Jun 24 11:02:43 2009
@@ -1490,7 +1490,7 @@
typedef struct switch_network_list switch_network_list_t;
-#define SWITCH_API_VERSION 3
+#define SWITCH_API_VERSION 4
#define SWITCH_MODULE_LOAD_ARGS (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)
#define SWITCH_MODULE_RUNTIME_ARGS (void)
#define SWITCH_MODULE_SHUTDOWN_ARGS (void)
Modified: freeswitch/trunk/src/mod/applications/mod_cidlookup/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_cidlookup/Makefile (original)
+++ freeswitch/trunk/src/mod/applications/mod_cidlookup/Makefile Wed Jun 24 11:02:43 2009
@@ -1,5 +1,4 @@
WANT_CURL=yes
-
BASE=../../../..
include $(BASE)/build/modmake.rules
-LOCAL_CFLAGS += `if test -f $(BASE)/.libs/libfreeswitch_la-switch_odbc.o ; then echo -DSWITCH_HAVE_ODBC; fi ;`
+
Modified: freeswitch/trunk/src/mod/applications/mod_cidlookup/mod_cidlookup.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_cidlookup/mod_cidlookup.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_cidlookup/mod_cidlookup.c Wed Jun 24 11:02:43 2009
@@ -30,9 +30,6 @@
*/
#include <switch.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
#include <curl/curl.h>
/* Prototypes */
@@ -56,33 +53,11 @@
char *odbc_dsn;
char *sql;
-#ifdef SWITCH_HAVE_ODBC
switch_mutex_t *db_mutex;
-#else
- void *filler1;
-#endif
switch_memory_pool_t *pool;
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_t *master_odbc;
-#else
- void *filler2;
-#endif
} globals;
-#ifdef SWITCH_HAVE_ODBC
-struct odbc_obj {
- switch_odbc_handle_t *handle;
- SQLHSTMT stmt;
- SQLCHAR *colbuf;
- int32_t cblen;
- SQLCHAR *code;
- int32_t codelen;
-};
-
-typedef struct odbc_obj odbc_obj_t;
-typedef odbc_obj_t *odbc_handle;
-#endif
-
struct http_data {
switch_stream_handle_t stream;
switch_size_t bytes;
@@ -103,13 +78,17 @@
static switch_status_t config_callback_dsn(switch_xml_config_item_t *data, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
-#ifdef SWITCH_HAVE_ODBC
char *odbc_user = NULL;
char *odbc_pass = NULL;
char *odbc_dsn = NULL;
switch_odbc_handle_t *odbc = NULL;
+ if (!switch_odbc_available()) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC is not compiled in. Do not configure odbc-dsn parameter!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
if (globals.db_mutex) {
switch_mutex_lock(globals.db_mutex);
}
@@ -152,18 +131,12 @@
}
switch_goto_status(SWITCH_STATUS_SUCCESS, done);
-#else
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC is not compiled in. Do not configure odbc-dsn parameter!\n");
- switch_goto_status(SWITCH_STATUS_FALSE, done);
-#endif
done:
-#ifdef SWITCH_HAVE_ODBC
if (globals.db_mutex) {
switch_mutex_unlock(globals.db_mutex);
}
switch_safe_free(odbc_dsn);
-#endif
return status;
}
@@ -193,7 +166,6 @@
do_config(SWITCH_TRUE);
}
-#ifdef SWITCH_HAVE_ODBC
static switch_bool_t cidlookup_execute_sql_callback(char *sql, switch_core_db_callback_func_t callback, void *pdata)
{
switch_bool_t retval = SWITCH_FALSE;
@@ -227,7 +199,6 @@
return SWITCH_STATUS_SUCCESS;
}
-#endif
/* make a new string with digits only */
static char *string_digitsonly(switch_memory_pool_t *pool, const char *str)
@@ -365,7 +336,6 @@
return name;
}
-#ifdef SWITCH_HAVE_ODBC
static char *do_db_lookup(switch_memory_pool_t *pool, switch_event_t *event, const char *num) {
char *name = NULL;
char *newsql = NULL;
@@ -386,7 +356,6 @@
}
return name;
}
-#endif
static char *do_lookup(switch_memory_pool_t *pool, switch_event_t *event, const char *num, switch_bool_t skipurl) {
char *number = NULL;
@@ -395,12 +364,11 @@
number = string_digitsonly(pool, num);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "caller_id_number", number);
-#ifdef SWITCH_HAVE_ODBC
/* database always wins */
- if (globals.master_odbc && globals.sql) {
+ if (switch_odbc_available() && globals.master_odbc && globals.sql) {
name = do_db_lookup(pool, event, number);
}
-#endif
+
if (!name && globals.url) {
if (globals.cache) {
name = check_cache(pool, number);
@@ -510,11 +478,7 @@
stream->write_function(stream, " odbc-dsn: %s\n sql: %s\n",
globals.odbc_dsn,
globals.sql);
-#ifdef SWITCH_HAVE_ODBC
- stream->write_function(stream, " ODBC Compiled: true\n");
-#else
- stream->write_function(stream, " ODBC Compiled: false\n");
-#endif
+ stream->write_function(stream, " ODBC Compiled: %s\n", switch_odbc_available() ? "true" : "false");
switch_goto_status(SWITCH_STATUS_SUCCESS, done);
}
@@ -556,13 +520,11 @@
globals.pool = pool;
-#ifdef SWITCH_HAVE_ODBC
- if (!globals.db_mutex) {
+ if (switch_odbc_available() && !globals.db_mutex) {
if (switch_mutex_init(&globals.db_mutex, SWITCH_MUTEX_UNNESTED, globals.pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to initialize db_mutex\n");
}
}
-#endif
do_config(SWITCH_FALSE);
@@ -585,7 +547,7 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cidlookup_shutdown)
{
/* Cleanup dynamically allocated config settings */
-#ifdef SWITCH_HAVE_ODBC
+
if (globals.db_mutex) {
switch_mutex_destroy(globals.db_mutex);
}
@@ -593,7 +555,7 @@
switch_odbc_handle_disconnect(globals.master_odbc);
switch_odbc_handle_destroy(&globals.master_odbc);
}
-#endif
+
switch_event_unbind(&reload_xml_event);
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/trunk/src/mod/applications/mod_easyroute/mod_easyroute.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_easyroute/mod_easyroute.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_easyroute/mod_easyroute.c Wed Jun 24 11:02:43 2009
@@ -38,10 +38,6 @@
#include <switch.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
-
typedef struct easyroute_results{
char limit[16];
char dialstring[256];
@@ -68,11 +64,7 @@
char *default_gateway;
switch_mutex_t *mutex;
char *custom_query;
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_t *master_odbc;
-#else
- void *filler1;
-#endif
} globals;
SWITCH_MODULE_LOAD_FUNCTION(mod_easyroute_load);
@@ -86,7 +78,6 @@
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_default_gateway, globals.default_gateway);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_custom_query, globals.custom_query);
-#ifdef SWITCH_HAVE_ODBC
static int route_callback(void *pArg, int argc, char **argv, char **columnNames)
{
route_callback_t *cbt = (route_callback_t *) pArg;
@@ -100,7 +91,6 @@
return 0;
}
-#endif
static switch_status_t load_config(void)
{
@@ -145,9 +135,7 @@
set_global_db_dsn("easyroute");
}
-
-#ifdef SWITCH_HAVE_ODBC
- if (globals.db_dsn) {
+ if (switch_odbc_available() && globals.db_dsn) {
if (!(globals.master_odbc = switch_odbc_handle_new(globals.db_dsn, globals.db_username, globals.db_password))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
status = SWITCH_STATUS_FALSE;
@@ -171,15 +159,12 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot find SQL Database! (Where\'s the gateways table\?\?)\n");
}
}
- } else {
-#endif
+ } else if (globals.db_dsn) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Connection (did you enable it?!)\n");
-#ifdef SWITCH_HAVE_ODBC
}
reallydone:
-#endif
if (xml) {
switch_xml_free(xml);
}
@@ -192,17 +177,20 @@
return status;
}
-#ifdef SWITCH_HAVE_ODBC
static char SQL_LOOKUP[] = "SELECT gateways.gateway_ip, gateways.group, gateways.limit, gateways.techprofile, numbers.acctcode, numbers.translated from gateways, numbers where numbers.number = '%q' and numbers.gateway_id = gateways.gateway_id limit 1;";
-#endif
static switch_status_t route_lookup(char *dn, easyroute_results_t *results, int noat, char *seperator)
{
switch_status_t sstatus = SWITCH_STATUS_SUCCESS;
-#ifdef SWITCH_HAVE_ODBC
char *sql = NULL;
route_callback_t pdata;
+ if (!switch_odbc_available()) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+ "mod_easyroute requires core ODBC support. Please refer to the documentation on how to enable this\n");
+ return sstatus;
+ }
+
memset(&pdata, 0, sizeof(pdata));
if (!globals.custom_query){
sql = switch_mprintf(SQL_LOOKUP, dn);
@@ -278,9 +266,6 @@
}
switch_safe_free(sql);
-#else
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "mod_easyroute requires core ODBC support. Please refer to the documentation on how to enable this\n");
-#endif
if (globals.mutex){
switch_mutex_unlock(globals.mutex);
@@ -347,11 +332,11 @@
goto done;
}
-#ifndef SWITCH_HAVE_ODBC
- stream->write_function(stream, "mod_easyroute requires you enable core odbc support\n");
- status = SWITCH_STATUS_SUCCESS;
- goto done;
-#endif
+ if (!switch_odbc_available()) {
+ stream->write_function(stream, "mod_easyroute requires you enable core odbc support\n");
+ status = SWITCH_STATUS_SUCCESS;
+ goto done;
+ }
if (!cmd || !(mydata = strdup(cmd))) {
stream->write_function(stream, "Usage: easyroute <number>\n");
@@ -430,10 +415,7 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_easyroute_shutdown)
{
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_disconnect(globals.master_odbc);
-#endif
-
switch_safe_free(globals.db_username);
switch_safe_free(globals.db_password);
switch_safe_free(globals.db_dsn);
Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c Wed Jun 24 11:02:43 2009
@@ -29,9 +29,6 @@
*
*/
#include <switch.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown);
SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load);
@@ -264,12 +261,7 @@
char *dbname;
char *odbc_dsn;
int node_thread_running;
-
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_t *master_odbc;
-#else
- void *filler1;
-#endif
} globals;
@@ -282,9 +274,9 @@
if (mutex) {
switch_mutex_lock(mutex);
}
-#ifdef SWITCH_HAVE_ODBC
- if (globals.odbc_dsn) {
- SQLHSTMT stmt;
+
+ if (switch_odbc_available() && globals.odbc_dsn) {
+ switch_odbc_statement_handle_t stmt;
if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
@@ -294,9 +286,8 @@
switch_safe_free(err_str);
status = SWITCH_STATUS_FALSE;
}
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ switch_odbc_statement_handle_free(&stmt);
} else {
-#endif
if (!(db = switch_core_db_open_file(globals.dbname))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
status = SWITCH_STATUS_FALSE;
@@ -309,12 +300,8 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s]\n[%s]\n", sql, err_str);
free(err_str);
}
-
switch_core_db_close(db);
-
-#ifdef SWITCH_HAVE_ODBC
}
-#endif
end:
if (mutex) {
@@ -334,11 +321,9 @@
switch_mutex_lock(mutex);
}
-#ifdef SWITCH_HAVE_ODBC
- if (globals.odbc_dsn) {
+ if (switch_odbc_available() && globals.odbc_dsn) {
switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata);
} else {
-#endif
if (!(db = switch_core_db_open_file(globals.dbname))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
goto end;
@@ -354,9 +339,7 @@
if (db) {
switch_core_db_close(db);
}
-#ifdef SWITCH_HAVE_ODBC
}
-#endif
end:
if (mutex) {
@@ -1766,17 +1749,17 @@
val = (char *) switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
-#ifdef SWITCH_HAVE_ODBC
- globals.odbc_dsn = switch_core_strdup(globals.pool, val);
- if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
- *odbc_user++ = '\0';
- if ((odbc_pass = strchr(odbc_user, ':'))) {
- *odbc_pass++ = '\0';
+ if (switch_odbc_available()) {
+ globals.odbc_dsn = switch_core_strdup(globals.pool, val);
+ if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
+ *odbc_user++ = '\0';
+ if ((odbc_pass = strchr(odbc_user, ':'))) {
+ *odbc_pass++ = '\0';
+ }
}
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
}
-#else
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
}
}
}
@@ -1786,8 +1769,7 @@
globals.dbname = "fifo";
}
-#ifdef SWITCH_HAVE_ODBC
- if (globals.odbc_dsn) {
+ if (switch_odbc_available() && globals.odbc_dsn) {
if (!(globals.master_odbc = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
status = SWITCH_STATUS_FALSE;
@@ -1806,7 +1788,6 @@
}
}
} else {
-#endif
if ((db = switch_core_db_open_file(globals.dbname))) {
switch_core_db_test_reactive(db, "delete from fifo_outbound", NULL, (char *)outbound_sql);
} else {
@@ -1815,9 +1796,7 @@
goto done;
}
switch_core_db_close(db);
-#ifdef SWITCH_HAVE_ODBC
}
-#endif
if (reload) {
switch_hash_index_t *hi;
Modified: freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c Wed Jun 24 11:02:43 2009
@@ -31,8 +31,6 @@
*/
#include <switch.h>
-#include <switch_odbc.h>
-
#define LCR_SYNTAX "lcr <digits> [<lcr profile>] [caller_id] [intrastate]"
#define LCR_ADMIN_SYNTAX "lcr_admin show profiles"
@@ -75,15 +73,6 @@
/* sql for random function */
static char *db_random = NULL;
-struct odbc_obj {
- switch_odbc_handle_t *handle;
- SQLHSTMT stmt;
- SQLCHAR *colbuf;
- int32_t cblen;
- SQLCHAR *code;
- int32_t codelen;
-};
-
struct lcr_obj {
char *carrier_name;
char *gw_prefix;
@@ -112,9 +101,6 @@
size_t dialstring;
};
-typedef struct odbc_obj odbc_obj_t;
-typedef odbc_obj_t *odbc_handle;
-
typedef struct lcr_obj lcr_obj_t;
typedef lcr_obj_t *lcr_route;
@@ -1384,11 +1370,11 @@
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-#ifndef SWITCH_HAVE_ODBC
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must have ODBC support in FreeSWITCH to use this module\n");
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\t./configure --enable-core-odbc-support\n");
- return SWITCH_STATUS_FALSE;
-#endif
+ if (!switch_odbc_available()) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must have ODBC support in FreeSWITCH to use this module\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "\t./configure --enable-core-odbc-support\n");
+ return SWITCH_STATUS_FALSE;
+ }
globals.pool = pool;
@@ -1417,10 +1403,8 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lcr_shutdown)
{
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_disconnect(globals.master_odbc);
switch_odbc_handle_destroy(&globals.master_odbc);
-#endif
switch_core_hash_destroy(&globals.profile_hash);
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c Wed Jun 24 11:02:43 2009
@@ -33,9 +33,6 @@
*/
#include <switch.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
#define LIMIT_EVENT_USAGE "limit::usage"
@@ -53,11 +50,7 @@
switch_hash_t *limit_hash;
switch_mutex_t *db_hash_mutex;
switch_hash_t *db_hash;
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_t *master_odbc;
-#else
- void *filler1;
-#endif
} globals;
typedef struct {
@@ -102,9 +95,9 @@
if (mutex) {
switch_mutex_lock(mutex);
}
-#ifdef SWITCH_HAVE_ODBC
- if (globals.odbc_dsn) {
- SQLHSTMT stmt;
+
+ if (switch_odbc_available() && globals.odbc_dsn) {
+ switch_odbc_statement_handle_t stmt;
if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
@@ -114,21 +107,16 @@
switch_safe_free(err_str);
status = SWITCH_STATUS_FALSE;
}
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ switch_odbc_statement_handle_free(&stmt);
} else {
-#endif
if (!(db = switch_core_db_open_file(globals.dbname))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
status = SWITCH_STATUS_FALSE;
goto end;
}
-
status = switch_core_db_persistant_execute(db, sql, 1);
switch_core_db_close(db);
-
-#ifdef SWITCH_HAVE_ODBC
}
-#endif
end:
if (mutex) {
@@ -148,11 +136,9 @@
switch_mutex_lock(mutex);
}
-#ifdef SWITCH_HAVE_ODBC
- if (globals.odbc_dsn) {
+ if (switch_odbc_available() && globals.odbc_dsn) {
switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata);
} else {
-#endif
if (!(db = switch_core_db_open_file(globals.dbname))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", globals.dbname);
goto end;
@@ -168,9 +154,7 @@
if (db) {
switch_core_db_close(db);
}
-#ifdef SWITCH_HAVE_ODBC
}
-#endif
end:
if (mutex) {
@@ -202,17 +186,15 @@
return SWITCH_STATUS_TERM;
}
- if (globals.odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
+ if (switch_odbc_available() && globals.odbc_dsn) {
if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
*odbc_user++ = '\0';
if ((odbc_pass = strchr(odbc_user, ':'))) {
*odbc_pass++ = '\0';
}
}
-#else
+ } else if (globals.odbc_dsn) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
}
@@ -220,8 +202,7 @@
globals.dbname = "call_limit";
}
-#ifdef SWITCH_HAVE_ODBC
- if (globals.odbc_dsn) {
+ if (switch_odbc_available() && globals.odbc_dsn) {
int x;
char *indexes[] = {
"create index ld_hostname on limit_data (hostname)",
@@ -269,7 +250,6 @@
switch_odbc_handle_exec(globals.master_odbc, indexes[x], NULL);
}
} else {
-#endif
if ((db = switch_core_db_open_file(globals.dbname))) {
switch_core_db_test_reactive(db, "select * from limit_data", NULL, limit_sql);
switch_core_db_test_reactive(db, "select * from db_data", NULL, db_sql);
@@ -292,9 +272,7 @@
goto done;
}
switch_core_db_close(db);
-#ifdef SWITCH_HAVE_ODBC
}
-#endif
done:
@@ -1129,11 +1107,9 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_limit_shutdown)
{
- #ifdef SWITCH_HAVE_ODBC
if (globals.master_odbc) {
switch_odbc_handle_destroy(&globals.master_odbc);
}
- #endif
switch_event_free_subclass(LIMIT_EVENT_USAGE);
Modified: freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c Wed Jun 24 11:02:43 2009
@@ -49,15 +49,9 @@
#include <switch.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
-
/* Defaults */
-#ifdef SWITCH_HAVE_ODBC
static char SQL_LOOKUP[] = "SELECT %s FROM %s WHERE %s='%s'";
static char SQL_SAVE[] = "UPDATE %s SET %s=%s-%f WHERE %s='%s'";
-#endif
typedef struct
{
@@ -109,11 +103,7 @@
char *db_table;
char *db_column_cash;
char *db_column_account;
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_t *master_odbc;
-#else
- void *padding1; /* Keep structures same size */
-#endif
} globals;
static void nibblebill_pause(switch_core_session_t *session);
@@ -141,7 +131,6 @@
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_lowbal_action, globals.lowbal_action);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_nobal_action, globals.nobal_action);
-#ifdef SWITCH_HAVE_ODBC
static int nibblebill_callback(void *pArg, int argc, char **argv, char **columnNames)
{
nibblebill_results_t *cbt = (nibblebill_results_t *) pArg;
@@ -150,7 +139,6 @@
return 0;
}
-#endif
static switch_status_t load_config(void)
{
@@ -220,8 +208,7 @@
set_global_nobal_action("hangup");
}
-#ifdef SWITCH_HAVE_ODBC
- if (globals.db_dsn) {
+ if (switch_odbc_available() && globals.db_dsn) {
if (!(globals.master_odbc = switch_odbc_handle_new(globals.db_dsn, globals.db_username, globals.db_password))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot create handle to ODBC Database!\n");
status = SWITCH_STATUS_FALSE;
@@ -231,7 +218,9 @@
}
if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot connect to ODBC driver/database %s (user: %s / pass %s)!\n", globals.db_dsn, globals.db_username, globals.db_password);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+ "Cannot connect to ODBC driver/database %s (user: %s / pass %s)!\n",
+ globals.db_dsn, globals.db_username, globals.db_password);
status = SWITCH_STATUS_FALSE;
goto done;
} else {
@@ -239,16 +228,11 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.db_dsn);
} else {
-#endif
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "ODBC does not appear to be installed in the core. You need to run ./configure --enable-core-odbc-support\n");
-#ifdef SWITCH_HAVE_ODBC
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+ "ODBC does not appear to be installed in the core. You need to run ./configure --enable-core-odbc-support\n");
}
-#endif
-#ifdef SWITCH_HAVE_ODBC
done:
-#endif
-
if (xml) {
switch_xml_free(xml);
}
@@ -314,9 +298,12 @@
/* At this time, billing never succeeds if you don't have a database. */
static switch_status_t bill_event(float billamount, const char *billaccount)
{
-#ifdef SWITCH_HAVE_ODBC
char sql[1024] = "";
- SQLHSTMT stmt;
+ switch_odbc_statement_handle_t stmt;
+
+ if (!switch_odbc_available()) {
+ return SWITCH_STATUS_SUCCESS;
+ }
switch_snprintf(sql, 1024, SQL_SAVE, globals.db_table, globals.db_column_cash, globals.db_column_cash, billamount, globals.db_column_account, billaccount);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doing update query\n[%s]\n", sql);
@@ -327,36 +314,35 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
switch_safe_free(err_str);
} else {
-#endif
/* TODO: Failover to a flat/text file if DB is unavailable */
return SWITCH_STATUS_SUCCESS;
-#ifdef SWITCH_HAVE_ODBC
}
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-#endif
+ switch_odbc_statement_handle_free(&stmt);
+
return SWITCH_STATUS_SUCCESS;
}
static float get_balance(const char *billaccount)
{
-#ifdef SWITCH_HAVE_ODBC
char sql[1024] = "";
nibblebill_results_t pdata;
float balance = 0.00f;
+ if (!switch_odbc_available()) {
+ return -1.00f;
+ }
+
memset(&pdata, 0, sizeof(pdata));
snprintf(sql, 1024, SQL_LOOKUP, globals.db_column_cash, globals.db_table, globals.db_column_account, billaccount);
if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, nibblebill_callback, &pdata) != SWITCH_ODBC_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running this query: [%s]\n", sql);
-#endif
/* Return -1 for safety */
- return -1.00;
-#ifdef SWITCH_HAVE_ODBC
+ return -1.00f;
} else {
/* Successfully retrieved! */
balance = pdata.balance;
@@ -365,7 +351,6 @@
}
return balance;
-#endif
}
/* This is where we actually charge the guy
@@ -879,10 +864,7 @@
{
switch_event_unbind(&globals.node);
switch_core_remove_state_handler(&nibble_state_handler);
-
-#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_disconnect(globals.master_odbc);
-#endif
return SWITCH_STATUS_UNLOAD;
}
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 Wed Jun 24 11:02:43 2009
@@ -33,10 +33,6 @@
*/
#include <switch.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
-
#ifdef _MSC_VER /* compilers are stupid sometimes */
#define TRY_CODE(code) for(;;) {status = code; if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { goto end; } break;}
#else
@@ -156,9 +152,8 @@
switch_mutex_lock(mutex);
}
- if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
- SQLHSTMT stmt;
+ if (switch_odbc_available() && profile->odbc_dsn) {
+ switch_odbc_statement_handle_t stmt;
if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
err_str = switch_odbc_handle_get_error(profile->master_odbc, stmt);
@@ -166,8 +161,7 @@
switch_safe_free(err_str);
status = SWITCH_STATUS_FALSE;
}
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-#endif
+ switch_odbc_statement_handle_free(&stmt);
} else {
if (!(db = switch_core_db_open_file(profile->dbname))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
@@ -196,10 +190,8 @@
switch_mutex_lock(mutex);
}
- if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
+ if (switch_odbc_available() && profile->odbc_dsn) {
switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
-#endif
} else {
if (!(db = switch_core_db_open_file(profile->dbname))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
@@ -266,12 +258,10 @@
static void free_profile(vm_profile_t *profile)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Profile %s\n", profile->name);
-#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn && profile->master_odbc) {
+ if (switch_odbc_available() && profile->odbc_dsn && profile->master_odbc) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Closing ODBC Database! %s\n", profile->name);
switch_odbc_handle_destroy(&profile->master_odbc);
}
-#endif
switch_core_destroy_memory_pool(&profile->pool);
}
@@ -669,8 +659,7 @@
}
profile->dbname = switch_core_sprintf(profile->pool, "voicemail_%s", profile_name);
- if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
+ if (switch_odbc_available() && profile->odbc_dsn) {
if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
goto end;
@@ -713,7 +702,6 @@
for (x = 0; vm_index_list[x]; x++) {
switch_odbc_handle_exec(profile->master_odbc, vm_index_list[x], NULL);
}
-#endif
} else {
if ((db = switch_core_db_open_file(profile->dbname))) {
char *errmsg;
@@ -4006,12 +3994,11 @@
switch_thread_rwlock_wrlock(profile->rwlock);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Profile %s\n", profile->name);
-#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn && profile->master_odbc) {
+
+ if (switch_odbc_available() && profile->odbc_dsn && profile->master_odbc) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Closing ODBC Database! %s\n", profile->name);
switch_odbc_handle_destroy(&profile->master_odbc);
}
-#endif
switch_core_destroy_memory_pool(&profile->pool);
profile = NULL;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/Makefile Wed Jun 24 11:02:43 2009
@@ -2,7 +2,6 @@
LOCAL_CFLAGS = `$(BASE)/libs/apr/apr-1-config --cflags --cppflags --includes`
LOCAL_CFLAGS += `$(BASE)/libs/apr-util/apu-1-config --includes`
-LOCAL_CFLAGS += `if test -f $(BASE)/.libs/libfreeswitch_la-switch_odbc.o ; then echo -DSWITCH_HAVE_ODBC; fi ;`
#LOCAL_CFLAGS += -w
IKS_DIR=$(BASE)/libs/iksemel
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Wed Jun 24 11:02:43 2009
@@ -32,9 +32,6 @@
#include <switch.h>
#include <switch_stun.h>
#include <libdingaling.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
#define DL_CAND_WAIT 10000000
#define DL_CAND_INITIAL_WAIT 2000000
@@ -128,17 +125,10 @@
char *timer_name;
char *dbname;
char *avatar;
-#ifdef SWITCH_HAVE_ODBC
char *odbc_dsn;
char *odbc_user;
char *odbc_pass;
switch_odbc_handle_t *master_odbc;
-#else
- void *filler1;
- void *filler2;
- void *filler3;
- void *filler4;
-#endif
switch_mutex_t *mutex;
ldl_handle_t *handle;
uint32_t flags;
@@ -273,30 +263,24 @@
if (mutex) {
switch_mutex_lock(mutex);
}
-#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
- SQLHSTMT stmt;
+
+ if (switch_odbc_available() && profile->odbc_dsn) {
+ switch_odbc_statement_handle_t stmt;
if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
err_str = switch_odbc_handle_get_error(profile->master_odbc, stmt);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
switch_safe_free(err_str);
}
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ switch_odbc_statement_handle_free(&stmt);
} else {
-#endif
if (!(db = switch_core_db_open_file(profile->dbname))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
goto end;
}
-
switch_core_db_persistant_execute(db, sql, 1);
switch_core_db_close(db);
-
-#ifdef SWITCH_HAVE_ODBC
}
-#endif
-
end:
if (mutex) {
@@ -316,20 +300,13 @@
switch_mutex_lock(mutex);
}
-#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
+ if (switch_odbc_available() && profile->odbc_dsn) {
switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
} else {
-#endif
-
-
-
if (!(db = switch_core_db_open_file(profile->dbname))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
goto end;
}
-
-
switch_core_db_exec(db, sql, callback, pdata, &errmsg);
if (errmsg) {
@@ -340,10 +317,7 @@
if (db) {
switch_core_db_close(db);
}
-#ifdef SWITCH_HAVE_ODBC
}
-#endif
-
end:
@@ -351,10 +325,7 @@
switch_mutex_unlock(mutex);
}
-
-
return ret;
-
}
static int sub_callback(void *pArg, int argc, char **argv, char **columnNames)
@@ -1949,18 +1920,17 @@
} else if (!strcasecmp(var, "avatar")) {
profile->avatar = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
-#ifdef SWITCH_HAVE_ODBC
- profile->odbc_dsn = switch_core_strdup(module_pool, val);
- if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
- *profile->odbc_user++ = '\0';
- if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
- *profile->odbc_pass++ = '\0';
+ if (switch_odbc_available()) {
+ profile->odbc_dsn = switch_core_strdup(module_pool, val);
+ if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
+ *profile->odbc_user++ = '\0';
+ if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
+ *profile->odbc_pass++ = '\0';
+ }
}
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
}
-
-#else
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
} else if (!strcasecmp(var, "use-rtp-timer") && switch_true(val)) {
switch_set_flag(profile, TFLAG_TIMER);
} else if (!strcasecmp(var, "dialplan") && !switch_strlen_zero(val)) {
@@ -2282,9 +2252,7 @@
switch_snprintf(dbname, sizeof(dbname), "dingaling_%s", profile->name);
profile->dbname = switch_core_strdup(module_pool, dbname);
-
-#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
+ if (switch_odbc_available() && profile->odbc_dsn) {
if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
continue;
@@ -2299,7 +2267,6 @@
switch_odbc_handle_exec(profile->master_odbc, sub_sql, NULL);
//mdl_execute_sql(profile, sub_sql, NULL);
} else {
-#endif
if ((db = switch_core_db_open_file(profile->dbname))) {
switch_core_db_test_reactive(db, "select * from jabber_subscriptions", NULL, sub_sql);
} else {
@@ -2307,9 +2274,7 @@
continue;
}
switch_core_db_close(db);
-#ifdef SWITCH_HAVE_ODBC
}
-#endif
}
if (profile) {
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Wed Jun 24 11:02:43 2009
@@ -42,9 +42,6 @@
#define HAVE_APR
#include <switch.h>
#include <switch_version.h>
-#ifdef SWITCH_HAVE_ODBC
-#include <switch_odbc.h>
-#endif
#define SOFIA_NAT_SESSION_TIMEOUT 20
#define SOFIA_MAX_ACL 100
#ifdef _MSC_VER
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 24 11:02:43 2009
@@ -2068,17 +2068,17 @@
} else if (!strcasecmp(var, "sip-trace") && switch_true(val)) {
sofia_set_flag(profile, TFLAG_TPORT_LOG);
} else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
-#ifdef SWITCH_HAVE_ODBC
- profile->odbc_dsn = switch_core_strdup(profile->pool, val);
- if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
- *profile->odbc_user++ = '\0';
- if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
- *profile->odbc_pass++ = '\0';
+ if (switch_odbc_available()) {
+ profile->odbc_dsn = switch_core_strdup(profile->pool, val);
+ if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
+ *profile->odbc_user++ = '\0';
+ if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
+ *profile->odbc_pass++ = '\0';
+ }
}
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
}
-#else
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
} else if (!strcasecmp(var, "user-agent-string")) {
profile->user_agent = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "auto-restart")) {
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 24 11:02:43 2009
@@ -3616,8 +3616,7 @@
" expires INTEGER\n"
");\n";
- if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
+ if (switch_odbc_available() && profile->odbc_dsn) {
int x;
char *indexes[] = {
"create index sr_call_id on sip_registrations (call_id)",
@@ -3735,9 +3734,8 @@
}
-#else
+ } else if (profile->odbc_dsn) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
} else {
if (!(profile->master_db = switch_core_db_open_file(profile->dbname))) {
return 0;
@@ -3835,28 +3833,23 @@
switch_core_db_exec(profile->master_db, "create index if not exists sa_hostname on sip_authentication (hostname)", NULL, NULL, NULL);
}
-#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
+ if (switch_odbc_available() && profile->odbc_dsn) {
return profile->master_odbc ? 1 : 0;
}
-#endif
return profile->master_db ? 1 : 0;
}
void sofia_glue_sql_close(sofia_profile_t *profile)
{
-#ifdef SWITCH_HAVE_ODBC
- if (profile->master_odbc) {
+ if (switch_odbc_available() && profile->master_odbc) {
switch_odbc_handle_destroy(&profile->master_odbc);
+ } else {
+ switch_core_db_close(profile->master_db);
+ profile->master_db = NULL;
}
-#else
- switch_core_db_close(profile->master_db);
- profile->master_db = NULL;
-#endif
}
-
void sofia_glue_execute_sql(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -3899,9 +3892,8 @@
switch_mutex_lock(mutex);
}
- if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
- SQLHSTMT stmt;
+ if (switch_odbc_available() && profile->odbc_dsn) {
+ switch_odbc_statement_handle_t stmt;
if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
err_str = switch_odbc_handle_get_error(profile->master_odbc, stmt);
@@ -3910,10 +3902,9 @@
}
switch_safe_free(err_str);
}
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-#else
+ switch_odbc_statement_handle_free(&stmt);
+ } else if (profile->odbc_dsn) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
} else {
if (master) {
db = profile->master_db;
@@ -3948,12 +3939,10 @@
}
- if (profile->odbc_dsn) {
-#ifdef SWITCH_HAVE_ODBC
+ if (switch_odbc_available() && profile->odbc_dsn) {
switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
-#else
+ } else if (profile->odbc_dsn) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
-#endif
} else {
if (master) {
@@ -3984,36 +3973,17 @@
return ret;
}
-#ifdef SWITCH_HAVE_ODBC
static char *sofia_glue_execute_sql2str_odbc(sofia_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len)
{
char *ret = NULL;
- SQLHSTMT stmt;
- SQLCHAR name[1024];
- SQLLEN m = 0;
-
- if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) == SWITCH_ODBC_SUCCESS) {
- SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
- SQLULEN ColumnSize;
- SQLRowCount(stmt, &m);
-
- if (m <= 0) {
- return NULL;
- }
-
- if (SQLFetch(stmt) != SQL_SUCCESS) {
- return NULL;
- }
- SQLDescribeCol(stmt, 1, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
- SQLGetData(stmt, 1, SQL_C_CHAR, (SQLCHAR *) resbuf, (SQLLEN) len, NULL);
- SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ if (switch_odbc_handle_exec_string(profile->master_odbc, sql, resbuf, len) == SWITCH_ODBC_SUCCESS) {
ret = resbuf;
}
return ret;
}
-#endif
+
char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len)
{
@@ -4021,11 +3991,9 @@
switch_core_db_stmt_t *stmt;
char *ret = NULL;
-#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
+ if (switch_odbc_available() && profile->odbc_dsn) {
return sofia_glue_execute_sql2str_odbc(profile, mutex, sql, resbuf, len);
}
-#endif
if (mutex) {
switch_mutex_lock(mutex);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Jun 24 11:02:43 2009
@@ -581,22 +581,17 @@
{
char sql[1024];
-#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
+ if (switch_odbc_available() && profile->odbc_dsn) {
if (!profile->master_odbc) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
return;
}
} else {
-#endif
if (!profile->master_db) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
return;
}
-#ifdef SWITCH_HAVE_ODBC
}
-#endif
-
switch_mutex_lock(profile->ireg_mutex);
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c Wed Jun 24 11:02:43 2009
@@ -30,7 +30,17 @@
*
*/
#include "mod_spidermonkey.h"
-#include <switch_odbc.h>
+
+#include <sql.h>
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4201)
+#include <sqlext.h>
+#pragma warning(pop)
+#else
+#include <sqlext.h>
+#endif
+#include <sqltypes.h>
static const char modname[] = "ODBC";
Modified: freeswitch/trunk/src/switch_odbc.c
==============================================================================
--- freeswitch/trunk/src/switch_odbc.c (original)
+++ freeswitch/trunk/src/switch_odbc.c Wed Jun 24 11:02:43 2009
@@ -30,7 +30,18 @@
*/
#include <switch.h>
-#include <switch_odbc.h>
+
+#ifdef SWITCH_HAVE_ODBC
+#include <sql.h>
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4201)
+#include <sqlext.h>
+#pragma warning(pop)
+#else
+#include <sqlext.h>
+#endif
+#include <sqltypes.h>
#if (ODBCVER < 0x0300)
#define SQL_NO_DATA SQL_SUCCESS
@@ -46,9 +57,11 @@
char odbc_driver[256];
BOOL is_firebird;
};
+#endif
SWITCH_DECLARE(switch_odbc_handle_t *) switch_odbc_handle_new(char *dsn, char *username, char *password)
{
+#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_t *new_handle;
if (!(new_handle = malloc(sizeof(*new_handle)))) {
@@ -86,13 +99,20 @@
switch_safe_free(new_handle);
}
+#endif
return NULL;
}
SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_disconnect(switch_odbc_handle_t *handle)
{
+#ifdef SWITCH_HAVE_ODBC
+
int result;
+ if (!handle) {
+ return SWITCH_ODBC_FAIL;
+ }
+
if (handle->state == SWITCH_ODBC_STATE_CONNECTED) {
result = SQLDisconnect(handle->con);
if (result == SWITCH_ODBC_SUCCESS) {
@@ -105,10 +125,14 @@
handle->state = SWITCH_ODBC_STATE_DOWN;
return SWITCH_ODBC_SUCCESS;
+#else
+ return SWITCH_ODBC_FAIL;
+#endif
}
SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_handle_t *handle)
{
+#ifdef SWITCH_HAVE_ODBC
int result;
SQLINTEGER err;
int16_t mlen;
@@ -186,10 +210,14 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected to [%s]\n", handle->dsn);
handle->state = SWITCH_ODBC_STATE_CONNECTED;
return SWITCH_ODBC_SUCCESS;
+#else
+ return SWITCH_ODBC_FAIL;
+#endif
}
static int db_is_up(switch_odbc_handle_t *handle)
{
+#ifdef SWITCH_HAVE_ODBC
int ret = 0;
SQLHSTMT stmt = NULL;
SQLLEN m = 0;
@@ -288,10 +316,68 @@
}
return ret;
+#else
+ return SWITCH_ODBC_FAIL;
+#endif
}
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, SQLHSTMT * rstmt)
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_statement_handle_free(switch_odbc_statement_handle_t * stmt)
{
+ if (!stmt || ! *stmt) {
+ return SWITCH_ODBC_FAIL;
+ }
+#ifdef SWITCH_HAVE_ODBC
+ SQLFreeHandle(SQL_HANDLE_STMT, *stmt);
+ *stmt = NULL;
+ return SWITCH_ODBC_SUCCESS;
+#else
+ return SWITCH_ODBC_FAIL;
+#endif
+}
+
+
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_handle_t *handle,
+ char *sql,
+ char *resbuf,
+ size_t len)
+{
+#ifdef SWITCH_HAVE_ODBC
+ switch_odbc_status_t sstatus = SWITCH_ODBC_FAIL;
+ switch_odbc_statement_handle_t stmt = NULL;
+ SQLCHAR name[1024];
+ SQLLEN m = 0;
+
+ if (switch_odbc_handle_exec(handle, sql, &stmt) == SWITCH_ODBC_SUCCESS) {
+ SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
+ SQLULEN ColumnSize;
+ SQLRowCount(stmt, &m);
+
+ if (m <= 0) {
+ goto done;
+ }
+
+ if (SQLFetch(stmt) != SQL_SUCCESS) {
+ goto done;
+ }
+
+ SQLDescribeCol(stmt, 1, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
+ SQLGetData(stmt, 1, SQL_C_CHAR, (SQLCHAR *) resbuf, (SQLLEN) len, NULL);
+ sstatus = SWITCH_ODBC_SUCCESS;
+ } else {
+ return sstatus;
+ }
+
+ done:
+ switch_odbc_statement_handle_free(&stmt);
+ return sstatus;
+#else
+ return SWITCH_ODBC_FAIL;
+#endif
+}
+
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, switch_odbc_statement_handle_t * rstmt)
+{
+#ifdef SWITCH_HAVE_ODBC
SQLHSTMT stmt = NULL;
int result;
@@ -327,6 +413,7 @@
} else if (stmt) {
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
}
+#endif
return SWITCH_ODBC_FAIL;
}
@@ -334,6 +421,7 @@
switch_odbc_handle_t *handle,
char *sql, switch_core_db_callback_func_t callback, void *pdata)
{
+#ifdef SWITCH_HAVE_ODBC
SQLHSTMT stmt = NULL;
SQLSMALLINT c = 0, x = 0;
SQLLEN m = 0, t = 0;
@@ -445,11 +533,14 @@
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
}
+#endif
return SWITCH_ODBC_FAIL;
}
SWITCH_DECLARE(void) switch_odbc_handle_destroy(switch_odbc_handle_t **handlep)
{
+#ifdef SWITCH_HAVE_ODBC
+
switch_odbc_handle_t *handle = NULL;
if (!handlep) {
@@ -468,15 +559,24 @@
free(handle);
}
*handlep = NULL;
+#else
+ return;
+#endif
}
SWITCH_DECLARE(switch_odbc_state_t) switch_odbc_handle_get_state(switch_odbc_handle_t *handle)
{
+#ifdef SWITCH_HAVE_ODBC
return handle ? handle->state : SWITCH_ODBC_STATE_INIT;
+#else
+ return SWITCH_ODBC_STATE_ERROR;
+#endif
}
-SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, SQLHSTMT stmt)
+SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, switch_odbc_statement_handle_t stmt)
{
+#ifdef SWITCH_HAVE_ODBC
+
char buffer[SQL_MAX_MESSAGE_LENGTH + 1] = "";
char sqlstate[SQL_SQLSTATE_SIZE + 1] = "";
SQLINTEGER sqlcode;
@@ -488,6 +588,18 @@
};
return ret;
+#else
+ return NULL;
+#endif
+}
+
+SWITCH_DECLARE(switch_bool_t) switch_odbc_available(void)
+{
+#ifdef SWITCH_HAVE_ODBC
+ return SWITCH_TRUE;
+#else
+ return SWITCH_FALSE;
+#endif
}
1
0
24 Jun '09
Author: brian
Date: Wed Jun 24 10:52:03 2009
New Revision: 13935
Log:
can't change behavior global user and pass alone MUST work as it did before
Modified:
freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c Wed Jun 24 10:52:03 2009
@@ -256,7 +256,7 @@
return FALSE;
}
- if (!switch_strlen_zero(globals.realm) && !strcasecmp(domain_name, globals.realm) && !switch_strlen_zero(globals.user) && !strcmp(user, globals.user)) {
+ if (!switch_strlen_zero(globals.realm) && !switch_strlen_zero(globals.user) && !strcmp(user, globals.user)) {
switch_safe_free(user);
return TRUE;
}
@@ -328,7 +328,7 @@
goto fail;
}
- if (!switch_strlen_zero(globals.realm) && !strcasecmp(domain_name, globals.realm) && !switch_strlen_zero(globals.user) && !switch_strlen_zero(globals.pass)) {
+ if (!switch_strlen_zero(globals.realm) && !switch_strlen_zero(globals.user) && !switch_strlen_zero(globals.pass)) {
if (at) {
switch_snprintf(z, sizeof(z), "%s@%s:%s", globals.user, globals.realm, globals.pass);
} else {
1
0
24 Jun '09
Author: ledr
Date: Wed Jun 24 03:11:13 2009
New Revision: 13933
Log:
got break-to working
Modified:
freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c
freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/xml_odbc.conf.xml
Modified: freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c
==============================================================================
--- freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c (original)
+++ freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c Wed Jun 24 03:11:13 2009
@@ -124,6 +124,7 @@
switch_xml_t xml_out;
int *off;
switch_event_t *params;
+ int rowcount;
} xml_odbc_query_helper_t;
@@ -133,6 +134,8 @@
switch_xml_t xml_in_tmp;
int i;
+ qh->rowcount++;
+
for (i = 0; i < argc; i++) {
switch_event_del_header(qh->params, columnName[i]);
switch_event_add_header_string(qh->params, SWITCH_STACK_BOTTOM, columnName[i], argv[i]);
@@ -154,7 +157,7 @@
xml_odbc_query_helper_t query_helper;
- if (!strcasecmp(xml_in->name, "xml-odbc-do")) {
+ if (!strcasecmp(xml_in->name, "xml-odbc-do")) {
char *name = NULL;
char *value = NULL, *new_value = NULL;
char *empty_result_break_to = NULL;
@@ -165,30 +168,47 @@
empty_result_break_to = (char *) switch_xml_attr_soft(xml_in, "on-empty-result-break-to");
no_template_break_to = (char *) switch_xml_attr_soft(xml_in, "on-no-template-break-to");
- if (!switch_strlen_zero(value)) {
- new_value = switch_event_expand_headers(params, value);
- if (!strcasecmp(name, "break-to")) { // WHAT TO DO WITH FURTHER RENDERING LOWER ON THE STACK ?!?!?!
- xml_out = NULL;
- off = 0; // <- ?
- if (xml_odbc_render_template(new_value, params, xml_out, off) == SWITCH_STATUS_FALSE) {
- if (!switch_strlen_zero(no_template_break_to)) {
- xml_odbc_render_template(no_template_break_to, params, xml_out, off);
- }
- }
- } else if (!strcasecmp(name, "query")) {
- query_helper.xml_in = xml_in;
- query_helper.xml_out = xml_out;
- query_helper.off = off;
- query_helper.params = params;
-
- if (switch_odbc_handle_callback_exec(globals.master_odbc, new_value, xml_odbc_query_callback, &query_helper) == SWITCH_ODBC_SUCCESS) {
- // nothing
- } else if (!switch_strlen_zero(empty_result_break_to)) { // if zero rows returned then switch_odbc_handle_callback_exec != SWITCH_ODBC_SUCCESS ???
- xml_out = NULL;
- off = 0; // <- ?
- xml_odbc_render_template(empty_result_break_to, params, xml_out, off);
+ if (switch_strlen_zero(name)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ignoring xml-odbc-do because no name attribute is given\n");
+ goto done;
+ }
+
+ if (switch_strlen_zero(value)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ignoring xml-odbc-do name=[%s] because no value attr is given\n", name);
+ goto done;
+ }
+
+ new_value = switch_event_expand_headers(params, value);
+
+ if (!strcasecmp(name, "break-to")) {
+// if (xml_odbc_render_template(new_value, params, xml_out, off) == SWITCH_STATUS_FALSE) {
+// if (!switch_strlen_zero(no_template_break_to)) {
+/* have a look at this again, not too happy about this next_template_name thing.. */
+ switch_event_del_header(params, "next_template_name");
+ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "next_template_name", value);
+ return SWITCH_STATUS_FALSE;
+// }
+// }
+ } else if (!strcasecmp(name, "query")) {
+ query_helper.xml_in = xml_in;
+ query_helper.xml_out = xml_out;
+ query_helper.off = off;
+ query_helper.params = params;
+ query_helper.rowcount = 0;
+
+ if (switch_odbc_handle_callback_exec(globals.master_odbc, new_value, xml_odbc_query_callback, &query_helper) != SWITCH_ODBC_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running this query: [%s]\n", new_value);
+ } else {
+ if (!switch_strlen_zero(empty_result_break_to) && query_helper.rowcount == 0) {
+/* have a look at this again, not too happy about this next_template_name thing.. */
+ switch_event_del_header(params, "next_template_name");
+ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "next_template_name", empty_result_break_to);
+ return SWITCH_STATUS_FALSE;
}
}
+
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ignoring unknown xml-odbc-do name=[%s]\n", name);
}
} else {
@@ -211,11 +231,14 @@
/* copy all children and render them */
for (xml_in_tmp = xml_in->child; xml_in_tmp; xml_in_tmp = xml_in_tmp->ordered) {
- xml_odbc_render_tag(xml_in_tmp, params, xml_out, off);
+ if (xml_odbc_render_tag(xml_in_tmp, params, xml_out, off) != SWITCH_STATUS_SUCCESS) {
+ return SWITCH_STATUS_FALSE;
+ }
}
}
+ done:
return SWITCH_STATUS_SUCCESS;
}
@@ -223,17 +246,31 @@
static switch_status_t xml_odbc_render_template(char *template_name, switch_event_t *params, switch_xml_t xml_out, int *off)
{
switch_xml_t template_tag = NULL, sub_tag = NULL;
+ char *next_template_name = NULL;
+
+ if ((template_tag = switch_xml_find_child(globals.templates_tag, "template", "name", template_name))) {
+ for (sub_tag = template_tag->child; sub_tag; sub_tag = sub_tag->ordered) {
+ if (xml_odbc_render_tag(sub_tag, params, xml_out, off) != SWITCH_STATUS_SUCCESS) {
+ }
- for (template_tag = switch_xml_child(globals.templates_tag, "template"); template_tag; template_tag = template_tag->next) {
- char *template_tag_name = (char*) switch_xml_attr_soft(template_tag, "name");
- if (!strcmp(template_tag_name, template_name)) {
- for (sub_tag = template_tag->child; sub_tag; sub_tag = sub_tag->ordered) {
- xml_odbc_render_tag(sub_tag, params, xml_out, off);
- return SWITCH_STATUS_SUCCESS;
+ if ((next_template_name = switch_event_get_header(params, "next_template_name"))) {
+ goto rewind;
}
+
}
+ goto done;
}
- return SWITCH_STATUS_FALSE;
+
+ next_template_name = "not_found";
+
+ rewind:
+/* have a look at this again, not too happy about this next_template_name thing.. */
+ switch_event_del_header(params, "next_template_name");
+ xml_out->name = "";
+ xml_odbc_render_template(next_template_name, params, xml_out, off);
+
+ done:
+ return SWITCH_STATUS_SUCCESS;
}
@@ -249,7 +286,6 @@
xml_odbc_query_type_t query_type;
-
int off = 0, ret = 1;
if (!binding) {
Modified: freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/xml_odbc.conf.xml
==============================================================================
--- freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/xml_odbc.conf.xml (original)
+++ freeswitch/trunk/scripts/contrib/ledr/mod_xml_odbc/xml_odbc.conf.xml Wed Jun 24 03:11:13 2009
@@ -10,9 +10,6 @@
<binding name="directory">
<param name="odbc-dsn" value="freeswitch:freeswitch:secret"/>
<param name="template" value="directory"/>
- <!-- <param name="template" value="not_found"/> -->
- <!-- <param name="template" value="someuser"/> -->
- <!-- <param name="template" value="testsql"/> -->
</binding>
<!--
<binding name="dialplan">
@@ -34,7 +31,7 @@
</template>
<template name="simple_configuration">
- <document type="freeswitch/xml"> <!-- should this tag be automatically rendered first on xml_out and left out here ? -->
+ <document type="freeswitch/xml">
<configuration name="${section}">
<settings>
<xml-odbc-do name="query" value="
@@ -60,45 +57,6 @@
</document>
</template>
- <template name="testsql"> <!-- for testing only -->
- <document type="freeswitch/xml">
- <xml-odbc-do name="query" value="SELECT name, value FROM dir_user_params WHERE dir_user_id='1';">
- <param name="${name}" value="${value}"/>
- </xml-odbc-do>
- </document>
- </template>
-
- <template name="someuser"> <!-- for testing only -->
- <document type="freeswitch/xml">
- <section name="directory">
- <domain name="${domain}">
- <params>
- <param name="some_domain_param" value="some_domain_value"/>
- </params>
- <variables>
- </variables>
- <groups>
- <group name="default">
- <users>
- <user id="someuser" mailbox="leon(a)toyos.nl" cidr="" number-alias="0031320227470">
- <params>
- <param name="password" value="secret"/>
- </params>
- <variables>
- <variable name="accountcode" value="1234"/>
- </variables>
- </user>
- </users>
- </group>
- <group name="prepay">
- <user id="someuser" type="pointer"/>
- </group>
- </groups>
- </domain>
- </section>
- </document>
- </template>
-
<X-PRE-PROCESS cmd="include" data="xml_odbc_templates/*.xml"/>
</templates>
1
0
Author: intralanman
Date: Tue Jun 23 18:45:00 2009
New Revision: 13929
Log:
i'll have a side of emacs hold the window please
Modified:
freeswitch/trunk/support-d/.bashrc
Modified: freeswitch/trunk/support-d/.bashrc
==============================================================================
--- freeswitch/trunk/support-d/.bashrc (original)
+++ freeswitch/trunk/support-d/.bashrc Tue Jun 23 18:45:00 2009
@@ -30,4 +30,5 @@
alias fstop='top -p `cat /usr/local/freeswitch/log/freeswitch.pid`'
alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/log/freeswitch.pid`'
alias fscore='gdb /usr/local/freeswitch/bin/freeswitch `ls -rt core.* | tail -n1`'
+alias emacs='emacs -nw'
# End of file
1
0
Author: mcollins
Date: Tue Jun 23 18:43:36 2009
New Revision: 13928
Log:
Update ChangeLog through r13927
Modified:
freeswitch/trunk/docs/ChangeLog
Modified: freeswitch/trunk/docs/ChangeLog
==============================================================================
--- freeswitch/trunk/docs/ChangeLog (original)
+++ freeswitch/trunk/docs/ChangeLog Tue Jun 23 18:43:36 2009
@@ -70,6 +70,9 @@
build: fix jobserver unavailable bug in make -j (r:13623/FSBUILD-6)
build: clean/uninstall disabled modules as well (r:13716/FSBUILD-85)
build: fix msvc pcre build for pcre 7.9 (r:13729)
+ build: trivial build fix (FSBUILD-174/r:13877)
+ build: fix automake warnings about underquoted definitions in apr macros (FSBUILD-175/r:13882)
+ build: make libtool version detection more portable (r:13926)
config: default config, calling own extension no longer goes to voicemail (r:12596)
config: default config, 1000-1019 uses $${default_password} instead of hard-coded 1234 (FSCONFIG-5/r:12838)
config: tweak the configs to bind siptrace on and off to F10 and F11 (r:12938)
@@ -87,6 +90,8 @@
config: tweaks to codecs in default config (r:13485)
config: Add example of sending SAS from b-leg to display on a-leg's phone (r:13500)
config: commit config options for new auto nat (r:13595)
+ config: Remove use_profile from default dialplan, move to vars.xml, default value is 'internal'
+ config: clean up configs and put wan.auto in by default commented out (r:13907)
core: fix suncc visibility support in libteletone (r:12154-12157)
core: fix crash on FS shutdown with "..." (FSCORE-297/r:12173,12361,12402)
core: add separate mutex for state related methods (r:12191)
@@ -213,6 +218,11 @@
core: Export swtich_inet_ntop so modules can use it (r:13738)
core: record_sample_rate variable influences the rate record app will use (r:13767,13768,13769)
core: init buffer in lead out on speak (r:13787)
+ core: add local_var_clobber variable for {} to set if [] vars should clobber {} vars (default false) (r:13842)
+ core: Fix switch_odbc_handle_callback_exec_detailed to handle floating point database columns properly (FSCORE-384/r:13866)
+ core: set sound path in say app (r:13904)
+ core: add wan.auto acl (r:13905)
+ core: Fix ACL nat.auto (FSCORE-385/r:13925)
docs: Fix filename references in phrase_en.xml (r:12976)
docs: Update phrase_en.xml to include v1.0.8 sound prompts (r:13041)
docs: Updates to phrase_es.xml (r:13067)
@@ -220,6 +230,7 @@
docs: switch_core.h doxygen update (r:13181)
docs: Add ZRTP phrases to phrase_en.xml (r:13488,13489,13490)
docs: Add Stephane Alnet's French translations to phrase_fr.xml (r:13624)
+ docs: Add AGL3.0 for zrtp (r:13848)
formats: add mod_portaudio_stream to get audio from any dev (MODFORM-25/r:12178)
fs_cli: fix solaris build (r:12160)
ivr: make tts-engine and tts-voice valid attributes on the menu xml (r:12278)
@@ -271,6 +282,7 @@
libsofiasip: fix re-register after 423 w/ Min-Expires (r:13619/SFSIP-143)
libsofiasip: use addres, id, and version from user sdp if they exist (r:13621)
libsofiasip: handle mid-line comments in resolv.conf patch from Lee Verberne (SFSIP-152/r:13749)
+ libsofiasip: fix CNAME record resolve failure (SFSIP-129/r:13915)
libspandsp: update to snapshot 20090308 (r:12514)
libspandsp: update to snapshot spandsp-20090421 (r:13086)
libspandsp: update to snapshot spandsp-20090427 (r:13177)
@@ -280,6 +292,7 @@
libteletone: update api visibility macros for windows
libtiff: add libtiff, v3.8.2
libxmlrpc: add select to read socket in abyss so we can timeout (r:13107)
+ libxmlrpc: fix segfault (MODAPP-293/r:13906)
mod_cidlookup: add new module, mod_cidlookup (r:12990)
mod_cidlookup: switch to using CURL instead of mod_http (r:12992)
mod_cidlookup: add config file (r:12994)
@@ -358,6 +371,7 @@
mod_fifo: don't do wrapup when agent is in nowait mode or call has ended (r:13094)
mod_fifo: don't call all members on on-hook mode and round robin based on next_avail (MODAPP-272/r:13240,13242)
mod_fifo: abandon outbound calls when they are not needed, place queue name in the caller id (r:13240)
+ mod_fifo: add "fifo_destroy_after_use" variable to allow quick destruction of one-time use FIFO queues (MODAPP-287/r:13897)
mod_file_string: add new module, allows for playing ! delimited lists of sound files (r:13182)
mod_flite: three new voices - rms, awb (male), slt (female) (r:12166)
mod_flite: mod_flite_shutdown not called/used (MODASRTTS-15/r:13270)
@@ -395,6 +409,7 @@
mod_memcache: unbind the reloadxml event handler on shutdown (r:12954)
mod_memcache: Fix C99 error, move var declaration out of the "for()" statement (no -std=c99?) (r:12959)
mod_memcache: cleanup xml config handling (r:13050,13051)
+ mod_memcache: fix compile failure (MODAPP-292/r:13883)
mod_nibblebill: mod_nibblebill question: DB Error while updating cash (MODAPP-229/r:12907)
mod_nibblebill: Updated mod_nibblebill to work properly w/ postgres fields (r:13031)
mod_nibblebill: Added feature mod_nibblebill to check balance and transfer the caller to an alternate dialplan context & extension if they deplete their funds. (r:13432)
@@ -414,6 +429,7 @@
mod_perl: Libtool build fix for mod_perl: use LIBTOOL_LIB_EXTEN to make libtool-2.2 happy and CXXLINK since we are linking a C++ lib (r:13080)
mod_pocketsphinx: Revamp mod_pocketsphinx to use jsgf format (r:12224)
mod_pocketsphinx: now you can specify the dictionary to use in the config file (r:13747)
+ mod_pocketsphinx: add language weight (r:13910)
mod_portaudio: fix audio issue in portaudio (r:12669)
mod_python: fix core dump when using startup script (MODLANG-106/r:12648)
mod_python: fix python failing during loading startup modules (MODLANG-105/r:12658)
@@ -429,20 +445,20 @@
mod_say_ru: change dollars and cents to rubles and kopecks (r:13025)
mod_say_ru: add ru_ip (r:13026)
mod_say_ru: Update phrase_ru.xml to include v1.0.8 sound prompts (r:13044,13045)
+ mod_shell_stream: Initial commit (r:13851)
mod_shout: Fix race conditions; fix stutter when first 64k is drained from shoutcast stream (r:13218)
+ mod_shout: bring media back so telecast of a no-media call will work. (MODFORM-28/r:13895)
mod_skel: add more example code and info (r:12459)
mod_skypiax: move to trunk (r:12167)
mod_skypiax: fix hang on invalid mod_skypiax.conf.xml (MODSKYPIAX-21/r:12320-12322,12343)
mod_skypiax: modified configs/startskype.sh to specify which unix user will start the Skype client instance (r:12937)
mod_skypiax: fixed assignment before declaration on Windows VC++ (r:12956)
mod_skypiax: great startup speedup in Windows (using only one Broadcast sendmessage for each interface hunting) (r:13083)
- skypiax: when repeatedly you try to connect to non-existing Skype account in a short period, the Skype client send you back the two halves of the message 'ERROR 92 CALL: Unrecognised identity' inverted in a way that breaks the flux of the API messages. Maybe an anti-spam feature? Anyway, let's try to work around it and restore sanity with a 1 second delay (r:13663)
- skypiax: the Skype client sends us BOTH inband and out_of_band DTMFs, no way to shut the inbands. Let's intercept the out_of_bands ONLY if we are not bridged (eg: IVR, so not to waste CPU in detecting inband), but not propagate the out_of_band DTMFs if we are bridged (inband ones will be propagated) (r:13664)
+ mod_skypiax: when repeatedly you try to connect to non-existing Skype account in a short period, the Skype client send you back the two halves of the message 'ERROR 92 CALL: Unrecognised identity' inverted in a way that breaks the flux of the API messages. Maybe an anti-spam feature? Anyway, let's try to work around it and restore sanity with a 1 second delay (r:13663)
+ mod_skypiax: the Skype client sends us BOTH inband and out_of_band DTMFs, no way to shut the inbands. Let's intercept the out_of_bands ONLY if we are not bridged (eg: IVR, so not to waste CPU in detecting inband), but not propagate the out_of_band DTMFs if we are bridged (inband ones will be propagated) (r:13664)
skypiax: now it manages the REMOTEHOLD status, when the remote party puts the call on-hold (r:13667)
- mod_spidermonkey: fix segfaults on dtmf callback (FSCORE-327/r:12577)
- mod_spidermonkey: fix error loading mod_spidermonkey due to missing PR_* symbols (r:12934,12939)
- mod_spidermonkey: add destroy method to js (r:13016)
- mod_spidermonkey: Let session.destroy() take the cause as a string too (r:13020)
+ mod_skypiax: removed FARMING ifdefs (r:13810)
+ mod_sndfile: fix off by one error (MODFORM-29/r:13890)
mod_sofia: allow you to set invite, to and from params independently (r:12287)
mod_sofia: allow add params to a contact that isn't a gateway (r:12289)
mod_sofia: add sip_route_uri var to set proxy route (r:12408)
@@ -510,6 +526,16 @@
mod_sofia: increase compat on NDLB-to-in-200-contact to handle NAT (r:13759)
mod_sofia: fix segfault (FSCORE-382/r:13774)
mod_sofia: Fix multicast replication of sofia registrations (r:13786)
+ mod_sofia: don't put params in chan names on sofia urls (r:13841)
+ mod_sofia: Fix mod_sofia is not looking fs_path for correct url if endpoint is behind NAT or proxy (MODENDP-221/r:13865)
+ mod_sofia: Move sip-allow-multiple-registrations and similar variables from variables to params (MODENDP-222/r:13875)
+ mod_sofia: fix segfault on refer with no content-type or body (SFSIP-153/r:13889)
+ mod_sofia: fix segfault on reinvite on nomedia call when using uuid_media (r:13894)
+ mod_sofia: use the register proxy for the R-URI on register when register-proxy is set (MODSOFIA-12/r:13911)
+ mod_spidermonkey: fix segfaults on dtmf callback (FSCORE-327/r:12577)
+ mod_spidermonkey: fix error loading mod_spidermonkey due to missing PR_* symbols (r:12934,12939)
+ mod_spidermonkey: add destroy method to js (r:13016)
+ mod_spidermonkey: Let session.destroy() take the cause as a string too (r:13020)
mod_spy: add new module, mod_spy (MODAPP-260/r:13035,13036)
mod_syslog: Keep the indent string in memory (LOGGER-1/r:12852)
mod_t38gateway: Introduction of the skeleton of a media bug implementing a T.38 gateway, so the
@@ -528,8 +554,18 @@
mod_voicemail: rework vm_boxcount api and add an optional profile parameter (r:13283)
mod_voicemail: add voicemail disk quota (MODAPP-173/r:13314)
mod_voicemail: abolish mailbox attribute in users and use number-alias attribute instead (MODAPP-218/r:13377,13378,13379,13380,13381)
+ mod_voicemail: Implement new config parser (r:13878,13879)
+ mod_voicemail: Implement reload in non-blocking way (r:13884)
mod_unimrcp: add to trunk (r:13788,13789,13790,13791)
+ mod_unimrcp: make mod_unimrcp compile with gcc 4.3 (MODUNIMRCP-1/r:13833)
+ mod_unimrcp: mrcp_profile for unimrcpserver 0.6.0 (MODASRTTS-18/r:13835)
+ mod_unimrcp: use paths referenced to the project file dir (r:13840)
+ mod_unimrcp: Added LPCM (16-bit linear PCM) codec, which is used internally in host order; while L16 is RFC3551 defined 16-bit linear PCM codec in network order. (r:13859)
mod_xml_curl: fix data fetch (MODXMLINT-48/r:12586)
+ mod_xml_rpc: xmlrpc fails to check security restrictions (MDXMLINT-53/r:13912)
+ scripts: Add -days option to set expiration time of certificates in gentls_cert (r:13825)
+ scripts: Add zrtp enrollment script, we do auto enrollment and verification (r:13843)
+ scripts: Add AT&T System 25 PBX style call pickup (FSSCRIPTS-16/FSSCRIPTS-17/r:13896)
support: Add print_list gdb macro (r:12687)
1
0