[SR-Users] How to use regular expression for $var ?

Brandon Armstead brandon at cryy.com
Mon Jul 16 19:11:15 CEST 2012


Gary,

  Please elaborate on "did not work".  Also have you logged the actual value of this var before the if/else statement?

Sent from my iPhone

On Jul 16, 2012, at 7:32 AM, Gary Chen <Gary.Chen at lightyear.net> wrote:

> Kamailio 3.3.0
>  
> I have a variable  $var(s:dst). It can store either a number or IP.
> How do I check to determine whether it is a number of IP?
> I tried the following and it did not work:
> If ($var(s:dst) =~ “^\d+\.\d+\.\d+\.\d+$”){
> It is a IP.
> }else{
> It is a Number
> }
>  
>  
> Thanks
>  
> Gary
>  
>  
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120716/0f578ae4/attachment.htm>


More information about the sr-users mailing list