Hi All
I may well be me missing something obvious but I have got three odd ones whilst trying to
test app_perl module which I'd appreciate some assistance with.
Setup
--------
Kamailio version : 4.0.0 (x86_64/linux) from Peter Dunkley's YUM Repository
Perl version : v5.10.1
OS version : CentOS release 6.4
Kamailio.cfg highlights;
loadmodule "app_perl.so"
modparam("app_perl", "filename", "/tmp/test.pl")
modparam("app_perl", "modpath",
"/usr/lib64/kamailio/perl/")
# ** would someone like to add the app_ to 5.1 and 5.2 of the manuals please
request_route {
.
.
route(PERL);
.
.
}
route[PERL] {
if ($rU=~"^124" && method=="INVITE") {
xlog("L_INFO","perl: match $rm $ru from:$fu ($si:$sp)
to:$tu rpid:$re\n");
if (perl_exec("testrouting")) {
xlog("L_INFO","perl: true exit\n");
} else {
xlog("L_INFO","perl: false exit\n");
}
}
}
/tmp/test.pl has the following in it ...
#!/usr/bin/perl
use Kamailio qw ( log );
use Kamailio::Constants;
use Sys::Syslog qw( :DEFAULT setlogsock);
sub testrouting {
setlogsock('unix');
openlog($0,'','user');
syslog('info', "PERL Kamailio - Log test");
closelog;
return 1;
}
There is no valid route for 124@ and the above works exactly as I'd expect;
-> Phone sends INVITE to 124
<- Proxy responds with AUTH Required
-> Phone sends ACK
-> Phone sends INVITE to 124 with AUTH
-- SysLog gets a "PERL Kamailio - Log test" from perl script
-- Kamailio log gets "perl: true exit"
<- Proxy responds with "404 Not Found"
-> Phone sends ACK
------------------------------------------
First problem is that if I swap the "return 1" in test.pl for "return
0" what I see is;
-> Phone sends INVITE to 124
<- Proxy responds with AUTH Required
-> Phone sends ACK
-> Phone sends INVITE to 124 with AUTH
-- SysLog gets a "PERL Kamailio - Log test" from perl script
-> Phone resends INVITE to 124 with AUTH
-- SysLog gets a "PERL Kamailio - Log test" from perl script
-> Phone resends INVITE to 124 with AUTH
-- SysLog gets a "PERL Kamailio - Log test" from perl script
-- I Hang Up Phone
--> Phone send CANCEL
--> Phone send CANCEL
--> Phone send CANCEL
In this second test once perl_exec is called all routing seems to stop. There's
nothing from the xlog to say if perl_exec returned true or false.
--------------------------------------
The second problem I have is when I add "Kamailio::log(L_INFO," line it never
arrives in any of the logs
use Kamailio qw ( log );
use Kamailio::Constants;
use Sys::Syslog qw( :DEFAULT setlogsock);
sub testrouting {
setlogsock('unix');
openlog($0,'','user');
syslog('info', "PERL Kamailio - Log test");
closelog;
Kamailio::log(L_INFO, "PERL : testrouting\n");
return 1;
}
--------------------------------------
The third one is that I cannot get append_branch to do anything.
If I add to the perl script the lines;
my $m = shift;
$m->rewrite_ruri("sip:anotheruser\@ourserver");
The call gets diverted as expected. However if I use append_branch;
$m->append_branch("sip:anotheruser\@ourserver");
It has no effect at all.
--------------------------------------
That's as far as I have experimented with the module so I can't say if everything
else is working as expected :-)
Anyone have any thoughts?
Cheers
Mark