[OpenSIPS-Devel] [ opensips-Patches-3599314 ] Make perlvdb work with alias_db and without leaks

SourceForge.net noreply at sourceforge.net
Thu Jan 3 13:39:21 CET 2013


Patches item #3599314, was opened at 2013-01-03 04:39
Message generated for change (Tracker Item Submitted) made by ratner2
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=3599314&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: bratner (ratner2)
Assigned to: Nobody/Anonymous (nobody)
Summary: Make perlvdb work with alias_db and without leaks

Initial Comment:
Several fixes:
1. change the the declared module name to db_perlvdb. Otherwise it is not found as db_ module. 
2. change the init db url type to actually be str
3. many changes that fix various memory leaks (perl object leaks)
4. fix result cleanup memory leaks

What works: Probably anything that does only query.
I use it for alias_db like this:
in opensips.cfg#perl stuff
loadmodule "perl.so"
modparam("perl", "modpath", "/usr/lib/opensips/perl")
modparam("perl", "filename", "/usr/lib/opensips/perl/vdbtest.pm")
loadmodule "perlvdb.so"

#alias lookup module 
loadmodule "alias_db.so"
modparam("alias_db", "db_url", "perlvdb:OpenSIPS::VDB::Adapter::Alias")
...
...
alias_db_lookup("OpenSIPS::VDB::VTab::MyCode","d" );  # Lookup the new user at domain for the incoming RURI
....

in /usr/lib/opensips/perl/vdbtest.pm:

use OpenSIPS::VDB::Adapter::Alias;
use OpenSIPS::VDB::VTab::MyCode;
use OpenSIPS;
1;

in /usr/lib/opensips/perl/OpenSIPS/VDB/VTab/MyCode.pm:

package OpenSIPS::VDB::VTab::MyCode;
@ISA = qw ( OpenSIPS::VDB::VTab OpenSIPS::Utils::Debug );
use OpenSIPS;
sub init {
        OpenSIPS::log(L_NOTICE, "Init in MyCode");
}



sub query {
        OpenSIPS::log(L_NOTICE, "Query in MyCode");
        my $self = shift;
        my $alias_username = shift;
        my $alias_domain = shift;
        OpenSIPS::log(L_NOTICE, "Finishing up the query in CP");
        return { username => "newuser", domain => "newdomain" };

}


1;


Any comments, bugs, requests to ratner2 at gmail.com





----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=3599314&group_id=232389



More information about the Devel mailing list