FreePBX

From SME Server
Revision as of 15:01, 28 September 2016 by RequestedDeletion (talk | contribs) (Security)
Jump to navigation Jump to search


Maintainer

Daniel B. from Firewall Services

Version

Contrib 10:
Contrib 9:
smeserver-freepbx
The latest version of smeserver-freepbx is available in the SME repository, click on the version number(s) for more information.



Contrib 10:
Contrib 9:
freepbx-src
The latest version of freepbx-src is available in the SME repository, click on the version number(s) for more information.



Description

FreePBX is a full-featured PBX web application. If you’ve looked into Asterisk, you know that it doesn’t come with any "built in" programming. You can’t plug a phone into it and make it work without editing configuration files, writing dialplans, and various messing about.

FreePBX simplifies this by giving you pre-programmed functionality accessible by a user-friendly web interfaces that allows you to have a fully functional PBX pretty much straight away with no programming required. Some of the features that FreePBX supports out of the box are:

  • Unlimited number of Voicemail boxes
  • "Follow Me" functionality
  • Ring Groups with calls confirmation (so if, eg, a cellphone is out of range and diverts to voicemail, all the other phones keep ringing)
  • Unlimited number of Conferences (limited by available CPU power - about 300 simultaneous users in conferences on a P4 3ghz - 600 with a dual core!)
  • Paging and Intercom functionality for man SIP phones that support it.
  • Music on Hold (via MP3s, or streamed off the internet)
  • Call Queues
  • And many other features

Optional

  • You may want some hardware cards if you don't want your installation to be IP only. I've tested successfully the TDM400P, TDM410P and b410P (misdn) from Digium, but any card supported by DAHDI (should be anything working with zaptel) should work.

Installation

[edit]

1. First, increase the php memory limit to at least 128M BEFORE the installation, or it will fail in the middle leaving it in an unstable state ( half mysql db installed, no modules activated).

db configuration setprop php MemoryLimit 128M
expand-template /etc/php.ini
service httpd-e-smith restart

2. Install the 4 yum repos necessary (asterisk-13,asterisk-current,digium-current,digium-13):

  • Asterisk 13 LTS repo
/sbin/e-smith/db yum_repositories set asterisk-13 repository \
Name 'Asterisk-13 - EL' \
BaseURL 'http://packages.asterisk.org/centos/$releasever/asterisk-13/$basearch/' \
EnableGroups yes \
Visible no \
status disabled


  • Asterisk current repo for asterisk support files such as sounds, MOH, DAHDI, libpri and libss7
/sbin/e-smith/db yum_repositories set asterisk-current repository \
Name 'Asterisk-current - EL' \
BaseURL 'http://packages.asterisk.org/centos/$releasever/current/$basearch/' \
Exclude php-* \
EnableGroups yes \
Visible no \
status disabled


  • digium-13 repo
/sbin/e-smith/db yum_repositories set digium-13 repository \
Name 'CentOS-$releasever - Digium 13' \
BaseURL 'http://packages.digium.com/centos/6/digium-13/$basearch/' \
EnableGroups no \
GPGCheck yes \
GPGKey 'http://packages.digium.com/RPM-GPG-KEY-Digium' \
Visible yes \
status disabled
  • digium-current repo
/sbin/e-smith/db yum_repositories set digium-current repository \
Name 'CentOS-$releasever - Digium current' \
BaseURL 'http://packages.digium.com/centos/6/current/$basearch/' \
EnableGroups no \
GPGCheck no \
GPGKey 'http://packages.digium.com/RPM-GPG-KEY-Digium' \
Visible yes \
status disabled


you should not enable GPG check for digium current some packages are not signed.

3. After adding it to the database updating the configuration file is required:

 signal-event yum-modify

4. Then the actual installation :

yum  install smeserver-freepbx --enablerepo=smetest,smecontribs,asterisk-13,asterisk-current,digium-current,digium-13

