No subject
Wed Jun 24 00:39:36 CEST 2009
numbers separated from dot's .
10.1.1.5
number called 1001 210XXXXXXX 1001=cust prefix and 210XXXXXX number
$var(dial_grp) = 10 the dialplan group in the dialplan query next one.values
.0-100
$var(check_p) = 1 if we want to check number for portability . values 0-1
$var(term_p) = 1 if the number is ported if we want to terminate it anyway.
values 0-1
$var(num_pr) = 4 this is the prefix(number of digits we want to remove
before the checking of portability)
if(prefix2domain("2", "0")) {
$var(dial_grp) = $(rd{s.select,0,.}{s.int});
$var(check_p) = $(rd{s.select,1,.}{s.int});
$var(term_p) = $(rd{s.select,2,.}{s.int});
$var(num_pr) = $(rd{s.select,3,.}{s.int});
$rU = $(rU{s.substr,$var(num_pr),0}); # we cat the prefix
here
if($var(check_p)==1){
sql_query("ca", "SELECT prefix FROM ported WHERE phonenumber='$rU'",
"ra");
$rU = '' + $dbr(ra=>[0,0]) + $rU;
if($var(term_p)==0){
xlog("alx ------- We dont terminate this
ported number!!!! ----------");
sl_send_reply("503","Congestion");
exit;
}
sql_result_free("ra");
}
On Mon, Dec 21, 2009 at 10:51 PM, Alex Balashov
<abalashov at evaristesys.com>wrote:
> On 12/21/2009 03:50 PM, Henning Westerholt wrote:
>
>> On Mon, December 21, 2009 5:37 pm, Alex Balashov wrote:
>>
>>> Try: if(is_avp_set("$avp(s:lnp_prefix)"))
>>>
>>
>> Hey Alex,
>>
>> also possible is to use it: if (! $avp(s:lnp_prefix)) which is shorter and
>> don't rely on the avpops module to test for null. (In sr the "defined"
>> operator can be used for the same purpose.
>>
>
> I thought that would evaluate the numerical expression value of the AVP,
> not whether it is null?
>
>
> --
> Alex Balashov - Principal
> Evariste Systems
> Web : http://www.evaristesys.com/
> Tel : (+1) (678) 954-0670
> Direct : (+1) (678) 954-0671
>
--0015175d03a632d7fe047b444190
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Guys thank you very much for all your answers. It is a very educational pro=
cess 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 of=
ficial 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 s=
cenario is that we expect calls from customers which we route through a spe=
cial prefix that they are sending us. For some customers we terminate porte=
d 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 prefi=
x to domain translation i=A0 expect back a value string with 4 numbers sepa=
rated from dot's .<br>10.1.1.5<br>number called 1001 210XXXXXXX=A0=A0 1=
001=3Dcust prefix and 210XXXXXX number<br>
<br>$var(dial_grp) =3D 10 the dialplan group in the dialplan query next one=
.values .0-100<br>$var(check_p) =3D 1 if we want to check number for portab=
ility . values 0-1<br>$var(term_p) =3D 1 if the number is ported if we want=
to terminate it anyway.=A0 values=A0 0-1<br>
$var(num_pr) =3D 4=A0 this is the prefix(number of digits we want to remove=
before the checking of portability)<br>if(prefix2domain("2", &qu=
ot;0")) {<br><br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $var(di=
al_grp)=A0 =3D $(rd{s.select,0,.}{<a href=3D"http://s.int">s.int</a>});<br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $var(check_p) =3D $(rd{s.sele=
ct,1,.}{<a href=3D"http://s.int">s.int</a>});<br>=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 $var(term_p) =A0 =3D $(rd{s.select,2,.}{<a href=3D"ht=
tp://s.int">s.int</a>});<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $=
var(num_pr)=A0 =3D $(rd{s.select,3,.}{<a href=3D"http://s.int">s.int</a>});=
<br>
<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $rU =3D $(rU{s.substr,$va=
r(num_pr),0}); # we cat the prefix here<br><br>=A0if($var(check_p)=3D=3D1){=
<br><br>=A0=A0=A0=A0=A0=A0 sql_query("ca", "SELECT prefix FR=
OM ported WHERE phonenumber=3D'$rU'", "ra");<br>
=A0=A0=A0=A0=A0=A0 $rU =3D '' + $dbr(ra=3D>[0,0]) + $rU;<br><br>=
=A0=A0=A0=A0=A0=A0 if($var(term_p)=3D=3D0){<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 xl=
og("alx ------- We dont terminate this ported number!!!! ----------&qu=
ot;);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sl_send_reply("503","Conge=
stion");<br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 exit;<br><br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }<br>=A0=A0=A0=A0=
=A0=A0=A0 sql_result_free("ra");<br><br>=A0=A0 }<br><br>=A0 <br><=
br><br><br><br><div class=3D"gmail_quote">On Mon, Dec 21, 2009 at 10:51 PM,=
Alex Balashov <span dir=3D"ltr"><<a href=3D"mailto:abalashov at evaristesy=
s.com">abalashov at evaristesys.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><=
div class=3D"h5">On 12/21/2009 03:50 PM, Henning Westerholt wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"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=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Try: =A0if(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 "defi=
ned"<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, no=
t whether it is null?<div><div></div><div class=3D"h5"><br>
<br>
-- <br>
Alex Balashov - Principal<br>
Evariste Systems<br>
Web =A0 =A0 : <a href=3D"http://www.evaristesys.com/" target=3D"_blank">htt=
p://www.evaristesys.com/</a><br>
Tel =A0 =A0 : (+1) (678) 954-0670<br>
Direct =A0: (+1) (678) 954-0671<br>
</div></div></blockquote></div><br>
--0015175d03a632d7fe047b444190--
More information about the Users
mailing list