Merge pull request #3264 from jmacelroy/missed-calls
feat(calls): Adding missed call event triggering.
This commit is contained in:
commit
cc27e96b22
|
@ -1,29 +1,41 @@
|
||||||
-- invite will perform the trigger for external call invites.
|
-- invite will perform the trigger for external call invites.
|
||||||
-- This trigger is left unimplemented. The implementation is expected
|
-- This trigger is left unimplemented. The implementation is expected
|
||||||
-- to be specific to the deployment.
|
-- to be specific to the deployment.
|
||||||
local function invite(stanza, url)
|
local function invite(stanza, url, call_id)
|
||||||
module:log(
|
module:log(
|
||||||
"warn",
|
"warn",
|
||||||
"A module has been configured that triggers external events."
|
"A module has been configured that triggers external events."
|
||||||
)
|
)
|
||||||
module:log("warn", "Implement this lib to trigger external events.")
|
module:log("warn", "Implement this lib to trigger external events.")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- cancel will perform the trigger for external call cancellation.
|
-- cancel will perform the trigger for external call cancellation.
|
||||||
-- This trigger is left unimplemented. The implementation is expected
|
-- This trigger is left unimplemented. The implementation is expected
|
||||||
-- to be specific to the deployment.
|
-- to be specific to the deployment.
|
||||||
local function cancel(stanza, url, reason)
|
local function cancel(stanza, url, reason, call_id)
|
||||||
module:log(
|
module:log(
|
||||||
"warn",
|
"warn",
|
||||||
"A module has been configured that triggers external events."
|
"A module has been configured that triggers external events."
|
||||||
)
|
)
|
||||||
module:log("warn", "Implement this lib to trigger 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
|
end
|
||||||
|
|
||||||
|
|
||||||
local ext_events = {
|
local ext_events = {
|
||||||
invite = invite,
|
missed = missed,
|
||||||
cancel = cancel
|
invite = invite,
|
||||||
|
cancel = cancel
|
||||||
}
|
}
|
||||||
|
|
||||||
return ext_events
|
return ext_events
|
||||||
|
|
|
@ -20,8 +20,7 @@ local calling_status = "calling"
|
||||||
local busy_status = "busy"
|
local busy_status = "busy"
|
||||||
local rejected_status = "rejected"
|
local rejected_status = "rejected"
|
||||||
local connected_status = "connected"
|
local connected_status = "connected"
|
||||||
|
local expired_status = "expired"
|
||||||
|
|
||||||
|
|
||||||
-- url_from_room_jid will determine the url for a conference
|
-- url_from_room_jid will determine the url for a conference
|
||||||
-- provided a room jid. It is required that muc domain mapping
|
-- provided a room jid. It is required that muc domain mapping
|
||||||
|
@ -92,6 +91,11 @@ module:hook(
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local missed = function()
|
||||||
|
cancel()
|
||||||
|
ext_events.missed(event.stanza, call_id)
|
||||||
|
end
|
||||||
|
|
||||||
-- All other call flow actions will require a status.
|
-- All other call flow actions will require a status.
|
||||||
if event.stanza:get_child_text("status") == nil then
|
if event.stanza:get_child_text("status") == nil then
|
||||||
return
|
return
|
||||||
|
@ -101,7 +105,8 @@ module:hook(
|
||||||
case = {
|
case = {
|
||||||
[calling_status] = function() invite() end,
|
[calling_status] = function() invite() end,
|
||||||
[busy_status] = function() cancel() 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
|
[connected_status] = function() cancel() end
|
||||||
}
|
}
|
||||||
if case[status] then case[status]() end
|
if case[status] then case[status]() end
|
||||||
|
|
Loading…
Reference in New Issue