Hi Juan, With debug=true you should be able to see what template it's trying to render in a loop, can you tell which one that is ? (I'm guessing it says 32 times it wants to render "not-found") In the xml you pasted in your mail, you didn't specify the name of the "not-found" template, just <template>, that could be the problem.. To get around the problem of generating a wrong query when the ${user} is not given, you could simply encapsulate everything with a check- event-header, like this: <template name="default"> <xml-odbc-do name="check-event-header" if-name="user"> <xml-odbc-do name="query" on-empty-result-break-to="not-found" value="...etc"> ..rest of your template goes here.. </xml-odbc-do> </xml-odbc-do> </template> But that would mean that an "empty" xml is returned whenever no $ {user} is provided. I didn't test how fs will react to that when it's looking up all the users for generating the acl list.. A way around that would be to only render your template when ${user} is set and otherwise render the not-found template, like this: <template name="default"> <xml-odbc-do name="check-event-header" if-name="user"> <xml-odbc-do name="break-to" value="directory-user"/> </xml-odbc-do> <xml-odbc-do name="break-to" value="not-found"/> </template> <template name="directory-user"> <xml-odbc-do name="query" on-empty-result-break-to="not-found" value="...etc"> ..rest of your template goes here.. </xml-odbc-do> </template> <template name="not-found"> etc... </template> --- Which comes close to how it's defined in the xml_odbc.conf.xml example, which solves it the other way around: ... <template name="default"> <xml-odbc-do name="break-to" value="${section}"/> </template> <template name="directory"> --> <xml-odbc-do name="check-event-header" if-name="purpose"> <!-- catches purpose gateways and network-list (any more?) --> <xml-odbc-do name="break-to" value="directory-${purpose}"/> </xml-odbc-do> <xml-odbc-do name="break-to" value="directory-user"/> </template> ... - First it checks what section is requested, which is nice but not really necessary in your case, since you only bind to directory. - Then it checks whether a purpose header is set (which was only the case for looking up acl's and gateways and NOT for regular user lookups last time I checked out the svn) - If a purpose header IS set, then it tries to render directory-$ {purpose}, which isn't specified, so it falls back to "not-found" which is what you want in this case - And as a last resort - this is where regular user lookups end up, it renders "directory-user" where you can put the template as specified above.. Hope that helps ? regards, Leon On Aug 27, 2009, at 3:53 PM, Juan Backson wrote:
Hi Leon,
Thanks for your help.
I have changed it according to your comment but I am still getting the looping error.
Would you please take a look see what else I did wrong?
Also, sip_user is an integer field, so I can't really use ''. Is there anyway to get around that?
<configuration name="xml_odbc.conf" description="XML ODBC Configuration">
<settings> <param name="binding" value="directory"/> <param name="odbc-dsn" value="class5_odbc:root:abcd"/> <param name="debug" value="true"/> <param name="keep-files-around" value="true"/> </settings>
<templates>
<template name="default"> <document type="freeswitch/xml"> <section name="directory"> <xml-odbc-do name="query" on-empty-result-break-to="not-found" value="SELECT enabled, sip_password FROM agent WHERE sip_user = $ {user} and enabled='t'"/> <domain name="${domain}"> <user id="${user}"> <params> <xml-odbc-do name="query" value="SELECT sip_password FROM agent WHERE sip_user = ${user}"> <param name="password" value="${sip_password}"/> </xml-odbc-do> </params> </user> </domain>
</section> </document> </template>
<template>
<document type="freeswitch/xml"> <section name="result"> <result status="not found"/> </section> </document> </template> </templates>
</configuration> _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org