Mercurial > libervia-backend
annotate libervia/backend/plugins/plugin_xep_0176.py @ 4242:8acf46ed7f36
frontends: remote control implementation:
This is the frontends common part of remote control implementation. It handle the creation
of WebRTC session, and management of inputs. For now the reception use freedesktop.org
Desktop portal, and works mostly with Wayland based Desktop Environments.
rel 436
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 11 May 2024 13:52:43 +0200 |
parents | e11b13418ba6 |
children | 0d7bb4df2343 |
rev | line source |
---|---|
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 # Libervia plugin for Jingle (XEP-0176) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # Copyright (C) 2009-2023 Jérôme Poisson (goffi@goffi.org) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or modify |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # it under the terms of the GNU Affero General Public License as published by |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # the Free Software Foundation, either version 3 of the License, or |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # (at your option) any later version. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # GNU Affero General Public License for more details. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 # You should have received a copy of the GNU Affero General Public License |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 from typing import Dict, List, Optional |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 import uuid |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 from twisted.internet import defer |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 from twisted.words.protocols.jabber.xmlstream import XMPPHandler |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 from twisted.words.xish import domish |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 from wokkel import disco, iwokkel |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 from zope.interface import implementer |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 |
4071
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4054
diff
changeset
|
28 from libervia.backend.core import exceptions |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4054
diff
changeset
|
29 from libervia.backend.core.constants import Const as C |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4054
diff
changeset
|
30 from libervia.backend.core.core_types import SatXMPPEntity |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4054
diff
changeset
|
31 from libervia.backend.core.i18n import _ |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4054
diff
changeset
|
32 from libervia.backend.core.log import getLogger |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4054
diff
changeset
|
33 from libervia.backend.tools.common import data_format |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 from .plugin_xep_0166 import BaseTransportHandler |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 log = getLogger(__name__) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
39 NS_JINGLE_ICE_UDP = "urn:xmpp:jingle:transports:ice-udp:1" |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 PLUGIN_INFO = { |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 C.PI_NAME: "Jingle ICE-UDP Transport Method", |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 C.PI_IMPORT_NAME: "XEP-0176", |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 C.PI_TYPE: "XEP", |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 C.PI_MODES: C.PLUG_MODE_BOTH, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 C.PI_PROTOCOLS: ["XEP-0176"], |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 C.PI_DEPENDENCIES: ["XEP-0166"], |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 C.PI_RECOMMENDATIONS: [], |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 C.PI_MAIN: "XEP_0176", |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 C.PI_HANDLER: "yes", |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 C.PI_DESCRIPTION: _("""Implementation of Jingle ICE-UDP transport"""), |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 } |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 class XEP_0176(BaseTransportHandler): |
4231
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
56 namespace = NS_JINGLE_ICE_UDP |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
57 |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 def __init__(self, host): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 log.info(f"plugin {PLUGIN_INFO[C.PI_NAME]!r} initialization") |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 self.host = host |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 self._j = host.plugins["XEP-0166"] # shortcut to access jingle |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 self._j.register_transport( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 NS_JINGLE_ICE_UDP, self._j.TRANSPORT_DATAGRAM, self, 100 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 host.bridge.add_method( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 "ice_candidates_add", |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 ".plugin", |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 in_sign="sss", |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 out_sign="", |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 method=self._ice_candidates_add, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 async_=True, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 host.bridge.add_signal( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 "ice_candidates_new", ".plugin", signature="sss" |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 ) # args: jingle_sid, candidates_serialised, profile |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 host.bridge.add_signal( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 "ice_restart", ".plugin", signature="sss" |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 ) # args: jingle_sid, side ("local" or "peer"), profile |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 def get_handler(self, client): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 return XEP_0176_handler() |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 def _ice_candidates_add( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 self, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 session_id: str, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 media_ice_data_s: str, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 profile_key: str, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 ): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 client = self.host.get_client(profile_key) |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
90 return defer.ensureDeferred( |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
91 self.ice_candidates_add( |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
92 client, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
93 session_id, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
94 data_format.deserialise(media_ice_data_s), |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
95 ) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
96 ) |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 def build_transport(self, ice_data: dict) -> domish.Element: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 """Generate <transport> element from ICE data |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 @param ice_data: a dict containing the following keys: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 - "ufrag" (str): The ICE username fragment. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 - "pwd" (str): The ICE password. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 - "candidates" (List[dict]): A list of ICE candidate dictionaries, each |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 containing: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 - "component_id" (int): The component ID. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 - "foundation" (str): The candidate foundation. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 - "address" (str): The candidate IP address. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 - "port" (int): The candidate port. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 - "priority" (int): The candidate priority. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 - "transport" (str): The candidate transport protocol, e.g., "udp". |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 - "type" (str): The candidate type, e.g., "host", "srflx", "prflx", or |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 "relay". |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 - "generation" (str, optional): The candidate generation. Defaults to "0". |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 - "network" (str, optional): The candidate network. Defaults to "0". |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 - "rel_addr" (str, optional): The related address for the candidate, if |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 any. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 - "rel_port" (int, optional): The related port for the candidate, if any. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 @return: A <transport> element. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 """ |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
122 try: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 ufrag: str = ice_data["ufrag"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 pwd: str = ice_data["pwd"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 except KeyError as e: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 raise exceptions.DataError(f"ICE {e} must be provided") |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
127 candidates: List[dict] = ice_data.get("candidates", []) |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
128 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 candidates.sort(key=lambda c: int(c.get("priority", 0)), reverse=True) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
130 transport_elt = domish.Element( |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
131 (NS_JINGLE_ICE_UDP, "transport"), attribs={"ufrag": ufrag, "pwd": pwd} |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
132 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
133 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
134 for candidate in candidates: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
135 try: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
136 candidate_elt = transport_elt.addElement("candidate") |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
137 candidate_elt["component"] = str(candidate["component_id"]) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
138 candidate_elt["foundation"] = candidate["foundation"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
139 candidate_elt["generation"] = str(candidate.get("generation", "0")) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
140 candidate_elt["id"] = candidate.get("id") or str(uuid.uuid4()) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
141 candidate_elt["ip"] = candidate["address"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
142 candidate_elt["network"] = str(candidate.get("network", "0")) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
143 candidate_elt["port"] = str(candidate["port"]) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
144 candidate_elt["priority"] = str(candidate["priority"]) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
145 candidate_elt["protocol"] = candidate["transport"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
146 candidate_elt["type"] = candidate["type"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
147 except KeyError as e: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
148 raise exceptions.DataError( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
149 f"Mandatory ICE candidate attribute {e} is missing" |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
150 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
151 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
152 if "rel_addr" in candidate and "rel_port" in candidate: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
153 candidate_elt["rel-addr"] = candidate["rel_addr"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
154 candidate_elt["rel-port"] = str(candidate["rel_port"]) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
155 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
156 self.host.trigger.point("XEP-0176_build_transport", transport_elt, ice_data) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
157 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
158 return transport_elt |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
159 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
160 def parse_transport(self, transport_elt: domish.Element) -> dict: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
161 """Parse <transport> to a dict |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
162 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
163 @param transport_elt: <transport> element |
4054
4c8bf67bfbeb
plugin XEP-0176: fix candidates data format when calling Bridge's `ice_candidates_new`
Goffi <goffi@goffi.org>
parents:
4052
diff
changeset
|
164 @return: ICE data (as in [build_transport]) |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
165 """ |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
166 try: |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
167 ice_data = {"ufrag": transport_elt["ufrag"], "pwd": transport_elt["pwd"]} |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
168 except KeyError as e: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
169 raise exceptions.DataError( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
170 f"<transport> is missing mandatory attribute {e}: {transport_elt.toXml()}" |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
171 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
172 ice_data["candidates"] = ice_candidates = [] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
173 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
174 for candidate_elt in transport_elt.elements(NS_JINGLE_ICE_UDP, "candidate"): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
175 try: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
176 candidate = { |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
177 "component_id": int(candidate_elt["component"]), |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
178 "foundation": candidate_elt["foundation"], |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
179 "address": candidate_elt["ip"], |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
180 "port": int(candidate_elt["port"]), |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
181 "priority": int(candidate_elt["priority"]), |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
182 "transport": candidate_elt["protocol"], |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
183 "type": candidate_elt["type"], |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
184 } |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
185 except KeyError as e: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
186 raise exceptions.DataError( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
187 f"Mandatory attribute {e} is missing in candidate element" |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
188 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
189 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
190 if candidate_elt.hasAttribute("generation"): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
191 candidate["generation"] = candidate_elt["generation"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
192 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
193 if candidate_elt.hasAttribute("network"): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
194 candidate["network"] = candidate_elt["network"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
195 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
196 if candidate_elt.hasAttribute("rel-addr"): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
197 candidate["rel_addr"] = candidate_elt["rel-addr"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
198 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
199 if candidate_elt.hasAttribute("rel-port"): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
200 candidate["rel_port"] = int(candidate_elt["rel-port"]) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
201 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
202 ice_candidates.append(candidate) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
203 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
204 self.host.trigger.point("XEP-0176_parse_transport", transport_elt, ice_data) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
205 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
206 return ice_data |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
207 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
208 async def jingle_session_init( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
209 self, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
210 client: SatXMPPEntity, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
211 session: dict, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
212 content_name: str, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
213 ) -> domish.Element: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
214 """Create a Jingle session initiation transport element with ICE candidates. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
215 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
216 @param client: SatXMPPEntity object representing the client. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
217 @param session: Dictionary containing session data. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
218 @param content_name: Name of the content. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
219 @param ufrag: ICE username fragment. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
220 @param pwd: ICE password. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
221 @param candidates: List of ICE candidate dictionaries parsed from the |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
222 parse_ice_candidate method. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
223 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
224 @return: domish.Element representing the Jingle transport element. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
225 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
226 @raise exceptions.DataError: If mandatory data is missing from the candidates. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
227 """ |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
228 content_data = session["contents"][content_name] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
229 transport_data = content_data["transport_data"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
230 ice_data = transport_data["local_ice_data"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
231 return self.build_transport(ice_data) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
232 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
233 async def jingle_handler( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
234 self, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
235 client: SatXMPPEntity, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
236 action: str, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
237 session: dict, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
238 content_name: str, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
239 transport_elt: domish.Element, |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
240 ) -> domish.Element: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
241 """Handle Jingle requests |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
242 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
243 @param client: The SatXMPPEntity instance. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
244 @param action: The action to be performed with the session. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
245 @param session: A dictionary containing the session information. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
246 @param content_name: The name of the content. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
247 @param transport_elt: The domish.Element instance representing the transport |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
248 element. |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
249 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
250 @return: <transport> element |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
251 """ |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
252 content_data = session["contents"][content_name] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
253 transport_data = content_data["transport_data"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
254 if action in (self._j.A_PREPARE_CONFIRMATION, self._j.A_PREPARE_INITIATOR): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
255 peer_ice_data = self.parse_transport(transport_elt) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
256 transport_data["peer_ice_data"] = peer_ice_data |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
257 |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
258 elif action == self._j.A_ACCEPTED_ACK: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
259 buffer = session.pop("XEP-0176_handler_buffer", None) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
260 if buffer: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
261 log.debug("replaying buffered events") |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
262 for args in buffer: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
263 await self.jingle_handler(*args) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
264 elif action == self._j.A_PREPARE_RESPONDER: |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
265 pass |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
266 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
267 elif action == self._j.A_SESSION_ACCEPT: |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
268 # we check if we have any buffered ICE candidates, and send them if it's the |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
269 # case |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
270 media_type = content_data["application_data"].get("media") |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
271 try: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
272 buffer = session["XEP-0176_buffer"] |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
273 buffered_ice_data = buffer.pop(media_type) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
274 except KeyError: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
275 pass |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
276 else: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
277 if not buffer: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
278 del session["XEP-0176_buffer"] |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
279 transport_elt = self.build_transport(buffered_ice_data) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
280 iq_elt, __ = self._j.build_action( |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
281 client, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
282 self._j.A_TRANSPORT_INFO, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
283 session, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
284 content_name, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
285 context_elt=transport_elt, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
286 ) |
4231
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
287 self.host.trigger.point( |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
288 "XEP-0176_jingle_handler_send_buffer", |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
289 client, |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
290 session, |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
291 content_name, |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
292 content_data, |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
293 transport_elt, |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
294 iq_elt |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
295 ) |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
296 await iq_elt.send() |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
297 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
298 elif action == self._j.A_START: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
299 pass |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
300 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
301 elif action == self._j.A_SESSION_INITIATE: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
302 # responder side, we give our candidates |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
303 transport_elt = self.build_transport(transport_data["local_ice_data"]) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
304 elif action == self._j.A_TRANSPORT_INFO: |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
305 if session["state"] == self._j.STATE_PENDING: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
306 # Session is not yet active; we buffer the arguments to replay them |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
307 # when the session becomes active. This makes the frontend's life easier. |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
308 log.debug("session is not active yet, buffering transport-info element") |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
309 buffer = session.setdefault("XEP-0176_handler_buffer", []) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
310 buffer.append([client, action, session, content_name, transport_elt]) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
311 return transport_elt |
4054
4c8bf67bfbeb
plugin XEP-0176: fix candidates data format when calling Bridge's `ice_candidates_new`
Goffi <goffi@goffi.org>
parents:
4052
diff
changeset
|
312 |
4c8bf67bfbeb
plugin XEP-0176: fix candidates data format when calling Bridge's `ice_candidates_new`
Goffi <goffi@goffi.org>
parents:
4052
diff
changeset
|
313 media_type = content_data["application_data"].get("media") |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
314 new_ice_data = self.parse_transport(transport_elt) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
315 restart = self.update_candidates(transport_data, new_ice_data, local=False) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
316 if restart: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
317 log.debug( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
318 f"Peer ICE restart detected on session {session['id']} " |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
319 f"[{client.profile}]" |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
320 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
321 self.host.bridge.ice_restart(session["id"], "peer", client.profile) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
322 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
323 self.host.bridge.ice_candidates_new( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
324 session["id"], |
4054
4c8bf67bfbeb
plugin XEP-0176: fix candidates data format when calling Bridge's `ice_candidates_new`
Goffi <goffi@goffi.org>
parents:
4052
diff
changeset
|
325 data_format.serialise({media_type: new_ice_data}), |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
326 client.profile, |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
327 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
328 elif action == self._j.A_DESTROY: |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
329 pass |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
330 else: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
331 log.warning("FIXME: unmanaged action {}".format(action)) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
332 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
333 return transport_elt |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
334 |
4052
2ced30f6d5de
plugin XEP-0166, 0176, 0234: minor renaming + type hints
Goffi <goffi@goffi.org>
parents:
4045
diff
changeset
|
335 def jingle_terminate( |
2ced30f6d5de
plugin XEP-0166, 0176, 0234: minor renaming + type hints
Goffi <goffi@goffi.org>
parents:
4045
diff
changeset
|
336 self, |
2ced30f6d5de
plugin XEP-0166, 0176, 0234: minor renaming + type hints
Goffi <goffi@goffi.org>
parents:
4045
diff
changeset
|
337 client: SatXMPPEntity, |
2ced30f6d5de
plugin XEP-0166, 0176, 0234: minor renaming + type hints
Goffi <goffi@goffi.org>
parents:
4045
diff
changeset
|
338 action: str, |
2ced30f6d5de
plugin XEP-0166, 0176, 0234: minor renaming + type hints
Goffi <goffi@goffi.org>
parents:
4045
diff
changeset
|
339 session: dict, |
2ced30f6d5de
plugin XEP-0166, 0176, 0234: minor renaming + type hints
Goffi <goffi@goffi.org>
parents:
4045
diff
changeset
|
340 content_name: str, |
2ced30f6d5de
plugin XEP-0166, 0176, 0234: minor renaming + type hints
Goffi <goffi@goffi.org>
parents:
4045
diff
changeset
|
341 reason_elt: domish.Element, |
2ced30f6d5de
plugin XEP-0166, 0176, 0234: minor renaming + type hints
Goffi <goffi@goffi.org>
parents:
4045
diff
changeset
|
342 ) -> None: |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
343 log.debug("ICE-UDP session terminated") |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
344 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
345 def update_candidates( |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
346 self, transport_data: dict, new_ice_data: dict, local: bool |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
347 ) -> bool: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
348 """Update ICE candidates when new one are received |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
349 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
350 @param transport_data: transport_data of the content linked to the candidates |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
351 @param new_ice_data: new ICE data, in the same format as returned |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
352 by [self.parse_transport] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
353 @param local: True if it's our candidates, False if it's peer ones |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
354 @return: True if there is a ICE restart |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
355 """ |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
356 key = "local_ice_data" if local else "peer_ice_data" |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
357 try: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
358 ice_data = transport_data[key] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
359 except KeyError: |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
360 log.warning(f"no {key} available") |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
361 transport_data[key] = new_ice_data |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
362 else: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
363 if ( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
364 new_ice_data["ufrag"] != ice_data["ufrag"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
365 or new_ice_data["pwd"] != ice_data["pwd"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
366 ): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
367 ice_data["ufrag"] = new_ice_data["ufrag"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
368 ice_data["pwd"] = new_ice_data["pwd"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
369 ice_data["candidates"] = new_ice_data["candidates"] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
370 return True |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
371 return False |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
372 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
373 async def ice_candidates_add( |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
374 self, client: SatXMPPEntity, session_id: str, media_ice_data: Dict[str, dict] |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
375 ) -> None: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
376 """Called when a new ICE candidates are available for a session |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
377 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
378 @param session_id: Session ID |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
379 @param media_ice_data: a map from media type (audio, video) to ICE data |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
380 ICE data must be in the same format as in [self.parse_transport] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
381 """ |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
382 session = self._j.get_session(client, session_id) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
383 iq_elt: Optional[domish.Element] = None |
4231
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
384 content_name: str|None = None |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
385 content_data: dict|None = None |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
386 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
387 for media_type, new_ice_data in media_ice_data.items(): |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
388 if session["state"] == self._j.STATE_PENDING: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
389 log.debug(f"session not active, buffering") |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
390 buffer = session.setdefault("XEP-0176_buffer", {}) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
391 media_buffer = buffer.setdefault(media_type, {}) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
392 |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
393 for key in ["ufrag", "pwd"]: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
394 if key not in media_buffer: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
395 media_buffer[key] = new_ice_data[key] |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
396 else: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
397 if media_buffer[key] != new_ice_data[key]: |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
398 log.warning( |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
399 f"{key} conflict, new value will replace old one\n" |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
400 f"buffer={media_buffer[key]!r}\n" |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
401 f"new={new_ice_data[key]!r}" |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
402 ) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
403 media_buffer[key] = new_ice_data[key] |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
404 |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
405 media_buffer.setdefault("candidates", []).extend( |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
406 new_ice_data["candidates"] |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
407 ) |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
408 continue |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
409 |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
410 for content_name, content_data in session["contents"].items(): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
411 if content_data["application_data"].get("media") == media_type: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
412 break |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
413 else: |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
414 log.warning(f"no media of type {media_type} has been found") |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
415 continue |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
416 restart = self.update_candidates( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
417 content_data["transport_data"], new_ice_data, True |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
418 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
419 if restart: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
420 log.debug( |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
421 f"Local ICE restart detected on session {session['id']} " |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
422 f"[{client.profile}]" |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
423 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
424 self.host.bridge.ice_restart(session["id"], "local", client.profile) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
425 transport_elt = self.build_transport(new_ice_data) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
426 iq_elt, __ = self._j.build_action( |
4116
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
427 client, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
428 self._j.A_TRANSPORT_INFO, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
429 session, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
430 content_name, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
431 iq_elt=iq_elt, |
23fa52acf72c
plugin XEP-0167, XEP-0176: transport-info and ICE candidate sending are delayed if session is not active yet
Goffi <goffi@goffi.org>
parents:
4071
diff
changeset
|
432 context_elt=transport_elt, |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
433 ) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
434 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
435 if iq_elt is not None: |
4231
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
436 assert content_name is not None and content_data is not None |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
437 try: |
4231
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
438 self.host.trigger.point( |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
439 "XEP-0176_ice_candidate_send", client, session, media_ice_data, |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
440 content_name, content_data, iq_elt |
e11b13418ba6
plugin XEP-0353, XEP-0234, jingle: WebRTC data channel signaling implementation:
Goffi <goffi@goffi.org>
parents:
4116
diff
changeset
|
441 ) |
4045
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
442 await iq_elt.send() |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
443 except Exception as e: |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
444 log.warning(f"Could not send new ICE candidates: {e}") |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
445 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
446 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
447 @implementer(iwokkel.IDisco) |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
448 class XEP_0176_handler(XMPPHandler): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
449 def getDiscoInfo(self, requestor, target, nodeIdentifier=""): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
450 return [disco.DiscoFeature(NS_JINGLE_ICE_UDP)] |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
451 |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
452 def getDiscoItems(self, requestor, target, nodeIdentifier=""): |
ae756bf7c3e8
plugin XEP-0176: Jingle ICE-UDP Transport Method implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
453 return [] |