Wednesday, January 11, 2012

Fancy time recurrence matching in config

A new module for Kamailio SIP Server named for now tmrec allow matching of time recurrences based on definitions specified by Internet Calendaring and Scheduling Core Object Specification (Calendar COS – RFC 2445).

It becomes trivial to match current time against rules such as working hours, weekend, up to complex conditions such as the interval from 18:00 to 20:00 of the 98th day of every other year if it is a Thursday.

Here is an example of how to match the working hours 8:30am to 6:30pm on business days:

 if(tmrec_match("20120101T083000|10H|weekly|||MO,TU,WE,TH,FR")
  xdbg("it is within working hours\n");

The rule can be specified via a config variable (e.g., load from user profile stored in database via sqlops). A typical use case is time based routing policies.

You can read more about the new extension in the documentation:

No comments:

Post a Comment