Skip to content

Commit dc190a0

Browse files
damenchobgrozev
andauthored
feat: Adds notification for conference audio recordings. (#564)
* feat: Adds notification for conference audio recordings. * squash: Fixes comments and updates the dependency. * squash: Fix jibri on check. * squash: Update src/main/java/org/jitsi/jigasi/sounds/SoundNotificationManager.java Co-authored-by: bgrozev <[email protected]> --------- Co-authored-by: bgrozev <[email protected]>
1 parent c0617b8 commit dc190a0

File tree

3 files changed

+43
-12
lines changed

3 files changed

+43
-12
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
<dependency>
353353
<groupId>${project.groupId}</groupId>
354354
<artifactId>jitsi-xmpp-extensions</artifactId>
355-
<version>1.0-78-g62d03d4</version>
355+
<version>1.0-82-ge8aacab</version>
356356
</dependency>
357357
<dependency>
358358
<groupId>org.slf4j</groupId>

src/main/java/org/jitsi/jigasi/JigasiBundleActivator.java

+11
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,17 @@ public void startWithServices(final BundleContext bundleContext)
236236
new DefaultPacketExtensionProvider<>(RecordingStatus.class)
237237
);
238238

239+
ProviderManager.addExtensionProvider(
240+
ConferenceProperties.ELEMENT,
241+
ConferenceProperties.NAMESPACE,
242+
new DefaultPacketExtensionProvider<>(ConferenceProperties.class)
243+
);
244+
ProviderManager.addExtensionProvider(
245+
ConferenceProperties.ConferenceProperty.ELEMENT,
246+
ConferenceProperties.NAMESPACE,
247+
new DefaultPacketExtensionProvider<>(ConferenceProperties.ConferenceProperty.class)
248+
);
249+
239250
logger.info("initialized SipGateway");
240251
sipGateway = new SipGateway(bundleContext)
241252
{

src/main/java/org/jitsi/jigasi/sounds/SoundNotificationManager.java

+31-11
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.jitsi.utils.*;
3131
import org.jitsi.utils.logging.Logger;
3232
import org.jitsi.xmpp.extensions.jibri.*;
33+
import org.jitsi.xmpp.extensions.jitsimeet.*;
3334
import org.jivesoftware.smack.packet.*;
3435

3536
import java.util.*;
@@ -232,13 +233,37 @@ private CallContext getCallContext()
232233
*/
233234
public void process(Presence presence)
234235
{
235-
RecordingStatus rs = presence.getExtension(RecordingStatus.class);
236-
237-
if (rs != null
238-
&& gatewaySession.getFocusResourceAddr().equals(
239-
presence.getFrom().getResourceOrEmpty().toString()))
236+
if (gatewaySession.getFocusResourceAddr().equals(presence.getFrom().getResourceOrEmpty().toString()))
240237
{
241-
notifyRecordingStatusChanged(rs.getRecordingMode(), rs.getStatus());
238+
boolean isJibriRecordingOn = false;
239+
RecordingStatus rs = presence.getExtension(RecordingStatus.class);
240+
if (rs != null)
241+
{
242+
isJibriRecordingOn = rs.getStatus() == JibriIq.Status.ON;
243+
}
244+
245+
boolean isAudioRecordingOn = false;
246+
ConferenceProperties props = presence.getExtension(ConferenceProperties.class);
247+
248+
if (props != null)
249+
{
250+
ConferenceProperties.ConferenceProperty prop
251+
= props.getProperties().stream()
252+
.filter(p -> ConferenceProperties.KEY_AUDIO_RECORDING_ENABLED.equals(p.getKey()))
253+
.findFirst().orElse(null);
254+
255+
isAudioRecordingOn = prop != null && Boolean.parseBoolean(prop.getValue());
256+
}
257+
258+
JibriIq.Status newStatus
259+
= isJibriRecordingOn || isAudioRecordingOn ? JibriIq.Status.ON : JibriIq.Status.OFF;
260+
261+
if (currentJibriStatus.equals(newStatus))
262+
{
263+
return;
264+
}
265+
266+
notifyRecordingStatusChanged(rs != null ? rs.getRecordingMode() : JibriIq.RecordingMode.FILE, newStatus);
242267
}
243268
}
244269

@@ -251,11 +276,6 @@ public void process(Presence presence)
251276
private void notifyRecordingStatusChanged(
252277
JibriIq.RecordingMode mode, JibriIq.Status status)
253278
{
254-
// not a change, ignore
255-
if (currentJibriStatus.equals(status))
256-
{
257-
return;
258-
}
259279
currentJibriStatus = status;
260280

261281
String offSound;

0 commit comments

Comments
 (0)