Skip to content

WebDevProUS/AsteriskManager

Repository files navigation

SIP Autodialer System

A professional web-based SIP autodialer system with Asterisk ARI integration for outbound calling campaigns.

Features

  • Web Dashboard: Upload phone lists (.txt) and audio files (.wav)
  • Campaign Management: Configure caller ID, concurrency, and call delays
  • Real-time Monitoring: Live statistics and call status updates
  • Answering Machine Detection (AMD): Automatic human/machine classification
  • DTMF Capture: Real-time tone detection and logging
  • CDR Logging: Complete call detail records with export functionality
  • WebSocket Integration: Real-time dashboard updates

Requirements

  • Rocky Linux 8 (or compatible Linux distribution)
  • Asterisk 20.14.1+ with ARI enabled
  • Node.js 18+ and npm
  • PJSIP trunk configured in Asterisk

Installation on Your Rocky Linux 8 VPS

1. Prepare the System

# Install Node.js 20
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
sudo dnf install -y nodejs

# Create application directory
sudo mkdir -p /opt/autodialer
sudo chown $USER:$USER /opt/autodialer
cd /opt/autodialer

2. Deploy the Application

Upload all files to /opt/autodialer/ on your VPS, then:

# Install dependencies
npm install

# Create necessary directories
mkdir -p uploads audio

# Set file permissions
chmod 755 server.js
chmod -R 755 lib/ public/

3. Configure Asterisk ARI

Ensure your /etc/asterisk/ari.conf contains:

[general]
enabled = yes
pretty = yes
allowed_origins = *

[asterisk]
type = user
read_only = no
password = asterisk

Ensure your /etc/asterisk/http.conf contains:

[general]
enabled = yes
bindaddr = 127.0.0.1
bindport = 8088
prefix = asterisk

4. Configure PJSIP Trunk

Your /etc/asterisk/pjsip.conf should have your trunk configured as trunk-endpoint:

[trunk-endpoint]
type = endpoint
transport = transport-udp
context = from-trunk
disallow = all
allow = ulaw,alaw,g729
rtp_symmetric = yes
direct_media = no

[trunk-auth]
type = auth
auth_type = userpass
password = your_password
username = your_username

[trunk-aor]
type = aor
contact = sip:us01.pr.mightycall.com:16060

[trunk-identify]
type = identify
endpoint = trunk-endpoint
match = us01.pr.mightycall.com

[trunk-reg]
type = registration
transport = transport-udp
outbound_auth = trunk-auth
server_uri = sip:us01.pr.mightycall.com:16060
client_uri = sip:your_username@us01.pr.mightycall.com:16060
retry_interval = 60

5. Audio File Setup

# Create custom audio directory in Asterisk
sudo mkdir -p /var/lib/asterisk/sounds/custom
sudo chown asterisk:asterisk /var/lib/asterisk/sounds/custom
sudo chmod 755 /var/lib/asterisk/sounds/custom

Audio files uploaded through the web interface will be automatically converted and placed in the correct location.

6. Stasis Application Configuration

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

[autodialer-context]
exten => _X.,1,NoOp(Autodialer call to ${EXTEN})
same => n,Stasis(autodialer)
same => n,Hangup()

7. Start the Application

# Run directly
node server.js

# Or run with PM2 for production
npm install -g pm2
pm2 start server.js --name "autodialer"
pm2 startup
pm2 save

8. Configure Firewall (if needed)

# Allow port 5000 for the web interface
sudo firewall-cmd --permanent --add-port=5000/tcp
sudo firewall-cmd --reload

Environment Variables

You can configure the application using environment variables:

export ARI_HOST=127.0.0.1
export ARI_PORT=8088
export ARI_USERNAME=asterisk
export ARI_PASSWORD=asterisk
export ARI_APP_NAME=autodialer
export PORT=5000

Usage

  1. Access the Dashboard: Open http://your-vps-ip:5000 in your browser

  2. Upload Files:

    • Phone list: Text file with one phone number per line
    • Audio file: WAV format audio message
  3. Configure Campaign:

    • Set caller ID (optional)
    • Configure concurrency (simultaneous calls)
    • Set delay between calls
  4. Monitor Progress: Watch real-time statistics and call status

  5. Export Results: Download CDR records in JSON format

File Structure

/opt/autodialer/
├── server.js              # Main application server
├── lib/
│   ├── ariClient.js        # Asterisk ARI client
│   ├── callManager.js      # Call management logic
│   ├── database.js         # SQLite database operations
│   └── amdDetector.js      # Answering machine detection
├── public/
│   ├── index.html          # Web dashboard
│   ├── app.js              # Frontend JavaScript
│   └── styles.css          # Dashboard styling
├── uploads/                # Uploaded phone lists
├── audio/                  # Uploaded audio files
├── autodialer.db          # SQLite database
└── package.json           # Node.js dependencies

Troubleshooting

ARI Connection Issues

  1. Check Asterisk ARI status:
asterisk -rx "ari show status"
  1. Verify ARI configuration:
asterisk -rx "ari show users"
  1. Check HTTP interface:
curl http://127.0.0.1:8088/ari/asterisk/info -u asterisk:asterisk

PJSIP Trunk Issues

  1. Check registration status:
asterisk -rx "pjsip show registrations"
  1. Check endpoint status:
asterisk -rx "pjsip show endpoints"

Audio File Issues

  1. Ensure files are in correct format (WAV, 8kHz, mono)
  2. Check Asterisk sounds directory permissions
  3. Verify file conversion logs in application output

Security Considerations

  • Change default ARI credentials
  • Use firewall to restrict access to port 5000
  • Consider using SSL/TLS for production
  • Regularly backup the SQLite database
  • Monitor call volumes and costs

Support

For issues related to:

  • Asterisk configuration: Check Asterisk documentation
  • PJSIP trunk setup: Contact your SIP provider
  • Application bugs: Check server logs in /opt/autodialer/

License

This software is provided as-is for educational and commercial use.

Releases

No releases published

Packages

No packages published