Ver código fonte

feat(calls): Adding missed call event triggering.

j8
jmacelroy 6 anos atrás
pai
commit
d189888902

+ 26
- 14
resources/prosody-plugins/ext_events.lib.lua Ver arquivo

1
 -- invite will perform the trigger for external call invites.
1
 -- invite will perform the trigger for external call invites.
2
 -- This trigger is left unimplemented. The implementation is expected
2
 -- This trigger is left unimplemented. The implementation is expected
3
 -- to be specific to the deployment.
3
 -- to be specific to the deployment.
4
-local function invite(stanza, url)
5
-   module:log(
6
-	  "warn",
7
-	  "A module has been configured that triggers external events."
8
-   )
9
-   module:log("warn", "Implement this lib to trigger external events.")
4
+local function invite(stanza, url, call_id)
5
+    module:log(
6
+        "warn",
7
+        "A module has been configured that triggers external events."
8
+    )
9
+    module:log("warn", "Implement this lib to trigger external events.")
10
 end
10
 end
11
 
11
 
12
 -- cancel will perform the trigger for external call cancellation.
12
 -- cancel will perform the trigger for external call cancellation.
13
 -- This trigger is left unimplemented. The implementation is expected
13
 -- This trigger is left unimplemented. The implementation is expected
14
 -- to be specific to the deployment.
14
 -- to be specific to the deployment.
15
-local function cancel(stanza, url, reason)
16
-   module:log(
17
-	  "warn",
18
-	  "A module has been configured that triggers external events."
19
-   )
20
-   module:log("warn", "Implement this lib to trigger external events.")
15
+local function cancel(stanza, url, reason, call_id)
16
+    module:log(
17
+        "warn",
18
+        "A module has been configured that triggers external events."
19
+    )
20
+    module:log("warn", "Implement this lib to trigger external events.")
21
+end
22
+
23
+-- missed will perform the trigger for external call missed notification.
24
+-- This trigger is left unimplemented. The implementation is expected
25
+-- to be specific to the deployment.
26
+local function missed(stanza, call_id)
27
+    module:log(
28
+        "warn",
29
+        "A module has been configured that triggers external events."
30
+    )
31
+    module:log("warn", "Implement this lib to trigger external events.")
21
 end
32
 end
22
 
33
 
23
 
34
 
24
 local ext_events = {
35
 local ext_events = {
25
-   invite = invite,
26
-   cancel = cancel
36
+    missed = missed,
37
+    invite = invite,
38
+    cancel = cancel
27
 }
39
 }
28
 
40
 
29
 return ext_events
41
 return ext_events

+ 8
- 3
resources/prosody-plugins/mod_muc_call.lua Ver arquivo

20
 local busy_status      = "busy"
20
 local busy_status      = "busy"
21
 local rejected_status  = "rejected"
21
 local rejected_status  = "rejected"
22
 local connected_status = "connected"
22
 local connected_status = "connected"
23
-
24
-
23
+local expired_status   = "expired"
25
 
24
 
26
 -- url_from_room_jid will determine the url for a conference
25
 -- url_from_room_jid will determine the url for a conference
27
 -- provided a room jid. It is required that muc domain mapping
26
 -- provided a room jid. It is required that muc domain mapping
92
             return
91
             return
93
         end
92
         end
94
 
93
 
94
+        local missed = function()
95
+            cancel()
96
+            ext_events.missed(event.stanza, call_id)
97
+        end
98
+
95
         -- All other call flow actions will require a status.
99
         -- All other call flow actions will require a status.
96
         if event.stanza:get_child_text("status") == nil then
100
         if event.stanza:get_child_text("status") == nil then
97
             return
101
             return
101
             case = {
105
             case = {
102
                 [calling_status]   = function() invite() end,
106
                 [calling_status]   = function() invite() end,
103
                 [busy_status]      = function() cancel() end,
107
                 [busy_status]      = function() cancel() end,
104
-                [rejected_status]  = function() cancel() end,
108
+                [rejected_status]  = function() missed() end,
109
+                [expired_status]   = function() missed() end,
105
                 [connected_status] = function() cancel() end
110
                 [connected_status] = function() cancel() end
106
             }
111
             }
107
             if case[status] then case[status]() end
112
             if case[status] then case[status]() end

Carregando…
Cancelar
Salvar