Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
savoirfairelinux
jami-daemon
Commits
f8ea5012
Commit
f8ea5012
authored
4 years ago
by
Pierre Lespagnol
Committed by
Adrien Béraud
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
sipcall: add new sip message to update peer Mute info
Change-Id: I6ba0a3d13eff9470e0bbccc77d24c183a011e449
parent
4e5c4c79
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/sip/sipcall.cpp
+36
-0
36 additions, 0 deletions
src/sip/sipcall.cpp
src/sip/sipcall.h
+8
-1
8 additions, 1 deletion
src/sip/sipcall.h
src/sip/sipvoiplink.cpp
+15
-0
15 additions, 0 deletions
src/sip/sipvoiplink.cpp
with
59 additions
and
1 deletion
src/sip/sipcall.cpp
+
36
−
0
View file @
f8ea5012
...
...
@@ -394,6 +394,26 @@ SIPCall::requestKeyframe()
lastKeyFrameReq_
=
now
;
}
void
SIPCall
::
setMute
(
bool
state
)
{
std
::
string
BODY
=
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>"
"<media_control><vc_primitive><to_encoder>"
"<mute_state="
+
std
::
to_string
(
state
)
+
"/>"
"</to_encoder></vc_primitive></media_control>"
;
// see https://tools.ietf.org/html/rfc5168 for XML Schema for Media Control details
JAMI_DBG
(
"Sending mute state via SIP INFO"
);
try
{
sendSIPInfo
(
BODY
.
c_str
(),
"media_control+xml"
);
}
catch
(
const
std
::
exception
&
e
)
{
JAMI_ERR
(
"Error sending mute state: %s"
,
e
.
what
());
}
}
void
SIPCall
::
updateSDPFromSTUN
()
{
...
...
@@ -1294,6 +1314,8 @@ SIPCall::muteMedia(const std::string& mediaType, bool mute)
avformatrtp_
->
setMuted
(
isAudioMuted_
);
if
(
not
isSubcall
())
emitSignal
<
DRing
::
CallSignal
::
AudioMuted
>
(
getCallId
(),
isAudioMuted_
);
setMute
(
mute
);
}
}
...
...
@@ -1733,4 +1755,18 @@ SIPCall::setRemoteRecording(bool state)
peerRecording_
=
state
;
}
void
SIPCall
::
setPeerMute
(
bool
state
)
{
if
(
state
)
{
JAMI_WARN
(
"SIP Peer muted"
);
}
else
{
JAMI_WARN
(
"SIP Peer ummuted"
);
}
peerMuted_
=
state
;
if
(
auto
conf
=
Manager
::
instance
().
getConferenceFromID
(
getConfId
()))
{
conf
->
muteParticipant
(
getPeerNumber
(),
state
);
}
}
}
// namespace jami
This diff is collapsed.
Click to expand it.
src/sip/sipcall.h
+
8
−
1
View file @
f8ea5012
...
...
@@ -240,7 +240,13 @@ public: // NOT SIP RELATED (good candidates to be moved elsewhere)
void
setRemoteRecording
(
bool
state
);
bool
isPeerRecording
()
{
return
peerRecording_
;
}
bool
isPeerRecording
()
const
{
return
peerRecording_
;
}
void
setMute
(
bool
state
);
void
setPeerMute
(
bool
state
);
bool
isPeerMuted
()
const
{
return
peerMuted_
;
}
private
:
using
clock
=
std
::
chrono
::
steady_clock
;
...
...
@@ -381,6 +387,7 @@ private:
OnReadyCb
offHoldCb_
{};
bool
peerRecording_
{
false
};
bool
peerMuted_
{
false
};
std
::
atomic_bool
waitForIceInit_
{
false
};
};
...
...
This diff is collapsed.
Click to expand it.
src/sip/sipvoiplink.cpp
+
15
−
0
View file @
f8ea5012
...
...
@@ -1053,6 +1053,7 @@ handleMediaControl(SIPCall& call, pjsip_msg_body* body)
static
constexpr
auto
PICT_FAST_UPDATE
=
"picture_fast_update"
sv
;
static
constexpr
auto
DEVICE_ORIENTATION
=
"device_orientation"
sv
;
static
constexpr
auto
RECORDING_STATE
=
"recording_state"
sv
;
static
constexpr
auto
MUTE_STATE
=
"mute_state"
sv
;
if
(
body_msg
.
find
(
PICT_FAST_UPDATE
)
!=
std
::
string_view
::
npos
)
{
call
.
sendKeyframe
();
...
...
@@ -1093,6 +1094,20 @@ handleMediaControl(SIPCall& call, pjsip_msg_body* body)
}
return
true
;
}
}
else
if
(
body_msg
.
find
(
MUTE_STATE
)
!=
std
::
string_view
::
npos
)
{
static
const
std
::
regex
REC_REGEX
(
"mute_state=([0-1])"
);
std
::
svmatch
matched_pattern
;
std
::
regex_search
(
body_msg
,
matched_pattern
,
REC_REGEX
);
if
(
matched_pattern
.
ready
()
&&
!
matched_pattern
.
empty
()
&&
matched_pattern
[
1
].
matched
)
{
try
{
bool
state
=
std
::
stoi
(
matched_pattern
[
1
]);
call
.
setPeerMute
(
state
);
}
catch
(
const
std
::
exception
&
e
)
{
JAMI_WARN
(
"Error parsing state remote mute: %s"
,
e
.
what
());
}
return
true
;
}
}
}
...
...
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