Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Janus SDK #347

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft

Implement Janus SDK #347

wants to merge 16 commits into from

Commits on Mar 11, 2024

  1. feat: implement websocket connection management and transaction manager

    * Introduces `Connection` class to handle WebSocket connections.
    * Defines connection states (connecting, connected, closing, closed) and
    exposes getters.
    * Implements event listeners for connection state changes and messages.
    * Creates `TransactionManager` class to manage transactions over the
    connection.
    * Enables queuing transactions when the connection is unavailable.
    * Binds `TransactionManager` to the `Connection` for message handling.
    
    This commit is part of a major change to support reliable communication
    and transaction management.
    farhat-ha committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    917fff3 View commit details
    Browse the repository at this point in the history
  2. chore: add helper functions for message handling and promise management

    * Introduces `isSipError`, `isSipHangupEvent`, `isSIPIncomingCallMessage`,
    `isSIPCallAcceptedEvent`, and `isSipRingingEvent` functions in `janus.ts` to
    identify specific Janus response types for SIP events.
    * Adds a `deferredPromise` function in `promise.ts` to create deferred
    promises for asynchronous operations.
    
    These functions enhance code readability and provide flexible promise
    control for improved message and task management.
    farhat-ha committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    fe571b2 View commit details
    Browse the repository at this point in the history
  3. chore: add eventemitter3 dependency

    * Includes eventemitter3 for event management within the connection class.
    
    This dependency provides a robust event system for the WebSocket connection.
    farhat-ha committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    3ba312e View commit details
    Browse the repository at this point in the history
  4. feat: implement keep-alive-agent for connection maintenance

    * Introduces `KeepAliveAgent` class to maintain connection health.
    * Utilizes `Connection` and `transactionManager` for communication.
    * Sends periodic keep-alive transactions (default 10 seconds) to the server.
    * Monitors connection state and restarts keep-alive on reconnection.
    *  Implements failure handling with a configurable retry mechanism.
    
    This feature ensures the connection remains active and facilitates reliable
    communication.
    farhat-ha committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    56ae7ce View commit details
    Browse the repository at this point in the history
  5. feat: implement sip-registration-agent for managing sip registration

    * Introduces `SIPRegistrationAgent` class to handle SIP registration.
    * Interacts with `Connection`, `transactionManager`, and `Handler` for
    communication.
    * Manages registration state (`unregistered`, `registering`, `registered`,
    `error`).
    * Sends SIP registration transactions using `transactionManager`.
    * Handles registration responses, updating state and triggering events.
    * Implements error handling and signaling through events.
    * Includes a placeholder for `unregister()` for future implementation.
    
    This feature enables automatic SIP registration with error handling and
    event notifications.
    farhat-ha committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    4e0d42e View commit details
    Browse the repository at this point in the history
  6. feat: implement call class for managing sip calls

    * Introduces `Call` class to represent SIP calls.
    * Manages call states (new, connecting, ringing, active, held, done).
    * Handles incoming and outbound call scenarios.
    * Provides methods for answering, hanging up, and getting call stats
    (placeholder).
    * Includes functionality for setting Telnyx call control IDs.
    
    feat: implement call-agent for handling sip call interactions
    
    * Introduces `CallAgent` class for managing SIP call flow.
    * Creates and manages `Call` instances for incoming and outgoing calls.
    * Interacts with `Connection`, `Peer`, `TransactionManager`, and `Handler`.
    * Handles incoming call events (`SIPIncomingCallMessage`).
    * Handles SIP hangup events (`JanusSIPHangupEvent`).
    * Handles SIP call accepted events (`JanusSIPCallAcceptedEvent`).
    * Triggers events (`SwEvent.Notification`) for call updates.
    * Implements audio handling for ringtones and ringback tones.
    
    feat: Implement Peer class for WebRTC peer connections
    
    * Introduces `Peer` class to handle WebRTC peer connections for calls.
    * Supports creating offer and answer peers based on call options.
    * Handles local media stream acquisition with constraints.
    * Manages adding media tracks to the peer connection.
    * Provides methods for handling ICE trickles and negotiation needed events.
    * Implements methods for setting remote SDP and closing the connection.
    * Triggers events (`SwEvent.MediaError`) for media acquisition failures.
    
    feat: Implement ICETrickleTransaction for sending ICE candidates
    
    * Introduces `ICETrickleTransaction` to send ICE candidates to Janus.
    * Constructs a Janus `trickle` request with candidate information.
    * Handles success and error responses from Janus on message received.
    
    feat: Implement SIPAnswerTransaction for sending SIP answer
    
    * Introduces `SIPAnswerTransaction` for sending SIP answer messages.
    * Constructs a Janus `message` request with answer SDP and other details.
    * Handles success (`isSIPCallAcceptedEvent`) and error (`isSipError`)
    responses.
    * Resolves with call ID on successful SIP answer reception.
    
    feat: Implement SIPCallTransaction for initiating SIP calls
    
    * Introduces `SIPCallTransaction` for initiating SIP calls via Janus.
    * Constructs a Janus `message` request with call details, URI, and SDP.
    * Handles success (`isSipRingingEvent`) and error (`isSipError`) responses.
    * Resolves with call ID, Telnyx IDs, on successful SIP call initiation.
    
    feat: Implement SIPHangupTransaction for terminating SIP calls
    
    * Introduces `SIPHangupTransaction` for sending SIP hangup messages.
    * Constructs a Janus `message` request with the hangup request.
    * Handles success (`janus === ack`) and error (`janus === error`) responses.
    * Resolves with `true` on successful SIP hangup.
    farhat-ha committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    aab56da View commit details
    Browse the repository at this point in the history
  7. feat: implement janus-client class for core sip client functionality

    * Introduces JanusClient class as the central component for SIP calls.
    * Manages connection to Janus server, plugin attachment, and SIP
    registration.
    * Handles call creation and management through CallAgent.
    * Provides methods for connecting, making calls, getting calls, and setting
    remote media element.
    * Includes event handling for listening to call events.
    * Implements stubs for enabling/disabling webcam and disconnection (to be
    completed).
    
    BREAKING CHANGE: Introduces a new class for core functionality, potentially
    affecting code organization and usage.
    farhat-ha committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    dd64f2f View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2024

  1. Configuration menu
    Copy the full SHA
    b0d9024 View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2024

  1. Configuration menu
    Copy the full SHA
    dd042c2 View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2024

  1. chore: setup janus package

    farhat-ha committed Mar 31, 2024
    Configuration menu
    Copy the full SHA
    4b43c16 View commit details
    Browse the repository at this point in the history

Commits on Apr 1, 2024

  1. Configuration menu
    Copy the full SHA
    369581a View commit details
    Browse the repository at this point in the history
  2. chore: fix imports

    farhat-ha committed Apr 1, 2024
    Configuration menu
    Copy the full SHA
    ab601f7 View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2024

  1. Configuration menu
    Copy the full SHA
    67e1133 View commit details
    Browse the repository at this point in the history
  2. fix: fix eslint ts errors

    farhat-ha committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    4dbe549 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2024

  1. feat: dtmf support

    farhat-ha committed Apr 3, 2024
    Configuration menu
    Copy the full SHA
    312978d View commit details
    Browse the repository at this point in the history

Commits on Apr 8, 2024

  1. Configuration menu
    Copy the full SHA
    ce1bffa View commit details
    Browse the repository at this point in the history