summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-06-10 10:10:25 +0200
committerPeter Kozak <spag@golwen.net>2013-06-10 10:10:25 +0200
commit419b25044950ab06a618eca2f3d2d699c1f3501b (patch)
treeb73652486b4fa51ca8320d7be141c0374d4341da
parent26fcd113a1cd193eebe012c91556e714fdc10610 (diff)
gateway_id can be nil
-rw-r--r--misc/freeswitch/scripts/common/gateway.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/common/gateway.lua b/misc/freeswitch/scripts/common/gateway.lua
index ac38326..0c6ab1c 100644
--- a/misc/freeswitch/scripts/common/gateway.lua
+++ b/misc/freeswitch/scripts/common/gateway.lua
@@ -34,6 +34,10 @@ end
function Gateway.find_by_id(self, id)
+ if not tonumber(id) then
+ return nil;
+ end
+
local sql_query = 'SELECT `a`.*, `c`.`sip_host` AS `domain`, `c`.`contact` AS `contact_full`, `c`.`network_ip`, `c`.`network_port` \
FROM `gateways` `a` \
LEFT JOIN `gateway_settings` `b` ON `a`.`id` = `b`.`gateway_id` AND `b`.`name` = "inbound_username" \