Merge pull request #3096 from jmacelroy/master

Cleaning up call flow presence stanzas and cancel triggers.
This commit is contained in:
Aaron van Meerten 2018-06-05 10:08:05 -05:00 committed by GitHub
commit ff0d42a95b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -17,7 +17,6 @@ end
-- Status strings that trigger call events. -- Status strings that trigger call events.
local calling_status = "calling" local calling_status = "calling"
local ringing_status = "ringing"
local busy_status = "busy" local busy_status = "busy"
local rejected_status = "rejected" local rejected_status = "rejected"
local connected_status = "connected" local connected_status = "connected"
@ -53,7 +52,6 @@ end
-- Status | Event Type -- Status | Event Type
-- _________________________ -- _________________________
-- "calling" | INVITE -- "calling" | INVITE
-- "ringing" | CANCEL
-- "busy" | CANCEL -- "busy" | CANCEL
-- "rejected" | CANCEL -- "rejected" | CANCEL
-- "connected" | CANCEL -- "connected" | CANCEL
@ -93,7 +91,6 @@ module:hook("muc-broadcast-presence", function (event)
local switch = function(status) local switch = function(status)
case = { case = {
[calling_status] = function() invite() end, [calling_status] = function() invite() end,
[ringing_status] = function() cancel() end,
[busy_status] = function() cancel() end, [busy_status] = function() cancel() end,
[rejected_status] = function() cancel() end, [rejected_status] = function() cancel() end,
[connected_status] = function() cancel() end [connected_status] = function() cancel() end

View File

@ -241,8 +241,14 @@ function create_poltergeist_occupant(room, nick, name, avatar, status, context)
join:tag("password", { xmlns = MUC_NS }):text(room_password); join:tag("password", { xmlns = MUC_NS }):text(room_password);
end end
-- Update the nil call id to the initial call id for call flows.
local call_id = get_username(room, context.user.id); local call_id = get_username(room, context.user.id);
join_presence:tag("call_id"):text(get_username(room, context.user.id)):up(); join_presence:maptags(function (tag)
if tag.name == "call_id" then
return st.stanza("call_id"):text(call_id);
end
return tag;
end);
update_presence_identity( update_presence_identity(
join_presence, join_presence,
@ -356,6 +362,7 @@ function update_presence_tags(presence_stanza, status, call_details)
return st.stanza("call_cancel"):text("false"); return st.stanza("call_cancel"):text("false");
end end
end end
return tag;
end); end);
return presence_stanza return presence_stanza