From ed7625053860e646824e3213dbff96c312e4c9b7 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 26 Mar 2013 15:55:17 +0100 Subject: voicemail dialplan method --- misc/freeswitch/scripts/dialplan/dialplan.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 5335328..7ed835b 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -590,19 +590,21 @@ end function Dialplan.voicemail(self, destination) - require 'dialplan.voicemail' + require 'dialplan.voicemail'; local voicemail_account = nil; - - local sip_account_id - if not common.str.blank(destination.number) and false then - voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database }:find_by_number(destination.number); + if common.str.to_i(destination.id) > 0 then + voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database, domain = self.domain }:find_by_id(destination.id); + elseif not common.str.blank(destination.number) then + voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database, domain = self.domain }:find_by_number(destination.number); elseif self.caller.auth_account and self.caller.auth_account.class == 'sipaccount' then - voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database }:find_by_sip_account_id(self.caller.auth_account.id); + voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database, domain = self.domain }:find_by_sip_account_id(self.caller.auth_account.id); + elseif self.caller.forwarding_number then + voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database, domain = self.domain }:find_by_number(self.caller.forwarding_number); end if not voicemail_account then - self.log:error('VOICEMAIL - no mailbox'); + self.log:error('VOICEMAIL - mailbox not found, '); return { continue = false, code = 404, phrase = 'Mailbox not found' } end -- cgit v1.2.3 From c2e5547c22d2021bfa0dbafadd55723485e1c7d1 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 27 Mar 2013 10:37:12 +0100 Subject: handle voicemailaccount destinations --- misc/freeswitch/scripts/dialplan/dialplan.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 7ed835b..31b88fd 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -711,7 +711,7 @@ function Dialplan.switch(self, destination) end end return result; - elseif destination.type == 'voicemail' then + elseif destination.type == 'voicemail' or destination.type == 'voicemailaccount' then return self:voicemail(destination); elseif destination.type == 'dialplanfunction' then return self:dialplanfunction(destination); -- cgit v1.2.3 From f89c54f914741e2aaa6d4910cd33eaa2bd7fedf3 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 11 Apr 2013 10:47:24 +0200 Subject: pass number as greeting --- misc/freeswitch/scripts/dialplan/dialplan.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 31b88fd..a8054ff 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -595,8 +595,6 @@ function Dialplan.voicemail(self, destination) local voicemail_account = nil; if common.str.to_i(destination.id) > 0 then voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database, domain = self.domain }:find_by_id(destination.id); - elseif not common.str.blank(destination.number) then - voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database, domain = self.domain }:find_by_number(destination.number); elseif self.caller.auth_account and self.caller.auth_account.class == 'sipaccount' then voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database, domain = self.domain }:find_by_sip_account_id(self.caller.auth_account.id); elseif self.caller.forwarding_number then @@ -608,7 +606,7 @@ function Dialplan.voicemail(self, destination) return { continue = false, code = 404, phrase = 'Mailbox not found' } end - voicemail_account:leave(self.caller, self.caller.forwarding_number); + voicemail_account:leave(self.caller, destination.number, self.caller.forwarding_number); if self.caller:to_s("voicemail_message_len") == '' then self.log:info('VOICEMAIL - no message saved'); -- cgit v1.2.3 From d3747bd38f106669d7b57a9c9b64d99b98c6aa59 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 16 Apr 2013 15:14:33 +0200 Subject: pass caller record to call forwarding class --- misc/freeswitch/scripts/dialplan/dialplan.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index a8054ff..3f84007 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -248,7 +248,7 @@ function Dialplan.destination_new(self, arg) destination.account = self:object_find{ class = destination.type, id = destination.id}; if self.caller then require 'common.call_forwarding'; - local call_forwarding_class = common.call_forwarding.CallForwarding:new{ log = self.log, database = self.database } + local call_forwarding_class = common.call_forwarding.CallForwarding:new{ log = self.log, database = self.database, caller = self.caller } destination.call_forwarding = call_forwarding_class:list_by_owner(destination.id, destination.type, self.caller.caller_phone_numbers); for service, call_forwarding_entry in pairs(call_forwarding_class:list_by_owner(destination.phone_number.id, destination.phone_number.class, self.caller.caller_phone_numbers)) do destination.call_forwarding[service] = call_forwarding_entry; -- cgit v1.2.3 From 4f2e4d63597904c0f2b71398619ee3d1294f297a Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 11 Jun 2013 14:54:12 +0200 Subject: set_privacy removed --- misc/freeswitch/scripts/dialplan/dialplan.lua | 3 --- 1 file changed, 3 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 3f84007..f96f857 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -372,7 +372,6 @@ function Dialplan.dial(self, destination) self.caller:set_caller_id(destination.caller_id_number, destination.caller_id_name or self.caller.caller_id_name); else self.caller:set_caller_id('anonymous', 'Unknown'); - self.caller:set_privacy(true); end local destinations = { destination }; @@ -418,7 +417,6 @@ function Dialplan.huntgroup(self, destination) end else self.caller:set_caller_id('anonymous', tostring(hunt_group.record.name)); - self.caller:set_privacy(true); end self.caller.auth_account = hunt_group; @@ -449,7 +447,6 @@ function Dialplan.acd(self, destination) end else self.caller:set_caller_id('anonymous', tostring(acd.record.name)); - self.caller:set_privacy(true); end self.caller.auth_account = acd; -- cgit v1.2.3 From f024d2383255847847de9cba4f1aa454a207de84 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 12 Jun 2013 09:19:38 +0200 Subject: set_caller_id removed --- misc/freeswitch/scripts/dialplan/dialplan.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index f96f857..913d7a5 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -370,8 +370,6 @@ function Dialplan.dial(self, destination) end end self.caller:set_caller_id(destination.caller_id_number, destination.caller_id_name or self.caller.caller_id_name); - else - self.caller:set_caller_id('anonymous', 'Unknown'); end local destinations = { destination }; @@ -416,7 +414,7 @@ function Dialplan.huntgroup(self, destination) self:set_caller_picture(self.caller.account.owner.id, self.caller.account.owner.class); end else - self.caller:set_caller_id('anonymous', tostring(hunt_group.record.name)); + self.caller.anonymous_name = tostring(hunt_group.record.name); end self.caller.auth_account = hunt_group; @@ -446,7 +444,7 @@ function Dialplan.acd(self, destination) self:set_caller_picture(self.caller.account.owner.id, self.caller.account.owner.class); end else - self.caller:set_caller_id('anonymous', tostring(acd.record.name)); + self.caller.anonymous_name = tostring(acd.record.name); end self.caller.auth_account = acd; @@ -814,6 +812,10 @@ function Dialplan.run(self, destination) self.caller.date = os.date('%y%m%d%w'); self.caller.time = os.date('%H%M%S'); + if self.config then + self.caller:export_variable('sip_cid_type=' .. (self.config.sip_cid_type or 'none')); + end + if type(self.config.variables) == 'table' then for key, value in pairs(self.config.variables) do self.caller:set_variable(key, value); -- cgit v1.2.3