[SR-Users] Unexpected evaluation to false on a phonenumber in $avp

Victor Seva linuxmaniac at torreviejawireless.org
Mon Jan 5 18:57:00 CET 2015


On 01/05/2015 04:19 PM, Daniel Tryba wrote:
> Not a really important question, just an observation that caused some 
> headscratching on my first day after a nice vacation.
> 
> I'm using an avp to make a redirect decision. Normally this avp contains Dutch 
> telephone numbers (+31[0-9]{7,10}). With a simple:
> if($avp(dst_redirectnumber))
> {
> 	#change $ru
> }
> this works flawless (normally).
> 
> But a client decided, to forward to a Swiss number (+4141743xxxx) but with 
> this number the if condition results in a false. A German number just works 
> fine (+49)
> 
> The avp is stuffed in an avp_db_query loop with $avp($avp(i:1))=$avp(i:2) as 
> key/value pair from the table.
> 
> I changed above condition to check if the string length of dst_redirectnumber 
> is larger than 0. But I'm at a loss why the false occurs, first guess was an 
> octal conversion (number only contains the digits 0-7) which results in a 
> number "just" above 2^32. But changing a digit to 8 still fails.
> 

Check
http://www.kamailio.org/docs/modules/4.1.x/modules/siputils.html#siputils.f.is_e164

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150105/14d1c82f/attachment.sig>


More information about the sr-users mailing list