Skip to content

ellwould/yap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

224 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image

image


YAP (Yet Another PBX) 📞

A GUI to administrate a multi-tenanted SIP Server, YAP is written in Go and uses the Asterisk framework.


(Tested with Ubuntu version 24.04.3 and Asterisk certified version 20.7-cert8)


Main Menu (logged in as a YAP Admin):


image


Show/hide more account details button pressed:

image


An Example of the group 👥 Table

id group_name date_added group_active note
1 system 20/10/2025 11:45:34 1 created during YAP install
13986442703273989 (typically a company name of a VoIP reseller) 04/11/2025 05:51:21 1 not_provided

An Example of the group_invoice_address 📕 Table

id address_line_1 address_line_2 city_town_village postcode_zip_code county_state_region country contact_email contact_number
1 system system system system system system system system
13986442703273989 (typically the VoIP resellers street/road) (typically the VoIP resellers building name/number) (typically the VoIP resellers city/town/village) (typically the VoIP resellers postcode/zip code) (typically the VoIP resellers county/state/region) (typically the VoIP resellers country) accounts@example.com +441514960000

An Example of the group_site_address 📗 Table

id address_line_1 address_line_2 city_town_village postcode_zip_code county_state_region country contact_email contact_number
1 system system system system system system system system
13986442703273989 (typically the VoIP resellers street/road) (typically the VoIP resellers building name/number) (typically the VoIP resellers city/town/village) (typically the VoIP resellers postcode/zip code) (typically the VoIP resellers county/state/region) (typically the VoIP resellers country) support@example.com +441614960000

An Example of the pbx 🖥️ Table

id pbx_name group_id date_added pbx_active note
1 system 1 20/10/2025 03:08:23 1 created during YAP install
13995787344150533 (typically a company that is a customer of a VoIP reseller) 13986442703273989 02/01/2026 09:02:13 1 not_provided

An Example of the pbx_invoice_address 📘 Table

id address_line_1 address_line_2 city_town_village postcode_zip_code county_state_region country contact_email contact_number
1 system system system system system system system system
13995787344150533 (typically the VoIP resellers street/road) (typically the VoIP resellers building name/number) (typically the VoIP resellers city/town/village) (typically the VoIP resellers postcode/zip code) (typically the VoIP resellers county/state/region) (typically the VoIP resellers country) accounts@example.net +441414960000

An Example of the pbx_site_address 📙 Table

id address_line_1 address_line_2 city_town_village postcode_zip_code county_state_region country contact_email contact_number
1 system system system system system system system system
13995787344150533 (typically the VoIP resellers street/road) (typically the VoIP resellers building name/number) (typically the VoIP resellers city/town/village) (typically the VoIP resellers postcode/zip code) (typically the VoIP resellers county/state/region) (typically the VoIP resellers country) sales@example.net +441414960000

An Example of the user_account 👤 Table

id email first_name last_name user_account_type_id group_id pbx_id date_added account_active
1 yap@ell.today Elliot Keavney 100 1 1 20/10/2025 09:53:55 1
2 john@example.com John not_provided 200 13986442703273989 1 04/11/2025 10:23:19 1
3 jane@example.net Jane not_provided 301 13986442703273989 13995787344150533 03/01/2026 07:49:12 0
4 frank@example.com Frank not_provided 201 13986442703273989 1 02/01/2026 04:42:10 1

User Account Permissions ✔️ ( ✅ = Allowed | ❌ = Prohibited | ⛔ = Not Applicable )

YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
View Own User Account
Update Own User Account
Delete Own User Account
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Create a YAP Admin
(100) User Account
View a YAP Admin
(100) User Account
Update a YAP Admin (100)
Delete a YAP Admin (100)
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Create a Group Admin (200)
View a Group Admin (200)
Update a Group Admin (200)
Delete a Group Admin (200)
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Create a Group Regular
(201) User Account
View a Group Regular
(201) User Account
Update a Group Regular
(201) User Account
Delete a Group Regular
(201) User Account
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Create a PBX Admin (300)
View a PBX Admin
(300) User Account
Update a PBX Admin
(300) User Account
Delete a PBX Admin
(300) User Account
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Create a PBX Regular
(301) User Account
View a PBX Regular
(301) User Account
Update a PBX Regular
(301) User Account
Delete a PBX Regular
(301) User Account
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Create a PBX Read Only
(302) User Account
View a PBX Read Only
(302) User Account
Update a PBX Read Only
(302) User Account
Delete a PBX Read Only
(302) User Account
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
View Own Group
Update Own Group
Delete Own Group
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Create a Group
View a Group
Update a Group
Delete a Group
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
View Own PBX
Update Own PBX
Delete Own PBX
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Create a PBX
View a PBX
Update a PBX
Delete a PBX
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Create a SIP Endpoint
View a SIP Endpoint
Update a SIP Endpoint
Delete a SIP Endpoint
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Add a SIP Trunk
View a SIP Trunk
Update a SIP Trunk
Delete a SIP Trunk
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Add a Phone Number
View a Phone Number
Update a Phone Number
Delete a Phone Number
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
View CDRs
Download CDRs
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
View Voicemails
Listen to Voicemails
Download Voicemails
Delete Voicemails
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
View Call Recordings
Listen to Call Recordings
Download Call Recordings
Delete Call Recordings
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Upload a MoH or AA Audio File
Listen to MoH and AA Audio Files
Download MoH and AA Audio Files
Delete MoH and AA Audio Files
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
Set Resource Limits
View Resource Limits
Set Storage Capacity
View Storage Capacity
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
View YAP User Account Logs
View Group Logs
View PBX Logs
Download Logs
YAP Admin (100) Group Admin (200) Group Regular (201) PBX Admin (300) PBX Regular (301) PBX Read Only (302)
View Server Information
Download Server Information


Asterisk ☎️


Naming Format 🏷️


Tip

Underscores are used for contexts names because MariaDB does not like hyphens in table names.


Transport 🚕 naming format:

  • IPv4-UDP
  • IPv4-TCP
  • IPv4-TLS
  • IPv6-UDP
  • IPv6-TCP
  • IPv6-TLS

SIP Trunks ↔️ naming format:

  • PBX-13995787344150533-ST-1 (Endpoint)
  • PBX-13995787344150533-ST-1 (AOR)
  • PBX-13995787344150533-ST-1 (AUTH)
  • PBX_13995787344150533_IN (Context)

  • PBX-13995787344150533-ST-2 (Endpoint)
  • PBX-13995787344150533-ST-2 (AOR)
  • PBX-13995787344150533-ST-2 (AUTH)
  • PBX_13995787344150533_IN (Context)

Extensions 📲 naming format:

  • PBX-13995787344150533-EXT-200 (Endpoint)
  • PBX-13995787344150533-EXT-200 (AOR)
  • PBX-13995787344150533-EXT-200 (AUTH)
  • PBX_13995787344150533_OUT (Context)

  • PBX-13995787344150533-EXT-201 (Endpoint)
  • PBX-13995787344150533-EXT-201 (AOR)
  • PBX-13995787344150533-EXT-201 (AUTH)
  • PBX_13995787344150533_OUT (Context)

Download, Compile and Install 💻 Asterisk


Note

For more detailed instructions on compiling and installing Asterisk please see my guide: Compiling a Phone System (Asterisk 20.7-cert8) on Ubuntu 24.04.3


1) Install Asterisk dependencies:

apt install unixodbc odbc-mariadb wget build-essential libjansson-dev autoconf libxml2-dev libncurses-dev libedit-dev uuid-dev libsqlite3-dev libnewt-dev automake unixodbc-dev sqlite3 libsrtp2-dev libtool libssl-dev libcurl4-gnutls-dev

2) Change to the /root directory (must be root):

cd /root

3) Download Asterisk source code:

wget https://downloads.asterisk.org/pub/telephony/certified-asterisk/asterisk-certified-20.7-cert8.tar.gz

4) Download the Asterisk teams PGP signature:

wget https://downloads.asterisk.org/pub/telephony/certified-asterisk/asterisk-certified-20.7-cert8.tar.gz.asc

5) Import the Asterisk teams public key from the Ubuntu key server:

gpg --keyserver keyserver.ubuntu.com --recv 0xF2FC93DB7587BD1FB49E045A5D984BE337191CE7

6) Verify the compressed tar file against the Asterisk teams PGP signature using GPG:

gpg --verify asterisk-certified-20.7-cert8.tar.gz.asc asterisk-certified-20.7-cert8.tar.gz

Output should show a good signature from the Asterisk team:

