diff options
author | Mario "Kuroir" Ricalde <kuroir@gmail.com> | 2013-02-13 05:39:43 -0600 |
---|---|---|
committer | Mario "Kuroir" Ricalde <kuroir@gmail.com> | 2013-02-13 05:39:43 -0600 |
commit | c2aad881ff34ce544b24847279472448917f38e1 (patch) | |
tree | 4b42aa65165f9adcc8e113a20cd141866cb09758 /misc/freeswitch/scripts | |
parent | 791bf973b02b626f876b7e5819e2037dcff90f84 (diff) | |
parent | 1776a5b243aa7b62eff09319e2f766426307e220 (diff) |
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'misc/freeswitch/scripts')
-rw-r--r-- | misc/freeswitch/scripts/common/conference.lua | 11 | ||||
-rw-r--r-- | misc/freeswitch/scripts/common/sip_account.lua | 1 | ||||
-rw-r--r-- | misc/freeswitch/scripts/dialplan/dialplan.lua | 12 |
3 files changed, 15 insertions, 9 deletions
diff --git a/misc/freeswitch/scripts/common/conference.lua b/misc/freeswitch/scripts/common/conference.lua index ca5fa62..f6a4d87 100644 --- a/misc/freeswitch/scripts/common/conference.lua +++ b/misc/freeswitch/scripts/common/conference.lua @@ -157,7 +157,7 @@ function Conference.enter(self, caller, domain) caller:answer(); caller:sleep(1000); - caller.session:streamFile('conference/conf-welcome.wav'); + caller.session:sayPhrase('conference_welcome'); if pin and pin ~= "" then local digits = ""; @@ -165,12 +165,12 @@ function Conference.enter(self, caller, domain) if digits == pin then break elseif digits ~= "" then - caller.session:streamFile('conference/conf-bad-pin.wav'); + caller.session:sayPhrase('conference_bad_pin'); end digits = caller.session:read(PIN_LENGTH_MIN, PIN_LENGTH_MAX, 'conference/conf-enter_conf_pin.wav', PIN_TIMEOUT, '#'); end if digits ~= pin then - caller.session:streamFile("conference/conf-goodbye.wav"); + caller.session:sayPhrase('conference_goodbye'); return "CALL_REJECTED"; end end @@ -192,8 +192,7 @@ function Conference.enter(self, caller, domain) if common.str.to_b(self.record.announce_new_member_by_name) or common.str.to_b(self.record.announce_left_member_by_name) then local uid = session:get_uuid(); name_file = "/tmp/conference_caller_name_" .. uid .. ".wav"; - caller.session:streamFile("voicemail/vm-record_name1.wav"); - caller.session:execute("playback", "tone_stream://%(1000,0,500)"); + caller.session:sayPhrase('conference_record_name'); session:recordFile(name_file, ANNOUNCEMENT_MAX_LEN, ANNOUNCEMENT_SILENCE_THRESHOLD, ANNOUNCEMENT_SILENCE_LEN); caller.session:streamFile(name_file); end @@ -209,7 +208,7 @@ function Conference.enter(self, caller, domain) local result = caller.session:execute('conference', self.record.id .. "@profile_" .. self.record.id .. "++flags{" .. table.concat(flags, '|') .. "}"); self.log:debug('exited conference - result: ' .. tostring(result)); - caller.session:streamFile("conference/conf-goodbye.wav") + caller.session:sayPhrase('conference_goodbye'); -- Play leaving caller's name if recorded if name_file then diff --git a/misc/freeswitch/scripts/common/sip_account.lua b/misc/freeswitch/scripts/common/sip_account.lua index d023f20..5b1ea56 100644 --- a/misc/freeswitch/scripts/common/sip_account.lua +++ b/misc/freeswitch/scripts/common/sip_account.lua @@ -38,6 +38,7 @@ function SipAccount.find_by_sql(self, where) `a`.`sip_accountable_id`, \ `a`.`hotdeskable`, \ `a`.`gs_node_id`, \ + `a`.`language_code`, \ `b`.`host`, \ `c`.`sip_host`, \ `c`.`profile_name` \ diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 72503e5..b27bb9d 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -270,7 +270,10 @@ function Dialplan.retrieve_caller_data(self) for index, caller_number in ipairs(self.caller.caller_phone_numbers) do self.caller.caller_phone_numbers_hash[caller_number] = true; end - self.log:info('CALLER_DATA - caller account: ', self.caller.account.class, '=', self.caller.account.id, '/', self.caller.account.uuid, ', phone_numbers: ', #self.caller.caller_phone_numbers); + if not common.str.blank(self.caller.account.record.language_code) then + self.caller.language = self.caller.account.record.language_code; + end + self.log:info('CALLER_DATA - caller account: ', self.caller.account.class, '=', self.caller.account.id, '/', self.caller.account.uuid, ', phone_numbers: ', #self.caller.caller_phone_numbers, ', language: ', self.caller.language); if self.caller.account.owner then self.log:info('CALLER_DATA - caller owner: ', self.caller.account.owner.class, '=', self.caller.account.owner.id, '/', self.caller.account.owner.uuid); else @@ -859,7 +862,6 @@ function Dialplan.run(self, destination) self.caller:set_variable('hangup_after_bridge', false); self.caller:set_variable('bridge_early_media', 'true'); - self.caller:set_variable('default_language', self.default_language); self.caller:set_variable('gs_save_cdr', true); self.caller:set_variable('gs_call_service', 'dial'); self.caller.session:setAutoHangup(false); @@ -876,6 +878,8 @@ function Dialplan.run(self, destination) self:retrieve_caller_data(); self.route_failover = common.configuration_table.get(self.database, 'call_route', 'failover'); + self.caller.language = self.caller.language or self.default_language; + if not destination or destination.type == 'unknown' then local route = nil; if self.caller.gateway then @@ -937,7 +941,9 @@ function Dialplan.run(self, destination) end end - self.log:info('DIALPLAN start - caller_id: ',self.caller.caller_id_number, ' "', self.caller.caller_id_name, '" , number: ', destination.number); + self.caller:set_variable('default_language', self.caller.language); + self.caller:set_variable('sound_prefix', common.str.try(self.config, 'sounds.' .. tostring(self.caller.language))); + self.log:info('DIALPLAN start - caller_id: ',self.caller.caller_id_number, ' "', self.caller.caller_id_name, '" , number: ', destination.number, ', language: ', self.caller.language); local result = { continue = false }; local loop = self.caller.loop_count; |