[SR-Dev] Both database interfaces integrated

Jan Janak jan at iptel.org
Tue Feb 17 13:32:16 CET 2009


I am happy to announce that I just managed to run sip-router with both
versions of the database interface, single db_mysql merged from both projects
and modules from both ser and kamailio at the same time.

I loaded sqlops (kamailio) and avp_db (ser) modules and tried to use them from
the same script and they both worked, using libsr1 and libsr2
respectively. Both modules used single db_mysql.

Here is a very simple configuration file which demonstrates how modules from
both projects can be used together:

loadmodule "./modules/db_mysql/db_mysql.so"
loadmodule "./modules/domain/domain.so"
loadmodule "./modules/avp_db/avp_db.so"
loadmodule "./modules/sqlops/sqlops.so"
loadmodule "./modules/xlog/xlog.so"
loadmodule "./modules/avp/avp.so"

modparam("domain|avp_db", "db_url", "db_mysql://ser:heslo@localhost/ser")

route {
        log(1, "ERR: Request received\n");
        sql_query("ca", "select * from domain", "ra");
        if($dbr(ra=>rows)>0) {
                log(1, "ERR:Some data found\n");
        } else {
                log(1, "ERR:No data found\n");

        load_attrs("$fu", "100");

        if ($fu.test && ($fu.test == "abc")) {
           log(1, "ERR: Attribute loaded\n");
        } else {
          log(1, "ERR: Attribute NOT loaded\n");

As the merged db_mysql module seems to work fine, I merged it from
janakj/mysql into the master branch and I would like to encourage others to
give it a spin.

I am quite happy about the merge of db_mysql, we preserved histories from both
projects, kamailio files are prefixed with km_ and it didn't that that many
changes to make it work :-). I think this is the way to go for other database
drivers as well.

On the other hand porting kamailio modules to sip-router takes more tweaks
than I expected. There are several subsystems which are not compatible (avps)
and also kamailio seems to have more functions and data structures in the
core, some of them are missing in the sip-router core. So expect more work
when you try to port kamailio modules to sip-router.


More information about the sr-dev mailing list