Module: kamailio Branch: master Commit: 661fc0193da9e559e22b83b006db3e23345c092c URL: https://github.com/kamailio/kamailio/commit/661fc0193da9e559e22b83b006db3e23...
Author: Victor Seva linuxmaniac@torreviejawireless.org Committer: Victor Seva linuxmaniac@torreviejawireless.org Date: 2020-04-09T13:48:06+02:00
misc: examples kemi, don't fail if optional modules are not loaded
kamailio-basic-kemi.cfg has some define instructions that can be removed ( WITH_MYSQL, WITH_AUTH, ...)
So lets make sure that modules are there in the lua script before using the defined routes.
---
Modified: misc/examples/kemi/kamailio-basic-kemi-lua.lua
---
Diff: https://github.com/kamailio/kamailio/commit/661fc0193da9e559e22b83b006db3e23... Patch: https://github.com/kamailio/kamailio/commit/661fc0193da9e559e22b83b006db3e23...
---
diff --git a/misc/examples/kemi/kamailio-basic-kemi-lua.lua b/misc/examples/kemi/kamailio-basic-kemi-lua.lua index 44a09186fd..b28eea0ff1 100644 --- a/misc/examples/kemi/kamailio-basic-kemi-lua.lua +++ b/misc/examples/kemi/kamailio-basic-kemi-lua.lua @@ -240,8 +240,11 @@ end
-- IP authorization and user uthentication function ksr_route_auth() + if not KSR.auth then + return 1; + end
- if not KSR.is_REGISTER() then + if KSR.permissions and not KSR.is_REGISTER() then if KSR.permissions.allow_source_address(1)>0 then -- source IP allowed return 1; @@ -273,6 +276,9 @@ end
-- Caller NAT detection function ksr_route_natdetect() + if not KSR.nathelper then + return 1; + end KSR.force_rport(); if KSR.nathelper.nat_uac_test(19)>0 then if KSR.is_REGISTER() then @@ -287,6 +293,9 @@ end
-- RTPProxy control function ksr_route_natmanage() + if not KSR.rtpproxy then + return 1; + end if KSR.siputils.is_request()>0 then if KSR.siputils.has_totag()>0 then if KSR.rr.check_route_param("nat=yes")>0 then @@ -317,6 +326,9 @@ end
-- URI update for dialog requests function ksr_route_dlguri() + if not KSR.nathelper then + return 1; + end if not KSR.isdsturiset() then KSR.nathelper.handle_ruri_alias(); end