Closed
Conversation
This commit introduces a significant refactoring of the Janus SDK to improve its design, fix critical bugs, and align it with modern Java best practices. The work was focused on the SIP plugin implementation as requested. The key changes include: - Refactored `JanusHandle` into an abstract class. This removes plugin-specific logic from the base handle, forcing subclasses to implement their own event dispatching. This adheres to the Open/Closed Principle. - Improved `SipHandle` implementation. The SIP-specific event logic has been moved into this class. A critical listener leak in `registerAsync` has been fixed by using a temporary, self-removing listener. The duplicated code for sending messages with JSEP has been removed. - Enhanced Event Handling. The `JanusSipEventListener` now uses default methods, making it more convenient for developers. The event data classes (`JanusSipEvents`) have been cleaned up to remove redundant fields. - Fixed Compilation and Build Issues. Resolved several compilation errors that arose from the refactoring, including issues in `JanusSession` and `AudioBridgeHandle`. Downgraded the Java target version from 24 to 21 to ensure compatibility with the build environment. - Updated `Main` Example. The main class now provides a clean, clear, and robust example of how to use the refactored SDK, demonstrating best practices for session management, event listening, and asynchronous operations.
Refactor Janus SDK for extensibility and fix SIP plugin
Adds the following functions to the SIP plugin: - unregister - progress - accept - decline - info - message - dtmf - subscribe - unsubscribe - transfer - recording - keyframe - hold - unhold - update All functions are documented with Javadoc comments and follow the existing coding style.
feat: add sip plugin functions
This commit introduces a new, detailed documentation file for the Janus SIP Plugin SDK, located at `docs/SipExample.md`. The documentation is a work-in-progress and aims to provide a comprehensive guide for developers. So far, the following has been accomplished: 1. **Initial Scaffolding:** A complete structure for the documentation was created, covering basic setup, user registration, call management, in-call operations, event listening, and advanced features. 2. **API Analysis and Correction:** After an initial code review revealed inaccuracies in the code examples, a thorough analysis of the SDK's source code was performed. 3. **Corrected Sections:** Based on the API analysis, the "Basic Setup" and "User Registration" sections have been revised to provide accurate and compilable code examples. This includes correcting constructor usage for `JanusConfiguration`, clarifying the connection lifecycle in `JanusClient`, and accurately representing the asynchronous nature of session creation and user registration. The remaining sections still contain the original, unverified code examples and require correction to align with the actual SDK implementation. This submission captures the progress made in creating a correct and reliable guide for the SIP plugin.
feat(docs): Create comprehensive SIP plugin SDK documentation
This commit introduces a full-featured Java SDK for the Janus AudioBridge plugin, replacing the previous basic implementation. The new SDK is designed to be type-safe, easy to use, and robust, abstracting away the low-level JSON communication with the Janus server. Key features and changes: - **Refactored Plugin Handle**: Renamed and overhauled the old `AudioBridgeHandle` into a new `JanusAudioBridgePlugin` class. This class serves as the primary entry point for all plugin interactions. - **Strongly-Typed Models**: Introduced Java records for all AudioBridge data structures (e.g., `AudioBridgeRoom`, `AudioBridgeParticipant`) and a builder pattern for creating complex requests (`CreateRoomRequest`, `JoinRoomRequest`). This eliminates the need for developers to work with raw JSONObjects. - **Event-Driven Architecture**: Created a `JanusAudioBridgeListener` interface with specific callback methods (e.g., `onJoined`, `onParticipantLeft`) for all asynchronous events from the plugin. - **Comprehensive API Coverage**: Implemented methods for the majority of the AudioBridge API, including creating, destroying, and listing rooms, as well as joining, leaving, configuring, and listing participants. - **Asynchronous by Design**: All API calls return `CompletableFuture`s, making the SDK suitable for modern, non-blocking applications. - **Full Javadoc Documentation**: Added comprehensive Javadoc to all new public classes, methods, and models to ensure the SDK is easy to understand and use.
This commit incorporates feedback from the code review. - Renames the main plugin class from `JanusAudioBridgePlugin` back to `AudioBridgeHandle` to align with user expectations and the existing structure. - Adds a comprehensive example to `Main.java`, replacing the old SIP example. The new example demonstrates how to connect to Janus, create an AudioBridge room, join it, and listen for events using the new SDK. - Corrects the constructor call in `JanusSession` to use the updated `AudioBridgeHandle` constructor.
This commit fixes a race condition where receiving an 'ack' message from Janus for an asynchronous request (like 'join') would cause the client to crash. The 'ack' message does not contain a 'plugindata' field, and the previous implementation was attempting to parse it, leading to a JSONException. The fix modifies the `CompletableFuture` handling in the `joinRoom`, `configure`, and `leave` methods in `AudioBridgeHandle.java`. The `thenAccept` block is now robust and no longer assumes the response from `sendMessage` contains a detailed body. It only checks for a Janus-level error, allowing the `ack` to be processed successfully. The substantive plugin-level events (e.g., 'joined') are handled separately by the event listener mechanism, which is the correct approach for asynchronous operations.
…ved message processing
feat(audiobridge): Implement comprehensive SDK for AudioBridge plugin
Adds all missing audio bridge api functions based on the documentation. This includes requests, responses, and events. Also refactors the existing code to be more consistent and maintainable.
…nd simplify imports
…ridge-functions feat: add missing audio bridge api functions
Create comprehensive documentation for the AudioBridge plugin.
This commit addresses two issues identified during testing: 1. A race condition in `JanusClient.disconnect()` is fixed by properly shutting down the `keepAliveScheduler` and its tasks. This prevents errors from being logged on exit when keep-alive tasks attempt to run on a closed WebSocket. 2. The `Main.java` VideoRoom example is refined by commenting out the `unpublish()` call and adding an explanation. This clarifies that the call is expected to fail in a simulation where no real media stream is published, preventing user confusion.
This commit appends the complete, runnable example from `Main.java` to the `videoRoomExamples.md` documentation file. This provides users with a comprehensive, self-contained reference for a typical publisher workflow.
This commit provides a complete and comprehensive implementation of the Janus VideoRoom plugin API. It includes all request and event models, a full-featured handle, and detailed documentation. Features: - Full support for all room management, publisher, and subscriber API calls as documented. - Implementation of advanced features including RTP forwarding, moderation, and the "Room Cascading" API for remote publishers. - A new `JanusVideoRoomListener` interface for handling all asynchronous events. - A `VideoRoomHandle` class that provides a clean, type-safe interface for all plugin interactions. - A new `docs/videoRoomExamples.md` file with comprehensive examples. - An updated `Main.java` with a runnable example. Fixes: - Corrects a shutdown race condition in the `JanusClient` keep-alive scheduler. - Adds the missing `attachToVideoRoom()` convenience method to `JanusSession`. - Refines the `VideoRoomHandle` API for better JSEP handling.
…ent, and RoomDestroyedEvent
feat: Add Janus VideoRoom Plugin Implementation
This commit introduces two main improvements:
1. **Comprehensive README:** The `README.md` file has been completely rewritten to provide a professional and detailed overview of the project. It now includes:
* A clear project description and features.
* Minimum JDK requirement.
* Maven installation instructions.
* A "Getting Started" code example.
* Links to detailed documentation, contributing guidelines, and the license.
* The file has also been renamed from `ReadMe.md` to `README.md` to follow standard conventions.
2. **Maven Deployment Configuration:** The `pom.xml` has been updated to include the necessary configuration for deploying the library to Maven Central. This includes:
* Adding project metadata (`name`, `url`).
* Configuring `distributionManagement` for snapshot and release repositories.
* Adding the `maven-source-plugin`, `maven-javadoc-plugin`, and `maven-gpg-plugin` to generate the required artifacts and sign the release.
feat: Update README and add Maven deployment configuration
This workflow creates a release with the JAR artifact on every push to the re-write branch.
feat: Add GitHub Actions workflow for releases
The previous workflow was failing because it didn't have the necessary permissions to create a release. This change adds the 'contents: write' permission to the job.
fix: Add write permissions to release workflow
This commit introduces a new feature: a Janus Admin API client. - Adds a `JanusAdminClient` for connecting to the Janus Admin WebSocket. - Implements request and response models for Admin API messages, starting with `list_sessions` and `handle_info`. - Provides a `JanusAdminMonitor` for handling asynchronous events from the admin WebSocket. - Includes an example in `Main.java` to demonstrate the usage of the new admin client.
This commit expands the functionality of the `JanusAdminClient` by adding support for several new Admin API requests: - `info`: Get server information. - `ping`: Perform a health check. - `destroy_session`: Destroy a specific session. - `list_handles`: List all handles for a given session. - `message_plugin`: Send a message to a plugin. - `get_status`: Get the current status of runtime-modifiable settings. - `set_log_level`: Change the log level. The example in `Main.java` has been updated to demonstrate the usage of these new methods.
This commit adds detailed documentation for the `JanusAdminClient`. - Creates a new file `docs/JanusAdmin.md` with examples for all implemented functions, comments, and performance considerations. - Updates `README.md` to include a link to the new documentation.
feat: Add Janus Admin API client
…nctions feat: add more request functions to JanusAdminClient
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a complete re write of the lib