[Freeswitch-trunk] [commit] r13974 - in freeswitch/trunk/contrib/ledr/mod_xml_odbc: . xml_odbc_templates
FreeSWITCH SVN
ledr at freeswitch.org
Fri Jun 26 07:09:48 PDT 2009
Author: ledr
Date: Fri Jun 26 09:09:47 2009
New Revision: 13974
Log:
Added Makefile again, created directory template compatible with swk's sql schema
Added:
freeswitch/trunk/contrib/ledr/mod_xml_odbc/Makefile
freeswitch/trunk/contrib/ledr/mod_xml_odbc/xml_odbc_templates/directory_swk.xml
Modified:
freeswitch/trunk/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c
freeswitch/trunk/contrib/ledr/mod_xml_odbc/xml_odbc.conf.xml
Added: freeswitch/trunk/contrib/ledr/mod_xml_odbc/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/ledr/mod_xml_odbc/Makefile Fri Jun 26 09:09:47 2009
@@ -0,0 +1,2 @@
+BASE=../../..
+include $(BASE)/build/modmake.rules
Modified: freeswitch/trunk/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c
==============================================================================
--- freeswitch/trunk/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c (original)
+++ freeswitch/trunk/contrib/ledr/mod_xml_odbc/mod_xml_odbc.c Fri Jun 26 09:09:47 2009
@@ -174,14 +174,10 @@
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;
-// }
-// }
+ 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;
Modified: freeswitch/trunk/contrib/ledr/mod_xml_odbc/xml_odbc.conf.xml
==============================================================================
--- freeswitch/trunk/contrib/ledr/mod_xml_odbc/xml_odbc.conf.xml (original)
+++ freeswitch/trunk/contrib/ledr/mod_xml_odbc/xml_odbc.conf.xml Fri Jun 26 09:09:47 2009
@@ -9,6 +9,7 @@
-->
<binding name="directory">
<param name="odbc-dsn" value="freeswitch:freeswitch:secret"/>
+ <!-- <param name="template" value="directory_swk"/> -->
<param name="template" value="directory"/>
</binding>
<!--
Added: freeswitch/trunk/contrib/ledr/mod_xml_odbc/xml_odbc_templates/directory_swk.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/contrib/ledr/mod_xml_odbc/xml_odbc_templates/directory_swk.xml Fri Jun 26 09:09:47 2009
@@ -0,0 +1,90 @@
+<include>
+ <template name="directory_swk" description="based on swk's shipment sql">
+ <document type="freeswitch/xml">
+ <xml-odbc-do name="query" on-empty-result-break-to="not_found" value="
+ SELECT
+ domains.uid AS domains_uid,
+ users.uid AS users_uid,
+ users.cidr,
+ users.mailbox
+ FROM
+ domains,
+ users
+ WHERE
+ users.username = '${user}' AND
+ domains.name = '${domain}' AND
+ users.domains_uid = domains.uid AND
+ domains.enabled = '1' AND
+ users.enabled = '1';"/>
+ <section name="directory">
+ <domain name="${domain}">
+ <params>
+ <xml-odbc-do name="query" value="
+ SELECT
+ name, value
+ FROM
+ domain_params
+ WHERE
+ domains_uid = '${domains_uid}';">
+ <param name="${name}" value="${value}"/>
+ </xml-odbc-do>
+ </params>
+ <variables>
+ <xml-odbc-do name="query" value="
+ SELECT
+ name, value
+ FROM
+ domain_variables
+ WHERE
+ domains_uid = '${domains_uid}';">
+ <variable name="${name}" value="${value}"/>
+ </xml-odbc-do>
+ </variables>
+ <groups>
+ <group name="default">
+ <users>
+ <user id="${user}" mailbox="${mailbox}" cidr="${cidr}">
+ <params>
+ <xml-odbc-do name="query" on-empty-result-break-to="not_found" value="
+ SELECT
+ name, value
+ FROM
+ user_params
+ WHERE
+ users_uid = '${users_uid}';">
+ <param name="${name}" value="${value}"/>
+ </xml-odbc-do>
+ </params>
+ <variables>
+ <xml-odbc-do name="query" value="
+ SELECT
+ name, value
+ FROM
+ user_variables
+ WHERE
+ users_uid = '${users_uid}';">
+ <variable name="${name}" value="${value}"/>
+ </xml-odbc-do>
+ </variables>
+ </user>
+ </users>
+ </group>
+ <xml-odbc-do name="query" value="
+ SELECT
+ name AS group_name
+ FROM
+ groups,
+ group_members
+ WHERE
+ group_members.groups_uid = groups.uid AND
+ users_uid = '${users_uid}';">
+ <group name="${group_name}">
+ <user id="${user}" type="pointer"/>
+ </group>
+ </xml-odbc-do>
+ </groups>
+ </domain>
+ </section>
+ </document>
+ </template>
+</include>
More information about the Freeswitch-trunk
mailing list