@@ -111,7 +111,7 @@ public void createAudioRoom(String sessionId, String handleId, int roomId) {
111111 restTemplate .postForEntity (handleUrl , request , JsonNode .class );
112112 }
113113
114- public JsonNode joinAudioRoom (String sessionId , String handleId , int roomId , String displayName ) {
114+ public void joinAudioRoom (String sessionId , String handleId , int roomId , String displayName ) {
115115 Map <String , Object > body = Map .of (
116116 "request" , "join" , "room" , roomId , "display" , displayName
117117 );
@@ -122,7 +122,24 @@ public JsonNode joinAudioRoom(String sessionId, String handleId, int roomId, Str
122122
123123 ResponseEntity <JsonNode > response = restTemplate .postForEntity (handleUrl , request , JsonNode .class );
124124 logger .info ("Janus join response: {}" , response .getBody ());
125- return response .getBody ();
125+ }
126+
127+ public JsonNode listParticipants (String sessionId , String handleId , int roomId ) {
128+ Map <String , Object > body = Map .of (
129+ "request" , "listparticipants" , "room" , roomId
130+ );
131+ Map <String , Object > request = Map .of (
132+ "janus" , "message" , "transaction" , UUID .randomUUID ().toString (), "body" , body
133+ );
134+ String handleUrl = String .format ("%s/%s/%s" , janusUrl , sessionId , handleId );
135+
136+ ResponseEntity <JsonNode > response = restTemplate .postForEntity (handleUrl , request , JsonNode .class );
137+
138+ if (response .getBody () != null ) {
139+ return response .getBody ().path ("plugindata" ).path ("data" ).path ("list" );
140+ }
141+
142+ throw new RuntimeException ("Failed to get participant list from Janus" );
126143 }
127144
128145 public void sendOffer (String sessionId , String handleId , String sdpOffer ,
0 commit comments