app_lua Module in Kamailio - Omid-Mohajerani/Learn-Kamailio GitHub Wiki

app_lua module introduction

Kamailio, SIP server, offers a vast array of modules to extend its functionality. App_lua modiule is one of them . It offers a simple yet flexible syntax, allowing you to use the vast ecosystem of Lua libraries and tools to extend Kamailio's capabilities even further

App_lua enables you to execute Lua scripts within Kamailio, opening up a world of possibilities for handling SIP traffic, manipulating headers and bodies, and even integrating with external systems.

With 'app_lua’ module you can:

  • Access and modify SIP headers on the fly
  • Route traffic dynamically based on custom conditions
  • Integrate with external services and APIs
  • Implement complex call handling logic
  • Perform real-time data processing and analytics
  • And so much more!

Imagine a scenario where you want to leverage the intelligence of an external application server to determine the optimal routing destination for your SIP invites. In this article, I will show you how to leverage the power of Lua scripting to communicate with your application server via web services, making dynamic routing decisions based on real-time data

I have prepared a practical sample here that Kamailio Server ask my application Server where to route traffic based on the source ip address . The destination can be SIP gateway, A voicemail Server or drop the invite for the blacklisted ip addresses.

app_lua module in Kamailio

Step 1: Installing app_lua Module

apt install kamailio-lua-modules

Step 2: Load app_lua module

edit kamailio configuration file and load app_lua.so in the "Modules Section"

loadmodule "app_lua.so"

if you are using any other library in your lua script you should install it as well . For example here I needed lua-socket library

apt install lua-socket lua-socket-dev 

Step 3: Define our lua script path

you load your lua script using modparam in kamailio.cfg

modparam("app_lua", "load", "/etc/kamailio/scripts/apps.lua")

Step 4: Lua Script

mkdir /etc/kamailio/scripts/
touch /etc/kamailio/scripts/apps.lua

Sample lua script

To route based on the webservice answer from application server

function dynamicroute()
        callerid = tostring(KSR.pv.get("fU"))
        url = "https://myappwebservice.omid.blog/routings?src=" .. callerid
        local http = require("socket.http")
        local mylua = require 'lunajson'
        local requesrString = url
        local body, code = http.request(requesrString)
        local jsonparse = mylua.decode(body)
        
        if jsonparse["dst"] == "BUSY" then
                KSR.sl.sl_send_reply("486", " Busy Here ")
                KSR.info( " =====  WebService Response: BUSY so we reply 486 Busy Here")
                KSR.x.exit()
        elseif jsonparse["dst"] == "VOICEMAIL" then
                KSR.info( " =====  WebService Response: VoiceMail so we route to our FreeSWITCH Voicemail Server")
                ServerName = "voicemail.omid.blog"
                PortNumber = 5060
                VM_URI = jsonparse["voicemailnumber"] .. "@" .. ServerName ..":" .. PortNumber
                KSR.hdr.insert("X-Additonal-callType: "  .. "VOICEMAIL" .. "\r\n");
                KSR.pv.sets("$du", "sip:" .. VM_URI .. ";transport=udp")
                KSR.x.exit()
        elseif jsonparse["dst"] == "PSTN" then
                KSR.info( " =====  WebService Response: PSTN so we route to our PSTN Gateway")
                KSR.dispatcher.ds_select_dst("2", "1")
                KSR.x.exit()
        else
                KSR.x.drop()

        end
end

Step 5: Calling lua script from Kamailio config file

we can use lua_run to call an specific function in the lua script

if(!lua_run("dynamicroute")){
    xdbg("SCRIPT: failed to execute dynamicroute Lua Function !!! \n");
}

Step 6: restart kamialio

systemctl restart kamailio

kamcmd app_lua.api_list

To list all the lua functions you can use following command. You need to load a module so that you can have the exported function. for example here I have loaded the dispatcher module so I have related functions to dispatcher.

{
	msize: 493
	methods: {
		func: {
			ret: none
			module: 
			name: dbg
			params: str
		}
		func: {
			ret: none
			module: 
			name: err
			params: str
		}
		func: {
			ret: none
			module: 
			name: info
			params: str
		}
		func: {
			ret: none
			module: 
			name: warn
			params: str
		}
		func: {
			ret: none
			module: 
			name: notice
			params: str
		}
		func: {
			ret: none
			module: 
			name: crit
			params: str
		}
		func: {
			ret: none
			module: 
			name: log
			params: str, str
		}
		func: {
			ret: none
			module: 
			name: set_drop
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_myself
			params: str
		}
		func: {
			ret: bool
			module: 
			name: is_myself_ruri
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_myself_duri
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_myself_nhuri
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_myself_furi
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_myself_turi
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_myself_suri
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_myself_srcip
			params: none
		}
		func: {
			ret: bool
			module: 
			name: setflag
			params: int
		}
		func: {
			ret: bool
			module: 
			name: resetflag
			params: int
		}
		func: {
			ret: bool
			module: 
			name: isflagset
			params: int
		}
		func: {
			ret: bool
			module: 
			name: setbflag
			params: int
		}
		func: {
			ret: bool
			module: 
			name: resetbflag
			params: int
		}
		func: {
			ret: bool
			module: 
			name: isbflagset
			params: int
		}
		func: {
			ret: bool
			module: 
			name: setbiflag
			params: int, int
		}
		func: {
			ret: bool
			module: 
			name: resetbiflag
			params: int, int
		}
		func: {
			ret: bool
			module: 
			name: isbiflagset
			params: int, int
		}
		func: {
			ret: bool
			module: 
			name: setsflag
			params: int
		}
		func: {
			ret: bool
			module: 
			name: resetsflag
			params: int
		}
		func: {
			ret: bool
			module: 
			name: issflagset
			params: int
		}
		func: {
			ret: bool
			module: 
			name: seturi
			params: str
		}
		func: {
			ret: bool
			module: 
			name: setuser
			params: str
		}
		func: {
			ret: bool
			module: 
			name: sethost
			params: str
		}
		func: {
			ret: bool
			module: 
			name: setdsturi
			params: str
		}
		func: {
			ret: bool
			module: 
			name: resetdsturi
			params: none
		}
		func: {
			ret: bool
			module: 
			name: isdsturiset
			params: none
		}
		func: {
			ret: bool
			module: 
			name: force_rport
			params: none
		}
		func: {
			ret: bool
			module: 
			name: add_local_rport
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_method
			params: str
		}
		func: {
			ret: bool
			module: 
			name: is_method_in
			params: str
		}
		func: {
			ret: int
			module: 
			name: forward
			params: none
		}
		func: {
			ret: int
			module: 
			name: forward_uri
			params: str
		}
		func: {
			ret: bool
			module: 
			name: set_forward_close
			params: none
		}
		func: {
			ret: bool
			module: 
			name: set_forward_no_connect
			params: none
		}
		func: {
			ret: bool
			module: 
			name: set_reply_close
			params: none
		}
		func: {
			ret: bool
			module: 
			name: set_reply_no_connect
			params: none
		}
		func: {
			ret: int
			module: 
			name: set_advertised_address
			params: str
		}
		func: {
			ret: int
			module: 
			name: set_advertised_port
			params: str
		}
		func: {
			ret: int
			module: 
			name: add_tcp_alias
			params: int
		}
		func: {
			ret: int
			module: 
			name: add_tcp_alias_via
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_INVITE
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_ACK
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_BYE
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_CANCEL
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_REGISTER
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_OPTIONS
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_SUBSCRIBE
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_PUBLISH
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_NOTIFY
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_REFER
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_INFO
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_UPDATE
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_PRACK
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_MESSAGE
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_KDMQ
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_GET
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_POST
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_PUT
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_DELETE
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_UDP
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_TCP
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_TLS
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_WS
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_WSS
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_WSX
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_SCTP
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_proto
			params: str
		}
		func: {
			ret: bool
			module: 
			name: is_IPv4
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_IPv6
			params: none
		}
		func: {
			ret: bool
			module: 
			name: to_UDP
			params: none
		}
		func: {
			ret: bool
			module: 
			name: to_TCP
			params: none
		}
		func: {
			ret: bool
			module: 
			name: to_TLS
			params: none
		}
		func: {
			ret: bool
			module: 
			name: to_SCTP
			params: none
		}
		func: {
			ret: bool
			module: 
			name: to_WS
			params: none
		}
		func: {
			ret: bool
			module: 
			name: to_WSS
			params: none
		}
		func: {
			ret: bool
			module: 
			name: to_WSX
			params: none
		}
		func: {
			ret: bool
			module: 
			name: to_IPv4
			params: none
		}
		func: {
			ret: bool
			module: 
			name: to_IPv6
			params: none
		}
		func: {
			ret: bool
			module: 
			name: is_src_port
			params: int
		}
		func: {
			ret: bool
			module: 
			name: is_dst_port
			params: int
		}
		func: {
			ret: int
			module: 
			name: get_debug
			params: none
		}
		func: {
			ret: int
			module: 
			name: route
			params: str
		}
		func: {
			ret: xval
			module: pv
			name: get
			params: str
		}
		func: {
			ret: xval
			module: pv
			name: getw
			params: str
		}
		func: {
			ret: xval
			module: pv
			name: gete
			params: str
		}
		func: {
			ret: int
			module: pv
			name: geti
			params: str
		}
		func: {
			ret: xval
			module: pv
			name: getvn
			params: str, int
		}
		func: {
			ret: xval
			module: pv
			name: getvs
			params: str, str
		}
		func: {
			ret: bool
			module: pv
			name: seti
			params: str, int
		}
		func: {
			ret: bool
			module: pv
			name: sets
			params: str, str
		}
		func: {
			ret: bool
			module: pv
			name: unset
			params: str
		}
		func: {
			ret: bool
			module: pv
			name: is_null
			params: str
		}
		func: {
			ret: int
			module: hdr
			name: append
			params: str
		}
		func: {
			ret: int
			module: hdr
			name: append_after
			params: str, str
		}
		func: {
			ret: int
			module: hdr
			name: insert
			params: str
		}
		func: {
			ret: int
			module: hdr
			name: insert_before
			params: str, str
		}
		func: {
			ret: int
			module: hdr
			name: remove
			params: str
		}
		func: {
			ret: int
			module: hdr
			name: rmappend
			params: str, str
		}
		func: {
			ret: int
			module: hdr
			name: rminsert
			params: str, str
		}
		func: {
			ret: int
			module: hdr
			name: is_present
			params: str
		}
		func: {
			ret: int
			module: hdr
			name: append_to_reply
			params: str
		}
		func: {
			ret: xval
			module: hdr
			name: get
			params: str
		}
		func: {
			ret: xval
			module: hdr
			name: gete
			params: str
		}
		func: {
			ret: xval
			module: hdr
			name: getw
			params: str
		}
		func: {
			ret: xval
			module: hdr
			name: get_idx
			params: str, int
		}
		func: {
			ret: xval
			module: hdr
			name: gete_idx
			params: str, int
		}
		func: {
			ret: xval
			module: hdr
			name: getw_idx
			params: str, int
		}
		func: {
			ret: bool
			module: hdr
			name: match_content
			params: str, str, str, str
		}
		func: {
			ret: int
			module: jsonrpcs
			name: dispatch
			params: none
		}
		func: {
			ret: int
			module: jsonrpcs
			name: exec
			params: str
		}
		func: {
			ret: int
			module: jsonrpcs
			name: execx
			params: str
		}
		func: {
			ret: xval
			module: jsonrpcs
			name: response
			params: none
		}
		func: {
			ret: int
			module: kex
			name: setdebug
			params: int
		}
		func: {
			ret: int
			module: kex
			name: resetdebug
			params: none
		}
		func: {
			ret: int
			module: corex
			name: append_branch
			params: none
		}
		func: {
			ret: int
			module: corex
			name: append_branch_uri
			params: str
		}
		func: {
			ret: int
			module: corex
			name: append_branch_uri_q
			params: str, str
		}
		func: {
			ret: int
			module: corex
			name: setxflag
			params: int
		}
		func: {
			ret: int
			module: corex
			name: resetxflag
			params: int
		}
		func: {
			ret: int
			module: corex
			name: isxflagset
			params: int
		}
		func: {
			ret: int
			module: corex
			name: set_send_socket
			params: str
		}
		func: {
			ret: int
			module: corex
			name: set_send_socket_name
			params: str
		}
		func: {
			ret: int
			module: corex
			name: set_recv_socket
			params: str
		}
		func: {
			ret: int
			module: corex
			name: set_recv_socket_name
			params: str
		}
		func: {
			ret: int
			module: corex
			name: set_source_address
			params: str
		}
		func: {
			ret: int
			module: corex
			name: via_add_srvid
			params: int
		}
		func: {
			ret: int
			module: corex
			name: via_add_xavp_params
			params: int
		}
		func: {
			ret: int
			module: corex
			name: via_use_xavp_fields
			params: int
		}
		func: {
			ret: int
			module: corex
			name: has_ruri_user
			params: none
		}
		func: {
			ret: int
			module: corex
			name: has_user_agent
			params: none
		}
		func: {
			ret: int
			module: corex
			name: send_data
			params: str, str
		}
		func: {
			ret: int
			module: corex
			name: sendx
			params: str, str, str
		}
		func: {
			ret: int
			module: corex
			name: is_faked_msg
			params: none
		}
		func: {
			ret: xval
			module: corex
			name: file_read
			params: str
		}
		func: {
			ret: int
			module: corex
			name: file_write
			params: str, str
		}
		func: {
			ret: int
			module: corex
			name: is_socket_name
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_relay
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_on_branch
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_on_failure
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_on_branch_failure
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_on_reply
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_reply
			params: int, str
		}
		func: {
			ret: int
			module: tm
			name: t_send_reply
			params: int, str
		}
		func: {
			ret: int
			module: tm
			name: t_check_trans
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_is_canceled
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_newtran
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_release
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_replicate
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_is_set
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_lookup_request
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_lookup_cancel
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_lookup_cancel_flags
			params: int
		}
		func: {
			ret: int
			module: tm
			name: t_retransmit_reply
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_set_fr_inv
			params: int
		}
		func: {
			ret: int
			module: tm
			name: t_set_fr
			params: int, int
		}
		func: {
			ret: int
			module: tm
			name: t_reset_fr
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_set_max_lifetime
			params: int, int
		}
		func: {
			ret: int
			module: tm
			name: t_reset_max_lifetime
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_set_retr
			params: int, int
		}
		func: {
			ret: int
			module: tm
			name: t_reset_retr
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_uac_send
			params: str, str, str, str, str, str
		}
		func: {
			ret: int
			module: tm
			name: t_load_contacts
			params: none
		}
		func: {
			ret: int
			module: tm
			name: ki_t_load_contacts_mode
			params: int
		}
		func: {
			ret: int
			module: tm
			name: t_next_contacts
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_next_contact_flow
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_drop_replies_all
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_drop_replies
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_use_uac_headers
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_save_lumps
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_is_expired
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_check_status
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_grep_status
			params: int
		}
		func: {
			ret: int
			module: tm
			name: t_is_retr_async_reply
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_any_replied
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_any_timeout
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_branch_replied
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_branch_timeout
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_set_auto_inv_100
			params: int
		}
		func: {
			ret: int
			module: tm
			name: t_set_disable_6xx
			params: int
		}
		func: {
			ret: int
			module: tm
			name: t_set_disable_failover
			params: int
		}
		func: {
			ret: int
			module: tm
			name: t_set_no_e2e_cancel_reason
			params: int
		}
		func: {
			ret: int
			module: tm
			name: t_set_disable_internal_reply
			params: int
		}
		func: {
			ret: int
			module: tm
			name: t_relay_to_proxy
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_relay_to_flags
			params: int
		}
		func: {
			ret: int
			module: tm
			name: t_relay_to_proxy_flags
			params: str, int
		}
		func: {
			ret: int
			module: tm
			name: t_relay_to_proto
			params: str
		}
		func: {
			ret: int
			module: tm
			name: t_relay_to_proto_addr
			params: str, str, int
		}
		func: {
			ret: int
			module: tm
			name: t_get_status_code
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_get_branch_index
			params: none
		}
		func: {
			ret: int
			module: tm
			name: t_clean
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_precheck_trans
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_is_request_route
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_is_reply_route
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_is_failure_route
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_is_branch_route
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_suspend
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_continue
			params: int, int, str
		}
		func: {
			ret: int
			module: tmx
			name: t_flush_flags
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_flush_xflags
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_cancel_branches
			params: str
		}
		func: {
			ret: int
			module: tmx
			name: t_reuse_branch
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_cancel_callid
			params: str, str, int
		}
		func: {
			ret: int
			module: tmx
			name: t_cancel_callid_reason
			params: str, str, int, int
		}
		func: {
			ret: int
			module: tmx
			name: t_reply_callid
			params: str, str, int, str
		}
		func: {
			ret: int
			module: tmx
			name: t_drop
			params: none
		}
		func: {
			ret: int
			module: tmx
			name: t_drop_rcode
			params: int
		}
		func: {
			ret: int
			module: sl
			name: sl_send_reply
			params: int, str
		}
		func: {
			ret: int
			module: sl
			name: send_reply
			params: int, str
		}
		func: {
			ret: int
			module: sl
			name: send_reply_mode
			params: int, str, int
		}
		func: {
			ret: int
			module: sl
			name: sl_reply_error
			params: none
		}
		func: {
			ret: int
			module: sl
			name: sl_forward_reply
			params: str, str
		}
		func: {
			ret: int
			module: rr
			name: record_route
			params: none
		}
		func: {
			ret: int
			module: rr
			name: record_route_params
			params: str
		}
		func: {
			ret: int
			module: rr
			name: loose_route
			params: none
		}
		func: {
			ret: int
			module: rr
			name: loose_route_preloaded
			params: none
		}
		func: {
			ret: int
			module: rr
			name: loose_route_mode
			params: int
		}
		func: {
			ret: int
			module: rr
			name: remove_record_route
			params: none
		}
		func: {
			ret: int
			module: rr
			name: add_rr_param
			params: str
		}
		func: {
			ret: int
			module: rr
			name: check_route_param
			params: str
		}
		func: {
			ret: int
			module: rr
			name: is_direction
			params: str
		}
		func: {
			ret: int
			module: rr
			name: record_route_preset_one
			params: str
		}
		func: {
			ret: int
			module: rr
			name: record_route_preset
			params: str, str
		}
		func: {
			ret: int
			module: rr
			name: record_route_advertised_address
			params: str
		}
		func: {
			ret: int
			module: rr
			name: next_hop_route
			params: none
		}
		func: {
			ret: int
			module: pvx
			name: sbranch_set_ruri
			params: none
		}
		func: {
			ret: int
			module: pvx
			name: sbranch_append
			params: none
		}
		func: {
			ret: int
			module: pvx
			name: sbranch_reset
			params: none
		}
		func: {
			ret: int
			module: pvx
			name: var_seti
			params: str, int
		}
		func: {
			ret: int
			module: pvx
			name: var_sets
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: var_get
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: shv_seti
			params: str, int
		}
		func: {
			ret: int
			module: pvx
			name: shv_sets
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: shv_get
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: pv_var_to_xavp
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: pv_xavp_to_var
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: pv_xavp_print
			params: none
		}
		func: {
			ret: int
			module: pvx
			name: pv_xavu_print
			params: none
		}
		func: {
			ret: int
			module: pvx
			name: pv_xavi_print
			params: none
		}
		func: {
			ret: int
			module: pvx
			name: xavp_params_explode
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavp_params_implode
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavu_params_explode
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavu_params_implode
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavp_slist_explode
			params: str, str, str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavp_seti
			params: str, int
		}
		func: {
			ret: int
			module: pvx
			name: xavp_sets
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavp_get
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: xavp_gete
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: xavp_getw
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: xavp_getd
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: xavp_getd_p1
			params: str, int
		}
		func: {
			ret: xval
			module: pvx
			name: xavp_get_keys
			params: str, int
		}
		func: {
			ret: int
			module: pvx
			name: xavp_rm
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: xavp_is_null
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: xavp_child_seti
			params: str, str, int
		}
		func: {
			ret: int
			module: pvx
			name: xavp_child_sets
			params: str, str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavp_child_rm
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavp_child_is_null
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavp_child_get
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavp_child_gete
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavp_child_getw
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavu_seti
			params: str, int
		}
		func: {
			ret: int
			module: pvx
			name: xavu_sets
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavu_get
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: xavu_gete
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: xavu_getw
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: xavu_rm
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: xavu_is_null
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: xavu_child_seti
			params: str, str, int
		}
		func: {
			ret: int
			module: pvx
			name: xavu_child_sets
			params: str, str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavu_child_rm
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavu_child_is_null
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavu_child_get
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavu_child_gete
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavu_child_getw
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavi_seti
			params: str, int
		}
		func: {
			ret: int
			module: pvx
			name: xavi_sets
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavi_get
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: xavi_gete
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: xavi_getw
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: xavi_getd
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: xavi_getd_p1
			params: str, int
		}
		func: {
			ret: xval
			module: pvx
			name: xavi_get_keys
			params: str, int
		}
		func: {
			ret: int
			module: pvx
			name: xavi_rm
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: xavi_is_null
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: xavi_child_seti
			params: str, str, int
		}
		func: {
			ret: int
			module: pvx
			name: xavi_child_sets
			params: str, str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavi_child_rm
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: xavi_child_is_null
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavi_child_get
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavi_child_gete
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: xavi_child_getw
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: evalx
			params: str, str
		}
		func: {
			ret: int
			module: pvx
			name: avp_seti
			params: str, int
		}
		func: {
			ret: int
			module: pvx
			name: avp_sets
			params: str, str
		}
		func: {
			ret: xval
			module: pvx
			name: avp_get
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: avp_gete
			params: str
		}
		func: {
			ret: xval
			module: pvx
			name: avp_getw
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: avp_rm
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: avp_is_null
			params: str
		}
		func: {
			ret: int
			module: pvx
			name: xavp_copy
			params: str, int, str
		}
		func: {
			ret: int
			module: pvx
			name: xavp_copy_dst
			params: str, int, str, int
		}
		func: {
			ret: int
			module: maxfwd
			name: process_maxfwd
			params: int
		}
		func: {
			ret: int
			module: maxfwd
			name: is_maxfwd_lt
			params: int
		}
		func: {
			ret: int
			module: registrar
			name: save
			params: str, int
		}
		func: {
			ret: int
			module: registrar
			name: save_uri
			params: str, int, str
		}
		func: {
			ret: int
			module: registrar
			name: lookup
			params: str
		}
		func: {
			ret: int
			module: registrar
			name: lookup_uri
			params: str, str
		}
		func: {
			ret: int
			module: registrar
			name: lookup_to_dset
			params: str, str
		}
		func: {
			ret: int
			module: registrar
			name: lookup_branches
			params: str
		}
		func: {
			ret: int
			module: registrar
			name: registered
			params: str
		}
		func: {
			ret: int
			module: registrar
			name: registered_uri
			params: str, str
		}
		func: {
			ret: int
			module: registrar
			name: registered_flags
			params: str, str, int
		}
		func: {
			ret: int
			module: registrar
			name: registered_action
			params: str, str, int, int
		}
		func: {
			ret: int
			module: registrar
			name: set_q_override
			params: str
		}
		func: {
			ret: int
			module: registrar
			name: add_sock_hdr
			params: str
		}
		func: {
			ret: int
			module: registrar
			name: unregister
			params: str, str
		}
		func: {
			ret: int
			module: registrar
			name: unregister_ruid
			params: str, str, str
		}
		func: {
			ret: int
			module: registrar
			name: reg_fetch_contacts
			params: str, str, str
		}
		func: {
			ret: int
			module: registrar
			name: reg_free_contacts
			params: str
		}
		func: {
			ret: int
			module: registrar
			name: reg_send_reply
			params: none
		}
		func: {
			ret: int
			module: textops
			name: search
			params: str
		}
		func: {
			ret: int
			module: textops
			name: search_body
			params: str
		}
		func: {
			ret: int
			module: textops
			name: search_hf
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: search_append
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: search_append_body
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: is_present_hf
			params: str
		}
		func: {
			ret: int
			module: textops
			name: is_present_hf_re
			params: str
		}
		func: {
			ret: int
			module: textops
			name: subst
			params: str
		}
		func: {
			ret: int
			module: textops
			name: subst_uri
			params: str
		}
		func: {
			ret: int
			module: textops
			name: subst_user
			params: str
		}
		func: {
			ret: int
			module: textops
			name: subst_body
			params: str
		}
		func: {
			ret: int
			module: textops
			name: subst_hf
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: remove_hf
			params: str
		}
		func: {
			ret: int
			module: textops
			name: remove_hf_re
			params: str
		}
		func: {
			ret: int
			module: textops
			name: remove_hf_idx
			params: str, int
		}
		func: {
			ret: int
			module: textops
			name: remove_hf_exp
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: remove_hf_match
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: replace
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: replace_str
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: replace_all
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: replace_body
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: replace_body_str
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: replace_hdrs
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: replace_hdrs_str
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: replace_body_all
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: replace_body_atonce
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: set_body
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: set_reply_body
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: has_body
			params: none
		}
		func: {
			ret: int
			module: textops
			name: has_body_type
			params: str
		}
		func: {
			ret: int
			module: textops
			name: filter_body
			params: str
		}
		func: {
			ret: int
			module: textops
			name: is_privacy
			params: str
		}
		func: {
			ret: int
			module: textops
			name: in_list
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: in_list_prefix
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: cmp_str
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: cmp_istr
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: search_str
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: starts_with
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: ends_with
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: str_find
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: str_ifind
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: is_audio_on_hold
			params: none
		}
		func: {
			ret: int
			module: textops
			name: set_body_multipart_mode
			params: none
		}
		func: {
			ret: int
			module: textops
			name: set_body_multipart_boundary
			params: str
		}
		func: {
			ret: int
			module: textops
			name: set_body_multipart_content
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: set_body_multipart
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: append_body_part
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: append_body_part_cd
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: append_body_part_hex
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: append_body_part_hex_cd
			params: str, str, str
		}
		func: {
			ret: int
			module: textops
			name: remove_body_part
			params: str
		}
		func: {
			ret: int
			module: textops
			name: get_body_part
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: get_body_part_raw
			params: str, str
		}
		func: {
			ret: int
			module: textops
			name: regex_substring
			params: str, str, int, int, str
		}
		func: {
			ret: int
			module: textopsx
			name: msg_apply_changes
			params: none
		}
		func: {
			ret: int
			module: textopsx
			name: msg_set_buffer
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: change_reply_status
			params: int, str
		}
		func: {
			ret: int
			module: textopsx
			name: remove_body
			params: none
		}
		func: {
			ret: int
			module: textopsx
			name: change_reply_status_code
			params: int
		}
		func: {
			ret: int
			module: textopsx
			name: keep_hf
			params: none
		}
		func: {
			ret: int
			module: textopsx
			name: keep_hf_re
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: fnmatch
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: fnmatch_ex
			params: str, str, str
		}
		func: {
			ret: int
			module: textopsx
			name: append_hf_value
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: insert_hf_value
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: assign_hf_value
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: assign_hf_value2
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: remove_hf_value
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: remove_hf_value2
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: include_hf_value
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: exclude_hf_value
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: hf_value_exists
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: hf_iterator_start
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: hf_iterator_end
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: hf_iterator_next
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: hf_iterator_prev
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: hf_iterator_rm
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: hf_iterator_append
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: hf_iterator_insert
			params: str, str
		}
		func: {
			ret: xval
			module: textopsx
			name: hf_iterator_hname
			params: str
		}
		func: {
			ret: xval
			module: textopsx
			name: hf_iterator_hbody
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: bl_iterator_start
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: bl_iterator_end
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: bl_iterator_next
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: bl_iterator_rm
			params: str
		}
		func: {
			ret: int
			module: textopsx
			name: bl_iterator_append
			params: str, str
		}
		func: {
			ret: int
			module: textopsx
			name: bl_iterator_insert
			params: str, str
		}
		func: {
			ret: xval
			module: textopsx
			name: bl_iterator_value
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: has_totag
			params: none
		}
		func: {
			ret: int
			module: siputils
			name: is_request
			params: none
		}
		func: {
			ret: int
			module: siputils
			name: is_reply
			params: none
		}
		func: {
			ret: int
			module: siputils
			name: is_first_hop
			params: none
		}
		func: {
			ret: int
			module: siputils
			name: is_first_hop_mode
			params: int
		}
		func: {
			ret: int
			module: siputils
			name: is_uri
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: is_user
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: uri_param
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: uri_param_value
			params: str, str
		}
		func: {
			ret: int
			module: siputils
			name: uri_param_any
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: uri_param_rm
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: is_tel_number
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: is_numeric
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: is_alphanum
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: is_alphanumex
			params: str, str
		}
		func: {
			ret: int
			module: siputils
			name: options_reply
			params: none
		}
		func: {
			ret: int
			module: siputils
			name: encode_contact
			params: str, str
		}
		func: {
			ret: int
			module: siputils
			name: decode_contact
			params: none
		}
		func: {
			ret: int
			module: siputils
			name: decode_contact_header
			params: none
		}
		func: {
			ret: int
			module: siputils
			name: contact_param_encode
			params: str, str
		}
		func: {
			ret: int
			module: siputils
			name: contact_param_decode
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: contact_param_decode_ruri
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: contact_param_rm
			params: str
		}
		func: {
			ret: int
			module: siputils
			name: hdr_date_check
			params: int
		}
		func: {
			ret: int
			module: siputils
			name: cmp_uri
			params: str, str
		}
		func: {
			ret: int
			module: siputils
			name: cmp_aor
			params: str, str
		}
		func: {
			ret: int
			module: siputils
			name: cmp_hdr_name
			params: str, str
		}
		func: {
			ret: int
			module: siputils
			name: is_gruu
			params: none
		}
		func: {
			ret: int
			module: siputils
			name: add_uri_param
			params: str
		}
		func: {
			ret: int
			module: xlog
			name: xdbg
			params: str
		}
		func: {
			ret: int
			module: xlog
			name: xinfo
			params: str
		}
		func: {
			ret: int
			module: xlog
			name: xnotice
			params: str
		}
		func: {
			ret: int
			module: xlog
			name: xwarn
			params: str
		}
		func: {
			ret: int
			module: xlog
			name: xerr
			params: str
		}
		func: {
			ret: int
			module: xlog
			name: xalert
			params: str
		}
		func: {
			ret: int
			module: xlog
			name: xcrit
			params: str
		}
		func: {
			ret: int
			module: xlog
			name: xlog
			params: str, str
		}
		func: {
			ret: int
			module: sanity
			name: sanity_check
			params: int, int
		}
		func: {
			ret: int
			module: sanity
			name: sanity_check_defaults
			params: none
		}
		func: {
			ret: int
			module: sanity
			name: sanity_reply
			params: none
		}
		func: {
			ret: int
			module: acc
			name: acc_log_request
			params: str
		}
		func: {
			ret: int
			module: acc
			name: acc_db_request
			params: str, str
		}
		func: {
			ret: int
			module: acc
			name: acc_request
			params: str, str
		}
		func: {
			ret: int
			module: counters
			name: inc
			params: str
		}
		func: {
			ret: int
			module: counters
			name: add
			params: str, int
		}
		func: {
			ret: int
			module: counters
			name: reset
			params: str
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_select
			params: int, int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_select_limit
			params: int, int, int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_select_domain
			params: int, int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_select_domain_limit
			params: int, int, int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_next_domain
			params: none
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_set_domain
			params: none
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_select_dst
			params: int, int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_select_dst_limit
			params: int, int, int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_select_routes
			params: str, str
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_select_routes_limit
			params: str, str, int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_next_dst
			params: none
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_set_dst
			params: none
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_mark_dst
			params: none
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_mark_dst_state
			params: str
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_is_from_lists
			params: none
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_is_from_list
			params: int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_is_from_list_mode
			params: int, int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_is_from_list_uri
			params: int, int, str
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_load_update
			params: none
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_load_unset
			params: none
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_reload
			params: none
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_list_exists
			params: int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_is_active
			params: int
		}
		func: {
			ret: int
			module: dispatcher
			name: ds_is_active_uri
			params: int, str
		}
		func: {
			ret: int
			module: app_lua
			name: dostring
			params: str
		}
		func: {
			ret: int
			module: app_lua
			name: dofile
			params: str
		}
		func: {
			ret: int
			module: app_lua
			name: runstring
			params: str
		}
		func: {
			ret: int
			module: app_lua
			name: run
			params: str
		}
		func: {
			ret: int
			module: app_lua
			name: run_p1
			params: str, str
		}
		func: {
			ret: int
			module: app_lua
			name: run_p2
			params: str, str, str
		}
		func: {
			ret: int
			module: app_lua
			name: run_p3
			params: str, str, str, str
		}
	}
}