Guys thank you very much for all your answers. It is a very educational process writing and reading from the users list.<br>For new people in kamailio like myself , the users list is the best way to learn AFTER reading the official documentation.<br>
<br>Thank you once again <br><br>P.S. For the records I'm attaching the script i wrote to implement the portability<br>Cheers<br>Alex<br><br>The scenario is that we expect calls from customers which we route through a special prefix that they are sending us. For some customers we terminate ported numbers and for others not.That depends on the contract they have.<br>
Anyway the script which i will test heavily tomorrow:<br><br>From the prefix to domain translation i expect back a value string with 4 numbers separated from dot's .<br>10.1.1.5<br>number called 1001 210XXXXXXX 1001=cust prefix and 210XXXXXX number<br>
<br>$var(dial_grp) = 10 the dialplan group in the dialplan query next one.values .0-100<br>$var(check_p) = 1 if we want to check number for portability . values 0-1<br>$var(term_p) = 1 if the number is ported if we want to terminate it anyway. values 0-1<br>
$var(num_pr) = 4 this is the prefix(number of digits we want to remove before the checking of portability)<br>if(prefix2domain("2", "0")) {<br><br> $var(dial_grp) = $(rd{s.select,0,.}{<a href="http://s.int">s.int</a>});<br>
$var(check_p) = $(rd{s.select,1,.}{<a href="http://s.int">s.int</a>});<br> $var(term_p) = $(rd{s.select,2,.}{<a href="http://s.int">s.int</a>});<br> $var(num_pr) = $(rd{s.select,3,.}{<a href="http://s.int">s.int</a>});<br>
<br> $rU = $(rU{s.substr,$var(num_pr),0}); # we cat the prefix here<br><br> if($var(check_p)==1){<br><br> sql_query("ca", "SELECT prefix FROM ported WHERE phonenumber='$rU'", "ra");<br>
$rU = '' + $dbr(ra=>[0,0]) + $rU;<br><br> if($var(term_p)==0){<br> xlog("alx ------- We dont terminate this ported number!!!! ----------");<br> sl_send_reply("503","Congestion");<br>
exit;<br><br> }<br> sql_result_free("ra");<br><br> }<br><br> <br><br><br><br><br><div class="gmail_quote">On Mon, Dec 21, 2009 at 10:51 PM, Alex Balashov <span dir="ltr"><<a href="mailto:abalashov@evaristesys.com">abalashov@evaristesys.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On 12/21/2009 03:50 PM, Henning Westerholt wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Mon, December 21, 2009 5:37 pm, Alex Balashov wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Try: if(is_avp_set("$avp(s:lnp_prefix)"))<br>
</blockquote>
<br>
Hey Alex,<br>
<br>
also possible is to use it: if (! $avp(s:lnp_prefix)) which is shorter and<br>
don't rely on the avpops module to test for null. (In sr the "defined"<br>
operator can be used for the same purpose.<br>
</blockquote>
<br></div></div>
I thought that would evaluate the numerical expression value of the AVP, not whether it is null?<div><div></div><div class="h5"><br>
<br>
-- <br>
Alex Balashov - Principal<br>
Evariste Systems<br>
Web : <a href="http://www.evaristesys.com/" target="_blank">http://www.evaristesys.com/</a><br>
Tel : (+1) (678) 954-0670<br>
Direct : (+1) (678) 954-0671<br>
</div></div></blockquote></div><br>