[SR-Users] Trouble with DB APIs

Daniel-Constantin Mierla miconda at gmail.com
Wed Feb 11 23:07:50 CET 2015


Hello,

long story short: if you write a db connector module then implement
srdb1 interface because most of the modules are relying on that. srdb2
comes from ser branch, only some of the uid_* modules use it. There are
couple of goodies in srdb2, but perhaps is easier to migrate them to
srdb1 rather than migrate all the modules to srdb1. Also, srdb1 is more
reach in exported API than srdb2 (which was more or less in early phase
of development at the merge time and remained like that).

Cheers,
Daniel

On 10/02/15 21:19, Davidson, Erik wrote:
> Hey Everyone!
>
> I’m currently working on a database module and I’ve come across some
> issues/confusion that I was hoping someone could clear up for me.
>  I’ve been looking at the existing modules and the docs online for
> help but I can’t find a definitive answer for them.
>
>  1. I see there are 2 DB APIs (srdb1 and srdb2) and I gather that
>     srdb2 is the newer version?  Should I aim to use srdb2 exclusively
>     or should I also use srdb1?
>  2. It looks like srdb2 provides a db_uri command that can be used to
>     implement custom URI parsing but I can’t figure out how to hook
>     into it.  I added it to my exported commands but it was never
>     called.  When I looked through the code I saw the only place that
>     ever really uses it is db_ctx, which itself looks to be used in
>     the child_init of modules.  I’m developing a database module that
>     I want to be a drop-in replacement for others, but it needs
>     multiple hosts specified in the connection uri (similar to the URI
>     example here
>     http://docs.mongodb.org/manual/reference/connection-string
>     <http://docs.mongodb.org/manual/reference/connection-string>/) and
>     I can’t figure out the best place to do it.  Should I be doing it
>     in db_func_t.init because it has the full string version of the
>     uri and parse it there? Do I then have to reimplement everything
>     that db_do_init would be doing?
>  3. Do I need to implement multiple database interfaces to get full
>     module coverage in Kamailio? I was looking at db_berkeley as a
>     reference and it looks like it has the KAMAILIO_MOD_INTERFACE as
>     well as the SER_MOD_INTERFACE implemented.
>  4. Is there a preferred way to handle the API binding (such as db_
>     commands vs db_bind_api)?
>
> Thanks for any help or direction you can give me!
>
> - Erik Davidson
>
> ------------------------------------------------------------------------
>
> *CONFIDENTIALITY NOTICE: The information contained in this e-mail
> message and any attachments is for the sole use of the intended
> recipients and may contain confidential and privileged information.
> Any unauthorized review, use, disclosure or distribution is
> prohibited. If you are not the intended recipient and have received
> this communication in error, please contact the sender by reply e-mail
> and destroy all copies of the original message. Thank you.*
>
>   ­­  
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - http://www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150211/e497fe09/attachment.html>


More information about the sr-users mailing list