gpg: Signature made Mon Jan 12 16:33:21 2026 UTC
gpg:                using RSA key F2FC93DB7587BD1FB49E045A5D984BE337191CE7
gpg: Good signature from "Asterisk Development Team <asteriskteam@digium.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: F2FC 93DB 7587 BD1F B49E  045A 5D98 4BE3 3719 1CE7

Warning

IF THE OUTPUT SHOWS A BAD SIGNATURE LIKE THIS:

gpg: Signature made Mon Jan 12 16:33:21 2026 UTC
gpg:                using RSA key F2FC93DB7587BD1FB49E045A5D984BE337191CE7
gpg: BAD signature from "Asterisk Development Team <asteriskteam@digium.com>" [unknown]

DELETE THE asterisk-certified-20.7-cert8.tar.gz FILE!!!


7) If the signature was good decompress and untar the Asterisk source code

tar -xvzf asterisk-certified-20.7-cert8.tar.gz

8) Change the working directory to the asterisk-certified-20.7-cert8 directory:

cd /root/asterisk-certified-20.7-cert8

9) Run the configure script:

./configure

10) Run the menu selection system to decide which modules should be compiled:

make menuselect

In menuselect enable the following options:

Applications:

  • app_voicemail_odbc
  • app_attended_transfer
  • app_blind_transfer
  • app_statsd

Call Detail Recording:

  • cdr_csv
  • cdr_odbc

PBX Modules:

  • pbx_realtime

Resource Modules:

  • res_stasis_mailbox
  • res_endpoint_stats
  • res_pjsip_history
  • res_prometheus

Core Sound Packages:

  • CORE-SOUNDS-EN_GB-WAV
  • CORE-SOUNDS-EN_GB-ULAW
  • CORE-SOUNDS-EN_GB-ALAW
  • CORE-SOUNDS-EN_GB-GSM
  • CORE-SOUNDS-EN_GB-G729
  • CORE-SOUNDS-EN_GB-G722
  • CORE-SOUNDS-EN_GB-SLN16
  • CORE-SOUNDS-EN_GB-SIREN7
  • CORE-SOUNDS-EN_GB-SIREN14

Music On Hold File Packages:

  • MOH-OPSOUND-ULAW
  • MOH-OPSOUND-ALAW
  • MOH-OPSOUND-GSM
  • MOH-OPSOUND-G729
  • MOH-OPSOUND-G722
  • MOH-OPSOUND-SLN16
  • MOH-OPSOUND-SIREN7
  • MOH-OPSOUND-SIREN14

Extras Sound Packages:

  • EXTRA-SOUNDS-EN_GB-WAV
  • EXTRA-SOUNDS-EN_GB-ULAW
  • EXTRA-SOUNDS-EN_GB-ALAW
  • EXTRA-SOUNDS-EN_GB-GSM
  • EXTRA-SOUNDS-EN_GB-G729
  • EXTRA-SOUNDS-EN_GB-G722
  • EXTRA-SOUNDS-EN_GB-SLN16
  • EXTRA-SOUNDS-EN_GB-SIREN7
  • EXTRA-SOUNDS-EN_GB-SIREN14

11) Run the configure script again:

./configure

12) Compile the source code:

make

13) Install Asterisk:

make install

Post ➡️ Asterisk Install


1) Create a system user named pbx with no shell for the Asterisk daemon:

useradd -r -s /bin/false pbx

2) Lock the pbx user

usermod -L pbx

3) Edit /etc/asterisk/asterisk.conf so Asterisk runs as the user pbx:

runuser = pbx    ; The user to run as.
rungroup = pbx   ; The group to run as.

4) Recursively change the group and permissions for Asterisk configuration files:

