On Tuesday 17 August 2010, Nicolas RĂ¼ger wrote:
is there any way to use or evaluate the
return-statements of a perl-script
in kamailio.cfg?
I tried the following in the Routing Logic in kamailio.cfg:
if (is_method("INVITE")) {
if (perl_exec("my_perl_subroutine") == -1){
xlog("PERL returns -1 \n");
}
}
Doesn't work.
The bad thing is that the return-values of the - perl_exec("XXX") - call
are not the same that the perl subroutine "XXX" returns.
That's at least what I strongly believe after testing.
I do need to read/evaluate the return-value of the perl-subroutine in the
Routing Logic to define different routes depending on what the
perl-subroutine returns.
Is there any way to do that???
Hi Nicolas,
i just checked in the code of perl/perlfunc.c:perl_exec2(..) in the module, it
seems that it according to the code it should return the result from the perl
method, or -1 on internal error or wrong parameter before execution.
If this not work, then its probably a bug in the module. Maybe you can add
some debugging information into this code statement to help with your tests.
Another idea, if you don't like to digg in the code, for returning some data
from perl to the script would be to use OpenSER::AVP and fill the return value
(maybe with some wrapper) in an AVP which you then read out later.
Cheers,
Henning