A Go-based SIP client for connecting to BSNL Wings VoIP service using the sipgo library.
- Go 1.21 or later
- BSNL Wings account credentials
Using the Makefile (recommended):
# Initial setup - creates .env file and installs dependencies
make setup
# Edit .env with your BSNL Wings credentials
# Then run the application
make dev-
Copy the environment configuration file:
cp .env.example .env # Or use: make setup -
Edit
.envand add your BSNL Wings credentials:SIP_USERNAME: Your BSNL Wings usernameSIP_PASSWORD: Your BSNL Wings passwordSIP_SERVER: BSNL Wings SIP server address (verify the correct server)SIP_PORT: SIP server port (typically 5060)
-
Install dependencies:
go mod download # Or use: make deps
# Run in development mode (loads .env automatically)
make dev
# Build and run
make run
# Just build
make buildOnce registered, use the interactive commands:
> call +919876543210 # Dial a number
> status # Check call status
> hangup # End the callSee CALLING.md for complete calling documentation.
# Using environment variables from .env file (filters out comments)
export $(grep -v '^#' .env | grep -v '^$' | xargs) && go run cmd/wings-client/main.go
# Or set environment variables manually
export SIP_USERNAME="your_username"
export SIP_PASSWORD="your_password"
export SIP_SERVER="sip.bsnl.in"
go run cmd/wings-client/main.go
# Build and run
go build -o wings-client cmd/wings-client/main.go
./wings-clientRun make help to see all available commands:
| Command | Description |
|---|---|
make help |
Display all available commands |
make setup |
Initial project setup (creates .env, installs dependencies) |
make dev |
Run in development mode with .env |
make build |
Build the application binary |
make build-all |
Build for multiple platforms (Linux, macOS, Windows) |
make run |
Build and run the application |
make test |
Run all tests |
make test-coverage |
Run tests with coverage report |
make fmt |
Format Go code |
make lint |
Run golangci-lint |
make vet |
Run go vet |
make check |
Run fmt, vet, and test |
make clean |
Remove built binaries and artifacts |
make install |
Install binary to $GOPATH/bin |
make sngrep |
Start sngrep for SIP traffic debugging |
make debug-sip |
Run client + sngrep in split screen (tmux) |
wings-client/
├── cmd/
│ └── wings-client/ # Main application entry point
│ └── main.go
├── internal/
│ ├── config/ # Configuration management
│ │ └── config.go
│ └── sip/ # SIP client implementation
│ └── client.go
├── go.mod
├── .env.example # Example environment configuration
└── README.md
- ✅ SIP Registration with BSNL Wings server
- ✅ Outbound Calling with full audio support
- ✅ RTP Audio Streaming (PCMU/PCMA codecs)
- ✅ WebSocket API for real-time audio integration
- ✅ Interactive CLI for making and managing calls
- ✅ AI Voice Bot — GPT-4o + ElevenLabs STT/TTS with weather & hangup tools
- ✅ Custom Pipecat Transport (
WingsWebSocketTransport) with PCMU↔PCM conversion - ✅ Digest authentication support
- ✅ UDP transport for SIP
- ✅ Compatible with Pipecat and similar frameworks
- ✅ Clean shutdown handling
The pipecat/ai_bot.py bot answers phone calls with a fully conversational AI using:
- STT: ElevenLabs Scribe v1 (speech-to-text)
- LLM: OpenAI GPT-4o
- TTS: ElevenLabs Turbo v2.5 (text-to-speech)
- VAD: Silero (voice activity detection, supports interruptions)
- Transport:
WingsWebSocketTransport— custom Pipecat transport that handles PCMU↔PCM conversion and real-time audio pacing
| Tool | Description |
|---|---|
get_weather(city) |
Fetches live weather for any city via Open-Meteo |
hangup() |
Politely says goodbye and ends the call |
Terminal 1 — start the SIP client:
make devTerminal 2 — start the AI bot:
cd pipecat
# Install dependencies (uv recommended)
uv sync
# or: pip install -r requirements.txt
# Set required API keys in .env
export OPENAI_API_KEY="sk-..."
export ELEVENLABS_API_KEY="..."
python ai_bot.py| Variable | Description | Default |
|---|---|---|
OPENAI_API_KEY |
OpenAI API key | Required |
ELEVENLABS_API_KEY |
ElevenLabs API key | Required |
WINGS_WS_URL |
Wings WebSocket URL | ws://localhost:8080/ws |
BOT_NAME |
Bot display name | BSNL Wings AI Assistant |
ELEVENLABS_VOICE_ID |
ElevenLabs voice ID | Rachel (21m00Tcm4TlvDq8ikWAM) |
LOG_LEVEL |
Log verbosity | INFO |
Caller dials → BSNL IMS → wings-client (Go, SIP+RTP) → WebSocket :8080
↕ PCMU binary
WingsWebSocketTransport (Python)
↕ PCM
ElevenLabs STT → GPT-4o → ElevenLabs TTS
The bot greets callers automatically, listens for speech, and responds naturally. Silero VAD enables real-time interruptions.
The client exposes a WebSocket server for real-time audio streaming and call control, making it easy to integrate with voice AI applications.
Quick Start:
const ws = new WebSocket('ws://localhost:8080/ws');
ws.onmessage = (event) => {
if (event.data instanceof Blob) {
// Received audio from SIP call
} else {
// Received event/control message
console.log(JSON.parse(event.data));
}
};Features:
- Bidirectional PCM audio streaming (8kHz, 16-bit, mono)
- JSON-based control messages
- Real-time call events
- Compatible with Pipecat, WebRTC, and other frameworks
See WEBSOCKET_API.md for complete API documentation.
All configuration is done through environment variables:
| Variable | Description | Default |
|---|---|---|
SIP_SERVER |
BSNL Wings SIP server address | sip.bsnl.in |
SIP_PORT |
SIP server port | 5060 |
SIP_USERNAME |
Your BSNL Wings username | Required |
SIP_PASSWORD |
Your BSNL Wings password | Required |
SIP_DISPLAY_NAME |
Display name for the client | BSNL Wings Client |
LOCAL_IP |
Local IP to bind to | 0.0.0.0 |
LOCAL_PORT |
Local port to listen on | 5061 |
WEBSOCKET_ENABLED |
Enable WebSocket server | true |
WEBSOCKET_PORT |
WebSocket server port | 8080 |
If you're getting a "404 Not Found" response:
- Verify account activation: Ensure your BSNL Wings account is fully activated and provisioned
- Check credentials: Confirm your SIP username and password are correct
- Username format: Use the full number with country code (e.g.,
+918480000384) - Contact BSNL: The account might need to be activated on their SIP server
- Ensure your firewall allows UDP traffic on the configured local port (default: 5061)
- If behind NAT, you may need to configure port forwarding
- Check that no other application is using the local port
The correct BSNL Wings configuration includes:
- Register Server:
or.voip.ims.bsnl.in - Outbound Proxy:
ir.bbsr.sbc.ims.bsnl.in:80(Bhubaneswar SBC)- Alternative:
ir.kol.sbc.ims.bsnl.in:80(Kolkata SBC)
- Alternative:
- Username: Full number with +91 prefix
- Port: 80 for outbound proxy (not standard 5060)
For detailed documentation on specific topics, see:
- WebSocket API - Complete WebSocket API reference for real-time audio streaming
- Making Calls - Detailed guide on making and managing calls
- Pipecat Integration - Integrating with Pipecat voice AI framework
- Debugging Guide - Troubleshooting and debugging SIP traffic
wings-client/
├── cmd/wings-client/ # Main application entry point
├── internal/
│ ├── config/ # Configuration management
│ ├── sip/ # SIP client (registration, calling, RTP)
│ └── websocket/ # WebSocket server for audio bridge
├── pipecat/
│ ├── ai_bot.py # AI voice bot (GPT-4o + ElevenLabs)
│ ├── wings_transport.py # Custom Pipecat WebSocket transport
│ ├── weather.py # Weather tool (Open-Meteo)
│ ├── echo_bot.py # Simple echo bot (testing)
│ └── echo_bot_smart.py # Echo bot with VAD
├── docs/ # Documentation + GitHub Pages site
├── examples/ # Code examples
└── scripts/ # Helper scripts
MIT License — see LICENSE.