Skip to content

fr0stb1rd/altaychat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AltayChat - Secure P2P Audio

Build & Deploy

logo

AltayChat is a cross-platform, peer-to-peer (P2P) voice chat application. It allows two people to talk securely over the internet without a central audio server. It uses modern technologies like WebRTC for networking and Opus for high-quality audio.

✨ Key Features

  • P2P Architecture: Audio data goes directly from one user to another. No server listens to or stores your voice.
  • High-Quality Audio: Powered by the Opus codec (48kHz Mono) for crystal clear sound even on slow connections.
  • Security: Uses DTLS-SRTP for end-to-end encryption.
  • Privacy: Supports Cloudflare TURN relay to hide your IP address and bypass strict firewalls.
  • Firewall & DPI Bypass: Uses Cloudflare TURN fallback ports (53 DNS, 80 HTTP, 443 HTTPS/TLS) to traverse strict corporate networks and Symmetric NATs seamlessly.
  • Low Latency: Uses lock-free buffers and event-driven threads for real-time performance.
  • Automated Signaling: No need to copy-paste long SDP strings; a lightweight signaling server handles the handshake.

🛠️ Technical Stack

Component Technology
Networking libdatachannel (WebRTC)
Audio Codec libopus
Audio I/O PortAudio
Signaling Cloudflare Workers & Durable Objects
Build System CMake
Dependencies vcpkg (C++ Package Manager)

🚀 Getting Started

Prerequisites

To build the project locally, you need a C++17 compiler and CMake.

Building on Linux (Arch Linux)

# Install system dependencies
sudo pacman -S libdatachannel opus portaudio nlohmann-json cmake ninja

# Build the project
cmake -B build
cmake --build build -j$(nproc)

# Run the app
./build/altaychat

Note (Local Build): You do not need vcpkg to build the app on Linux or macOS. As long as you install the dependencies using your system package manager (e.g., pacman, apt, brew), the CMakeLists.txt will automatically use pkg-config as a fallback to locate them.

Building on macOS

brew install libdatachannel opus portaudio nlohmann-json
cmake -B build && cmake --build build
./build/altaychat

Building on Windows (with vcpkg)

# Install dependencies via vcpkg
vcpkg install libdatachannel:x64-windows opus:x64-windows portaudio:x64-windows nlohmann-json:x64-windows

# Configure and Build
cmake -B build -DCMAKE_TOOLCHAIN_FILE="C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake"
cmake --build build --config Release

# Run the app
./build/Release/altaychat.exe

📖 How to Use

  1. Launch the App: Open the terminal and run altaychat.
  2. Join a Room: Enter a unique room name (e.g., my-private-room-123).
  3. Connect: Tell your friend to join the exact same room name.
  4. Talk: Once connected, the audio stream starts automatically.
  5. Exit: Press Ctrl+C to close the connection and exit.

Advanced Flags

  • --debug: Show detailed connection and audio logs.
  • --version: Show current version and build info.
  • --smoke-test: Verify if all libraries and audio drivers are loaded correctly.

🔒 Security & TURN Configuration

By default, AltayChat tries to connect directly. For better connectivity and privacy, you can use TURN servers.

  1. Create or open the altaychat.conf file in the same folder as the app.
  2. Add your credentials:
ALTAYCHAT_TURN_USERNAME=your_username
ALTAYCHAT_TURN_PASSWORD=your_password

Alternatively, you can set ALTAYCHAT_TURN_USERNAME and ALTAYCHAT_TURN_PASSWORD environment variables.


⚙️ Signaling Server Configuration

The app requires a signaling server URL to connect peers. You can set this URL in one of three ways:

  1. Configuration File (Recommended): Create a file named altaychat.conf in the same directory as the executable and add your URL:
    SIGNALING_URL=wss://your-signaling-server.com
  2. Environment Variable: Export the ALTAYCHAT_SIGNALING_URL environment variable:
    export ALTAYCHAT_SIGNALING_URL=wss://your-signaling-server.com
  3. Default Fallback: If neither is provided, the app will use default signaling server.

🔒 Security Note: The default public signaling server only routes connection data (SDP and ICE candidates). It cannot access or eavesdrop on your audio. All media is strictly Peer-to-Peer and End-to-End Encrypted (E2EE) using DTLS-SRTP.


🏗️ Project Structure

  • src/audio/: Handles raw audio capture and playback using PortAudio.
  • src/config/: Centralized configuration manager for parsing files and environment variables.
  • src/signaling/: Communicates with the Cloudflare Worker to find peers.
  • src/webrtc/: Manages P2P connection, ICE gathering, and RTP packets.
  • server/: Source code for the Cloudflare Worker signaling server.

☁️ Signaling Server

The signaling server runs on Cloudflare Workers with Durable Objects. Source is in the server/ folder. Deploy with:

cd server
npx wrangler deploy

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.


Developed with ❤️ by fr0stb1rd

About

High-performance, P2P encrypted voice chat application using WebRTC, Opus, and PortAudio. Cross-platform, serverless audio relay, and Cloudflare-backed signaling.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors