[OpenSIPS-Users] [NEW FEATURE] Multi DB connections support in AVPOPS

Bogdan-Andrei Iancu bogdan at voice-system.ro
Wed Dec 31 10:12:24 CET 2008


Thanks to a contribution of Kobi Eshun, the avpops module can now 
operate with multiple DB connections in the same time. Shortly, you will 
be able to operate with multiple databases (even different types of 
databases) in the same time.

How it works:

1) define all the DB connections you want to use in AVPOPS module be 
multiple definitions of "db_url" param:
        modparam("avpops","db_url","1 postgres://user:passwd@host/osips")
Note that the db url string is prefixed by a numerical id - a db_url 
reference number that will be used later to specify what DB connection 
to be used.

For backward comaptibility, the id 0 is considered default if missing 
and it is considered the default DB connection to be used if no other 
one is explicitly given:
  is the same with:
        modparam("avpops","db_url","0 mysql://user:passwd@host/database")

Also see 

2) use it - all avp_db_xxxx function takes as optional 3rd parameter the 
db connection id. If this param is missing, the default (id 0) 
connection is to be assumed.

    # load using default db connection (backward compatible)
    # load using db connection id 2
    avp_db_load("$fu","$(i:678)", "2");

Also see 

Many thanks to Kobi for his contribution.

Best regards,

More information about the Users mailing list