May
20th

New feature – event_route

miconda on May 20th, 2009

Support for a new type of route in configuration file – event_route – is now in the GIT repository. The prototype for it is:

event_route[groupid:eventid] {
    [actions]
}

The main purpose for it is to allow modules (and core) to be able to execute code written in configuration file when a specific event happens, without altering the config grammar. Also, in short term, the modules that fire events should be able to impose what type of actions can be used in the respective event_route – now functions allowed in request route can be used.

First module that uses this feature is htable, executing an event route only once, when all modules were initialised. A typical use case is to initialise some items in a hash table. Example:

modparam("htable", "htable", "a=>size=4;")
event_route[htable:mod-init] {
  $sht(a=>calls-to::10.10.10.10) = 0;
  $sht(a=>max-calls-to::10.10.10.10) = 100;
}
route {
  if(is_method("INVITE") && !has_totag())
  {
    switch($rd) {
      case "10.10.10.10":
        lock("calls-to::10.10.10.10");
        $sht(a=>calls-to::10.10.10.10) =
            $sht(a=>calls-to::10.10.10.10) + 1;
        unlock("calls-to::10.10.10.10");
        if($sht(a=>calls-to::10.10.10.10)>$sht(a=>max-calls-to::10.10.10.10))
        {
           sl_send_reply("500", "To many calls to .10");
           exit;
        }
      break;
      ...
    }
  }
}

This system will be used to get kamailio‘s error_route and local_route functionalities. Other cases I have in mind now are:

  • auto-expired dialog route introduced in kamailio 1.5.0 to become event_route[dialog:auto-expired]
  • call event route when a location record has expired on timer:event_route[usrloc:auto-expired] making available via PV details of expired contact
  • rtimer module routes to become event routes
Tags: kamailio, openser, ser, sip-router, srouter
News - RSS Feed

Comments are closed.


    Menu

  • About
  • Answers
  • Benefits
  • Download
  • Releases
  • History
  • How to Contribute
  • Licensing
  • Management

    Links

    • Bug Tracker
    • Docbook Docs
    • Doxygen Docs
    • GIT Repository
    • Mailing Lists
    • Wiki
  • News
  • Log in
© The SIP-Router Project | Entries (RSS)