<div dir="ltr"><div>Thanks Bogdan, that works fine!<br></div>Stefan<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 28, 2016 at 6:06 PM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<tt>Hi Stefan,<br>
<br>
Instead of <br><span class="">
if (src_ip == $(var(qpip){ip.pton}) && src_port ==
$var(qpprt)) { <br></span>
do<br>
if ( $si== $var(qpip) && $sp == $var(qpprt) ) {<br>
<br>
<br>
For t_relay(), see:<br>
<a href="http://www.opensips.org/html/docs/modules/2.1.x/tm.html#trelay-1" target="_blank">http://www.opensips.org/html/docs/modules/2.1.x/tm.html#trelay-1</a><br>
but it does not accept variables.<br>
To get a similar behavior, do :<br>
$du = "sip:"+ </tt><tt><tt>$var(qpip) + ":" + </tt></tt><tt><tt><tt>$var(qpprt);<br>
t_relay();<br>
<br>
</tt></tt>Regards,<br>
</tt>
<pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre><div><div class="h5">
<div>On 28.04.2016 15:50, Stefan Tobé wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="h5">
<div dir="ltr">
<div>
<div>
<div>Hi there,<br>
</div>
I am trying to sanitize the opensips script by using a
script 'dashboard' in the beginning of the script (using
startup_route)<br>
<br>
I face two problems here (opensips script errors)<br>
problem 1: $var(uriqp) should be the uri-string in order to
use that in t_relay() which is rejected<br>
</div>
problem 2: completing IF statement where src_ip should be
compared to transformed (to binary) ip address and source
port is both rejected<br>
<br>
</div>
Can somebody explain <br>
<ol>
<li>what the correct uri string for use in t_relay() would
need to be ? (just entering t_relay("udp:<a href="http://10.130.2.4:5060" target="_blank">10.130.2.4:5060</a>")
works fine)</li>
<li>what the correct way of transformation I need to use in
order to have this IF statement accepted?</li>
</ol>
<p>thanks</p>
<p>Stefan Tobé<br>
</p>
<div>
<div><br>
<br>
<br>
####### Routing Logic ########<br>
startup_route {<br>
####### Local Parameters / Dashboard #########<br>
$var(qpip)= "10.130.2.4";<br>
$var(qpprt)= "5090";<br>
# $var(qpprt)= 5090;<br>
<br>
<span style="color:rgb(255,0,0)"><b> $var(uriqp)=
"udp:"+$var(qpip)+":"+$var(qpprt);<br>
</b></span><br>
<br>
}<br>
<br>
<br>
route{<br>
<br>
<b><span style="color:rgb(255,0,0)">if (src_ip ==
$(var(qpip){ip.pton}) && src_port ==
$var(qpprt)) { (=> won't accept </span><span style="color:rgb(255,0,0)">regardless whether
$var(qpprt)= "5090" or $var(qpprt)= 5090)</span></b><br>
# code here<br>
route(sbc);<br>
}<br>
</div>
<div>else ....<br>
</div>
<div>}<br>
<br>
route[qp] {<br>
<br>
<span style="color:rgb(255,0,0)"><b> if
(!t_relay($var(uriqp)) {</b></span><br>
send_reply("500","Internal Error");<br>
}<br>
exit;<br>
}<br clear="all">
<div>
<div><br>
-- <br>
<div>mvg<br>
Stefan Tobé<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><span class=""><pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</span></blockquote>
<br>
</div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">mvg<br>Stefan Tobé<br><br><br>Private Mobility Nederland B.V.<br>Bolderweg 1<br>1332 AX Almere<br>tel: 088 303 3002 / 06 21 26 59 68<br>email: <a href="mailto:stefan.tobe@privatemobility.nl" target="_blank">stefan.tobe@privatemobility.nl</a><br>internet: <a href="http://www.privatemobility.nl" target="_blank">www.privatemobility.nl</a><br><br></div>
</div>