[OpenSER-Devel] Memory leak
Mik Cheez
michael_bulk at wildgate.com
Thu Jul 12 17:22:56 CEST 2007
Hi Bastian!
I've attached the script for you. I was planning on submitting this
with revision 2386, but 2425 came out just before I did so I gave it a
shot. In both cases, as well as the current release, the error is the same.
I love this module...
Bastian Friedrich wrote:
> Hi,
>
> On Wednesday 11 July 2007, Mik Cheez wrote:
>> My openser starts reporting "out of memory" and soforth on a fairly
>> regular basis. The server is being used to communicate with PSTN's
>> only. I use the Perl module on all invites to set different headers,
>> including the URI.
>
> Do I get that right: the problem occured with the transition from SVN revision
> 2386 to revision 2425?
>
> Can you give me an excerpt of your Perl script to reproduce the problem? You
> are probably adding AVPs in your Perl function?
>
> Thx,
> Bastian
>
-------------- next part --------------
use strict;
use DBI;
use OpenSER qw ( log );
use OpenSER::Constants;
use OpenSER::Message;
sub ser_geturi {
my $m = shift; # headers
my $param = shift; # doroute
$param =~ s/l/L/g;
my $sth;
my $dbh;
my $rpid;
my ($inani, $insrc);
my ($ruri, $clid, $srcip);
my ($outuri, $route, $outnumber, $outani);
my ($daytim, $callid);
$ruri = $m->getHeader("To");
$clid = $m->getHeader("Call-ID");
$srcip = $m->pseudoVar("\$si");
$inani = $m->pseudoVar("\$fU");
$insrc = $m->pseudoVar("\$fd");
$daytim = $m->pseudoVar("\$Tf");
$callid = $m->pseudoVar("\$ci");
$dbh = DBI->connect(
"dbi:Sybase:database",
'xxxxxx',
'yyyyyy',
{
RaiseError => 1,
AutoCommit => 0
}
) || die "Database connection not made: $DBI::errstr";
$dbh->do("use Routing");
if( $inani =~ /^(\d+)$/ ){
$sth = $dbh->prepare("exec proxy_getoutgoingroute \@inURI=?, \@doroute=?, \@inANI=?, \@transip=?");
$sth->execute($ruri, $param, $inani, $srcip);
} else {
$sth = $dbh->prepare("exec proxy_getoutgoingroute \@inURI=?, \@doroute=?, \@transip=?");
$sth->execute($ruri, $param, $srcip);
}
$sth->bind_columns(undef,\($outuri, $route, $outnumber, $outani));
if( $sth->fetch ) {
OpenSER::AVP::add(39, "$outuri");
log(L_INFO, "droute: $param\r\n");
log(L_INFO, "inani : $inani\r\n");
log(L_INFO, "insrc : $insrc\r\n");
log(L_INFO, "route : $route\r\n");
log(L_INFO, "outuri: $outuri\r\n");
log(L_INFO, "outnum: $outnumber\r\n");
log(L_INFO, "outani: $outani\r\n");
log(L_INFO, "callid: $callid\r\n");
log(L_INFO, "time : $daytim\r\n");
if( $outani != undef ){
my %group = ('5', '6', '7', '8');
if (exists($group{$route})){
$outani = "NOTHING";
}
$rpid = "Remote-Party-ID: <sip:$outani\@$insrc>;screen=no;id-type=subscriber;party=calling;privacy=off\r\n";
OpenSER::AVP::add(38, "$rpid");
log(L_INFO, "rpid : $rpid");
}
} else {
log(L_INFO, "nothing returned\r\n");
}
$sth->finish;
$dbh->disconnect();
return 1;
}
More information about the Devel
mailing list