5. By default en language with ulaw are added. You may want to add some extra format and languages. (you might choose codec {alaw,ulaw,g722,gsm} you want and language {en,en_AU,fr,es}, see http://packages.asterisk.org/centos/6/current/i386/RPMS/). You can also manually download them latter through the Freepbx interface (first install Freepbx Sound Languages module,then go to Admin/Sound Languages)

yum install asterisk-sounds-core-fr-ulaw  asterisk-sounds-extra-en-gsm --enablerepo=asterisk-current

6. This is the important step of the installation, the actual configuration and installation of files:

signal-event freepbx-update

7. Then you can start to configure and upgrade trough the interface in the server-manager it might also be necessary to reboot or relaunch asterisk to allow all modules to be launch:

signal-event post-upgrade; signal-event reboot


You may need to first install the ATrpms repository.

yum --enablerepo=smecontribs --enablerepo=atrpms install smeserver-freepbx dahdi-linux-kmdl-$(uname -r)
signal-event freepbx-update 
signal-event post-upgrade; signal-event reboot

source : http://forums.contribs.org/index.php?topic=48143.0

Components

FreePBX is composed of 4 main parts: the main FreePBX interface, Recordings, Asterisk-Stats and Flash Operator Panel

FreePBX

This is the main web interface for asterisk configuration. This interface is available at https://server.domain.tld/freepbx/admin, or in the server-manager, under FreePBX menu. You'll need to login as admin (password of your admin's SME account) to access this part. You can grant the access to any user of the system using the userpanel contrib (just grant the user or the group the permission to access freepbx panel)


Recordings

Recordings, is a web based portal for users. You may configure some features of your phone here (followme, call forward, call waiting etc...), check you call history, or download/listen to your voicemail. This interface is available at https://server.domain.tld/recordings. The login here is your phone (extension) number and your voicemail password. There's also a special admin account. The admin account can access all call logs and recordings. The login is admin, the password is randomly generated, you can find it in /opt/freepbx/recordings/includes/main.conf.php


Asterisk Stats

Asterisk-Stats is an interface to query CDR (Call Detail Reports) database. It's available on the main FreePBX interface at https://server/domain.tls/freepbx, on the "Reports" tab


Flash Operator Panel (SME8)

Flash Operator Panel is a switchboard type application for the Asterisk PBX. It runs on a web browser with the flash plugin. It is able to display information about your PBX activity in real time. The layout is configurable (button sizes and colours, icons, etc). The FOP is available at https://server.domain.tld/panel or in the main interface in the "Panel" tab.

You can grant the access to any user of the system using the userpanel contrib (just grant the user or the group the permission to access fop panel)

DB parameters

Here's the list of DB parameters:

This contrib add 3 entries in the configuration db: freepbx, dahdi and fop. Here's a description of available parameters for each entry

  • freepbx
    • CdrDbName: the name of the database for CDR. The default is asteriskcdrdb. You should let this unless you know what you're doing
    • DbName: the name of the database for FreePBX. The default is freepbxdb. You should let this unless you know what you're doing
    • DbPassword: the password to access FreePBX database. A random value is generated at install time.
    • DbUser: the username to access both databases. Default is freepbxuser
    • DeviceAndUser: (enabled|disabled) You can enable the 'deviceanduser' display view of FreePBX. DeviceAndUser is enabled, Devices and Users will be administered separately, and Users will be able to "login" to (adhoc) devices. If disabled Devices and Users will me administered in a single screen.
    • ManagerPassword: This is the asterisk manager password used by FreePBX (the login is 'admin'). The default one is randomly generated at install time.
    • UDPPorts: Lists of ports used by asterisk. This settings is only useful if you want to open asterisk on the public interface (you can also restrict it with AllowHost parameter)
    • access: (private|public). if you want to open asterisk on the public interface, you can set this to public.
    • status: (enabled|disabled). Should asterisk (with FreePBX provided helper script) should be started automatically.
  • fop
    • status: (enabled|disabled) Should we start the FOP server with FreePBX ?
    • Password: This is the additional password for FOP. There's a first password needed to access FOP (by default, only admin is allowed). This first password is your SME account password. The second password (the one on this db parameter) allow users to use drag/drop on the different items (transfer call, initiate a call, hangup etc...). The default password is a random generated one at install time.
    • TCPPort: This is the TCP port used for the communication between the flash applet and FOP daemon. The default is 4445
    • access: The default is to allow only connections from the local network. You can allow external IP if you configure public here (and if you do so, you should limit this access to a list of IP using the AllowHost key)
  • dahdi
    • status: (enabled|disabled) You should let this to enabled, even if you don't have any hardware card because some functions (like meetme) requires the dahdi_dummy driver to be loaded.
  Note:
dahdi_dummy is no longer required as a 'timing' device (since Asterisk 1.6) . This has been solved by using other timing mechanisms automatically. So setting dahdi to disabled does no harm to meetme.


Related pages

You may be interested in the following how-to:

  • How-to configure your card using DAHDI
  • How-to configure your card using mISDN

Update Freepbx

To update your freepbx installation simply follow the procedure inside freepbx web interface. After every version update (from 2.5 to 2.6, etc.) you should run a

signal-event freepbx-update

in order to update file ownership according to SME specifications.

The way the contrib is designed, updating freepbx-src (i.e. from 2.5 to 2.7) won't update your working freepbx installation.


Uninstall

yum remove smeserver-freepbx freepbx-src

If you want to cleanup everything (MySQL databases, DB, etc...), you can use this script:


#!/bin/bash

clear
echo "----------------------------"
echo "!!!!!     WARNING     !!!!!"
echo "----------------------------"
echo ""
echo "This script will remove from your server:"
echo "     - freepbx and asterisk cdr MySQL databases"
echo "     - freepbx MySQL User"
echo "     - freepbx DB entries (freepbx, httpd-fpbx and dahdi)"
echo "     - /opt/freepbx"
echo ""
echo -n "Are you sure you want to remove FreePBX permanently ? (y/n) [n] "
read confirm
if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then
       echo "Droping MySQL databases..."
       DBNAME=$(/sbin/e-smith/db configuration getprop freepbx DbName)
       CDRDBNAME=$(/sbin/e-smith/db configuration getprop freepbx CdrDbName)
       mysql -e "DROP DATABASE $DBNAME"
       mysql -e "DROP DATABASE $CDRDBNAME"
       echo "Deleting MySQL User..."
       DBUSER=$(/sbin/e-smith/db configuration getprop freepbx DbUser)
       mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$DBUSER'@'localhost';"
       mysql -u root -e "DROP USER '$DBUSER'@'localhost';" > /dev/null 2>&1
       echo "Removing SME DB entries..."
       /sbin/e-smith/db configuration delete freepbx
       /sbin/e-smith/db configuration delete httpd-fpbx
       /sbin/e-smith/db configuration delete dahdi
       echo "Removing /opt/freepbx ..."
       rm -rf /opt/freepbx
       echo "Done!"
fi 


Reinstall

If you need to re-install everything, you should completely remove the previous installation (remove the rpms and run the cleanup script.)

Known issues

SME8: Sounds

you might have some trouble with sounds not playing, after updates of freepbx. The problem is that freepbx in new release configures asterisk to search for sounds in /usr/share/asterisk/sounds but all rpm for centos will install them in /var/lib/asterisk/sounds

create a symlink for each folder in it and everything will works.

SME8: Dahdi-linux-kmdl

be carrefull to keep the kernel module up to date every time you have a new kernel release ( wait if they are not available)

SME8: FOP could not reload

if after installation you get this message just do a

service freepbx restart

and everything will get fine !

SME9: CDR logging not enabled by default

CDR logging is not enabled by default. To enable one must manually load the cdr_mysql.so module:

Admin -> Asterisk Modules -> Manually loaded Modules -> Add module and enter the module name cdr_mysql.so

SME9: /tmp owned by asterisk:asterisk

When FreePBX is started, one of the processes (fwconsole chown) is setting permissions on all Asterisk files. We want to exclude the /tmp directory being owned by the asterisk user/group and prevent setting tight permissions which actually leads to a 'broken' system, due to the importance of the /tmp directory for many other (non Asterisk) related processes and applications such as Mysql.

The default settings for the /tmp directory is root:root and 4177 that can be applied (or recovered):

chown -R root:root /tmp
chmod 4177 /tmp/*

To exclude the /tmp directory from being altered we need to create the /etc/asterisk/freepbx_chown.conf additional config file manually (as of Asterisk 13.x) and enter the following content:

[blacklist]
directory = /tmp/

Now you can stopt/start the freepbx service and the /tmp directory will still have the proper settings. (see http://wiki.freepbx.org/display/FOP/FreePBX+Chown+Conf)

You could also skip the permission settings on all files when freepbx starts. This will also speed up the starting time of the freepbx service.

[blacklist]
directory = /

SME9: warnings at boot

at the end of boot sequence you can read:

Starting system message bus                    [OK]
/etc/amportal.conf: line 624: reg: command not found
/etc/amportal.conf: line 785: http://feeds.feedburner.com/InsideTheAsterisk: No such file or directory

you can safely ignore those, they are cause by an upstream migration script and they are just noise. Or you can fix them, but please note that /etc/amportal.conf is regenerated with update events:

The 'reg' issue is due to the lack of an escape (\) character. (see http://issues.freepbx.org/browse/FREEPBX-5464)

Is now:
# Default value: FreePBX®
> BRAND_FREEPBX_ALT_FOOT=FreePBX®

Should be:
# Default value: FreePBX\®
> BRAND_FREEPBX_ALT_FOOT=FreePBX\®

The wiki shows the registered trademark sign &reg, where the characters are '& reg' together.

The 'Feedburner' issue is due to another typo. Please see /etc/amportal.conf at the line shown above, and remove the line break (^M) so that it looks exactly like the default example directly above the line.

SME9: freepbx modules

if you need to install the digium addons from freepbx, you will first need to install the following RPM:

yum install php-digium_register --enablerepo-digium-current

Firewall addons does not work on SME, it requires Sysadmin RPM.

SME9: warnings during yum install

you can safely ignore any of the following warnings during the installation :

Installing : asterisk-sounds-extra-en-ulaw-1.4.11-1_centos6.noarch                                                                                                         22/45 
warning: user asterisk does not exist - using root

and

Installing : kmod-dahdi-linux-fwload-vpmadt032-2.9.0-1_centos6.2.6.32_279.14.1.el6.x86_64.x86_64                                                                           15/45 
WARNING: /lib/modules/2.6.32-573.26.1.el6.x86_64/weak-updates/dahdi-linux-fwload-vpmadt032/dahdi_vpmadt032_loader.ko needs unknown symbol vpmadtreg_unregister
WARNING: /lib/modules/2.6.32-573.26.1.el6.x86_64/weak-updates/dahdi-linux-fwload-vpmadt032/dahdi_vpmadt032_loader.ko needs unknown symbol vpmadtreg_register
WARNING: /lib/modules/2.6.32-573.8.1.el6.x86_64/weak-updates/dahdi-linux-fwload-vpmadt032/dahdi_vpmadt032_loader.ko needs unknown symbol vpmadtreg_unregister
WARNING: /lib/modules/2.6.32-573.8.1.el6.x86_64/weak-updates/dahdi-linux-fwload-vpmadt032/dahdi_vpmadt032_loader.ko needs unknown symbol vpmadtreg_register
WARNING: /lib/modules/2.6.32-642.1.1.el6.x86_64/weak-updates/dahdi-linux-fwload-vpmadt032/dahdi_vpmadt032_loader.ko needs unknown symbol vpmadtreg_unregister
WARNING: /lib/modules/2.6.32-642.1.1.el6.x86_64/weak-updates/dahdi-linux-fwload-vpmadt032/dahdi_vpmadt032_loader.ko needs unknown symbol vpmadtreg_register

they are only the result of the order choosed by yum for doing the install, and they do not impact the final result.

in /var/log/asterisk/freepbx.log you might see the following

[2016-06-10 12:14:08] ERROR[11265] res_pjsip_config_wizard.c: Unable to load config file 'pjsip_wizard.conf'

you can safely ignore it, or refer to https://wiki.asterisk.org/wiki/display/AST/PJSIP+Configuration+Wizard in order to create your own.

Security

Please see http://www.voipbl.org/ to adapt fail2ban to use blacklisted IP's worldwide.

Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-freepbx component or use this link


IDProductVersionStatusSummary (7 tasks)
12496SME Contribs10.0CONFIRMEDBind address 0.0.0.0 causes SIP authorization failures
12463SME Contribs10.0CONFIRMEDARI default username/password
12363SME Contribs10.0CONFIRMEDUpgrade Asterisk to a supported version - minimum 16
12362SME Contribs10.0CONFIRMEDUCP WebRTC phone requires websocket
12361SME Contribs10.0CONFIRMEDUCP does not use mysql socket
10620SME Contribs9.2NEEDINFOAsterisk not logging to CDR or CEL databases
9945SME Contribs9.1CONFIRMEDserver manager :not found if freepbx disabled

Changelog

Only released version in smecontrib are listed here.

smeserver-freepbx Changelog: SME 10 (smecontribs)

2024/04/22 Jean-Philippe Pialasse 14-14.sme
- some logs not rotated [SME: 12506]

- moving freepbx php error log from /var/log/php [SME: 12481]
2023/01/04 Jean-Philippe Pialasse 14-13.sme
- fix permission denied on /usr/local/sbin/fwconsole from cron

2022/12/14 Jean-Philippe Pialasse 14-11.sme
- fix bugs installing FPBX 15
- fix amportal alerts [SME: 12259]
- compatible FBX 16 [SME: 12276]
- fix duplicate logrotate [SME: 12237]

- force php memory on install [SME: 10221]

2022/12/13 Jean-Philippe Pialasse 14-10.sme
- fix backup for FreePBX 15 and higher [SME: 12256]

- make compatible up to FreePBX 16 [SME: 11923]
2022/12/07 Jean-Philippe Pialasse 14-9.sme
- improve backup [SME: 10703]