1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// SPDX-FileCopyrightText: 2022 Kitsune Ral <Kitsune-Ral@users.sf.net>
// SPDX-License-Identifier: LGPL-2.1-or-later
#include "callevents.h"
#include "logging.h"
using namespace Quotient;
QJsonObject CallEvent::basicJson(const QString& matrixType,
const QString& callId, int version,
QJsonObject contentJson)
{
contentJson.insert(QStringLiteral("call_id"), callId);
contentJson.insert(QStringLiteral("version"), version);
return RoomEvent::basicJson(matrixType, contentJson);
}
CallEvent::CallEvent(const QJsonObject& json)
: RoomEvent(json)
{
if (callId().isEmpty())
qCWarning(EVENTS) << id() << "is a call event with an empty call id";
}
/*
m.call.invite
{
"age": 242352,
"content": {
"call_id": "12345",
"lifetime": 60000,
"offer": {
"sdp": "v=0\r\no=- 6584580628695956864 2 IN IP4 127.0.0.1[...]",
"type": "offer"
},
"version": 0
},
"event_id": "$WLGTSEFSEF:localhost",
"origin_server_ts": 1431961217939,
"room_id": "!Cuyf34gef24t:localhost",
"sender": "@example:localhost",
"type": "m.call.invite"
}
*/
CallInviteEvent::CallInviteEvent(const QString& callId, int lifetime,
const QString& sdp)
: EventTemplate(
callId,
{ { QStringLiteral("lifetime"), lifetime },
{ QStringLiteral("offer"),
QJsonObject{ { QStringLiteral("type"), QStringLiteral("offer") },
{ QStringLiteral("sdp"), sdp } } } })
{}
/*
m.call.answer
{
"age": 242352,
"content": {
"answer": {
"sdp": "v=0\r\no=- 6584580628695956864 2 IN IP4 127.0.0.1[...]",
"type": "answer"
},
"call_id": "12345",
"version": 0
},
"event_id": "$WLGTSEFSEF:localhost",
"origin_server_ts": 1431961217939,
"room_id": "!Cuyf34gef24t:localhost",
"sender": "@example:localhost",
"type": "m.call.answer"
}
*/
CallAnswerEvent::CallAnswerEvent(const QString& callId, const QString& sdp)
: EventTemplate(callId, { { QStringLiteral("answer"),
QJsonObject { { QStringLiteral("type"),
QStringLiteral("answer") },
{ QStringLiteral("sdp"), sdp } } } })
{}
|