Mercurial > libervia-backend
annotate libervia/backend/plugins/plugin_xep_0294.py @ 4320:9658c534287e
plugin XEP-0215, XEP-0376: fix bad calls to `hasFeature`:
`hasFeature` was called like blocking code, missing the `await`. This has been fixed, and
is now using the `memory.disco.has_feature` version.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 30 Sep 2024 14:14:38 +0200 |
parents | 4b842c1fb686 |
children |
rev | line source |
---|---|
4062
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 # Libervia plugin |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # Copyright (C) 2009-2023 Jérôme Poisson (goffi@goffi.org) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or modify |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # it under the terms of the GNU Affero General Public License as published by |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # the Free Software Foundation, either version 3 of the License, or |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # (at your option) any later version. |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # GNU Affero General Public License for more details. |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 # You should have received a copy of the GNU Affero General Public License |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 from typing import Dict, List, Optional, Union |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 from twisted.words.protocols.jabber.xmlstream import XMPPHandler |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 from twisted.words.xish import domish |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 from wokkel import disco, iwokkel |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 from zope.interface import implementer |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 |
4071
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4062
diff
changeset
|
26 from libervia.backend.core import exceptions |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4062
diff
changeset
|
27 from libervia.backend.core.constants import Const as C |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4062
diff
changeset
|
28 from libervia.backend.core.i18n import _ |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4062
diff
changeset
|
29 from libervia.backend.core.log import getLogger |
4062
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 log = getLogger(__name__) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 NS_JINGLE_RTP_HDREXT = "urn:xmpp:jingle:apps:rtp:rtp-hdrext:0" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 PLUGIN_INFO = { |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 C.PI_NAME: "Jingle RTP Header Extensions Negotiation", |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 C.PI_IMPORT_NAME: "XEP-0294", |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 C.PI_TYPE: "XEP", |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 C.PI_MODES: C.PLUG_MODE_BOTH, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 C.PI_PROTOCOLS: ["XEP-0294"], |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 C.PI_DEPENDENCIES: ["XEP-0167"], |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 C.PI_RECOMMENDATIONS: [], |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 C.PI_MAIN: "XEP_0294", |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 C.PI_HANDLER: "yes", |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 C.PI_DESCRIPTION: _("""Jingle RTP Header Extensions Negotiation"""), |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 } |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 class XEP_0294: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 def __init__(self, host): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 log.info(f"plugin {PLUGIN_INFO[C.PI_NAME]!r} initialization") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 host.trigger.add("XEP-0167_parse_sdp_a", self._parse_sdp_a_trigger) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 host.trigger.add( |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 "XEP-0167_generate_sdp_content", self._generate_sdp_content_trigger |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 ) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 host.trigger.add("XEP-0167_parse_description", self._parse_description_trigger) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 host.trigger.add("XEP-0167_build_description", self._build_description_trigger) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 def get_handler(self, client): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 return XEP_0294_handler() |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 def _parse_extmap(self, parts: List[str], application_data: dict) -> None: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 """Parse an individual extmap line and fill application_data accordingly""" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 if "/" in parts[0]: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 id_, direction = parts[0].split("/", 1) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 else: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 id_ = parts[0] |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 direction = None |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 uri = parts[1] |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 attributes = parts[2:] |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 if direction in (None, "sendrecv"): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 senders = "both" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 elif direction == "sendonly": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 senders = "initiator" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 elif direction == "recvonly": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 senders = "responder" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 elif direction == "inactive": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 senders = "none" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 else: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 log.warning(f"invalid direction for extmap: {direction}") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 senders = "sendrecv" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 rtp_hdr_ext_data: Dict[str, Union[str, dict]] = { |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 "id": id_, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 "uri": uri, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 "senders": senders, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 } |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 if attributes: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 parameters = {} |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 for attribute in attributes: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 name, *value = attribute.split("=", 1) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 parameters[name] = value[0] if value else None |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 rtp_hdr_ext_data["parameters"] = parameters |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 application_data.setdefault("rtp-hdrext", {})[id_] = rtp_hdr_ext_data |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 def _parse_sdp_a_trigger( |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 self, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 attribute: str, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 parts: List[str], |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 call_data: dict, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 metadata: dict, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 media_type: str, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 application_data: Optional[dict], |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 transport_data: dict, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 ) -> None: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 """Parse "extmap" and "extmap-allow-mixed" attributes""" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 if attribute == "extmap": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 if application_data is None: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 call_data.setdefault("_extmaps", []).append(parts) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 else: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 self._parse_extmap(parts, application_data) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 elif attribute == "extmap-allow-mixed": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 if application_data is None: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 call_data["_extmap-allow-mixed"] = True |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 else: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 application_data["extmap-allow-mixed"] = True |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 elif ( |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 application_data is not None |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
122 and "_extmaps" in call_data |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 and "rtp-hdrext" not in application_data |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 ): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 extmaps = call_data.pop("_extmaps") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 for parts in extmaps: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 self._parse_extmap(parts, application_data) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
128 elif ( |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 application_data is not None |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
130 and "_extmap-allow-mixed" in call_data |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
131 and "extmap-allow-mixed" not in application_data |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
132 ): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
133 value = call_data.pop("_extmap-allow-mixed") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
134 application_data["extmap-allow-mixed"] = value |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
135 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
136 def _generate_sdp_content_trigger( |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
137 self, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
138 session: dict, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
139 local: bool, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
140 idx: int, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
141 content_data: dict, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
142 sdp_lines: List[str], |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
143 application_data: dict, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
144 app_data_key: str, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
145 media_data: dict, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
146 media: str, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
147 ) -> None: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
148 """Generate "extmap" and "extmap-allow-mixed" attributes""" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
149 rtp_hdrext_dict = media_data.get("rtp-hdrext", {}) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
150 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
151 for id_, ext_data in rtp_hdrext_dict.items(): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
152 senders = ext_data.get("senders") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
153 if senders in (None, "both"): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
154 direction = "sendrecv" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
155 elif senders == "initiator": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
156 direction = "sendonly" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
157 elif senders == "responder": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
158 direction = "recvonly" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
159 elif senders == "none": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
160 direction = "inactive" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
161 else: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
162 raise exceptions.InternalError( |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
163 f"Invalid senders value for extmap: {ext_data.get('senders')}" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
164 ) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
165 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
166 parameters_str = "" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
167 if "parameters" in ext_data: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
168 parameters_str = " " + " ".join( |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
169 f"{k}={v}" if v is not None else f"{k}" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
170 for k, v in ext_data["parameters"].items() |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
171 ) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
172 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
173 sdp_lines.append( |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
174 f"a=extmap:{id_}/{direction} {ext_data['uri']}{parameters_str}" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
175 ) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
176 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
177 if media_data.get("extmap-allow-mixed", False): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
178 sdp_lines.append("a=extmap-allow-mixed") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
179 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
180 def _parse_description_trigger( |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
181 self, desc_elt: domish.Element, media_data: dict |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
182 ) -> None: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
183 """Parse the <rtp-hdrext> and <extmap-allow-mixed> elements""" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
184 for rtp_hdrext_elt in desc_elt.elements(NS_JINGLE_RTP_HDREXT, "rtp-hdrext"): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
185 id_ = rtp_hdrext_elt["id"] |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
186 uri = rtp_hdrext_elt["uri"] |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
187 senders = rtp_hdrext_elt.getAttribute("senders", "both") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
188 # FIXME: workaround for Movim bug https://github.com/movim/movim/issues/1212 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
189 if senders in ("sendonly", "recvonly", "sendrecv", "inactive"): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
190 log.warning("Movim bug workaround for wrong extmap value") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
191 if senders == "sendonly": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
192 senders = "initiator" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
193 elif senders == "recvonly": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
194 senders = "responder" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
195 elif senders == "sendrecv": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
196 senders = "both" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
197 else: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
198 senders = "none" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
199 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
200 media_data.setdefault("rtp-hdrext", {})[id_] = { |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
201 "id": id_, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
202 "uri": uri, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
203 "senders": senders, |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
204 } |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
205 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
206 parameters = {} |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
207 for param_elt in rtp_hdrext_elt.elements(NS_JINGLE_RTP_HDREXT, "parameter"): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
208 try: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
209 parameters[param_elt["name"]] = param_elt.getAttribute("value") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
210 except KeyError: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
211 log.warning(f"invalid parameters (missing name): {param_elt.toXml()}") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
212 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
213 if parameters: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
214 media_data["rtp-hdrext"][id_]["parameters"] = parameters |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
215 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
216 try: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
217 next(desc_elt.elements(NS_JINGLE_RTP_HDREXT, "extmap-allow-mixed")) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
218 except StopIteration: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
219 pass |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
220 else: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
221 media_data["extmap-allow-mixed"] = True |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
222 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
223 def _build_description_trigger( |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
224 self, desc_elt: domish.Element, media_data: dict, session: dict |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
225 ) -> None: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
226 """Build the <rtp-hdrext> and <extmap-allow-mixed> elements if possible""" |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
227 for id_, hdrext_data in media_data.get("rtp-hdrext", {}).items(): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
228 rtp_hdrext_elt = desc_elt.addElement((NS_JINGLE_RTP_HDREXT, "rtp-hdrext")) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
229 rtp_hdrext_elt["id"] = id_ |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
230 rtp_hdrext_elt["uri"] = hdrext_data["uri"] |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
231 senders = hdrext_data.get("senders", "both") |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
232 if senders != "both": |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
233 # we must not set "both" senders otherwise calls will fail with Movim due |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
234 # to https://github.com/movim/movim/issues/1213 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
235 rtp_hdrext_elt["senders"] = senders |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
236 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
237 for name, value in hdrext_data.get("parameters", {}).items(): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
238 param_elt = rtp_hdrext_elt.addElement((NS_JINGLE_RTP_HDREXT, "parameter")) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
239 param_elt["name"] = name |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
240 if value is not None: |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
241 param_elt["value"] = value |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
242 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
243 if media_data.get("extmap-allow-mixed", False): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
244 desc_elt.addElement((NS_JINGLE_RTP_HDREXT, "extmap-allow-mixed")) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
245 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
246 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
247 @implementer(iwokkel.IDisco) |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
248 class XEP_0294_handler(XMPPHandler): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
249 def getDiscoInfo(self, requestor, target, nodeIdentifier=""): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
250 return [disco.DiscoFeature(NS_JINGLE_RTP_HDREXT)] |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
251 |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
252 def getDiscoItems(self, requestor, target, nodeIdentifier=""): |
18719058a914
plugin XEP-0294: "Jingle RTP Feedback Negotiation" implementation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
253 return [] |