Asterisk install on Debian 12

sachin
edited October 24 in asterisk

Asterisk installation in Debian 12 along with ODBC and FastAGI

Step 1: ODBC

Install MySQL 8.0

For detailed steps, follow: https://forum.devsach.in/discussion/87

apt update
apt install mysql-server

Install ODBC

For detailed steps, follow: https://forum.devsach.in/discussion/9

apt install unixodbc-dev unixodbc odbcinst mysql-connector-odbc

Edit nano /etc/odbc.ini

[asterisk-connector]
Description = MySQL ODBC 8.0 ANSI Driver

# Get Driver name from cat /etc/odbcinst.ini
Driver = MySQL ODBC 8.2 ANSI Driver
Database = asterisk
User = root
Password = Password#123
Server = localhost
Port = 3306
# Get socket path from cat /etc/mysql/mysql.conf.d/mysqld.cnf
Socket = /var/run/mysqld/mysqld.sock

Test your connection

isql -v asterisk-connector

Step 2: Installing Asterisk

Note: if required ODBC, then complete step

apt -y install build-essential git curl wget libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev libjansson-dev libxml2-dev uuid-dev default-libmysqlclient-dev
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-20-current.tar.gz
tar -zxvf asterisk-20-current.tar.gz
mv asterisk-20.5.2 asterisk
cd asterisk/
contrib/scripts/install_prereq install
./configure --with-pjproject-bundled --with-crypto --with-ssl=ssl --with-srtp --with-jansson-bundled

make menuselect
make
make install
make samples
make config
ldconfig

systemctl status asterisk
systemctl start asterisk
systemctl status asterisk

Step 3: FastAGI

Install php

For detailed steps, follow: https://forum.devsach.in/discussion/83

apt update
apt install php7.4
apt install php7.4-zip php7.4-curl php7.4-json php7.4-xml php7.4-posix php7.4-mysqlndl php7.4-gd php7.4-process php7.4-curl php7.4-mbstring php7.4-pdo php7.4-pgsql

Install xinetd server

For detailed steps, follow: https://forum.devsach.in/discussion/8

apt install xinetd ngrep net-tools

Download the latest PHP-AGI library

cd /usr/src
wget https://excellmedia.dl.sourceforge.net/project/phpagi/phpagi/2.20/phpagi-2.20.tgz
tar -zxvf phpagi-2.20.tgz
cd phpagi-2.20
cp -r ./* /var/lib/asterisk/agi-bin/
chmod -R 777 /var/lib/asterisk/agi-bin/

# For custom agi files
mkdir /var/lib/asterisk/fastAGI/
chmod -R 777 /var/lib/asterisk/fastAGI/

# also ensure that the executable path of php is correct in
# /var/lib/asterisk/agi-bin/phpagi-fastagi.php
# #!/usr/bin/php -q
# or get it from command: which php

Edit nano /etc/xinetd.d/fastagi

# default: off
# description: fastagi is a remote AGI interface
service fastagi
{
    socket_type  = stream
    user         = root
    group        = root
    server       = /var/lib/asterisk/agi-bin/phpagi-fastagi.php
    wait         = no
    protocol     = tcp
    bind         = 127.0.0.1
    disable      = no
}

Create phpagi.conf nano /etc/asterisk/phpagi.conf

[phpagi]
debug=true
error_handler=true
tempdir=/var/spool/asterisk/tmp/

[asmanager]
server=localhost
port=8753
username=RTrep
secret=RTreprt

[fastagi]
setuid=true
basedir=/var/lib/asterisk/fastAGI/

Adding the service, edit nano /etc/services and following to the end line

fastagi         4573/tcp                # Asterisk AGI

Restarting xinetd server

systemctl restart xinetd
systemctl status xinetd
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!