Tuesday, December 10, 2013

Regex & SIP URI

When you work with SIP trunk, you often have to write regular expression - a regular expression (abbreviated regex or regexp) is a sequence of characters that forms a search pattern, mainly for use in pattern matching with strings, or string matching, i.e. "find and replace"-like operations dixit Wikipedia.

I dont know for you, but since School, it is lways difficult for me...
So, I would like to share some basic regex for SIP trunk. You will be able to use them in IBM Sametime 9 SIP Proxy.

Any Username @ Any Domain => sip:(.*)@(.*)
Any Username @ IP Address => sip:(.*)@9.9.9.9
Any Username @ Domain => sip:(.*)@sip_domain.com
8-digit number@ Any Domain => sip:[0-9]{8}@(.*)
8-digit number, beginning with optional 9 @ Any Domain => sip:9?[0-9]{7}@(.*)
4-digit extension starting with 5 @ Any Domain => sip:5[0-9]{3}@(.*)
4-digit number not starting with 36 @ Any Domain => sip:(?!36)[0-9]{4}@(.*)

No comments:

Post a Comment