Back to Dashboard

Bring Your Own Asterisk (BYOA) Setup Guide

Connect your own Asterisk or SIP server to Hello Kit for VoIP compliance in restricted regions.

Prerequisites

  • Asterisk 16+ or 18+ installed on your server
  • PJSIP module enabled (not chan_sip)
  • Public IP address or domain pointing to your server
  • Firewall access for SIP (5060) and RTP (10000-20000) ports
  • ITSP account (Telnyx, Twilio, etc.) for DID numbers

Configuration Generator

Enter your LiveKit SIP details to generate custom configuration:

These values will be provided after you create a Custom SIP trunk in Hello Kit.

1PJSIP Configuration

Add this to /etc/asterisk/pjsip.conf:

; ===== LiveKit SIP Trunk Configuration =====
; Add this to /etc/asterisk/pjsip.conf

; Transport (if not already defined)
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060

; LiveKit Endpoint
[livekit]
type=endpoint
context=to-livekit
disallow=all
allow=ulaw
allow=alaw
allow=opus
allow=g722
transport=transport-udp
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes

; LiveKit AOR (Address of Record)
[livekit]
type=aor
contact=sip:sip.yourdomain.com:5060
qualify_frequency=30

; LiveKit Identify (IP-based authentication)
[livekit]
type=identify
endpoint=livekit
match=YOUR_LIVEKIT_IP/32

2Dialplan Configuration

Add this to /etc/asterisk/extensions.conf:

; ===== LiveKit Routing Configuration =====
; Add this to /etc/asterisk/extensions.conf

[to-livekit]
; Route inbound DID calls to LiveKit AI Agent
exten => _+X.,1,NoOp(Routing to LiveKit: ${EXTEN})
 same => n,Set(CALLERID(name)=${CALLERID(num)})
 same => n,Dial(PJSIP/${EXTEN}@livekit,60)
 same => n,Hangup()

exten => _X.,1,NoOp(Routing to LiveKit: ${EXTEN})
 same => n,Dial(PJSIP/${EXTEN}@livekit,60)
 same => n,Hangup()

[from-livekit]
; Handle outbound calls from LiveKit
exten => _+X.,1,NoOp(Outbound from LiveKit: ${EXTEN})
 same => n,Dial(PJSIP/${EXTEN}@your-itsp-trunk,60)
 same => n,Hangup()

Replace your-itsp-trunk with your actual ITSP trunk name.

3Firewall Configuration

Open required ports (adjust for your firewall):

# Allow SIP traffic
sudo ufw allow 5060/udp
sudo ufw allow 5060/tcp

# Allow RTP traffic (adjust range as needed)
sudo ufw allow 10000:20000/udp

# If using TLS
sudo ufw allow 5061/tcp

4Reload & Verify

Reload Asterisk and verify the configuration:

# Reload Asterisk configuration
asterisk -rx "module reload res_pjsip.so"
asterisk -rx "dialplan reload"

# Verify trunk is loaded
asterisk -rx "pjsip show endpoints"
asterisk -rx "pjsip show aors"
asterisk -rx "pjsip show identifies"

# Test connectivity
asterisk -rx "pjsip qualify livekit"

5Create Custom SIP Trunk in Hello Kit

  1. Go to Telephony → SIP Trunks
  2. Click Create Trunk
  3. Select Custom / Bring Your Own as the provider
  4. Enter your Asterisk server's public IP address
  5. Add your DID numbers from your ITSP
  6. Create a Dispatch Rule to route calls to your AI agent or IVR

Troubleshooting

Trunk not connecting?

Check firewall rules, ensure ports 5060 and 10000-20000 are open. Verify the LiveKit IP is correct.

No audio?

Ensure RTP ports are open. Check rtp_symmetric=yes is set. Verify NAT settings if behind a router.

Calls dropping after 30 seconds?

This is usually a NAT issue. Ensure force_rport=yes and rewrite_contact=yes are set.

Debug commands:

# Enable SIP debugging
asterisk -rx "pjsip set logger on"

# Check active channels
asterisk -rx "core show channels"

# View SIP traffic
tcpdump -i any port 5060 -vvv

Need Help?

If you're having trouble setting up BYOA, our support team can help.