AI Voice Agent and Chat Platform

AI Voice Agent and Chat Platform
AI Voice Agent and Chat Platform - 1AI Voice Agent and Chat Platform - 2
OtherVisit

TanvirSoftCall

AI voice-agent, contact-center, and Asterisk PBX platform

TanvirSoftCall is a self-hosted, multi-tenant platform for building AI voice agents, handling browser and SIP calls, managing PBX resources, and operating customer communication workflows from one web application.

The project combines a visual AI workflow builder with real-time speech processing, WebRTC calling, website voice and chat widgets, campaign automation, CRM tools, and a dedicated Asterisk PBX control service. It supports both AI-assisted calls and conventional extension-to-extension communication while keeping organizations, credentials, usage, and telephony resources isolated by tenant.

The Problem

Businesses often need separate products for AI agents, SIP/PBX administration, browser calling, campaigns, CRM records, recordings, and reporting. This increases integration effort and makes it difficult to maintain one reliable view of each customer interaction.

TanvirSoftCall brings these capabilities into a unified platform. Administrators can design an agent, connect a telephony provider or Asterisk PBX, assign phone numbers and extensions, publish a website widget, and review call activity without building a separate control plane for every service.

Core Features

AI Agent Platform

  • Visual node-based workflow builder for conversational voice agents
  • Draft, versioning, publishing, templates, folders, and reusable agent definitions
  • Configurable prompts, tools, global guidance, call transfer, data extraction, and end-call behavior
  • Separate LLM, speech-to-text, and text-to-speech configuration
  • Realtime speech-to-speech model support
  • Per-agent TTS voice and speaking-speed controls
  • Retrieval-augmented knowledge base with document processing and vector search
  • Browser-based audio testing and text-based agent simulation
  • Per-workflow call-recording controls with transcript and recording storage

Voice, WebRTC, and Embeddable Widgets

  • Browser audio calls using WebRTC and WebSocket signaling
  • Self-hosted coturn service for STUN/TURN NAT traversal with temporary credentials
  • Embeddable website voice-call widget
  • Separate embeddable ChatAgent widget with independent text, color, position, and display settings
  • Floating, inline, and headless chat-widget modes
  • Call and chat history with duration, disposition, media, and LLM token usage

Telephony and Asterisk PBX

  • Dedicated FastAPI PBX service connected to a containerized Asterisk 22 runtime
  • SIP extensions, endpoint devices, registration status, trunks, queues, routes, DIDs, IVR menus, and voicemail foundations
  • Organization-scoped PBX configuration and extension numbering
  • Extension-to-extension calling and AI-agent routing through Asterisk ARI/Stasis
  • AMI/ARI integration, service-token authentication, health checks, command validation, and audit records
  • Idempotent PBX provisioning jobs with generated configuration artifacts and startup reconciliation
  • SIP UDP and TCP transports, NAT-aware media configuration, and RTP port management
  • G.722, Opus, ulaw, and alaw codec support with configurable codec policies
  • Optional SIP audio denoising and human-to-human call recording
  • PBX call events synchronized into the main application call history

Contact Center and Business Operations

  • Contact-center agent workspace with agent presence, queue context, extension status, and live call state
  • Agent assignment, queue membership, outbound dialing, and agent-wise reporting foundations
  • Inbound and outbound campaign management with background orchestration
  • CRM companies, contacts, leads, deals, activities, notes, tasks, and call links
  • Product catalog, collections, orders, and order-item management
  • Organization-level reporting, monitoring, and audit trails

Multi-Tenant Administration

  • Local authentication with organization and user management
  • Organization-scoped data access and delegated PBX permissions
  • Superadmin control plane for tenant governance, PBX access, health, provisioning, and audit review
  • Configurable concurrency and usage limits
  • Versioned pricing catalog, usage events, charge records, invoices, payments, and credit-ledger foundations
  • API keys and Python/TypeScript SDKs for external integrations

