First thinks first: please don’t forget to CC the list…. Any information can be for others help… ;)

 

Well, I would suggest You to make some tests on a command line simulation to be sure what You want to accoplish is even possible… Something like this:

 

# echo "sip:112345678#@10.10.10.10" | grep -E "^sip:1[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]@"

# echo "sip:112345678#@10.10.10.10" | grep -E "^sip:1[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\@"

# echo "sip:112345678#@10.10.10.10" | grep -E "^sip:1[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"

sip:112345678#@10.10.10.10

# echo "sip:112345678@10.10.10.10" | grep -E "^sip:1[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\@"

sip:112345678@10.10.10.10

# echo "sip:112345678@10.10.10.10" | grep -E "^sip:1[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]@"

sip:112345678@10.10.10.10

#

 

As OpenSER, and SER as origin, use a regular expression as GREP, You could see that it work like You asked for…

 

I also run a test in a SER leaving here. I put this code:

 

                } else if (uri=~"^sip:1[0-9]{8}@") {                          # Test for "1xxxxxxxx" mask numbers

                        strip(9);

                        prefix("600");

                        route(6);

                        break;

                }

 

And when I call 112345678 from my Softphone, ngrep shows me this forwarded INVITE:

 

  INVITE sip:600@pstn.gw:5060 SIP/2.0..Record-Route: <sip:sip.proxy;ftag=1468362515290;lr=on>..Via: SIP/2.0/UDP sip.proxy;branch=z9hG4bK90b1.5f

  c55385.0..Via: SIP/2.0/UDP client.ip;received=sip.client;rport=1024;branch=z9hG4bKac1bf8060000010f456ef12a000028cf00000158..From: "Edson -

  SJPhone"<sip:8201@sip.proxy>;tag=1468362515290..To: <sip:112345678@sip.proxy>..Contact: <sip:8201@sip.client>..Call-ID: 647DD163-9B1E-45DB-93A2-99

  CAC53532B8@client.ip..CSeq: 2 INVITE..Max-Forwards: 16..User-Agent: SJphone/1.61 (SJ Labs)..Content-Length: 217..Content-Type: application/sdp....v=0

  ..o=- 3373887402 3373887402 IN IP4 sip.client..s=SJphone..c=IN IP4 sip.client..t=0 0..a=setup:active..m=audio 49186 RTP/AVP 4 101..a=rtpmap:4 G723/8000

  ..a=rtpmap:101 telephone-event/8000..a=fmtp:101 0-11,16..

 

Which in case is what we are looking for. Identified and translate any 9 digit number, started with ‘1’ to ‘600’.

 

Hope that this help You understand all the mechanism.

 

Edson.

 


From: raviprakash sunkara [mailto:sunkara.raviprakash.feb14@gmail.com]
Sent: quinta-feira, 30 de novembro de 2006 01:24
To: Edson
Subject: Re: [Users] regular expression

 

Hello Edson,

On 11/29/06, Edson <4lists@gmail.com> wrote:

Opppsss....

 

I think that You make a little typo....

 

Wouldn't the correct be "^sip:1[0-9]{8}@" to match all numbers with 9 digits initiated by an '1' and followed by any combination of digits (from '0' to '9')?


this Regular epression is   sip:1[0-9]{8}  correct  but...... if the number like this ... 112345678#
The Red color one must  be the digit , not any any special charecter....... According u reg expression ..

So,,, i'm sure ..................... like this it must .........
.
sip:1{8}[0-9}............

Sorry , if i did any thing mistake......excuse me.........

 

Edson

 


From: users-bounces@openser.org [mailto: users-bounces@openser.org] On Behalf Of raviprakash sunkara
Sent: quarta-feira, 29 de novembro de 2006 11:35
To: Jayesh Nambiar
Cc: Users@openser.org
Subject: Re: [Users] regular expression

 

 

On 11/29/06, Jayesh Nambiar <voip_freak@yahoo.co.in > wrote:

Hi all,
Can someone please help me in formulating a regular expression. I have an expression like this:
if(uri=~"^sip:1[0-9]*@)
This matches numbers like 15552221212, but also matches number like 15552221212#.

when i make it as:
if(uri=~"^sip:1[0-9]@*)


Use this
if (uri=~"^sip:1{8}[0-9]@" )


 

 

Again this matches any special characters after the number.

I just wanted a regular expression that will match only numbers and no alphabets or special characters.
Can someone please help me to formulate a regular expression for this.

Thanks in advance.

w/regards,
Jayesh

 


Find out what India is talking about on - Yahoo! Answers India
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW


_______________________________________________
Users mailing list
Users@openser.org
http://openser.org/cgi-bin/mailman/listinfo/users




--
Thanks and Regards
Ravi Prakash Sunkara
ravi.sunkara@hyperion-tech.com
M:+91 9985077535
O:+91 40 23114549
F:+91 40 40208727
ravi.sunkara@hyperion-tech.com
www.hyperion-tech.com




--
Thanks and Regards
Ravi Prakash Sunkara
ravi.sunkara@hyperion-tech.com
M:+91 9985077535
O:+91 40 23114549
F:+91 40 40208727
ravi.sunkara@hyperion-tech.com
www.hyperion-tech.com