<div dir="ltr">Hey Karsten, <div><br></div><div>I had a similar doubt and following Daniel's recommendation I went with the same route you did (using {<a href="http://s.int">s.int</a>} to convert to integer).</div><div><br></div><div>Quote from another thread: <i>"you can also convert the header value to integer using the transformation {<a href="http://s.int/" target="_blank">s.int</a>}, that's safer if you need to do other types of comparison such as > or <, because comparing string values might give the result you don't expect"</i></div><div><br></div><div>Hope this helps!</div><div><br></div><div>Joel.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 18, 2019 at 10:58 AM Karsten Horsmann <<a href="mailto:khorsmann@gmail.com">khorsmann@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hi List,<div dir="auto"><br></div><div dir="auto">I use Kamailio 5.2.x and I want to fetch an value from an X Header and do some checks like "is not empty" and "should be an integer". </div><div dir="auto"><br></div><div dir="auto">AFAIK per default all values are strings with the hdr function. </div><div dir="auto"><br></div><div dir="auto">What are the best way for some validations within Kamailio script language? </div><div dir="auto"> </div><div dir="auto"><br></div><div dir="auto">if(is_present_hf("X-someheader")) {</div><div dir="auto"> $avp(routing_target) = $(hdr(X-someheader){<a href="http://s.int" target="_blank">s.int</a>});</div><div dir="auto"> if(!ds_list_exists("$avp(routing_target)")) </div><div dir="auto">Cheers </div><div dir="auto">Karsten Horsmann </div></div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>