diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-27 12:22:29 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-27 12:22:29 +0100 |
commit | 67c1a0a951403a546250ea860a3e3d199cae2fce (patch) | |
tree | f86ec6cedf081a1a57005eca1661e9bead34e4de /misc/freeswitch/scripts/dialplan/call_parking.lua | |
parent | 5d8ce5f4775ac8bc5f523964e6e36f63ff3c4683 (diff) | |
parent | 211f558a86ae30cdd5b392ab1376e1393f97e22c (diff) |
Merge branch 'develop'5.1-beta6
Diffstat (limited to 'misc/freeswitch/scripts/dialplan/call_parking.lua')
-rw-r--r-- | misc/freeswitch/scripts/dialplan/call_parking.lua | 16 |
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; |