chown -R root:pbx /etc/asterisk && chmod 550 /etc/asterisk && chmod 440 /etc/asterisk/*

5) Recursively change the group and permissions for the Asterisk voicemail and call recording files:

chown -R pbx:pbx /var/spool/asterisk && chmod -R 770 /var/spool/asterisk

6) Recursively change the group and permissions for Asterisk log files

chown -R pbx:pbx /var/log/asterisk && chmod -R 770 /var/log/asterisk

7) Copy the Asterisk systemd service file:

cp /root/yap/systemd/asterisk.service /usr/lib/systemd/system/

8) Reload the systemd manager configuration:

systemctl daemon-reload

9) Make a directory for the SQLite database

mkdir /var/lib/asterisk/database

10) Change the SQLite database directory permissions and group:

chmod 570 /var/lib/asterisk/database && chgrp pbx /var/lib/asterisk/database

Tip

If a firewall 🔥🧱 is enabled, set Asterisk to automatically start 🟢 at boot:

systemctl enable asterisk

To stop 🔴 Asterisk starting at boot:

systemctl disable asterisk

Tip

To enter 🚪 Asterisk:

sudo -u pbx asterisk -rvvvvv

Tip

To find 🔍 and fix 🪛 faults ⚠️ with Asterisk:

/usr/sbin/asterisk -mqfv -C /etc/asterisk/asterisk.conf



MariaDB 🗄️ Setup


Python 🐍 Alembic 🗂️


1) Install the Python interface for MySQL and Alembic

apt install python3-mysqldb alembic

2) Change the working directory

cd /root/asterisk-certified-20.7-cert8/contrib/ast-db-manage

3) Copy the sample configuration file and rename it (must add username, password and other details inside the config.ini)

cp config.ini.sample config.ini

4) Create a database named asterisk in MariaDB

create database asterisk;

5) Run Alembic

alembic -c config.ini upgrade head

Generate a Self-Signed ECDSA Key 🔑 and Certificate 📜 for MariaDB Using the OpenSSL Cryptographic Library 📚


Caution

A more secure method than the steps listed below is to generate all the files on a seprate computer that is isolated away from the YAP server and then transfer the mariadb.crt, mariadb.key and yap-ca.crt to the YAP server using the SCP (Secure Copy Protocol). For better security the yap-ca.key should not be on the YAP server because it can be used to sign certificate signing requests.


1) Make a directory for the files and change into the directory (must be root):

mkdir /root/mariadb-openssl && cd /root/mariadb-openssl

2) Generate the Certificate Authority (CA) key:

openssl ecparam -genkey -name secp384r1 -out yap-ca.key

3) Generate a certificate Authority Certificate (CA) with expiry of 7300 days (20 years):

openssl req -x509 -new -SHA384 -nodes -key yap-ca.key -days 7300 -out yap-ca.crt

4) Generate a key for the MariaDB server:

openssl ecparam -genkey -name secp384r1 -out mariadb.key

5) Generate a CSR (Certificate Signing Request):

openssl req -new -SHA384 -key mariadb.key -nodes -out mariadb.csr

6) Generate an extensions file:

touch extensions.ext

7) The contents of the extensions.ext file:

authorityKeyIdentifier = keyid, issuer
basicConstraints = critical, CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = localhost
DNS.2 = 127.0.0.1
DNS.3 = (FQDN)

8) Generate and sign the mariadb.crt. It is vaild for 1825 days (5 years):

openssl x509 -req -SHA384 -extfile extensions.ext -days 1825 -in mariadb.csr -CA yap-ca.crt -CAkey yap-ca.key -CAcreateserial -out mariadb.crt

9) Copy mariadb.crt, mariadb.key and yap-ca.crt to the /etc/mysql directory:

cp /root/mariadb-openssl/{mariadb.crt,mariadb.key,yap-ca.crt} /etc/mysql/

10) Change the mariadb.key permissions and group:

chmod 440 /etc/mysql/mariadb.key && chgrp mysql /etc/mysql/mariadb.key

Tip

To view the CA certificate in the CLI:

openssl x509 -noout -text -in yap-ca.crt

To view the MariaDB server certificate in the CLI:

openssl x509 -noout -text -in mariadb.crt

To view the MariaDB server certificate signing request in the CLI:

openssl req -text -noout -verify -in mariadb.csr


Adding the YAP self-signed CA certificate to the certificate store 🏪:


1) Copy the YAP self-signed CA certificate to the certificate store:

cp /etc/mysql/yap-ca.crt /usr/local/share/ca-certificates

2) Update the CA certificates:

update-ca-certificates




Note

For a list of abbreviations and there meanings used throughout this repository please refer to this README


Important

All third-party product and/or company names and logos are trademarks™ or registered® trademarks and remain the property of their respective holders/owners. Unless specifically identified as such, use of third party trademarks does not imply any affiliation with or endorsement between Elliot Michael Keavney and the owners of those trademarks.

About

YAP (Yet Another PBX) - A GUI to administrate a multi-tenanted SIP Server, YAP is written in Go and uses the Asterisk framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors