Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
How to Set Up an Asterisk VoIP Server on Linux
#1
How to Set Up an Asterisk VoIP Server on Linux - Server Solutions

Setting up a VoIP (Voice over Internet Protocol) server can significantly improve communication efficiency for businesses or individuals. Asterisk is one of the most popular open-source frameworks for building communications applications. In this guide, we’ll walk through the process of setting up an Asterisk VoIP server on a Linux-based system. By the end, you’ll have a fully functional VoIP server that you can customize to meet your needs.

Prerequisites
Before you start, ensure you have the following:

Linux Server: A server running a Linux distribution such as Ubuntu, CentOS, or Debian. This guide will focus on Ubuntu for its popularity and user-friendliness.
Root Access: You need root or sudo access to install the necessary packages.
Basic Knowledge: Familiarity with the Linux command line and basic networking concepts will be beneficial.

Step 1: Update Your System
First, it’s crucial to ensure your server is up to date. Open your terminal and run the following commands:

Kod PHP:
sudo apt update
sudo apt upgrade 
-

This updates the package list and installs the latest available versions of your installed packages.

Step 2: Install Required Dependencies
Asterisk requires several packages to function correctly. Install them using:

Kod PHP:
sudo apt install -y build-essential git wget libxml2-dev libncurses5-dev libssl-dev libnewt-dev libsqlite3-dev 

These packages provide the necessary tools and libraries for compiling Asterisk from source.

Step 3: Download Asterisk
Next, you need to download the latest version of Asterisk. At the time of writing, the latest version is 20.10. You can check the official Asterisk website for the most current version.

Tutaj dostepne wszytskie wersje jakie sa do pobraniahttps://downloads.asterisk.org/pub/telephony/asterisk/

Kod PHP:
cd /usr/src
sudo wget http
://downloads.asterisk.org/pub/telephony/asterisk/asterisk-20.10.tar.gz 


After downloading, extract the tarball:

Kod PHP:
sudo tar -xvf asterisk-20.10.tar.gz
cd asterisk
-20.10 

Download the mp3 decoder library into the source tree by running below commands:


Kod PHP:
sudo contrib/scripts/get_mp3_source.sh
A    addons
/mp3
A    addons
/mp3/MPGLIB_README
A    addons
/mp3/common.c
A    addons
/mp3/huffman.h
A    addons
/mp3/tabinit.c
A    addons
/mp3/Makefile
A    addons
/mp3/README
A    addons
/mp3/decode_i386.c
A    addons
/mp3/dct64_i386.c
A    addons
/mp3/MPGLIB_TODO
A    addons
/mp3/mpg123.h
A    addons
/mp3/layer3.c
A    addons
/mp3/mpglib.h
A    addons
/mp3/decode_ntom.c
A    addons
/mp3/interface.c
Exported revision 202. 

Confirm all dependencies are installed using install_prereq script.

Kod PHP:
sudo contrib/scripts/install_prereq install 

Message output from successful installation:

Cytat:.....
Setting up libsrtp2-dev (2.5.0-3) ...
Setting up libxmu6:amd64 (2:1.1.3-3) ...
Setting up libxaw7:amd64 (2:1.0.14-1) ...
Setting up libical-dev:amd64 (3.0.16-1+b1) ...
Setting up libgvc6 (2.42.2-7+b3) ...
Setting up graphviz (2.42.2-7+b3) ...
Processing triggers for libglib2.0-0:amd64 (2.74.6-2) ...
No schema files found: doing nothing.
Processing triggers for libc-bin (2.36-9+deb12u4) ...
Processing triggers for man-db (2.11.2-2) ...
Setting up libgmime-3.0-dev:amd64 (3.2.13+dfsg-2) ...

#############################################
## install completed successfully
#############################################


Step 4: Compile and Install Asterisk
Now, you can compile and install Asterisk. Start by running the configuration script:

Kod PHP:
sudo ./configure 

After the configuration is complete, you will need to run the following commands to build and install Asterisk:  


Kod PHP:
sudo make menuselect 
tym poleceniem mozesz wybrac to co ty chesz zainstalowac w swoim asterisk

Use the arrow keys in your keyboard to navigate through the menus, and Enter key to select.

Example selecting Add-ons to install in Asterisk:
[Obrazek: install-asterisk-ubuntu-18.04-01-min.png]

Example on adding extra Core Sound Packages to build.

[Obrazek: install-asterisk-ubuntu-18.04-02-min.png]

For Music On Hold, select the following minimal modules

