[Freeswitch-users] need help with mod_xml_odbc

Leon de Rooij leon at scarlet-internet.nl
Thu Aug 27 06:31:21 PDT 2009


Made a typo in the <param>, you have to leave out the comma..

regards,

Leon


On Aug 27, 2009, at 2:57 PM, Leon de Rooij wrote:

> Hi Juan,
>
> Perhaps it loops because you didn't include the "not-found" template ?
> Actually, I see there's a bug in the example xml_odbc.conf.xml file
> where it's defined with an underscore instead of a dash, will change
> that tonight..
>
> The not-found template needs to be specified as a template in the
> configuration. I think I'll define that template statically in the
> module itself later.
> Because it's the 'fall-through' template when it can't find a
> template, you get a loop.
>
> So, something like this should probably work for you:
>
> <templates>
>
>   <template name="default">
>     <xml-odbc-do name="query" on-empty-result-break-to="not-found"
> value="SELECT sip_password FROM agent WHERE sip_user = '${user}';"/>
>     <document type="freeswitch/xml">
>       <section name="directory">
>         <domain name="${domain}">
>           <user id="${user}">
>             <params>
>               <param name="password", value="${sip_password}"/>
>             </params>
>           </user>
>         </domain>
>       </section>
>     </document>
>   </template>
>
>   <template name="not-found">
>     <document type="freeswitch/xml">
>       <section name="result">
>         <result status="not found"/>
>       </section>
>     </document>
>   </template>
>
> </templates>
>
> (I didn't include the enabled field in your select statement, as you
> don't use it later, perhaps you need it in the where clause ?)
>
> Also, note that this way the template will also be used at startup
> when FS tries to get a list of all ACL's - I believe for something
> else as well, have to check it - but those lookups probably don't give
> a ${user} so will render the "not-found" anyway..
>
> One last thing, you didn't have ${user} enclosed in quotes in your
> query, so if no ${user} was given with the lookup to the module, then
> your query becomes invalid, which probably breaks things as well.
>
> Let me know if it works..
>
> regards,
>
> Leon
>
>
>
> On Aug 27, 2009, at 1:40 PM, Juan Backson wrote:
>
>> Hi,
>>
>> Finally, I got xml_odbc running, but it does not really work well
>> for me.  I am getting:
>> 2009-08-28 03:33:47.459383 [ERR] mod_xml_odbc.c:325 Stopped
>> rendering template, called xml_odbc_render_template more than [32]
>> times, probably looping.
>> 2009-08-28 03:33:47.459383 [ERR] mod_xml_odbc.c:408 Something went
>> horribly wrong while generating an XML template!
>>
>> My config is:
>> <configuration name="xml_odbc.conf" description="XML ODBC
>> Configuration">
>>
>>  <settings>
>>        <param name="binding" value="directory"/>
>>    <param name="odbc-dsn" value="class5_odbc:root:JdqB-S"/>
>>    <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}"/>
>>        <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>
>>
>>  </templates>
>>
>> </configuration>
>>
>>
>> Since these two queries get data from the same table, I tried to
>> merge them, but could not get it to work.
>>
>> Anyone has any idea?
>>
>> Thanks,
>> JB
>> _______________________________________________
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org





More information about the FreeSWITCH-users mailing list