IAX2 Registration Server (Python)
Overview
- Listens for IAX2 registration packets and authenticates/registers
nodes using pluggable backends. Successful registrations are optionally
published as protobuf
updatemessages to Kafka for consumption by other services (for example a DNS service).
Project layout
threaded_server.py— UDP server entrypoint handling IAX2 packets.iax2/— IAX2 packet parsing and helpers.register/— registration backends (aslold, flatfile, dummy).notify/— notification backends (kafka, dummy).dns_pb2.py— generated protobuf bindings (included in-tree).pyiax-reg.conf— example configuration file.useraccess.csv— sample flatfile user database used byflatfilebackend.
Prerequisites
- Python 3.8+
- A running Kafka cluster if you plan to use the
kafkanotify backend - (optional) A MySQL-compatible database containing an ASL-style
user_Nodestable if you use theasloldregistration backend
Install
- Create and activate a virtualenv and install requirements:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt- The repository already includes
dns_pb2.py. If you need to regenerate it, obtaindns.protofrom the DNS server project (GitHub: https://github.com/Apprpt-Central/dnsserver) and runprotoc.
Configuration
pyiax-reg.confcontains defaults for command line options. You can either edit this file or pass options tothreaded_server.py.- Important options include:
--register— choose a registration backend (choices are the names in theregister/package, e.g.flatfile,aslold,dummy).--notify— choose a notification backend (e.g.kafka,dummy).- Backend-specific options are documented in each module's
help().
Running locally
Start the UDP server with a chosen register & notify backend. Examples:
Flatfile register (uses useraccess.csv):
python3 threaded_server.py --register flatfile --notify dummyASL DB register (MySQL):
python3 threaded_server.py --register aslold --notify kafka --db mysql+pymysql://user:pass@host/dbnameNotes on backends
register/flatfile.pyreadsuseraccess.csvby default; see itshelp()for the--fileoption.register/aslold.pyconnects via SQLAlchemy; pass--dbto configure the SQLAlchemy URL.notify/kafka.pyusesconfluent_kafka.Producerand publishes serializedupdateprotobuf messages to the configured topic.
Testing
get_info.pyis a small client script that sends an IAX INFO packet to a local server to help exercise parsing and responses.threaded_server.pyruns the server directly and supports common command-line help for module-specific options.
Docker
Build and run with the provided Dockerfile:
docker build -t pyiax-register .
docker run --rm -it --network host pyiax-register python3 threaded_server.py --register flatfileSecurity & notes
- The project includes example credentials and configuration files for
testing (
useraccess.csv,pyiax-reg.conf). Do not use these in production. - When referencing the DNS server/protobufs, note that
dnsserveris a separate GitHub project: https://github.com/Apprpt-Central/dnsserver
License
This project is licensed under the terms in LICENSE.