summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan/voicemail.lua
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-01-24 16:00:25 +0100
committerspag <spag@golwen.net>2013-01-24 16:00:25 +0100
commit0f26298b241fc92f05972a9e47a0cec01245dd10 (patch)
tree9beff0b38b1669d2b5cc8563ac6f9d4b149f430e /misc/freeswitch/scripts/dialplan/voicemail.lua
parent04eea0955c4a7b6d183fa7545b61c0732b8b41b8 (diff)
trigger voicemail notification
Diffstat (limited to 'misc/freeswitch/scripts/dialplan/voicemail.lua')
-rw-r--r--misc/freeswitch/scripts/dialplan/voicemail.lua12
1 files changed, 5 insertions, 7 deletions
diff --git a/misc/freeswitch/scripts/dialplan/voicemail.lua b/misc/freeswitch/scripts/dialplan/voicemail.lua
index 5d79ba3..4c96fbe 100644
--- a/misc/freeswitch/scripts/dialplan/voicemail.lua
+++ b/misc/freeswitch/scripts/dialplan/voicemail.lua
@@ -117,6 +117,7 @@ function Voicemail.leave(self, caller, phone_number)
caller.uuid .. "'"
);
caller:set_variable('voicemail_message_len', duration);
+ self:trigger_notification(caller);
else
caller:set_variable('voicemail_message_len');
end
@@ -125,14 +126,11 @@ function Voicemail.leave(self, caller, phone_number)
end
-function Voicemail.send_notify(self, caller)
- self.log:debug('VOICEMAIL_NOTIFY - account: ' .. self.record.auth_name .. ", id: " .. tostring(caller.uuid));
+function Voicemail.trigger_notification(self, caller)
+ local command = 'http_request.lua ' .. caller.uuid .. ' http://127.0.0.1/trigger/voicemail?sip_account_id=' .. tostring(self.id);
- local file = io.popen("/opt/GS5/script/voicemail_new '" .. tostring(self.record.auth_name) .. "' '" .. tostring(caller.uuid) .. "' 2>&1");
- self.log:debug('VOICEMAIL_NOTIFY - result: ' .. tostring(file:read("*a")));
- file:close();
-
- return true;
+ require 'common.fapi'
+ return common.fapi.FApi:new():execute('luarun', command);
end