feat(calls): Adding missed call event triggering.

This commit is contained in:
jmacelroy 2018-07-11 20:49:11 +00:00
parent bd449be20d
commit d189888902
2 changed files with 34 additions and 17 deletions

View File

@ -1,29 +1,41 @@
-- invite will perform the trigger for external call invites.
-- This trigger is left unimplemented. The implementation is expected
-- to be specific to the deployment.
local function invite(stanza, url)
module:log(
"warn",
"A module has been configured that triggers external events."
)
module:log("warn", "Implement this lib to trigger external events.")
local function invite(stanza, url, call_id)
module:log(
"warn",
"A module has been configured that triggers external events."
)
module:log("warn", "Implement this lib to trigger external events.")
end
-- cancel will perform the trigger for external call cancellation.
-- This trigger is left unimplemented. The implementation is expected
-- to be specific to the deployment.
local function cancel(stanza, url, reason)
module:log(
"warn",
"A module has been configured that triggers external events."
)
module:log("warn", "Implement this lib to trigger external events.")
local function cancel(stanza, url, reason, call_id)
module:log(
"warn",
"A module has been configured that triggers external events."
)
module:log("warn", "Implement this lib to trigger external events.")
end
-- missed will perform the trigger for external call missed notification.
-- This trigger is left unimplemented. The implementation is expected
-- to be specific to the deployment.
local function missed(stanza, call_id)
module:log(
"warn",
"A module has been configured that triggers external events."
)
module:log("warn", "Implement this lib to trigger external events.")
end
local ext_events = {
invite = invite,
cancel = cancel
missed = missed,
invite = invite,
cancel = cancel
}
return ext_events

View File

@ -20,8 +20,7 @@ local calling_status = "calling"
local busy_status = "busy"
local rejected_status = "rejected"
local connected_status = "connected"
local expired_status = "expired"
-- url_from_room_jid will determine the url for a conference
-- provided a room jid. It is required that muc domain mapping
@ -92,6 +91,11 @@ module:hook(
return
end
local missed = function()
cancel()
ext_events.missed(event.stanza, call_id)
end
-- All other call flow actions will require a status.
if event.stanza:get_child_text("status") == nil then
return
@ -101,7 +105,8 @@ module:hook(
case = {
[calling_status] = function() invite() end,
[busy_status] = function() cancel() end,
[rejected_status] = function() cancel() end,
[rejected_status] = function() missed() end,
[expired_status] = function() missed() end,
[connected_status] = function() cancel() end
}
if case[status] then case[status]() end