[Obrazek: notWebP]

On Extra Sound Packages select as shown below:

[Obrazek: notWebP]

Enable app_macro under Applications menu.

[Obrazek: ngcb23]


Feel free to enable or disable any modules as you see fit. After all the configurations, use the “Save and Exit” button to update.

To build Asterisk 18 LTS on Debian Linux by running the command below:


Kod PHP:
sudo make
sudo make install 

Once the installation is complete, you should also install the sample configuration files:

Kod PHP:
sudo make config 


Finally, load the Asterisk service into systemd:

Kod PHP:
sudo systemctl start asterisk
sudo systemctl enable asterisk 

Step 5: Configure Asterisk
After installation, Asterisk’s configuration files will be located in the /etc/asterisk directory. The most critical file is sip.conf, where you will define your SIP (Session Initiation Protocol) settings

Open sip.conf:


Kod PHP:
sudo nano /etc/asterisk/sip.conf 

Add the following lines to set up a basic configuration:


Kod PHP:
[general]
context=default
allowguest=no 

Next, you need to configure your extensions. Open the extensions.conf file:


Kod PHP:
sudo nano /etc/asterisk/extensions.conf 


Add a simple extension configuration:

Kod PHP:
[default]
exten => 100,1,Dial(SIP/100)
exten => 101,1,Dial(SIP/101

This example allows users with extensions 100 and 101 to call each other.

Step 6: Create SIP User Accounts
You need to create user accounts for your VoIP clients. Open sip.conf again and add the following entries:

Kod PHP:
[100]
type=friend
secret
=your_password
host
=dynamic

[101]
type=friend
secret
=your_password
host
=dynamic
Replace your_password with strong passwords 
for each user

Step 7: Start Asterisk CLI
To interact with your Asterisk server, you can use the Asterisk Command Line Interface (CLI). Run the following command:

Kod PHP:
sudo asterisk -rvv 


This command connects you to the Asterisk CLI, where you can monitor logs and manage the server in real-time.

Step 8: Test Your Configuration
You can test your VoIP server by using a softphone client such as Zoiper or Linphone. Configure the softphone with the following details:

SIP Server: Your server’s IP address
Username: 100 or 101 (as per your configuration)
Password: The corresponding password you set in sip.conf
Once configured, try making a call between the two extensions.


Step 9: Enable Firewall Settings
Ensure your firewall settings allow traffic on the necessary ports. You typically need to open ports 5060 (SIP) and 10000-20000 (RTP).

For UFW, run:

Kod PHP:
sudo ufw allow 5060/udp
sudo ufw allow 10000
:20000/udp 
Odpowiedz
#2
1-wszy blad podczas instalacji servera:
configure: error: *** Please install the 'libedit' development package.
lekarstwo -
Kod PHP:
sudo apt-get -y install libedit-dev 


2-gi blad servera:
configure: error: *** uuid support not found (this typically means the uuid development package is missing)#
lekarstwo : 
Kod PHP:
sudo apt install uuid-dev 


3-ci blad podczas instalacji
Install libjansson-dev
lekarstwo: 
Kod PHP:
sudo apt-get -y install libjansson-dev 
pamietaj ze po kazdym problemie w zwiazku z brakiem jakiegos pakietu zawsze powtarzaj komende 
Kod PHP:
sudo ./configure 

Jezeli wszystko zostanie sprawdzone tona koncu powinnienes ijrzec taki wpis:


configure: Menuselect build configuration successfully completed

              .$$$$$$$$$$$$$$$=..
            .$7$7..          .7$$7:.
          .$$:.                ,$7.7
        .$7.    7$$$$          .$$77
    ..$$.      $$$$$            .$$$7
    ..7$  .?.  $$$$$  .?.      7$$$.
  $.$.  .$$$7. $$$$7 .7$$$.      .$$$.
.777.  .$$$$$$77$$$77$$$$$7.      $$$,
$$$~      .7$$$$$$$$$$$$$7.      .$$$.
.$$7          .7$$$$$$$7:          ?$$$.
$$$          ?7$$$$$$$$$$I        .$$$7
$$$      .7$$$$$$$$$$$$$$$$      :$$$.
$$$      $$$$$$7$$$$$$$$$$$$    .$$$.
$$$        $$$  7$$$7  .$$$    .$$$.
$$$$            $$$$7        .$$$.
7$$$7            7$$$$        7$$$
$$$$$                        $$$
  $$$$7.                      $$  ™
  $$$$$$$.          .7$$$$$$  $$
    $$$$$$$$$$$$7$$$$$$$$$.$$$$$$
      $$$$$$$$$$$$$$$$.




No wiec mamy server - to teraz pytanie jak to wszystko zaimplementowac do sieci LAN na poczatek tak aby to dzialalo - nie mam pojecia czy jest potrzebny jakis client >? - To droga ktora musze sam przejsc i opracowac to samemu z pomoca wojka GOOGLE Smile
Odpowiedz
#3
centos ustawienia : https://mike42.me/blog/2015-01-02-how-to...10-minutes
Odpowiedz
#4
DEBIAN Konfiguracja

https://computingforgeeks.com/install-as...ian-linux/



- Dokumentacja znajduje sie tu - https://github.com/asterisk/documentation     zreszta na stronie https://www.asterisk.org mozna wyszukac instalacje oraz konfiguracje


Tu zajebiscie wytlumaczone i pokazane jak i co Asterisk VOIP Server Setup On Ubuntu 20 | Making Calls via SIP Soft Phone | Rocket System
Odpowiedz
#5
sip.conf  below:


Kod PHP:
[general]
context=internal
allowguest
=no
allowoverlap
=no
bindport
=5060
bindaddr
=0.0.0.0
srvlookup
=no
disallow
=all
allow
=ulaw
alwaysauthreject
=yes
canreinvite
=no
nat
=yes
session
-timers=refuse
localnet
=192.168.0.0/255.255.255.0

[7001]
type=friend
host
=dynamic
secret
=7001
context
=internal

[7002]
type=friend
host
=dynamic
secret
=7002
context
=internal 

extensions.conf below:

Kod PHP:
[internal]
exten => 7001,1,Answer()
exten => 7001,2,Dial(SIP/7001,60)
exten => 7001,3,Playback(vm-nobodyavail)
exten => 7001,4,VoiceMail(7001@main)
exten => 7001,5,Hangup()

exten => 7002,1,Answer()
exten => 7002,2,Dial(SIP/7002,60)
exten => 7002,3,Playback(vm-nobodyavail)
exten => 7002,4,VoiceMail(7001@main)
exten => 7002,5,Hangup()

exten => 8001,1,VoicemailMain(7001@main)
exten => 8001,2,Hangup()

exten => 8002,1,VoicemailMain(7002@main)
exten => 8002,2,Hangup() 

voicemail.conf below:

Kod PHP:
[main]
7001 => 7001

7002 
=> 7002 



----------------------------
[general]
context=internal
allowguest=no
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
disallow=all
allow=ulaw
alwaysauthreject=yes
canreinvite=no
nat=yes
session-timers=refuse
localnet=192.168.0.0/255.255.255.0

[7001]
type=friend
host=dynamic
secret=7001
context=internal

[7002]
type=friend
host=dynamic
secret=7002
context=internal
Odpowiedz
#6
Stad tez mozna zainstalowac - https://hotkey404.com/installing-asteris...debian-12/
Odpowiedz
#7
Wlaczenie SIP w asterisk

W CLI wpisujemy

module load chan_sip.so

lecz po tym wyskoczy erro ze port nasluchu jest wykozystany wiec trzeba wyedytowac plik plik sip - zamienic istniejacy port 5060 na 5070 dla przyklasu. Po czym raz jeszcze wpisac w CLI module load chan_sip.so a nastepnie przeladowac ustawieni asteriska za pomoca komendu core reload , lubn core restart

Później musimy tylko dopisać załadowanie modułu chan_sip.so do modules.conf, żeby sterownik był ładowany podczas autostartu Asteriska.

informacja zaczerpnieta z tej ztrony www: https://hotkey404.com/pl/samouczek-aster...e-modulow/

Moduł chan_sip.so
Począwszy od Asteriska 13, PJSIP jest domyślnym sterownikiem do obsługi kanałów. Dlatego plik sip.conf nie jest już domyślnie generowany przez make basic-pbx, ale przez make samples już tak.

Jeśli posiadasz przykładowe pliki, mogło by się wydawać, że wystarczy skopiować plik sip.conf do /etc/asterisk/ oraz załadować moduł w modules.conf. Jednak jeśli w CLI (polecenie asterisk -r) wykonamy „module load chan_sip.so” otrzymamy błąd:

WARNING[1901]: chan_sip.c:33496 reload_config: Failed to bind to 0.0.0.0:5060: Address already in use
Odpowiedz


Skocz do:


Użytkownicy przeglądający ten wątek: 2 gości