rewritehost using avp

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

rewritehost using avp

Eldad Ran
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: rewritehost using avp

Bogdan-Andrei Iancu
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
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>  


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


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users