Core KEMI FunctionsLink

The core of Kamailio exports via KEMI:

  • several functions directly to KSR module (like KSR.function(params)), which are mostly the main function from the core and for writing log messages (some being part of xlog module for native kamailio.cfg language)
  • the KSR.hdr submodule, which are the most used functions for managing SIP message headers

Example of using KEMI functions exported to Lua interpreter:

KSR.dbg("a debug message from Lua script\n");
KSR.hdr.remove("Route");

Exported functions from core directly to KSR module or KSR.hdr submodule are listed in the next sections.

void KSR.dbg(...)Link

void KSR.dbg("msg")

Write a log message to DEBUG level.

void KSR.err(...)Link

void KSR.err("msg")

Write a log message to ERROR level.

void KSR.info(...)Link

void KSR.info("msg")

Write a log message to INFO level.

void KSR.log(...)Link

void KSR.log("level", "msg")

Write a log message specifying the level value. The level parameter can be:

  • "dbg"
  • "info"
  • "warn"
  • "crit"
  • "err"

If level value is not matched, then "err" log level is used.

KSR.drop(...)Link

void KSR.drop()

Set the DROP flag, so at the end of KEMI script execution, the SIP request branch or the SIP response is not forwarded.

Note: it doesn't not stop the execution of KEMI script, see KSR.x.drop() for an alternative with that purpose.

KSR.is_myself(...)Link

bool KSR.is_myself("uri")

KSR.setflag(...)Link

bool KSR.setflag(flag)

KSR.resetflag(...)Link

bool KSR.resetflag(flag)

KSR.isflagset(...)Link

bool KSR.isflagset(flag)

KSR.setbflag(...)Link

bool KSR.setbflag(flag)

KSR.resetbflag(...)Link

bool KSR.resetbflag(flag)

KSR.isbflagset(...)Link

bool KSR.isbflagset(flag)

KSR.setbiflag(...)Link

bool KSR.setbiflag(flag, branch)

KSR.resetbiflag(...)Link

bool KSR.resetbiflag(flag, branch)

KSR.isbiflagset(...)Link

bool KSR.isbiflagset(flag, branch)

KSR.setsflag(...)Link

bool KSR.setsflag(flag)

KSR.resetsflag(...)Link

bool KSR.resetsflag(flag)

KSR.issflagset(...)Link

bool KSR.issflagset(flag)

KSR.seturi(...)Link

bool KSR.seturi("uri")

KSR.setuser(...)Link

bool KSR.setuser("user")

KSR.sethost(...)Link

bool KSR.sethost("host")

KSR.setdsturi(...)Link

bool KSR.setdsturi("uri")

KSR.resetdsturi(...)Link

bool KSR.resetdsturi()

KSR.isdsturiset(...)Link

bool KSR.isdsturiset()

KSR.is_method(...)Link

bool KSR.is_method("methods")

KSR.force_rport(...)Link

bool KSR.force_rport()

KSR.set_forward_close(...)Link

bool KSR.set_forward_close()

KSR.set_forward_no_connect(...)Link

bool KSR.set_forward_no_connect()

KSR.set_reply_close(...)Link

bool KSR.set_reply_close()

KSR.set_reply_no_connect(...)Link

bool KSR.set_reply_no_connect()

KSR.forward(...)Link

int KSR.forward()

KSR.forward_uri(...)Link

int KSR.forward_uri("uri")

KSR.hdr.append(...)Link

int KSR.hdr.append("hdrval")

KSR.hdr.append_after(...)Link

int KSR.hdr.append_after("hdrval", "hdrname")

KSR.hdr.insert(...)Link

int KSR.hdr.insert("hdrval")

KSR.hdr.insert_before(...)Link

int KSR.hdr.insert_before("hdrval", "hdrname")

KSR.hdr.remove(...)Link

int KSR.hdr.remove("hdrval")

KSR.hdr.is_present(...)Link

int KSR.hdr.is_present("hdrval")

KSR.hdr.append_to_reply(...)Link

int KSR.hdr.append_to_reply("hdrval")