VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
juanbackson at gmail.com Guest
|
Posted: Thu Aug 27, 2009 4:04 am Post subject: [Freeswitch-users] need help with mod_xml_odbc |
|
|
Hi,
I tried to make install mod_xml_odbc and load it in freeswitch, but I am getting:
2009-08-28 00:46:55.848087 [CRIT] switch_loadable_module.c:871 Error Loading module /usr/local/freeswitch/mod/mod_xml_odbc.so
**/usr/local/freeswitch/mod/mod_xml_odbc.so: invalid ELF header**
I had to manually copy the .so file from the mod_xml_odbc dir to /usr/local/freeswitch/mod
Does anyone know what is wrong?
Thanks,
JB |
|
Back to top |
|
|
krice at freeswitch.org Guest
|
Posted: Thu Aug 27, 2009 4:10 am Post subject: [Freeswitch-users] need help with mod_xml_odbc |
|
|
You can not just copy the .so file from the directory it is just a pointer file to the real .so ... You should always use the make install target or make {module_name}-install target to get it properly installed From: Juan Backson <juanbackson@gmail.com> Reply-To: <freeswitch-users@lists.freeswitch.org> Date: Thu, 27 Aug 2009 16:56:09 +0800 To: <freeswitch-users@lists.freeswitch.org> Subject: [Freeswitch-users] need help with mod_xml_odbc Hi, I tried to make install mod_xml_odbc and load it in freeswitch, but I am getting: 2009-08-28 00:46:55.848087 [CRIT] switch_loadable_module.c:871 Error Loading module /usr/local/freeswitch/mod/mod_xml_odbc.so **/usr/local/freeswitch/mod/mod_xml_odbc.so: invalid ELF header** I had to manually copy the .so file from the mod_xml_odbc dir to /usr/local/freeswitch/mod Does anyone know what is wrong? Thanks, JB _______________________________________________ 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 |
|
Back to top |
|
|
juanbackson at gmail.com Guest
|
Posted: Thu Aug 27, 2009 5:45 am Post subject: [Freeswitch-users] need help with mod_xml_odbc |
|
|
Hi,
ok, the module can be loaded, but it now complains about odbc. I can't find anything missing in my odbc.ini. Could someone please point me to the right direction?
2009-08-28 02:22:35.670284 [ERR] switch_odbc.c:188 STATE: IM002 CODE 201 ERROR: [unixODBC]Missing server name, port, or database name in call to CC_connect.
2009-08-28 02:22:35.670312 [CRIT] mod_xml_odbc.c:577 Cannot Open ODBC Database!
2009-08-28 02:22:35.670319 [ERR] mod_xml_odbc.c:612 Unable to load xml_odbc config file
2009-08-28 02:22:35.670326 [CRIT] switch_loadable_module.c:871 Error Loading module /usr/local/freeswitch/mod/mod_xml_odbc.so
**Module load routine returned an error**
I already have xml_odbc.conf
cat /etc/odbc.ini
; begin odbc.ini
[ODBC Data Sources]
test = PostgreSQL ODBC Driver
[test]
Driver = /usr/local/lib/libodbcpsql.so
Description = PostgreSQL Data Source
DSN = test
Servername = 192.168.1.133
Server = 192.168.1.133
Port = 5432
;Socket = 4096
Protocol = 6.4 # 7.2 or other values
UserName = root
Password = JdqB-S
Database = freeswitch
ReadOnly = no
ServerType = Postgres
FetchBufferSize = 99
ServerOptions =
ConnectOptions =
;Options = 3
Trace = 0
TraceFile = /var/log/PostgreSQL_test_trace.log
Debug = 0
DebugFile = /var/log/PostgreSQL_test_debug.log |
|
Back to top |
|
|
juanbackson at gmail.com Guest
|
Posted: Thu Aug 27, 2009 6:50 am Post subject: [Freeswitch-users] need help with mod_xml_odbc |
|
|
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 |
|
Back to top |
|
|
leon at scarlet-intern... Guest
|
Posted: Thu Aug 27, 2009 8:12 am Post subject: [Freeswitch-users] need help with mod_xml_odbc |
|
|
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:
Quote: | 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@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org |
|
Back to top |
|
|
leon at scarlet-intern... Guest
|
Posted: Thu Aug 27, 2009 8:38 am Post subject: [Freeswitch-users] need help with mod_xml_odbc |
|
|
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:
Quote: | 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:
Quote: | 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@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@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org |
|
Back to top |
|
|
juanbackson at gmail.com Guest
|
Posted: Thu Aug 27, 2009 8:58 am Post subject: [Freeswitch-users] need help with mod_xml_odbc |
|
|
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> |
|
Back to top |
|
|
leon at scarlet-intern... Guest
|
Posted: Thu Aug 27, 2009 10:09 am Post subject: [Freeswitch-users] need help with mod_xml_odbc |
|
|
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:
Quote: | 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
|
_______________________________________________
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 |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|