summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-21 11:03:13 +0100
committerspag <spag@golwen.net>2013-02-21 11:03:13 +0100
commitdb436013b94cd7a565fde96baba37677d3884d8d (patch)
tree59d434da53347d11ab9125228d7bd413f695e89b /misc
parent8f6c2ff6f50739a0370fff8641244d4d04be6fa9 (diff)
find_by_owner method added
Diffstat (limited to 'misc')
-rw-r--r--misc/freeswitch/scripts/dialplan/call_parking.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/dialplan/call_parking.lua b/misc/freeswitch/scripts/dialplan/call_parking.lua
index cc2cf4b..e51eb16 100644
--- a/misc/freeswitch/scripts/dialplan/call_parking.lua
+++ b/misc/freeswitch/scripts/dialplan/call_parking.lua
@@ -39,6 +39,22 @@ function CallParking.find_by_name(self, name)
end
+function CallParking.find_by_owner(self, owner_id, owner_type)
+ local sql_query = 'SELECT * FROM `parking_stalls` WHERE `parking_stallable_id` = '.. owner_id .. ' AND `parking_stallable_type` = "' .. owner_type .. '" ORDER BY `name`';
+ local parking_stalls = {};
+
+ self.database:query(sql_query, function(entry)
+ local parking_stall = CallParking:new(self);
+ parking_stall.record = entry;
+ parking_stall.id = tonumber(entry.id);
+ parking_stall.name = entry.name;
+ table.insert(parking_stalls, parking_stall)
+ end)
+
+ return parking_stalls;
+end
+
+
function CallParking.list_occupied(self, lot)
lot = lot or self.lot;