[Kamailio-Users] Error with table version

Raúl Alexis Betancor Santana rabs at dimension-virtual.com
Mon May 25 09:55:10 CEST 2009


On Monday 25 May 2009 08:48:42 you wrote:
> Hello,
>
> On 05/24/2009 12:45 PM, Raúl Alexis Betancor Santana wrote:
> > This is and old issue that I still have around here ...
> >
> > -Kamailio 1.5.1 (svn)
> > -PostgreSQL database
> > -Database created with "kamdbctl create", so just clean
> > - in kamailio.cfg:
> > [...]
> > loadmodule "uri_db.so"
> > modparam("uri_db", "db_url",
> > "postgres://openser:XXXXX@localhost:5435/voip3") modparam("uri_db",
> > "db_table", "uri")
> > modparam("uri_db", "user_column", "username")
> > modparam("uri_db", "domain_column", "domain")
> > modparam("uri_db", "uriuser_column", "uri_user")
> > modparam("uri_db", "use_uri_table", 0)
> > modparam("uri_db", "use_domain", 0)
> > [...]
> >
> > May 24 10:22:27 [23631] INFO:core:init_mod: initializing module auth_db
> > May 24 10:22:27 [23631] INFO:core:init_mod: initializing module uri_db
> > May 24 10:22:27 [23631] ERROR:uri_db:mod_init: Invalid table version of
> > the subscriber table
> > May 24 10:22:27 [23631] ERROR:core:init_mod: failed to initialize module
> > uri_db
> > May 24 10:22:27 [23631] ERROR:core:main: error while initializing modules
> >
> > And I don't undestand why ... because subscriber table it's on version 6,
> > that is what uri_db checks ...
> >
> > [uri_db_mod.c]
> > /* Check table version */
> >    ver = uridb_db_ver(&db_url, &db_table);
> >    if (ver < 0) {
> >       LM_ERR("Error while querying table version\n");
> >       return -1;
> >    } else {
> >       if (use_uri_table) {
> >          if (ver != URI_TABLE_VERSION) {
> >          LM_ERR("Invalid table version of the uri table\n");
> >          return -1;
> >          }
> >       } else {
> >          if (ver != SUBSCRIBER_TABLE_VERSION) {
> >          LM_ERR("Invalid table version of the subscriber table\n");
> >          return -1;
> >          }
> >       }
> >    }
> > [uri_db_mod.c]
> >
> > and SUBSCRIBER_TABLE_VERSION has value 6
> >
> > is there something I'm doing wrong?, last time I compile myself this I
> > was forced to comment that block of code on the uri_db sources.
>
> paste the output of "select * from version" here and if you can get it
> in postgres, the equivalent in mysql of "describe version".

Hi Daniel, the "real problem" is this line ..

[...]
ver = uridb_db_ver(&db_url, &db_table);
[...]

Because with it you allways get the version of uri table, but then on the if 
block you check it against URI_TABLE_VERSION or SUBSCRIBER_TABLE_VERSION.
The solution was "UPDATE version SET table_version=6 WHERE table_name ='uri';" 
so it get's the correct version of SUBSCRIBER_TABLE_VERSION

The check code should be fixed to get the table version of the table you are 
using (uri or subscriber) and not allways get the version of uri.

Best regards
-- 
Raúl Alexis Betancor Santana
Dimensión Virtual



More information about the Users mailing list