Skip to content

DaddyFilth/swireit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ž Swireit - Free Real-Time Call Platform

A completely free and open-source real-time call handling platform with AI agent tools, similar to SignalWire but without any costs.

✨ Features

  • 🌐 WebRTC Voice Calls - Browser-based real-time audio communication
  • πŸ€– AI Agent Tools - Smart call handling with intent recognition
  • πŸ”„ Call Transfer - Route and manage calls dynamically
  • πŸ“‘ WebSocket Signaling - Fast and reliable connection management
  • πŸ’° 100% Free - No hidden costs, subscriptions, or API limits
  • πŸš€ Easy Setup - Get started in minutes

🎯 What You Get

Unlike paid services like SignalWire, Swireit provides:

  1. Real-time call handling - WebRTC-based voice communication
  2. AI agent capabilities - Intent recognition and automated responses
  3. Signaling server - WebSocket-based call management
  4. Web interface - Ready-to-use browser client
  5. REST API - Programmatic call control
  6. Open source - Modify and extend as needed

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ installed
  • Modern web browser with WebRTC support

Installation

# Install dependencies
npm install

# Build the project
npm run build

# Start the server
npm start

The server will start on port 3000 (or PORT environment variable).

Development Mode

npm run dev

πŸ“– Usage

Web Interface

  1. Open http://localhost:3000 in your browser
  2. Enter a client ID (username) and click "Connect"
  3. Open another browser window/tab with a different client ID
  4. Enter the other client's ID and click "Start Call"
  5. The other client will receive an incoming call notification

API Endpoints

Health Check

GET /api/health

Get Active Calls

GET /api/calls

AI Agent Processing

POST /api/ai/process
Content-Type: application/json

{
  "transcript": "Hello, I need help",
  "context": {}
}

WebSocket Protocol

Connect to ws://localhost:3000 and send:

Register Client

{
  "type": "register",
  "clientId": "user123"
}

Make a Call

{
  "type": "call",
  "to": "user456",
  "offer": <RTCSessionDescription>
}

πŸ€– AI Agent Features

The platform includes a basic AI agent that can:

  • Recognize greetings and respond appropriately
  • Understand help requests
  • Detect transfer/forward intents
  • Provide contextual responses

Extending AI Capabilities

You can integrate free AI services:

  • Hugging Face - Free inference API
  • OpenAI Free Tier - Limited free tokens
  • Local Models - Run models like Llama locally
  • Rasa - Open-source conversational AI

AISec (AI Secretary) Integration

Swireit can forward AI processing to the AISec backend (https://github.com/DaddyFilth/aisec) for advanced call screening. AISec is public and can be initialized from this repo.

  1. Clone and start AISec from the repo:
    • git clone https://github.com/DaddyFilth/aisec.git
    • cd aisec
    • Follow the AISec README to configure and run the service (the default endpoint is /api/ai/process).
  2. Add the following to your .env file in this repo:
AISEC_API_URL=http://localhost:8080/api/ai/process
AISEC_API_KEY=your_aisec_api_key
AISEC_TIMEOUT_MS=5000
SWIREIT_PROJECT_ID=your_swireit_project_id
SWIREIT_API_TOKEN=your_swireit_api_token
SWIREIT_SPACE_URL=your-space.swireit.com
SWIREIT_CALLER_ID=+15551231234
SWIREIT_TWIML_URL=your_swireit_twiml_url
SWIREIT_VALIDATE_WEBHOOKS=true
  1. Ensure Swireit is running, then initialize AISec with the Swireit settings:
npm run init:aisec

This copies the Swireit settings into the AISec .env.local file so AISec can start with your Swireit configuration. Swireit should already be running before you run the init step. You can override the AISec location with AISEC_DIR=/path/to/aisec npm run init:aisec.

  1. Restart AISec so it picks up the updated .env.local.

Swireit will call AISec when AISEC_API_URL is set, and fall back to the built-in rules if AISec is unavailable.

Example integration in src/server.ts:

import fetch from 'node-fetch';

async function processWithAI(transcript: string) {
  // Example: Use Hugging Face free API (no cost, no API key required for basic usage)
  const response = await fetch(
    'https://api-inference.huggingface.co/models/facebook/blenderbot-400M-distill',
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ inputs: transcript })
    }
  );
  return await response.json();
}

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         WebSocket         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Client A  │◄──────Signaling──────────►│   Server    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                                          β”‚
       β”‚            WebRTC Audio                  β”‚
       │◄─────────Direct P2P────────────►│        β”‚
       β”‚                                  β”‚        β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Client B  β”‚                     β”‚  AI Agent   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Configuration

Create a .env file:

PORT=3000

🌟 Use Cases

  • Customer Support - AI-powered call routing
  • Conference Calling - Multi-party voice chat
  • Voice Assistants - Build custom voice bots
  • Call Centers - Free alternative to expensive platforms
  • Testing - WebRTC development and testing

πŸ†š Comparison with SignalWire

Feature Swireit SignalWire
Voice Calls βœ… Free πŸ’° Paid
AI Integration βœ… Free πŸ’° Paid
WebRTC βœ… Yes βœ… Yes
Cost πŸ’š $0 πŸ’Έ Usage-based
Open Source βœ… Yes ❌ No
Self-Hosted βœ… Yes ❌ No

πŸ” Security Notes

For production use:

  1. Add authentication/authorization
  2. Use HTTPS/WSS for encryption
  3. Implement rate limiting
  4. Add input validation
  5. Use secure TURN servers for NAT traversal

πŸ“ License

MIT License - Use freely for any purpose

🀝 Contributing

Contributions welcome! This is a free alternative to expensive platforms.

πŸŽ“ Learn More

πŸ’‘ Future Enhancements

  • Recording capabilities
  • Group calling (3+ participants)
  • Screen sharing
  • Advanced AI models integration
  • Call analytics dashboard
  • SIP gateway integration
  • Mobile app support

Built with ❀️ as a free alternative to expensive call platforms

About

real time call control

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors