[Kamailio-Users] [OpenSER-Users] Perl module and moduleFunction()

Sebastian sastre sebas at nextcommunications.com
Tue Nov 18 18:32:17 CET 2008


Daniel,

I want to be able to send a sip redirect to my gateways TCL Script from
a perl script. The perl connects to our routing engine and receives an
ip to terminate the call. This should in turn be sent to the originating
gateway. 

This works perfectly. 
$ru="sip:xxxxxxxxx at yyy.yyy.yyy.yyy";
sl_send_reply("302", "Redirect to SIP provider");


But when I call a perl script and do 
perl_exec("Process_call");

sub Process_call(){
      my $m = shift;
	$ru = "sip:fffffff at ddd.ddd.ddd.dddd";
	$m->rewrite_ruri($ru);
	$m->sl_send_reply("302", "Redirect");
}
The redirect gets sent but with the old ruri. 


I have also tried returning the value of the function to the routing
block.

$ru = perl_exec("Process_call");
ERROR:core:pv_set_ruri: str value required to set R-URI


$ru = "." + perl_exec("Process_call"); 
ERROR:core:do_assign: no value in right expression


Sebastian
Senior Network Engineer
 

-----Original Message-----
From: Daniel-Constantin Mierla [mailto:miconda at gmail.com] 
Sent: Tuesday, November 18, 2008 12:05 PM
To: Sebastian sastre; kamailio
Subject: Re: [Kamailio-Users] [OpenSER-Users] Perl module and
moduleFunction()

please cc always to mailing lists...

On 11/18/08 18:30, Sebastian sastre wrote:
> Daniel,
>
> Thanks a lot for the info. I was playing with the scripts yesterday to
> find a workaround.
>
> When I call my perl script with perl_exec() if I rewrite the headers
> with 
>
> $m->rewrite_ruri("sip:A at B");
>
> They never get overwritten. 
>   
rewrite_uri should set a new request URI, not  headers. What do you 
expect to be overwritten?

Daniel

> Is there a way to access the $ru variable from the script? 
>
> I also tried using the Avpops module but no luck. 
>
> Thanks !!!
>
> Sebastian Sastre
> Senior Network Engineer
>  
>  
> NextCommunications, Inc.
> 100 North Biscayne Blvd. Suite 900
> Miami, FL. 33132. USA
> Phone: +1-305-356-4558
> Main:  +1-305-356-454528
> Fax: +1-305-374-4081
> e-mail: sebas at nextcommunications.com
>
> -----Original Message-----
> From: Daniel-Constantin Mierla [mailto:miconda at gmail.com] 
> Sent: Tuesday, November 18, 2008 6:14 AM
> To: Sebastian sastre
> Cc: users at lists.kamailio.org
> Subject: Re: [Kamailio-Users] [OpenSER-Users] Perl module and
> moduleFunction()
>
> Hello,
> On 11/14/08 01:54, Sebastian sastre wrote:
>   
>> Hello,
>>
>>  
>>
>> I am interested in knowing which flags I can set to have the 
>> sl_send_reply work from a perl script.
>>
>>     
> be careful, it is prety dangerous -- the undocumented parameter is 
> "unsafemodfnc", set it to 1.
>
> Cheers,
> Daniel
>
>   

-- 
Daniel-Constantin Mierla
http://www.asipto.com





More information about the Users mailing list