Phone: (416) 214 3174 Email:

CDR2Cloud Blog

Whats New / Tips / Tricks / Feedback

Regular Expressions (RegEx) Lead the Way

By February 19, 2014 CDR2Cloud Blogs

A Regular Expression is a sequence of characters that form a search pattern. Billing your customers from CDR files can be very simple if you identify your customers using strings of data that exist in their complete form. However this can get very difficult as the business logic of your customer identification process gets more complicated.

Let’s say for example you identify customers by their Caller-ID, then this is very simple. Your customer John Doe has a Caller-ID of 5164445555, so all calls in the CDR file with this Caller-ID will be billed to customer John Doe. This is very simple and can be defined in customers CDR2Cloud account as follows:

Notice that I have enclosed the telephone number in parentheses. This Regular Expression markup for matching a whole string. So when this file is parsed any record with Calling-Number field = 5614445555 will be billed to our customer John Doe.

Let’s take a look at a more complicated example.

Let’s say your CDR file contains a FROM SIP URI field (Brekeke CDR contains SIP URI) which you would like to use for identifying your customers and you would like to identify all records where the FROM-SIP-URI‘s Hostname is “”. So a call with a FROM SIP URI of “;user=phone” should be billed to our customer John Doe. This is bit more complicated as it does not conform to a simple match and so our Regular Expression would be a bit more challenging as follows:

This will match any record where the domain portion of the FROM SIP URI = and you can test my example live here

If you have a complicated way that you would like to identify your customers please send to me and I can try and help you to figure it out. Also I find the website RUBULAR very RegEx friendly for doing what if RegEx Scenario’s.

In closing remember you can reprocess your CDR file as many times as you need to until you get your billing right. When a file is reprocessed all previous billings are reversed and rebilled so any changes that you have made to a customer’s Authentication Code will be picked up.

Please send me an email ( if you have any questions or comments about Regular Expressions.