diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-28 09:12:47 +0100 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-28 09:12:47 +0100 |
commit | 19b259d1bcba979b6af0b494029ed8be547afa45 (patch) | |
tree | 1c99e61b5b24c1150c0b27cb13579466e173f493 /misc/freeswitch/scripts/dialplan | |
parent | e2b4088b25551316d373eae6a4e4cc2293801058 (diff) |
options menu added
Diffstat (limited to 'misc/freeswitch/scripts/dialplan')
-rw-r--r-- | misc/freeswitch/scripts/dialplan/voicemail.lua | 72 |
1 files changed, 66 insertions, 6 deletions
diff --git a/misc/freeswitch/scripts/dialplan/voicemail.lua b/misc/freeswitch/scripts/dialplan/voicemail.lua index eaa8064..bdbb223 100644 --- a/misc/freeswitch/scripts/dialplan/voicemail.lua +++ b/misc/freeswitch/scripts/dialplan/voicemail.lua @@ -109,6 +109,12 @@ function Voicemail.settings_get(self, id) end +function Voicemail.find_message_by_uuid(self, uuid) + local sql_query = 'SELECT * FROM `voicemail_msgs` WHERE `uuid` = ' .. self.database:escape(uuid, '"') .. ' LIMIT 1'; + return self.database:query_return_first(sql_query); +end + + function Voicemail.messages_get(self, status) local sql_query = 'SELECT * FROM `voicemail_msgs` WHERE `username` = ' .. self.database:escape(self.name, '"'); @@ -289,12 +295,6 @@ function Voicemail.menu_messages(self, folder, messages) end -function Voicemail.menu_options(self) - self.log:info('VOICEMAIL_OPTIONS_MENU'); - self.caller:send_display('Voicemail options'); -end - - function Voicemail.message_delete(self, message) self.log:debug('VOICEMAIL_MESSAGE_DELETE - message: ', message.uuid); require 'common.fapi'; @@ -372,3 +372,63 @@ function Voicemail.trigger_notification(self, caller) require 'common.fapi'; return common.fapi.FApi:new():execute('luarun', command); end + + +function Voicemail.message_play(self, caller, uuid) + local message = self:find_message_by_uuid(uuid); + + if message and message.file_path then + if not caller:answered() then + caller:answer(); + caller:sleep(1000); + end + caller:send_display(message.cid_name .. ' ' .. message.cid_number); + caller:playback(message.file_path); + end + + return message; +end + + +function Voicemail.menu_options(self) + self.log:info('VOICEMAIL_OPTIONS_MENU'); + self.caller:send_display('Voicemail options'); + + local menu = { + { key = '1', method = self.greeting_record, parameters = { self } }, + { key = '2', method = self.greeting_choose, parameters = { self } }, + { key = '3', method = self.name_record, parameters = { self } }, + { key = '4', method = self.pin_change, parameters = { self } }, + { key = self.settings.key_terminator, exit = true }, + { key = '', exit = true }, + }; + + while true do + local digits, key = self.ivr:ivr_phrase('voicemail_config_menu', menu); + self.log:debug('VOICEMAIL_MAIN_MENU - digit: ', digits); + if key.exit then + break; + end + + key.method(unpack(key.parameters)); + end +end + +function Voicemail.greeting_record(self) + self.log:info('VOICEMAIL_GREETING_RECORD'); +end + +function Voicemail.greeting_choose(self) + self.log:info('VOICEMAIL_GREETING_CHOSE'); + +end + +function Voicemail.name_record(self) + self.log:info('VOICEMAIL_NAME_RECORD'); +end + +function Voicemail.pin_change(self) + self.log:info('VOICEMAIL_PIN_CHANGE'); + + +end |