This project sets up a complete SIP call monitoring solution using:
- SIPp to simulate SIP traffic.
- Asterisk as the SIP server.
- Telegraf with custom scripts to export SIP stats.
- Prometheus for scraping metrics.
- Grafana for visualizing SIP call KPIs.
Architecture Overview
+----------------+ +----------------+ +--------------+ | | SIP | | Metrics| | | SIPp Load +------->| Asterisk +------->| Telegraf | | Generator | | SIP Server | | (exec plugin)| | | | | +--------------+ +----------------+ +----------------+ | | Metrics (HTTP) v +--------------------+ | Prometheus | | (Metrics Store) | +--------------------+ | | Query & Visualization v +--------------------+ | Grafana | | (Dashboard UI) | +--------------------+
sudo apt update
sudo apt install -y asterisk
sudo systemctl enable asterisk
sudo systemctl start asterisk
Configure basic Asterisk SIP accounts in /etc/asterisk/pjsip.conf and dialplans in /etc/asterisk/extensions.conf.
Enable the logs on asterisk console go to interactive mode using astersik -rvvv and give
sudo apt install -y sippAlternatively, build from source if more control is needed.
wget https://github.com/prometheus/prometheus/releases/latest/download/prometheus-*.linux-amd64.tar.gz
# Extract and move to /opt/prometheus, configure prometheus.ymlsudo apt install -y software-properties-common
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo apt update
sudo apt install grafanasudo apt install -y telegrafEnable the exec plugin in /etc/telegraf/telegraf.conf:
[[inputs.exec]]
commands = ["/usr/src/sipp/docs/sipp_stats_combined.sh"]
timeout = "5s"
data_format = "prometheus"/usr/src/sipp/docs/
├── sipp_stats_combined.sh # Exports SIP stats in Prometheus format
├── uac_new.xml # SIPp scenario file
├── uac_new_*.csv # Auto-generated stats CSV
├── uac_new_*.log # SIPp logs
Run SIPp with: sipp -sf uac_new.xml 172.31.17.9:5060 -s 1000 -p 5090 -m 1000 -trace_msg -trace_logs -trace_err
Above file will generate the latest CSV file and below script fetch the data from CSV
---
## 🧠 `sipp_stats_combined.sh`
Parses latest `uac_*.csv` and logs to export metrics:
* `sipp_successful_calls`
* `sipp_failed_calls`
* `sipp_retransmissions`
* `sipp_call_duration_seconds`
* `sipp_msg_invite`, `sipp_msg_ack`, etc.
Place in `/usr/src/sipp/docs/sipp_stats_combined.sh` and make it executable:
```bash
chmod +x /usr/src/sipp/docs/sipp_stats_combined.sh
-
Add Prometheus as a data source.
-
Create panels using metrics exposed:
- Call Success/Failure
- Call Duration
- SIP Message Counts
- Retransmission Rate
- Total and failed call count
- SIP response breakdown
- Retransmission tracking
- Message type distribution
- Histogram for call duration
Pull requests welcome! Please open an issue first to discuss your ideas.