summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan/functions.lua
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-12 13:53:28 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-12 13:53:28 +0100
commitc9066760fd1f5f2f892ce2be5cf2a83bb5210246 (patch)
tree82ecdd528e803ccd1b469dc13482e06cf8ea0b8e /misc/freeswitch/scripts/dialplan/functions.lua
parent0b97717b2171820dea41de8df705f8f0e4b71464 (diff)
parentfb66a5e5a4c5d5f9eac4a5e8de6a286482cb55d5 (diff)
Release a new beta.5.1-beta4
Diffstat (limited to 'misc/freeswitch/scripts/dialplan/functions.lua')
-rw-r--r--misc/freeswitch/scripts/dialplan/functions.lua20
1 files changed, 15 insertions, 5 deletions
diff --git a/misc/freeswitch/scripts/dialplan/functions.lua b/misc/freeswitch/scripts/dialplan/functions.lua
index 2ca51c8..4430be1 100644
--- a/misc/freeswitch/scripts/dialplan/functions.lua
+++ b/misc/freeswitch/scripts/dialplan/functions.lua
@@ -111,6 +111,8 @@ function Functions.dialplan_function(self, caller, dialed_number)
result = "+" .. tostring(parameters[3]);
elseif fid == "hangup" then
result = self:hangup(caller, parameters[3], parameters[4]);
+ elseif fid == "park" then
+ result = self:park(caller, parameters[3]);
end
return result;
@@ -264,7 +266,7 @@ function Functions.account_node_change(self, caller)
-- resync caller phones
for index, phone_caller in ipairs(caller_phones) do
- local result = phone_caller:resync{ auth_name = caller_sip_account.auth_name, domain = caller.domain };
+ local result = phone_caller:resync{ auth_name = caller_sip_account.record.auth_name, domain = caller_sip_account.record.host };
self.log:info('NODE_CHANGE - resync phone - mac: ', phone_caller.record.mac_address, ', ip_address: ', phone_caller.record.ip_address, ', result: ', result);
end
@@ -302,6 +304,7 @@ function Functions.user_login(self, caller, number, pin)
if not caller_phone then
self.log:notice('LOGIN - caller phone not found or not hot-deskable');
+ local result = phone_class:resync{ auth_name = caller_sip_account.record.auth_name, domain = caller_sip_account.record.host };
return { continue = false, code = 403, phrase = 'Phone not hot-deskable', no_cdr = true }
end
@@ -374,13 +377,13 @@ function Functions.user_login(self, caller, number, pin)
-- resync destination phones
for index, phone_destination in ipairs(destination_phones) do
- local result = phone_destination:resync{ auth_name = destination_sip_account.auth_name, domain = caller.domain_local };
+ local result = phone_destination:resync{ auth_name = destination_sip_account.record.auth_name, domain = destination_sip_account.record.host };
self.log:info('LOGIN - resync destination phone - mac: ', phone_destination.record.mac_address, ', ip_address: ', phone_destination.record.ip_address, ', result: ', result);
end
-- resync caller phones
for index, phone_caller in ipairs(caller_phones) do
- local result = phone_caller:resync{ auth_name = caller_sip_account.auth_name, domain = caller.domain };
+ local result = phone_caller:resync{ auth_name = caller_sip_account.record.auth_name, domain = caller_sip_account.record.host };
self.log:info('LOGIN - resync caller phone - mac: ', phone_caller.record.mac_address, ', ip_address: ', phone_caller.record.ip_address, ', result: ', result);
end
@@ -409,8 +412,9 @@ function Functions.user_logout(self, caller)
local caller_phones = phone_class:find_all_hot_deskable_by_account(caller_sip_account.id);
- if caller_phones == 0 then
+ if #caller_phones == 0 then
self.log:notice('LOGOUT - caller phones not found or not hot-deskable');
+ local result = phone_class:resync{ auth_name = caller_sip_account.record.auth_name, domain = caller_sip_account.record.host };
return { continue = false, code = 403, phrase = 'Phone not hot-deskable', no_cdr = true }
end
@@ -426,7 +430,7 @@ function Functions.user_logout(self, caller)
-- resync caller phones
for index, phone_caller in ipairs(caller_phones) do
- local result = phone_caller:resync{ auth_name = caller_sip_account.auth_name, domain = caller.domain };
+ local result = phone_caller:resync{ auth_name = caller_sip_account.record.auth_name, domain = caller_sip_account.record.host };
self.log:info('LOGIN - resync caller phone - mac: ', phone_caller.record.mac_address, ', ip_address: ', phone_caller.record.ip_address, ', result: ', result);
end
@@ -909,3 +913,9 @@ function Functions.hangup(self, caller, code, phrase)
self.log:info("FUNCTION_HANGUP code: ", code, ', phrase: ', phrase);
return { continue = false, code = code, phrase = phrase:gsub('_', ' '), no_cdr = true }
end
+
+function Functions.park(self, caller, lot)
+ self.log:info("FUNCTION_PARK lot: ", lot);
+ caller:execute("valet_park", 'valet_lot ' .. lot);
+ return { continue = false, code = 200, phrase = 'OK', no_cdr = true }
+end