Modified: freeswitch/trunk/contrib/ledr/c/mod_odbc_query/mod_odbc_query.c (14837 => 14838)
--- freeswitch/trunk/contrib/ledr/c/mod_odbc_query/mod_odbc_query.c 2009-09-13 13:24:00 UTC (rev 14837)
+++ freeswitch/trunk/contrib/ledr/c/mod_odbc_query/mod_odbc_query.c 2009-09-13 14:40:49 UTC (rev 14838)
@@ -181,13 +181,18 @@
switch_api_interface_t *api_interface;
switch_application_interface_t *app_interface;
+ switch_core_new_memory_pool(&globals.pool);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ODBC Query module loading...\n");
+
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
+ if (do_config(SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to load xml_odbc config file\n");
+ return SWITCH_STATUS_FALSE;
+ }
- do_config(SWITCH_FALSE);
-
SWITCH_ADD_API(api_interface, "odbc_query", "ODBC Query API", odbc_query_function, "syntax");
SWITCH_ADD_APP(app_interface, "odbc_query", "Perform an ODBC query", "Perform an ODBC query", odbc_query_app_function, "<query>", SAF_SUPPORT_NOMEDIA);
Copied: freeswitch/trunk/contrib/ledr/c/mod_odbc_query/odbc_query.conf.xml (from rev 14836, freeswitch/trunk/contrib/ledr/c/mod_odbc_query/mod_odbc_query.conf.xml) (0 => 14838)
--- freeswitch/trunk/contrib/ledr/c/mod_odbc_query/odbc_query.conf.xml (rev 0)
+++ freeswitch/trunk/contrib/ledr/c/mod_odbc_query/odbc_query.conf.xml 2009-09-13 14:40:49 UTC (rev 14838)
@@ -0,0 +1,21 @@
+<configuration name="odbc_query.conf" description="ODBC Query Module">
+
+ <settings>
+ <param name="odbc-dsn" value="freeswitch:freeswitch:secret"/>
+ </settings>
+
+ <queries>
+ <!-- the ${foo} variable will be expanded from channel variables at query time -->
+ <query name="map-did-users" value="
+ SELECT
+ dir_users.username AS dest_user,
+ dir_domains.name AS dest_domain
+ FROM
+ map_did_users, dir_domains, dir_users
+ WHERE
+ map_did_users.did='${destination_number}' AND
+ dir_users.id = map_did_users.user_id AND
+ dir_domains.id = dir_users.dir_domain_id;"/>
+ </queries>
+
+</configuration>