Skip to content

DEC112 – The Kamailio LoST Module

Open Source Contribution

DEC112 implements an open source Kamailio LoST Module and presents it at Kamailio World 2018 and NENA 2018 Conference & Expo …

You may remember our previous blog introducing the ESRP. The DEC112 ESRP is based on the well-known open source SIP Server Kamailio ( extended with a specific module that provides location based call routing. As it implements a protocol named LoST (Location-to-Service Translation, we simply call it LoST module.

Kamailio has a modular architecture (refer to comprising to main categories:

  • Core: the component that provides the low-level functionalities for Kamailio
  • Modules: components that provide most of the functionalities that make Kamailio powerful in real world deployments

One component of the core is the configuration file parser and interpreter to allow an extended routing configuration and dynamic execution of specific actions. The execution of the Kamailio configuration file is triggered upon receiving a SIP message and processing may be different depending on if it’s a SIP request, response or specific SIP method. For instance, receiving a SIP REGISTER message results in the execution of actions defined for a SIP Registrar service.

Since DEC112 utilizes the SIP MESSAGE method, specific actions are taken when receiving the first chat message from the DEC112 Application. The following shows an excerpt of the Kamailio configuration file:

route[URN] {
      if($rz=~"^urn$") {
            lost_query("$var(target)", "$var(display)");
      else if($rU=~"^122$") {
            $var(myurn) = "";
            lost_query_urn($var(target)", "$var(display)", "$var(myurn)");
      } else return;

Basically, what it does is it looks for a service URN in the request and calls a function (lost_query) that is exported by the LoST module implemented in the DEC112 project. In the case no URN is received, the dial string is used to set a proper URN (for instance in Austria the emergency number 122 results in a namespace specific string “”).

To get the geolocation, received in the message body, the functions lost_query, and lost_query_urn need to parse the multipart MIME body and create a proper findService (refer to request. In the case the request is successful, the ECRF returns mapping information (the target SIP URI) and a display name via the arguments of the function call. Further actions in the Kamailio configuration file are used to forward messages to the next hop, which is the correct emergency call center (PSAP).

We introduced the DEC112 project and demonstrated the LoST module at the Kamailio World Conference 2018 in Berlin (May 14-16, 2018) and at NENA 2018 Conference & Expo in Nashville, TN (June 16-21, 2018).

Further reading...