Module: kamailio Branch: master Commit: 96ba8bdf87221c985d8198fe36f7f0bd9858a738 URL: https://github.com/kamailio/kamailio/commit/96ba8bdf87221c985d8198fe36f7f0bd...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-12-15T12:37:48+01:00
misc/examples: kemi - sanity check for response in lua script
---
Modified: misc/examples/kemi/kamailio-basic-kemi-lua.lua
---
Diff: https://github.com/kamailio/kamailio/commit/96ba8bdf87221c985d8198fe36f7f0bd... Patch: https://github.com/kamailio/kamailio/commit/96ba8bdf87221c985d8198fe36f7f0bd...
---
diff --git a/misc/examples/kemi/kamailio-basic-kemi-lua.lua b/misc/examples/kemi/kamailio-basic-kemi-lua.lua index bddabbaa895..a406b6429cf 100644 --- a/misc/examples/kemi/kamailio-basic-kemi-lua.lua +++ b/misc/examples/kemi/kamailio-basic-kemi-lua.lua @@ -195,7 +195,7 @@ function ksr_route_reqinit() end
if KSR.sanity.sanity_check(1511, 7)<0 then - KSR.err("Malformed SIP message from " + KSR.err("malformed SIP message from " .. KSR.kx.get_srcip() .. ":" .. KSR.kx.get_srcport() .."\n"); KSR.x.exit(); end @@ -418,6 +418,11 @@ end -- SIP response handling -- equivalent of reply_route{} function ksr_reply_route() - KSR.info("===== response - from kamailio lua script\n"); + KSR.dbg("response - from kamailio lua script\n"); + if KSR.sanity.sanity_check(17604, 6)<0 then + KSR.err("malformed SIP response from " + .. KSR.kx.get_srcip() .. ":" .. KSR.kx.get_srcport() .."\n"); + KSR.x.drop(); + end return 1; end