<div dir="ltr"><div class="message-author">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?</div><div class="message-content">
The Error:<br>
Mar 2 14:45:11 [16996] CRITICAL:core:yyerror: parse error in config file, line 377, column 19-20: syntax error<br>
Mar 2 14:45:11 [16996] CRITICAL:core:yyerror: parse error in config file, line 377, column 34-35: bad argument, string expected<br>
For checking the type I get:<br>
AVP with string id IP and having String value exists<br>
The value of $avp(s:IP) is a valid IP address.<br>
The opensips.cfg relevant part:<br>
if(!avp_db_query("select value from usr_preferences where uuid='MTI' LIMIT 1","$avp(s:IP)")){<br>
exit;<br>
}<br>
else {<br>
if(is_avp_set("$avp(s:IP)/s"))<br>
log("AVP with string id IP and having String value exists\n");<br>
if(is_avp_set("$avp(s:IP)/n"))<br>
log("AVP with string id IP and having Int value exists\n");<br>
rewritehost($avp(s:IP));<br>
}</div></div>