My Contributions

  • Designed and implemented the end-to-end architecture across the SaaS application and dedicated PBX service
  • Built the main asynchronous FastAPI backend and organization-scoped PostgreSQL data model
  • Developed the Next.js and React administration interface, workflow builder, dashboards, and operational forms
  • Integrated the Pipecat-based real-time voice pipeline with configurable LLM, STT, TTS, and realtime providers
  • Implemented WebRTC signaling, microphone handling, ICE configuration, and self-hosted STUN/TURN support
  • Built independent website voice and ChatAgent widgets with token-based embedding and domain controls
  • Developed Asterisk AMI/ARI integration, SIP extension provisioning, registration telemetry, dialplan generation, and AI call routing
  • Implemented PBX synchronization jobs, idempotent command contracts, rendered configuration snapshots, and recovery behavior
  • Added extension-to-extension calling, NAT-aware RTP handling, codec policies, denoising, and recording support
  • Built CRM, campaign, product, order, reporting, pricing, usage, and superadmin foundations
  • Implemented background processing with ARQ and Redis for workflow completion, recordings, campaigns, knowledge-base processing, and PBX synchronization
  • Containerized the platform and configured production deployment with Docker Compose, Nginx, TLS, PostgreSQL, Redis, MinIO, coturn, and Asterisk
  • Added automated backend tests, frontend type checking, smoke-test scripts, health checks, and operational documentation

Technical Architecture

The system is divided into two services:

  1. Main application: The Next.js interface and FastAPI backend own authentication, organizations, AI workflows, CRM, campaigns, billing foundations, usage, browser calling, and application-level telephony configuration.
  2. PBX service: A separate FastAPI service owns low-level Asterisk execution, including AMI/ARI communication, SIP configuration rendering, PBX event ingestion, runtime health, and configuration reloads.

The services communicate through authenticated internal APIs. PostgreSQL is the application source of truth, Redis and ARQ handle asynchronous work, MinIO stores recordings and generated media, and Asterisk manages SIP signaling and RTP media. Nginx provides the public HTTPS entry point, including WebSocket and object-storage proxy routes.

Technology Stack

AreaTechnologies
FrontendNext.js 16, React 19, TypeScript, Tailwind CSS, Radix UI, React Flow, Zustand, Recharts
Main backendPython, FastAPI, SQLAlchemy Async, Alembic, Pydantic
AI and voicePipecat, OpenAI-compatible LLMs, configurable STT/TTS providers, realtime speech models
Realtime communicationWebRTC, WebSocket, ICE, STUN/TURN, coturn
PBX and SIPAsterisk 22, PJSIP, ARI, AMI, RTP, SIP UDP/TCP
Data and workersPostgreSQL, pgvector, Redis, ARQ
Media storageMinIO with S3-compatible object storage
InfrastructureDocker, Docker Compose, Linux, Nginx, Let's Encrypt TLS
Quality and toolingPytest, TypeScript type checking, ESLint, API smoke tests, Git

Supported Integration Foundation

The telephony abstraction contains provider adapters for Asterisk ARI, Twilio, Telnyx, Vonage, Plivo, Cloudonix, and Vobiz. The model configuration layer supports multiple LLM, STT, TTS, and realtime providers, including OpenAI, Azure OpenAI, Google Gemini, Groq, Deepgram, Cartesia, ElevenLabs, and other compatible services.

Provider availability depends on configured credentials and the selected deployment. The self-hosted Asterisk path is the primary PBX implementation used by this project.

Engineering Challenges Solved

  • Coordinated state between a multi-tenant SaaS database and live Asterisk configuration without reporting false synchronization
  • Preserved tenant isolation while allowing different organizations to reuse the same extension numbers
  • Solved SIP and RTP behavior across Docker networks, public servers, NAT, Wi-Fi, and mobile networks
  • Connected Asterisk media to the AI runtime through ARI, Stasis, and external media channels
  • Added WebRTC fallback behavior using both STUN and authenticated TURN relay paths
  • Kept recordings, transcripts, usage processing, and billing events reliable through background workers
  • Unified AI calls, browser calls, chat sessions, and PBX call records without duplicating AI-agent history

Outcome

TanvirSoftCall provides a deployable foundation for AI voice automation and contact-center operations. A business can create and publish an AI agent, connect browser or SIP channels, manage its PBX extensions and routing, embed voice and chat experiences on a website, and review communication history from one tenant-aware platform.

The project demonstrates full-stack product engineering across conversational AI, real-time media, telecommunications, SaaS architecture, background processing, operational tooling, and production deployment.