You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.6 KiB
56 lines
1.6 KiB
#!/usr/bin/env lua5.1
|
|
-- Kamailio Lua Config
|
|
require 'ngcp.ngcp'
|
|
|
|
ngcp = NGCP:new()
|
|
loaded_keys = {caller={}, callee={}}
|
|
|
|
-- set config
|
|
ngcp.config.db_user = "[% kamailio.proxy.dbrwuser %]"
|
|
ngcp.config.db_pass = "[% kamailio.proxy.dbrwpw %]"
|
|
ngcp.config.db_host = "[% database.dbhost %]"
|
|
ngcp.config.db_database = "[% kamailio.proxy.dbname %]"
|
|
|
|
function ngcp_test()
|
|
print = function(msg)
|
|
sr.log("info", msg)
|
|
end
|
|
require('tests.test_kamailio')
|
|
end
|
|
|
|
function ngcp_clean(vtype)
|
|
ngcp:clean(vtype)
|
|
if #loaded_keys[vtype] > 0 then
|
|
sr.log("info", string.format("callee-> real: %s", table.tostring(loaded_keys[vtype])))
|
|
end
|
|
end
|
|
|
|
function print_loaded_prefs(vtype)
|
|
local _,v
|
|
local xavp = NGCPRealPrefs:xavp(vtype)
|
|
for _,v in pairs(loaded_keys[vtype]) do
|
|
sr.log("info", string.format("real key:%s value:%s\n", v, xavp(v)))
|
|
end
|
|
end
|
|
|
|
function ngcp_caller_peer_load(peer)
|
|
loaded_keys["caller"] = ngcp:caller_peer_load(peer)
|
|
sr.log("info", string.format("real: %s", table.tostring(loaded_keys["caller"])))
|
|
end
|
|
|
|
function ngcp_callee_peer_load(peer)
|
|
loaded_keys["callee"] = ngcp:callee_peer_load(peer)
|
|
sr.log("info", string.format("real: %s", table.tostring(loaded_keys["callee"])))
|
|
end
|
|
|
|
function ngcp_caller_usr_load(peer)
|
|
loaded_keys["caller"] = ngcp:caller_usr_load(peer)
|
|
sr.log("info", string.format("real: %s", table.tostring(loaded_keys["caller"])))
|
|
end
|
|
|
|
function ngcp_callee_usr_load(peer)
|
|
loaded_keys["callee"] = ngcp:callee_usr_load(peer)
|
|
sr.log("info", string.format("real: %s", table.tostring(loaded_keys["callee"])))
|
|
end
|
|
--EOF
|