Table of Contents

FreePBX

Установка

Подготовка VM

Настройка сети

# ifconfig eth0 inet 172.16.1.100+X/24

# route add default gw 172.16.1.254

# echo "nameserver 172.16.1.254" > /etc/resolv.conf
[root@freepbx ~]# ps ax | grep ast

[root@freepbx ~]# kill NNNN

[root@freepbx ~]# service asterisk start

Работает вариант:
freepbx*CLI> core restart now

Процесс начальной конфигурации

Username: admin
Password: Pa$$w0rd
Admin Email address: userX@isp.un

Отключение Firewall

Connectivity - Firewall - Disable Firewall
# systemctl stop fail2ban

Базовая конфигурация

Settings - Asterisk SIP Settings
  External Address: 172.16.1.100+X
  Local Networks: 172.16.0.0 / 16
  Local Networks: 10.0.0.0 / 8

Управление телефонными номерами и пользователями

Application-Extensions

  Add Extensions -> PJSIP
  User Extension: 402
  Display Name: Petr Petrov
  Secret: tpassword402
  Link to a Default User: Create New User
  Username: user2   Use Custom Username
  Password For New User: password2
C:\> cd Documents

C:\> notepad extensions.csv
extension,name,secret
401,Ivan Ivanov,tpassword401
403,Sidor Sidorov,tpassword403
C:\> notepad users.csv
username,password,default_extension
user1,password1,401
user3,password3,403
Admin -> Bulk Handler
!!! Не включает в группу All Users, приходится "вручную" для доступа к UCP 

Звонки в "город"

Connectivity -> Trunks
Add Trunk -> Add...pjsip...
  Trunk Name: PSTN
  Outbound CallerID: 8495NNNNNNN
  Username: 00000X
  Secret: spasswordX
  SIP Server: voip1.un
  Contact User: 8495NNNNNNN
  From Domain: voip1.un
  From User: 00000X

Connectivity -> Outbound Routes
  Route Name: ToPSTN
  Trunk Sequence for Matched Routes: PSTN
  Dial Patterns (match pattern): 8XXXXXXXXXX

Connectivity -> Inbound Routes
  Description: FromPSTN
  DID Number: 8495NNNNNNN
  Set Destination: Ext 403

Звонки в "соседний офис"

Connectivity -> Trunks
Add Trunk -> Add...iax2...
  Trunk Name: CORP
  Outbound CallerID: 013401
  iax Settings
    Outgoing
      Trunk Name: corp_out
      PEER Details
host=corp.un
username=corp13
secret=apassword13
type=peer
auth=md5
    Incoming
      USER Context: corp
      USER Details:
secret=apassword
type=user
host=dynamic
auth=md5
  
Connectivity -> Outbound Routes
  Route Name: ToCORP
  Trunk Sequence for Matched Routes: CORP
  Dial Patterns 
    prefix: 000
    match pattern: XXX

Connectivity -> Inbound Routes
  Description: FromCORP
  DID Number: _XXX
  Set Destination: Ext 401

Интерфейс пользователя

http://172.16.1.100+X/ucp/

Использование файлов конфигурации

# cat /etc/asterisk/extensions_custom.conf
exten => 301,1,Answer()
exten => 301,n,Playback(hello-world)
exten => 301,n,SayDigits(X)
exten => 301,n,Hangup()

[from101] ; no need, use DAHDI Channel
exten => s,1,Dial(DAHDI/1,20)
exten => s,n,Hangup()