|
1 | 1 | package io.github.kinsleykajiva.janus.admin; |
2 | 2 |
|
3 | 3 | import io.github.kinsleykajiva.janus.ServerInfo; |
| 4 | +import io.github.kinsleykajiva.janus.admin.messages.AcceptNewSessions; |
| 5 | +import io.github.kinsleykajiva.janus.admin.messages.CustomEvent; |
| 6 | +import io.github.kinsleykajiva.janus.admin.messages.DestroySession; |
| 7 | +import io.github.kinsleykajiva.janus.admin.messages.DetachHandle; |
| 8 | +import io.github.kinsleykajiva.janus.admin.messages.GetStatus; |
4 | 9 | import io.github.kinsleykajiva.janus.admin.messages.HandleInfo; |
5 | 10 | import io.github.kinsleykajiva.janus.admin.messages.HandleInfoResponse; |
| 11 | +import io.github.kinsleykajiva.janus.admin.messages.HangupWebRTC; |
6 | 12 | import io.github.kinsleykajiva.janus.admin.messages.Info; |
7 | | -import io.github.kinsleykajiva.janus.admin.messages.DestroySession; |
8 | 13 | import io.github.kinsleykajiva.janus.admin.messages.ListHandles; |
9 | 14 | import io.github.kinsleykajiva.janus.admin.messages.ListHandlesResponse; |
10 | | -import io.github.kinsleykajiva.janus.admin.messages.GetStatus; |
11 | | -import io.github.kinsleykajiva.janus.admin.messages.MessagePlugin; |
12 | | -import io.github.kinsleykajiva.janus.admin.messages.SetLogLevel; |
13 | 15 | import io.github.kinsleykajiva.janus.admin.messages.ListSessions; |
14 | | -import io.github.kinsleykajiva.janus.admin.messages.Ping; |
15 | 16 | import io.github.kinsleykajiva.janus.admin.messages.ListSessionsResponse; |
| 17 | +import io.github.kinsleykajiva.janus.admin.messages.MessagePlugin; |
| 18 | +import io.github.kinsleykajiva.janus.admin.messages.Ping; |
| 19 | +import io.github.kinsleykajiva.janus.admin.messages.QueryEventHandler; |
| 20 | +import io.github.kinsleykajiva.janus.admin.messages.ResolveAddress; |
| 21 | +import io.github.kinsleykajiva.janus.admin.messages.SetLogLevel; |
| 22 | +import io.github.kinsleykajiva.janus.admin.messages.SetSessionTimeout; |
| 23 | +import io.github.kinsleykajiva.janus.admin.messages.StartPcap; |
| 24 | +import io.github.kinsleykajiva.janus.admin.messages.StartText2Pcap; |
| 25 | +import io.github.kinsleykajiva.janus.admin.messages.StopPcap; |
| 26 | +import io.github.kinsleykajiva.janus.admin.messages.StopText2Pcap; |
| 27 | +import io.github.kinsleykajiva.janus.admin.messages.TestStun; |
16 | 28 | import io.github.kinsleykajiva.janus.exception.JanusException; |
17 | 29 | import io.github.kinsleykajiva.janus.internal.TransactionManager; |
18 | 30 | import org.json.JSONException; |
@@ -313,4 +325,100 @@ public CompletableFuture<JSONObject> setLogLevel(int level) { |
313 | 325 | sendMessage(request.toJson()); |
314 | 326 | return future; |
315 | 327 | } |
| 328 | + |
| 329 | + public CompletableFuture<JSONObject> resolveAddress(String address) { |
| 330 | + String transactionId = transactionManager.createTransaction(); |
| 331 | + var future = transactionManager.registerTransaction(transactionId); |
| 332 | + ResolveAddress request = new ResolveAddress(transactionId, address); |
| 333 | + sendMessage(request.toJson()); |
| 334 | + return future; |
| 335 | + } |
| 336 | + |
| 337 | + public CompletableFuture<JSONObject> testStun() { |
| 338 | + String transactionId = transactionManager.createTransaction(); |
| 339 | + var future = transactionManager.registerTransaction(transactionId); |
| 340 | + TestStun request = new TestStun(transactionId); |
| 341 | + sendMessage(request.toJson()); |
| 342 | + return future; |
| 343 | + } |
| 344 | + |
| 345 | + public CompletableFuture<JSONObject> queryEventHandler(String handler, JSONObject query) { |
| 346 | + String transactionId = transactionManager.createTransaction(); |
| 347 | + var future = transactionManager.registerTransaction(transactionId); |
| 348 | + QueryEventHandler request = new QueryEventHandler(transactionId, handler, query); |
| 349 | + sendMessage(request.toJson()); |
| 350 | + return future; |
| 351 | + } |
| 352 | + |
| 353 | + public CompletableFuture<JSONObject> customEvent(JSONObject event) { |
| 354 | + String transactionId = transactionManager.createTransaction(); |
| 355 | + var future = transactionManager.registerTransaction(transactionId); |
| 356 | + CustomEvent request = new CustomEvent(transactionId, event); |
| 357 | + sendMessage(request.toJson()); |
| 358 | + return future; |
| 359 | + } |
| 360 | + |
| 361 | + public CompletableFuture<JSONObject> startPcap(long sessionId, long handleId, String folder, String filename) { |
| 362 | + String transactionId = transactionManager.createTransaction(); |
| 363 | + var future = transactionManager.registerTransaction(transactionId); |
| 364 | + StartPcap request = new StartPcap(transactionId, sessionId, handleId, folder, filename); |
| 365 | + sendMessage(request.toJson()); |
| 366 | + return future; |
| 367 | + } |
| 368 | + |
| 369 | + public CompletableFuture<JSONObject> stopPcap(long sessionId, long handleId) { |
| 370 | + String transactionId = transactionManager.createTransaction(); |
| 371 | + var future = transactionManager.registerTransaction(transactionId); |
| 372 | + StopPcap request = new StopPcap(transactionId, sessionId, handleId); |
| 373 | + sendMessage(request.toJson()); |
| 374 | + return future; |
| 375 | + } |
| 376 | + |
| 377 | + public CompletableFuture<JSONObject> startText2Pcap(long sessionId, long handleId, String folder, String filename) { |
| 378 | + String transactionId = transactionManager.createTransaction(); |
| 379 | + var future = transactionManager.registerTransaction(transactionId); |
| 380 | + StartText2Pcap request = new StartText2Pcap(transactionId, sessionId, handleId, folder, filename); |
| 381 | + sendMessage(request.toJson()); |
| 382 | + return future; |
| 383 | + } |
| 384 | + |
| 385 | + public CompletableFuture<JSONObject> stopText2Pcap(long sessionId, long handleId) { |
| 386 | + String transactionId = transactionManager.createTransaction(); |
| 387 | + var future = transactionManager.registerTransaction(transactionId); |
| 388 | + StopText2Pcap request = new StopText2Pcap(transactionId, sessionId, handleId); |
| 389 | + sendMessage(request.toJson()); |
| 390 | + return future; |
| 391 | + } |
| 392 | + |
| 393 | + public CompletableFuture<JSONObject> hangupWebRTC(long sessionId, long handleId) { |
| 394 | + String transactionId = transactionManager.createTransaction(); |
| 395 | + var future = transactionManager.registerTransaction(transactionId); |
| 396 | + HangupWebRTC request = new HangupWebRTC(transactionId, sessionId, handleId); |
| 397 | + sendMessage(request.toJson()); |
| 398 | + return future; |
| 399 | + } |
| 400 | + |
| 401 | + public CompletableFuture<JSONObject> detachHandle(long sessionId, long handleId) { |
| 402 | + String transactionId = transactionManager.createTransaction(); |
| 403 | + var future = transactionManager.registerTransaction(transactionId); |
| 404 | + DetachHandle request = new DetachHandle(transactionId, sessionId, handleId); |
| 405 | + sendMessage(request.toJson()); |
| 406 | + return future; |
| 407 | + } |
| 408 | + |
| 409 | + public CompletableFuture<JSONObject> setSessionTimeout(int timeout) { |
| 410 | + String transactionId = transactionManager.createTransaction(); |
| 411 | + var future = transactionManager.registerTransaction(transactionId); |
| 412 | + SetSessionTimeout request = new SetSessionTimeout(transactionId, timeout); |
| 413 | + sendMessage(request.toJson()); |
| 414 | + return future; |
| 415 | + } |
| 416 | + |
| 417 | + public CompletableFuture<JSONObject> acceptNewSessions(boolean accept) { |
| 418 | + String transactionId = transactionManager.createTransaction(); |
| 419 | + var future = transactionManager.registerTransaction(transactionId); |
| 420 | + AcceptNewSessions request = new AcceptNewSessions(transactionId, accept); |
| 421 | + sendMessage(request.toJson()); |
| 422 | + return future; |
| 423 | + } |
316 | 424 | } |
0 commit comments