[OpenSIPS-Users] rewritehost using avp

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Mar 4 12:00:09 CET 2010


Hi Eldad,

The rewritehost function does not accept variables.

Better use directly the variables to set a new IP in RURI:
    $rd = $avp(s:IP);

See: http://www.opensips.org/Resources/DocsCoreVar16#toc56

Regards,
Bogdan


Eldad Ran wrote:
> I have to rewrite host by a value that I extract from a DB, stored in 
> an $avp, but the rewritehost function won't accpet it as it expects a 
> string, I've checked the $avp type and it is a string, is there any 
> way to go around this?
> The Error:
> Mar 2 14:45:11 [16996] CRITICAL:core:yyerror: parse error in config 
> file, line 377, column 19-20: syntax error
> Mar 2 14:45:11 [16996] CRITICAL:core:yyerror: parse error in config 
> file, line 377, column 34-35: bad argument, string expected
> For checking the type I get:
> AVP with string id IP and having String value exists
> The value of $avp(s:IP) is a valid IP address.
> The opensips.cfg relevant part:
> if(!avp_db_query("select value from usr_preferences where uuid='MTI' 
> LIMIT 1","$avp(s:IP)")){
> exit;
> }
> else {
> if(is_avp_set("$avp(s:IP)/s"))
> log("AVP with string id IP and having String value exists\n");
> if(is_avp_set("$avp(s:IP)/n"))
> log("AVP with string id IP and having Int value exists\n");
> rewritehost($avp(s:IP));
> }
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Users mailing list