[SR-Users] Perl Module Logging Query

Bruce McAlister bruce.mcalister at blueface.ie
Wed Dec 9 18:21:25 CET 2009


Hi All,

I have been trying to use the perl module with Kamailio 1.5.3-notls. I
have managed to load the module successfully.

I have a simple script with a single function that strips the "<" or ">"
from a contact header and logs the info, then sets an AVP.

Kamailio seems to load the perl module and the script properly, but when
it runs I get an error on the logging side of it. I cannot for the life
of me see where the error lies.

Could one of you guru's out there please cast an eye over my config and
see if you can spot something I am missing.

My kamailio configuration for perl is as such:

----
loadmodule "perl.so"
modparam("perl", "modpath", "/opt/kamailio/lib64/perl")
modparam("perl", "filename", "/opt/kamailio/perl-scripts/kamailio-perl.pl")
----

My perl script looks as follows:

----
use OpenSER ;
use OpenSER::Message ;

sub clean_contact {
    my $contact_header = shift;

    log("contact header passed: $contact_header\n");
    $contact_header =~ s/^<|>$//g;
    log("contact header fixed: $contact_header\n");
    OpenSER::AVP::add("clnct", "$contact_header");

    return 1;
}
----

I have the following section in the route logic that calls this function
as follows:

----
perl_exec_simple("clean_contact","$ct");
----

When the perl script executes, it gets to the first log line and dies
with the following message:

----
ERROR:core:XS_OpenSER__Message_log: perl error: Can't take log of 0 at
/opt/kamailio/perl-scripts/kamailio-perl.pl line 7.
----

I have had a look at the logging.pl script in the sample directory for
the perl module, and have tried all the methods shown in the example,
but I just cannot seem to get past this particular logging issue.

Any tips would be greatly appreciated.

Thanks
Bruce




More information about the sr-users mailing list