Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mtxclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
mtxclient
Commits
53f8883a
Unverified
Commit
53f8883a
authored
4 years ago
by
Nicolas Werner
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #50 from trilene/master
Fix calls with voip v1 clients
parents
004d4203
a37827de
No related branches found
No related tags found
No related merge requests found
Pipeline
#791
passed
4 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/mtx/events/voip.hpp
+4
-4
4 additions, 4 deletions
include/mtx/events/voip.hpp
lib/structs/events/voip.cpp
+15
-4
15 additions, 4 deletions
lib/structs/events/voip.cpp
with
19 additions
and
8 deletions
include/mtx/events/voip.hpp
+
4
−
4
View file @
53f8883a
...
...
@@ -22,7 +22,7 @@ struct CallInvite
//! The SDP text of the session description.
std
::
string
sdp
;
//! The version of the VoIP specification this message adheres to.
uint16_t
version
;
std
::
string
version
;
//! The time in milliseconds that the invite is valid for.
uint32_t
lifetime
;
};
...
...
@@ -51,7 +51,7 @@ struct CallCandidates
//! Array of objects describing the candidates.
std
::
vector
<
Candidate
>
candidates
;
//! The version of the VoIP specification this message adheres to.
uint16_t
version
;
std
::
string
version
;
};
void
...
...
@@ -68,7 +68,7 @@ struct CallAnswer
//! The SDP text of the session description.
std
::
string
sdp
;
//! The version of the VoIP specification this message adheres to.
uint16_t
version
;
std
::
string
version
;
};
void
...
...
@@ -90,7 +90,7 @@ struct CallHangUp
//! The ID of the call this event relates to.
std
::
string
call_id
;
//! The version of the VoIP specification this message adheres to.
uint16_t
version
;
std
::
string
version
;
//! The reason for the call hang up.
Reason
reason
=
Reason
::
User
;
};
...
...
This diff is collapsed.
Click to expand it.
lib/structs/events/voip.cpp
+
15
−
4
View file @
53f8883a
#include
<string>
#include
"mtx/events/voip.hpp"
#include
<nlohmann/json.hpp>
using
json
=
nlohmann
::
json
;
namespace
{
std
::
string
version
(
const
json
&
obj
)
{
auto
v
=
obj
.
at
(
"version"
);
return
v
.
is_number
()
?
"0"
:
v
.
get
<
std
::
string
>
();
}
}
namespace
mtx
::
events
::
msg
{
// m.call.invite
...
...
@@ -12,7 +23,7 @@ from_json(const json &obj, CallInvite &content)
{
content
.
call_id
=
obj
.
at
(
"call_id"
).
get
<
std
::
string
>
();
content
.
sdp
=
obj
.
at
(
"offer"
).
at
(
"sdp"
).
get
<
std
::
string
>
();
content
.
version
=
obj
.
at
(
"version"
).
get
<
uint16_t
>
(
);
content
.
version
=
version
(
obj
);
content
.
lifetime
=
obj
.
at
(
"lifetime"
).
get
<
uint32_t
>
();
}
...
...
@@ -47,7 +58,7 @@ from_json(const json &obj, CallCandidates &content)
{
content
.
call_id
=
obj
.
at
(
"call_id"
).
get
<
std
::
string
>
();
content
.
candidates
=
obj
.
at
(
"candidates"
).
get
<
std
::
vector
<
CallCandidates
::
Candidate
>>
();
content
.
version
=
obj
.
at
(
"version"
).
get
<
uint16_t
>
(
);
content
.
version
=
version
(
obj
);
}
void
...
...
@@ -64,7 +75,7 @@ from_json(const json &obj, CallAnswer &content)
{
content
.
call_id
=
obj
.
at
(
"call_id"
).
get
<
std
::
string
>
();
content
.
sdp
=
obj
.
at
(
"answer"
).
at
(
"sdp"
).
get
<
std
::
string
>
();
content
.
version
=
obj
.
at
(
"version"
).
get
<
uint16_t
>
(
);
content
.
version
=
version
(
obj
);
}
void
...
...
@@ -80,7 +91,7 @@ void
from_json
(
const
json
&
obj
,
CallHangUp
&
content
)
{
content
.
call_id
=
obj
.
at
(
"call_id"
).
get
<
std
::
string
>
();
content
.
version
=
obj
.
at
(
"version"
).
get
<
uint16_t
>
(
);
content
.
version
=
version
(
obj
);
if
(
obj
.
count
(
"reason"
)
==
0
)
{
content
.
reason
=
CallHangUp
::
Reason
::
User
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment