[sr-dev] kamailio-ser integration - db modules

Olle E. Johansson oej at edvina.net
Fri Dec 21 08:29:24 CET 2012


20 dec 2012 kl. 20:52 skrev Jan Janak <jan at janakj.org>:

> The database API version 2 (originating from SER) is an evolved
> version of the database API that Kamailio has (version 1), they both
> share a common ancestor.
> 
> The main motivation for designing a new API was to make it possible to
> integrate SER with non-SQL based databases. The general idea was that
> SER would include an API that would enable it to execute general
> queries on the database server. Any results those queries produce
> would get converted into AVPs. SER modules that depend on data
> obtained from the database would then work primarily with those AVPs.
> You could also process those AVPs directly in the configuration file
> in the routing logic.
> 
> In theory this enables the integration of SER with in-memory and
> no-SQL based databases. I have tested this with LDAP (hence the
> generic LDAP database driver), Cassandra, and other (proprietary)
> database engines. One could also implement RADIUS support in form of a
> database connector via this API, but I never found the time to do
> that.
> 
> The version 2 of the database API is, unfortunately, not backwards
> compatible with version 1. That's because version 1 assumes that all
> database queries are directly mapped to corresponding SQL statements.
> Version 2 is a bit more general and does not assume SQL.
> 
> Although we also did a number of changes to the database schema used
> by SER around the same time, those schema changes are not related to
> the new database API. Version 2 of the database API does not require
> schema changes per se and it should work fine with the database schema
> used by Kamailio.
> 
> Somewhere in the process of changing the database code I also added
> support for pre-compiled statements to the MySQL connector module, in
> fact the module uses them by default for all database queries. I
> thought this might improve performance of the MySQL connector module
> (which it does under certain circumstances), but in practice it only
> makes things more complicated. Properly configured SQL query cache on
> the database server works even better in terms of performance.
> 
Jan,
Thank you for the extensive feedback and tutorial!

This should be copied to the wiki.

/O
> -Jan
> 
> On Thu, Dec 20, 2012 at 11:38 AM, Ovidiu Sas <osas at voipembedded.com> wrote:
>> On Thu, Dec 20, 2012 at 11:20 AM, Daniel-Constantin Mierla
>> <miconda at gmail.com> wrote:
>>>> What's the difference between the db1 and db2 interface?
>>> 
>>> It is not the case here, modules_k/ldap does not have any relation to
>>> database interface.
>> 
>> 
>> Any database module db_[DatabaseType] implements an API.
>> SER was using one API and opensips/kamailio a different API (and
>> therefore today we have version 1 and 2).
>> All db modules in the stable release are supporting both APIs.
>> The new db ldap module has support only for the SER API version.
>> The API is documented in each lib/srdb[1|]/*.h header files.
>> 
>> The ldap module from ser is completely different than ldap module from
>> kamailio (despite the fact that both are using the same name).
>> It's the same with the dialog module.  Check the README file for each.
>> 
>> Hope this brings a little bit of light :)
>> 
>> 
>> -ovidiu
>> 
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> 
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev




More information about the sr-dev mailing list