[SR-Users] carrierroute cr_route fails with pvars

marius zbihlei marius.zbihlei at 1and1.ro
Mon May 3 12:13:01 CEST 2010


Ole Kaas wrote:
> Hello,
>
>   
Hello Ole
> Any idea why this fails:
>
> $var(carrier) = "carriername";
> $var(domainname) = "domain";
> if(cr_route( "$var(carrier)", "$var(domainname)", "$rU", "$rU", "call_id")) 
>
> with tis in the log:
>
> INFO: carrierroute [cr_func.c:598]: uri domain was rewritten to sip:domain, carrier 2, domain 2
>
>   
You are right, if you use 2 PV in the cr_route function things will go 
badly.

The reason is that the core function get_str_fparam() returns a pointer 
to a static buffer, and in total there are three(3) static buffers to 
return, so after a fourth call the first value (if cached which is the 
case in your proof) will be overwritten by the fourth. A solution is to 
increase the number of buffers to a number larger than 3 (but still 
small - keep in mind that each buffer is 1kB). I have tested with 6 and 
it works.

Please modify PV_PRINT_BUF_NO in sr_module.c(line 1418) to a larger 
value , compile and retest.

Thanks
Marius
> /Ole
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>   




More information about the sr-users mailing list