Mercurial > libervia-backend
annotate sat/plugins/plugin_xep_0167/__init__.py @ 4056:1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
rel 420
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 29 May 2023 13:38:10 +0200 |
parents | |
children | adb9dc9c8114 |
rev | line source |
---|---|
4056
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 # Libervia plugin for managing pipes (experimental) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # Copyright (C) 2009-2023 Jérôme Poisson (goffi@goffi.org) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or modify |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # it under the terms of the GNU Affero General Public License as published by |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # the Free Software Foundation, either version 3 of the License, or |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # (at your option) any later version. |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # GNU Affero General Public License for more details. |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 # You should have received a copy of the GNU Affero General Public License |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 from typing import Optional |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 from twisted.internet import defer |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 from twisted.words.protocols.jabber import jid |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 from twisted.words.protocols.jabber.xmlstream import XMPPHandler |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 from twisted.words.xish import domish |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 from wokkel import disco, iwokkel |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 from zope.interface import implementer |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 from sat.core import exceptions |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 from sat.core.constants import Const as C |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 from sat.core.core_types import SatXMPPEntity |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 from sat.core.i18n import D_, _ |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 from sat.core.log import getLogger |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 from sat.tools import xml_tools |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 from sat.tools.common import data_format |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 from . import mapping |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 from ..plugin_xep_0166 import BaseApplicationHandler |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 from .constants import ( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 NS_JINGLE_RTP, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 NS_JINGLE_RTP_INFO, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 NS_JINGLE_RTP_AUDIO, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 NS_JINGLE_RTP_VIDEO, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 log = getLogger(__name__) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 PLUGIN_INFO = { |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 C.PI_NAME: "Jingle RTP Sessions", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 C.PI_IMPORT_NAME: "XEP-0167", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 C.PI_TYPE: "XEP", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 C.PI_PROTOCOLS: ["XEP-0167"], |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 C.PI_DEPENDENCIES: ["XEP-0166"], |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 C.PI_MAIN: "XEP_0167", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 C.PI_HANDLER: "yes", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 C.PI_DESCRIPTION: _("""Real-time Transport Protocol (RTP) is used for A/V calls"""), |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 } |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 CONFIRM = D_("{peer} wants to start a call ({call_type}) with you, do you accept?") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 CONFIRM_TITLE = D_("Incoming Call") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 SECURITY_LIMIT = 0 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 ALLOWED_ACTIONS = ( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 "active", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 "hold", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 "unhold", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 "mute", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 "unmute", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 "ringing", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 class XEP_0167(BaseApplicationHandler): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 def __init__(self, host): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 log.info(f'Plugin "{PLUGIN_INFO[C.PI_NAME]}" initialization') |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 self.host = host |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 # FIXME: to be removed once host is accessible from global var |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 mapping.host = host |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 self._j = host.plugins["XEP-0166"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 self._j.register_application(NS_JINGLE_RTP, self) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 host.bridge.add_method( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 "call_start", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 ".plugin", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 in_sign="sss", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 out_sign="s", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 method=self._call_start, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 async_=True, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 host.bridge.add_method( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 "call_info", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 ".plugin", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 in_sign="ssss", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 out_sign="", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 method=self._call_start, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 host.bridge.add_signal( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 "call_accepted", ".plugin", signature="sss" |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 ) # args: session_id, answer_sdp, profile |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 host.bridge.add_signal( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 "call_info", ".plugin", signature="ssss" |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 ) # args: session_id, info_type, extra, profile |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 def get_handler(self, client): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 return XEP_0167_handler() |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 # bridge methods |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 def _call_start( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 self, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 entity_s: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 call_data_s: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 profile_key: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 ): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 client = self.host.get_client(profile_key) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 return defer.ensureDeferred( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 self.call_start( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 client, jid.JID(entity_s), data_format.deserialise(call_data_s) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
122 async def call_start( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 self, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 client: SatXMPPEntity, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 peer_jid: jid.JID, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 call_data: dict, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 media: str = "video", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
128 ) -> None: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 """Temporary method to test RTP session""" |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
130 contents = [] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
131 metadata = call_data.get("metadata") or {} |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
132 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
133 if "sdp" in call_data: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
134 sdp_data = mapping.parse_sdp(call_data["sdp"]) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
135 for media_type in ("audio", "video"): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
136 try: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
137 media_data = sdp_data.pop(media_type) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
138 except KeyError: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
139 continue |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
140 call_data[media_type] = media_data["application_data"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
141 transport_data = media_data["transport_data"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
142 try: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
143 call_data[media_type]["fingerprint"] = transport_data["fingerprint"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
144 except KeyError: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
145 log.warning("fingerprint is missing") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
146 pass |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
147 try: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
148 call_data[media_type]["id"] = media_data["id"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
149 except KeyError: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
150 log.warning(f"no media ID found for {media_type}: {media_data}") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
151 try: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
152 call_data[media_type]["ice-candidates"] = transport_data["candidates"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
153 metadata["ice-ufrag"] = transport_data["ufrag"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
154 metadata["ice-pwd"] = transport_data["pwd"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
155 except KeyError: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
156 log.warning("ICE data are missing from SDP") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
157 continue |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
158 metadata.update(sdp_data.get("metadata", {})) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
159 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
160 call_type = ( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
161 C.META_SUBTYPE_CALL_VIDEO |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
162 if "video" in call_data |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
163 else C.META_SUBTYPE_CALL_AUDIO |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
164 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
165 seen_names = set() |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
166 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
167 for media in ("audio", "video"): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
168 media_data = call_data.get(media) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
169 if media_data is not None: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
170 content = { |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
171 "app_ns": NS_JINGLE_RTP, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
172 "senders": "both", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
173 "transport_type": self._j.TRANSPORT_DATAGRAM, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
174 "app_kwargs": {"media": media, "media_data": media_data}, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
175 "transport_data": { |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
176 "local_ice_data": { |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
177 "ufrag": metadata["ice-ufrag"], |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
178 "pwd": metadata["ice-pwd"], |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
179 "candidates": media_data.pop("ice-candidates"), |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
180 "fingerprint": media_data.pop("fingerprint", {}), |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
181 } |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
182 }, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
183 } |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
184 if "id" in media_data: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
185 name = media_data.pop("id") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
186 if name in seen_names: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
187 raise exceptions.DataError( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
188 f"Content name (mid) seen multiple times: {name}" |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
189 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
190 content["name"] = name |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
191 contents.append(content) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
192 if not contents: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
193 raise exceptions.DataError("no valid media data found: {call_data}") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
194 return await self._j.initiate( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
195 client, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
196 peer_jid, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
197 contents, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
198 call_type=call_type, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
199 metadata=metadata, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
200 peer_metadata={}, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
201 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
202 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
203 # jingle callbacks |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
204 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
205 def jingle_session_init( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
206 self, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
207 client: SatXMPPEntity, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
208 session: dict, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
209 content_name: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
210 media: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
211 media_data: dict, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
212 ) -> domish.Element: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
213 if media not in ("audio", "video"): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
214 raise ValueError('only "audio" and "video" media types are supported') |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
215 content_data = session["contents"][content_name] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
216 application_data = content_data["application_data"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
217 application_data["media"] = media |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
218 application_data["local_data"] = media_data |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
219 desc_elt = mapping.build_description(media, media_data, session) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
220 self.host.trigger.point( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
221 "XEP-0167_jingle_session_init", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
222 client, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
223 session, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
224 content_name, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
225 media, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
226 media_data, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
227 desc_elt, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
228 triggers_no_cancel=True, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
229 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
230 return desc_elt |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
231 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
232 async def jingle_request_confirmation( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
233 self, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
234 client: SatXMPPEntity, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
235 action: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
236 session: dict, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
237 content_name: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
238 desc_elt: domish.Element, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
239 ) -> bool: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
240 if content_name != next(iter(session["contents"])): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
241 # we request confirmation only for the first content, all others are |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
242 # automatically accepted. In practice, that means that the call confirmation |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
243 # is requested only once for audio and video contents. |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
244 return True |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
245 peer_jid = session["peer_jid"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
246 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
247 if any( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
248 c["desc_elt"].getAttribute("media") == "video" |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
249 for c in session["contents"].values() |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
250 ): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
251 call_type = session["call_type"] = C.META_SUBTYPE_CALL_VIDEO |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
252 else: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
253 call_type = session["call_type"] = C.META_SUBTYPE_CALL_AUDIO |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
254 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
255 sdp = mapping.generate_sdp_from_session(session) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
256 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
257 resp_data = await xml_tools.defer_dialog( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
258 self.host, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
259 _(CONFIRM).format(peer=peer_jid.userhost(), call_type=call_type), |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
260 _(CONFIRM_TITLE), |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
261 action_extra={ |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
262 "session_id": session["id"], |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
263 "from_jid": peer_jid.full(), |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
264 "type": C.META_TYPE_CALL, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
265 "sub_type": call_type, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
266 "sdp": sdp, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
267 }, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
268 security_limit=SECURITY_LIMIT, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
269 profile=client.profile, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
270 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
271 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
272 if resp_data.get("cancelled", False): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
273 return False |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
274 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
275 answer_sdp = resp_data["sdp"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
276 parsed_answer = mapping.parse_sdp(answer_sdp) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
277 session["peer_metadata"].update(parsed_answer["metadata"]) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
278 for media in ("audio", "video"): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
279 for content in session["contents"].values(): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
280 if content["desc_elt"].getAttribute("media") == media: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
281 media_data = parsed_answer[media] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
282 application_data = content["application_data"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
283 application_data["local_data"] = media_data["application_data"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
284 transport_data = content["transport_data"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
285 local_ice_data = media_data["transport_data"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
286 transport_data["local_ice_data"] = local_ice_data |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
287 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
288 return True |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
289 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
290 async def jingle_handler(self, client, action, session, content_name, desc_elt): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
291 content_data = session["contents"][content_name] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
292 application_data = content_data["application_data"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
293 if action == self._j.A_PREPARE_CONFIRMATION: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
294 session["metadata"] = {} |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
295 session["peer_metadata"] = {} |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
296 try: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
297 media = application_data["media"] = desc_elt["media"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
298 except KeyError: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
299 raise exceptions.DataError('"media" key is missing in {desc_elt.toXml()}') |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
300 if media not in ("audio", "video"): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
301 raise exceptions.DataError(f"invalid media: {media!r}") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
302 application_data["peer_data"] = mapping.parse_description(desc_elt) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
303 elif action == self._j.A_SESSION_INITIATE: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
304 application_data["peer_data"] = mapping.parse_description(desc_elt) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
305 desc_elt = mapping.build_description( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
306 application_data["media"], application_data["local_data"], session |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
307 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
308 elif action == self._j.A_ACCEPTED_ACK: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
309 pass |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
310 elif action == self._j.A_PREPARE_INITIATOR: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
311 application_data["peer_data"] = mapping.parse_description(desc_elt) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
312 elif action == self._j.A_SESSION_ACCEPT: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
313 if content_name == next(iter(session["contents"])): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
314 # we only send the signal for first content, as it means that the whole |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
315 # session is accepted |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
316 answer_sdp = mapping.generate_sdp_from_session(session) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
317 self.host.bridge.call_accepted(session["id"], answer_sdp, client.profile) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
318 else: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
319 log.warning(f"FIXME: unmanaged action {action}") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
320 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
321 self.host.trigger.point( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
322 "XEP-0167_jingle_handler", |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
323 client, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
324 action, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
325 session, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
326 content_name, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
327 desc_elt, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
328 triggers_no_cancel=True, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
329 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
330 return desc_elt |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
331 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
332 def jingle_session_info( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
333 self, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
334 client: SatXMPPEntity, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
335 action: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
336 session: dict, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
337 content_name: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
338 jingle_elt: domish.Element, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
339 ) -> None: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
340 """Informational messages""" |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
341 for elt in jingle_elt.elements(): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
342 if elt.uri == NS_JINGLE_RTP_INFO: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
343 info_type = elt.name |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
344 if info_type not in ALLOWED_ACTIONS: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
345 log.warning("ignoring unknow info type: {info_type!r}") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
346 continue |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
347 extra = {} |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
348 if info_type in ("mute", "unmute"): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
349 name = elt.getAttribute("name") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
350 if name: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
351 extra["name"] = name |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
352 log.debug(f"{info_type} call info received (extra: {extra})") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
353 self.host.bridge.call_info( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
354 session["id"], info_type, data_format.serialise(extra), client.profile |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
355 ) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
356 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
357 def _call_info(self, session_id, info_type, extra_s, profile_key): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
358 client = self.host.get_client(profile_key) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
359 extra = data_format.deserialise(extra_s) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
360 return self.send_info(client, session_id, info_type, extra) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
361 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
362 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
363 def send_info( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
364 self, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
365 client: SatXMPPEntity, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
366 session_id: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
367 info_type: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
368 extra: Optional[dict], |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
369 ) -> None: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
370 """Send information on the call""" |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
371 if info_type not in ALLOWED_ACTIONS: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
372 raise ValueError(f"Unkown info type {info_type!r}") |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
373 session = self._j.get_session(client, session_id) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
374 iq_elt, jingle_elt = self._j.build_session_info(client, session) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
375 info_elt = jingle_elt.addElement((NS_JINGLE_RTP_INFO, info_type)) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
376 if extra and info_type in ("mute", "unmute") and "name" in extra: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
377 info_elt["name"] = extra["name"] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
378 iq_elt.send() |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
379 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
380 def jingle_terminate( |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
381 self, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
382 client: SatXMPPEntity, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
383 action: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
384 session: dict, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
385 content_name: str, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
386 reason_elt: domish.Element, |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
387 ) -> None: |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
388 pass |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
389 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
390 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
391 @implementer(iwokkel.IDisco) |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
392 class XEP_0167_handler(XMPPHandler): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
393 def getDiscoInfo(self, requestor, target, nodeIdentifier=""): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
394 return [ |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
395 disco.DiscoFeature(NS_JINGLE_RTP), |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
396 disco.DiscoFeature(NS_JINGLE_RTP_AUDIO), |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
397 disco.DiscoFeature(NS_JINGLE_RTP_VIDEO), |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
398 ] |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
399 |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
400 def getDiscoItems(self, requestor, target, nodeIdentifier=""): |
1c4f4aa36d98
plugin XEP-0167: Jingle RTP Sessions implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
401 return [] |