This is an old revision of the document!


Lua API

Overview

Initial author:
    Daniel-Constantin Mierla

Module app_lua allows execution of Lua scripts from SIP router configuration file, providing access to SIP message which is processed at that time. Exported functions by app_lua are available in the Lua script as package sr.

References:

SR Package

Core functions.

sr.dbg

Print message to L_DBG level using internal log API.

Prototype

sr.dbg("message")

sr.err

Print message to L_ERR level using internal log API.

Prototype

sr.err("message")

sr.log

Print message to 'level' using internal log API.

Prototype

sr.log("level", "message")

Parameter level can be"

  • dbg
  • info
  • warn
  • err
  • crit

SR.HDR Package

Header management functions.

sr.hdr.append

Append header to end of headers list.

Prototype

sr.hdr.append("text")

sr.hdr.insert

Insert header to first position.

Prototype

sr.hdr.insert("text")

sr.hdr.remove

Remove header.

Prototype

sr.hdr.remove("hdrname")

sr.hdr.append_to_reply

Append a header to SIP reply generated by proxy.

Prototype

sr.hdr.append_to_reply("text")

SR.PV Package

Pseudo-variable management functions.

sr.pv.get

Get the value of a pseudo-variable.

Prototype

sr.pv.get("pv")

sr.pv.seti

Set the integer value to pseudo-variable.

Prototype

sr.pv.seti("pv", value)

sr.pv.sets

Set the string value to pseudo-variable.

Prototype

sr.pv.sets("pv", "value")

sr.pv.unset

Unset pseudo-variables (assign $null).

Prototype

sr.pv.unset("pv")

sr.pv.is_null

Check if the pseudo-variable value is $null or not.

Prototype

sr.pv.is_null("pv")

Navigation

Wiki

Other

QR Code
QR Code api:lua:devel (generated for current page)