Skip to content

feat: Add JJSIP based phone option to chat #561

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

adriavidal
Copy link

Integrates JJSIP.js to enable voice call functionality within chat rooms.

Key changes:

  • Added jjsipService.js to manage JJSIP User Agent, call session lifecycle (make, answer, hangup), and event handling.
  • Modified Room.vue to:
    • Initialize and use jjsipService.
    • Manage call states (incoming, active, errors).
    • Render UI for incoming call notifications (with Answer/Decline) and active call display (with Hang Up).
    • Include an <audio> element for remote audio playback, connected via jjsipService.
  • Updated RoomHeader.vue to include a "Call" button that initiates calls.
  • Made JJSIP credentials (SIP URI, password, server) configurable via props from your demo application (App.vue -> ChatContainer.vue -> ChatWindow.vue -> Room.vue).
  • Added a placeholder vendor/jjsip.min.js as the JJSIP library was not found on standard package managers/CDNs during development.
  • Implemented unit tests for jjsipService.js, Room.vue, and RoomHeader.vue to cover the new functionality, including mocking of the JJSIP library and service interactions.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • All tests are passing

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

google-labs-jules bot and others added 8 commits May 28, 2025 06:44
Integrates JJSIP.js to enable voice call functionality within chat rooms.

Key changes:
- Added `jjsipService.js` to manage JJSIP User Agent, call session lifecycle (make, answer, hangup), and event handling.
- Modified `Room.vue` to:
    - Initialize and use `jjsipService`.
    - Manage call states (incoming, active, errors).
    - Render UI for incoming call notifications (with Answer/Decline) and active call display (with Hang Up).
    - Include an `<audio>` element for remote audio playback, connected via `jjsipService`.
- Updated `RoomHeader.vue` to include a "Call" button that initiates calls.
- Made JJSIP credentials (SIP URI, password, server) configurable via props from your demo application (`App.vue` -> `ChatContainer.vue` -> `ChatWindow.vue` -> `Room.vue`).
- Added a placeholder `vendor/jjsip.min.js` as the JJSIP library was not found on standard package managers/CDNs during development.
- Implemented unit tests for `jjsipService.js`, `Room.vue`, and `RoomHeader.vue` to cover the new functionality, including mocking of the JJSIP library and service interactions.
Adds a Dockerfile and instructions to build and run the demo application
in a Docker container.

- Creates a multi-stage `demo/Dockerfile` using Node.js for the build
  stage and Nginx for the serve stage.
- Adds `demo/.dockerignore` to exclude unnecessary files from the image.
- Creates `demo/README.md` with instructions on how to build and run
  the Docker container.
Addresses issues related to `package-lock.json` in the demo's Docker build.

- Modifies `demo/Dockerfile` to remove the `COPY package-lock.json ./` line.
  The `npm install` command during the Docker build will handle lockfile
  generation internally if one is not present. This prevents build failures
  if `package-lock.json` is missing from the `demo/` directory.
- Updates `demo/README.md` to provide clearer Docker build instructions,
  emphasizing that the build must be run from within the `demo/`
  directory and removing previous advice about manually generating
  `package-lock.json` in `demo/` before building the image.
Installs python3, make, and g++ in the Docker build stage
to allow node-sass to compile from source if needed. This resolves
build failures encountered due to incompatible pre-compiled
node-sass binaries or missing native compilation tools, particularly
on ARM64 architectures or with Alpine Linux.
Adds py3-setuptools to the apk dependencies in the Docker build stage.
This provides the 'distutils' Python module, which is required by
node-gyp when compiling native addons like node-sass. This resolves
the 'ModuleNotFoundError: No module named distutils' error encountered
during the build.
Addresses two issues that caused the Vite build to fail:

1.  Corrects the handling of `jjsip.min.js`:
    - Moves `vendor/jjsip.min.js` to `demo/public/jjsip.min.js`.
    - Updates the script tag in `demo/index.html` to `src="/jjsip.min.js"`
      so Vite handles it as a static asset. This resolves the error
      "can't be bundled without type='module' attribute".

2.  Removes unexpected characters from `demo/src/ChatContainer.vue`:
    - Deletes stray Unicode characters ('ްް') found in an import
      statement that caused a SyntaxError during parsing.
Modifies `demo/vite.config.js` to set `base: '/'` unconditionally.
This ensures that asset paths generated during the Vite build are
absolute from the server root, aligning with the Nginx configuration
in the Docker image which serves the demo application from the root.

This resolves 404 errors for assets (e.g., JavaScript, CSS files)
when running the demo application in the Docker container, where previously
assets were being requested with a `/vue-advanced-chat/` prefix due to
a conditional production base path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant