Skip to content

Commit

Permalink
examples/kemi: more comments to explain the lua routing script
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Apr 27, 2016
1 parent 55b1c2c commit a712dc3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples/kemi/kamailio-basic-kemi-lua.lua
@@ -1,8 +1,10 @@
-- Kamailio - equivalent of routing blocks in Lua
--
-- KSR - the new dynamic object exporting Kamailio functions
-- sr - the old static object exporting Kamailio functions
--

-- global variables corresponding to defined values (e.g., flags) in kamailio.cfg
FLT_ACC=1
FLT_ACCMISSED=2
FLT_ACCFAILED=3
Expand Down Expand Up @@ -322,6 +324,7 @@ function ksr_route_sipout()
end

-- Manage outgoing branches
-- equivalent of branch_route[...]{}
function ksr_branch_manage()
KSR.dbg("new branch [".. KSR.pv.get("$T_branch_idx]")
.. " to ".. KSR.pv.get("$ru") .. "\n");
Expand All @@ -330,6 +333,7 @@ function ksr_branch_manage()
end

-- Manage incoming replies
-- equivalent of onreply_route[...]{}
function ksr_onreply_manage()
KSR.dbg("incoming reply\n");
local scode = KSR.pv.get("$rs");
Expand All @@ -340,6 +344,7 @@ function ksr_onreply_manage()
end

-- Manage failure routing cases
-- equivalent of failure_route[...]{}
function ksr_failure_manage()
if ksr_route_natmanage()==-255 then return 1; end

Expand All @@ -349,7 +354,7 @@ function ksr_failure_manage()
return 1;
end

-- SIP response routing
-- SIP response handling
-- equivalent of reply_route{}
function ksr_reply_route()
KSR.info("===== response - from kamailio lua script\n");
Expand Down

0 comments on commit a712dc3

Please sign in to comment.