_images/logo1.png

Welcome to FusionPBX Docs

FusionPBX

An open source project that provides a customizable and flexible web interface to the very powerful and highly scalable multi-platform voice switch called FreeSWITCH.

FusionPBX will run on a variety of operating systems (Optimized for Debian 8) and hardware of your choice. FusionPBX provides a GUI for unlimited extensions, voicemail-to-email, music on hold, call parking, analog lines or high density T1/E1 circuits, and many other features. FusionPBX provides the functionality that business need and provides corporate level phone system features to small, medium and large businesses. Click here for the FusionPBX youtube channel .

Benefits of FusionPBX

  1. Adding extra functionality to the incredibly robust FreeSWITCH VoIP Platform.
  2. Makes FreeSWITCH easy to administer while at the same time still allowing you to work directly within FreeSWITCH Command Line Interface (fs_cli) when you need to.
  3. Gives your users and tenants an attractive GUI interface to interact with.

Our Ecosystem

We are a global community that has an open and very friendly ecosystem. We encourage community engagement, contribution and feedback. Please join us by getting involved with giving feedback, new feature ideas, helping out with code or Documentation.
Most of the core folks who develop and use FusionPBX can be found hanging out in Freenode IRC in the #fusionpbx channel. Come join us and meet the team.

Getting Started

Welcome! Let’s install FusionPBX. Follow the menu to the left and you will have a working PBX in no time. For PDF and Epub formats of this documentation click the bottom left on v:latest and a menu will pop-up to choose from.

注解

There are many ways to install FusionPBX depending on how you want to build your solution. What is presented here represents the quickest, easiest, best supported way to a FusionPBX system. For advanced topics like Bi Directional Replication or High Availability, consider attending the in person or online training at http://fusionpbx.com.

Quick Install

_images/logo_right1.png

Welcome to the FUSIONPBX installation guide.


FUSIONPBX can be several different operating systems. However this install is focused on a minimal install of Debian 8 with SSH enabled. This install has been designed to be fast, simple and modular. On many systems it will install in 5 minutes or less. Installation times depend on CPU, RAM and bandwidth. Install Video https://youtu.be/YmIht8hEHYU


1. Run the following commands under root. The script installs FusionPBX, FreeSWITCH release package and its dependencies, IPTables, Fail2ban, NGINX, PHP FPM and PostgreSQL.

Start with a minimal install of Debian 8 with SSH enabled. Paste the following commands in the console window one line at a time.

apt-get update && apt-get upgrade -y --force-yes
apt-get install -y --force-yes git
cd /usr/src
git clone https://github.com/fusionpbx/fusionpbx-install.sh.git
chmod 755 -R /usr/src/fusionpbx-install.sh
cd /usr/src/fusionpbx-install.sh/debian
./install.sh

If using Debian on Proxmox LXC containers please run the following BEFORE starting the FusionPBX install.

apt-get update && apt-get upgrade
apt-get install systemd
apt-get install systemd-sysv
apt-get install ca-certificates
reboot

2. At the end of the install, the script will instruct you to go to the ip address of the server (or domain name) in your web browser to login. The script will also provide a username and secure random password for you to use. This can be changed after you login. The install script builds the fusionpbx database. If you need the database password it is located in /etc/fusionpbx/config.php .

Installation has completed.

Use a web browser to login.
   domain name: https://000.000.000.000
   username: admin
   password: zxP5yatwMxejKXd

The domain name in the browser is used by default as part of the authentication.
If you need to login to a different domain then use username@domain.
   username: admin@000.000.000.000

Official FusionPBX Training
   Admin Training    24 - 26 Jan (3 Days)
   Advanced Training 31 Jan - Feb 2 (3 Days)
   Timezone: https://www.timeanddate.com/worldclock/usa/boise
   For more info visit https://www.fusionpbx.com

Additional information.
   https://fusionpbx.com/support.php
   https://www.fusionpbx.com
   http://docs.fusionpbx.com

_images/ilogin.jpg

After the install script has completed go to your web browser and login with the information provided by the install script.

Security

Similar to medieval fortifications it is recommended to provide your servers with multiple layers of defenses. Be sure to use Firewalls, Strong passwords, SSH, and make sure your servers are kept up to date for all software being used. This includes the operating system, FreeSWITCH and FusionPBX.

FusionPBX

The latest Debian install script configures IPTables firewall for you. FusionPBX extensions set strong passwords for you by default. You can increase the password complexity using settings in Advanced -> Default Settings to increase the length of the passwords that are generated by default.

Firewall

Although the new install script configured IPTables for you it is recommended that you review the settings. On Debian and Ubuntu you can check your firewall with the following command.

iptables -L
SSL / TLS

SSL and TLS are very necessary in today’s internet applications from VOIP to Websites. FusionPBX by default uses a self signed certificate. However you can use certificate providers where you can purchase certificates and there are free options as well. With domain based multi-tenant wildcard certificates can be useful. Also when deciding on which certificate provider to use you should look at the phones manufacturers documentation to find one that is compatible HTTPS provisioning.

Let’s Encrypt provides free certificates for a single domain but they don’t support wildcard certificates.

Upgrade

Security problems are fixed as they are discovered and are updated for master and the latest release. Upgrades are considered an important part of keeping the server secure. Upgrades always need to be done on the operating system, FreeSWITCH and FusionPBX. On Debian and Ubuntu you can check your firewall with the following command.

Latest install script will install FreeSWITCH packages by default to upgrade them and operating system packages run the following commands.

apt-get update
apt-get upgrade

If you need help upgrading safely please consider paid support.

XML RPC

New install mod_xml_rpc is not enabled by default. It is recommended to run a firewall on all FusionPBX servers. The latest debian install script configures the firewall by default. However it is recommended to check to make sure it is installed and running.

Mod_xml_rpc allows running remote commands to FreeSWITCH. Ensure you have a firewall that is protecting the XML RPC port. Consider changing the XML RPC password. At very least do not allow access to the public. Advanced -> Settings page in the interface allows you to change the password or the port. Do not allow public access to the XML RPC port.

Latest Debian install script installs iptables firewall which prevents public access to the mod_xml_rpc port. If you are not using a firewall on the server you should even if its protected by by an external firewall. Some not informed co-worker could expose the server to the public internet at some point in the future. Multiple layers of security is considered best practice.

XML RPC is secure by default for 2 reasons.
  • The module is disabled by default.
  • Install script firewalls XML RPC port 8787 and does not allow access to it by default outside of 127.0.0.1.

If you were to start the module and open port 8787 on the firewall you would want to set a really good password for it under Advanced -> Settings. It would be recommended to use a VPN to like OpenVPN to access XML RPC over port 8787 instead of opening port 8787 on the firewall.

Fail2ban

Fail2ban is also used to protect SSH, FreeSWITCH, the web server as well as other services. You can view the IP addresses blocked by Fail2ban with the following command.

iptables -L
SSH

Use strong passwords with SSH or even better use SSH keys for better protection of your servers.

Backup


It’s always good to have a backup method in place. Here are the steps to a basic backup method with FusionPBX.

Command line settings

Be sure to change the password by replacing the zzzzzzzz in PGPASSWORD=”zzzzzzzz” with your password.

cd /usr/src/fusionpbx-install.sh
git pull
cd debian/resources/backup/
vim fusionpbx-backup.sh

#!/bin/sh
now=$(date +%Y-%m-%d)
echo "Server Backup"
export PGPASSWORD="zzzzzzzz"
mkdir -p /var/backups/fusionpbx/postgresql
#delete postgres logs older than 7 days
find /var/log/postgresql/postgresql-9.4-main* -mtime +7 -exec rm {} \;
#delete freeswitch logs older 3 days
find /usr/local/freeswitch/log/freeswitch.log.* -mtime +2 -exec rm {} \;
pg_dump --verbose -Fc --host=$database_host --port=$database_port -U fusionpbx fusionpbx --schema=public -f /var/backups/fusionpbx/postgresql/fusionpbx_pgsql_$now.sql
echo "Backup Complete";

To save the file press escape then :wq for write and quit.

You should have the script ready to execute. (Default the script will use FreeSWITCH package paths. If you have an older install using source be sure to change this by commenting the package line #22 and uncomment the source line #25.)

Crontab settings

Setting crontab -e

crontab -e
Choose 1 for nano
Goto the last blank line and paste in the next line.
0 0 * * * bash /etc/cron.daily/fusionpbx-backup.sh
press enter then save and exit.

cd /usr/src/fusionpbx-install.sh/debian/resources/backup/
cp fusionpbx-backup.sh /etc/cron.daily
chmod 755 fusionpbx-backup.sh

Once this is complete you will have the backup ready to execute by ./fusionpbx-backup.sh or from the daily cron job.

Gui settings

From the Gui.

FreeSWITCH Package install paths.

_images/fusionpbx_backup_source1.jpg

Goto Advanced > Default Settings.

Settings for FreeSWITCH package backup paths.

path           array  /var/backups/fusionpbx/postgresql                True    postgresql
path           array  /usr/share/freeswitch/scripts                    True    scripts
path           array  /var/www/fusionpbx                               True    fusionpbx
path           array  /var/lib/freeswitch/storage                      True    storage
path           array  /var/lib/freeswitch/recordings                   True    recordings
path           array  /etc/freeswitch/conf                             True    conf

Click "Reload" at the top of the page.

FreeSWITCH Source install paths.

_images/fusionpbx_backup_source1.jpg
Settings for FreeSWITCH source backup paths.

path           array   /var/backups/fusionpbx/postgresql       True    postgresql
path           array   /usr/local/freeswitch/scripts           True    scripts
path           array   /usr/local/freeswitch/recordings        True    recordings
path           array   /var/www/fusionpbx                      True    fusionpbx
path           array   /usr/local/freeswitch/conf              True    conf
path           array   /usr/local/freeswitch/storage           True    storage

Click "Reload" at the top of the page.
Download Backups

From Advanced > Backup you can download the backup also.

FreeSWITCH Source install paths.

_images/fusionpbx_backup_source.jpg

FreeSWITCH Package install paths.

_images/fusionpbx_backup_package1.jpg

Restore


It’s always good to have a restore method of a backup in place. Here are the steps to a basic restore method with FusionPBX.

注解

It is important to know if your installation is from package or source as the paths are different for FreeSWITCH. Always test the backups and restore methods on test machines first.

  • To create the script use an editor such as vi or nano.
  • Copy/Paste from the code block below and save the file as fusionpbx-restore.sh
  • Replace zzz with your database password
  • chmod + x fusionpbx-restore.sh and then run the script ./fusionpbx-restore.sh
  • edit the script as needed and run this script from the server you are restoring on.
#!/bin/sh
now=$(date +%Y-%m-%d)
ssh_server=x.x.x.x
database_host=127.0.0.1
database_port=5432
export PGPASSWORD="zzz"

#run the remote backup
ssh -p 22 root@$ssh_server "nice -n -20 /etc/cron.daily/./fusionpbx-backup.sh"

#delete freeswitch logs older 7 days
find /var/log/freeswitch/freeswitch.log.* -mtime +7 -exec rm {} \;

#synchronize the backup directory
#rsync -avz -e 'ssh -p 22' root@$ssh_server:/var/backups/fusionpbx /var/backups
rsync -avz -e 'ssh -p 22' root@$ssh_server:/var/backups/fusionpbx/postgresql /var/backups/fusionpbx
rsync -avz -e 'ssh -p 22' root@$ssh_server:/var/www/fusionpbx /var/www
rsync -avz -e 'ssh -p 22' root@$ssh_server:/etc/fusionpbx /etc
find /var/backups/fusionpbx/postgresql -mtime +2 -exec rm {} \;

rsync -avz -e 'ssh -p 22' root@$ssh_server:/etc/freeswitch/ /etc
rsync -avz -e 'ssh -p 22' root@$ssh_server:/var/lib/freeswitch/storage /var/lib/freeswitch
rsync -avz -e 'ssh -p 22' root@$ssh_server:/var/lib/freeswitch/scripts /var/lib/freeswitch
rsync -avz -e 'ssh -p 22' root@$ssh_server:/var/lib/freeswitch/sounds /var/lib/freeswitch
rsync -avz -e 'ssh -p 22' root@$ssh_server:/var/lib/freeswitch/recordings /var/lib/freeswitch

echo "Restoring the Backup"
#extract the backup from the tgz file
#tar -xvpzf /var/backups/fusionpbx/backup_$now.tgz -C /

#remove the old database
psql --host=$database_host --port=$database_port  --username=fusionpbx -c 'drop schema public cascade;'
psql --host=$database_host --port=$database_port  --username=fusionpbx -c 'create schema public;'
#restore the database
pg_restore -v -Fc --host=$database_host --port=$database_port --dbname=fusionpbx --username=fusionpbx /var/backups/fusionpbx/postgresql/fusionpbx_pgsql_$now.sql

#restart freeswitch
service freeswitch restart
echo "Restore Complete";

Firewall

Basic ports used

  • SIP TCP/UDP
    • 5060, 5061, 5080
  • RTP UDP
    • 16384-32768
  • SSH
    • 22
  • HTTP
    • 80, 443
Iptables

Iptables are used in the Debian install script.

Basic Rules
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp --dport 5060:5061 -j ACCEPT
iptables -A INPUT -p udp --dport 5060:5061 -j ACCEPT
iptables -A INPUT -p tcp --dport 5080:5081 -j ACCEPT
iptables -A INPUT -p udp --dport 5080:5081 -j ACCEPT
iptables -A INPUT -p udp --dport 16384:32768 -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
Optional Rules
OPENVPN: iptables -A INPUT -p udp --dport 1194 -j ACCEPT
ICMP: iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
Friendly Scanner

Rules to block not so friendly scanner

iptables -I INPUT -j DROP -p tcp --dport 5060 -m string --string "friendly-scanner" --algo bm
iptables -I INPUT -j DROP -p tcp --dport 5080 -m string --string "friendly-scanner" --algo bm
iptables -I INPUT -j DROP -p udp --dport 5060 -m string --string "friendly-scanner" --algo bm
iptables -I INPUT -j DROP -p udp --dport 5080 -m string --string "friendly-scanner" --algo bm
Optional
iptables -I INPUT -j DROP -p tcp --dport 5060 -m string--string "VaxSIPUserAgent" --algo bm
iptables -I INPUT -j DROP -p udp --dport 5060 -m string --string "VaxIPUserAgent" --algo bm
iptables -I INPUT -j DROP -p udp --dport 5080 -m string --string "VaxSIPUserAgent" --algo bm
iptables -I INPUT -j DROP -p tcp --dport 5080 -m string --string "VaxIPUserAgent" --algo bm
Show iptable rules

sudo iptables -L -v

Show line numbers

iptables -L -v --line-numbers

Delete a line

Delete line 2

iptables -D INPUT 2

Block IP address

iptables -I INPUT -s 62.210.245.132 -j DROP

Save Changes

Debian / Ubuntu

apt-get install iptables-persistent
service iptables-persistent save
dpkg-reconfigure iptables-persistent
PF

Packet Filter is used in the FreeBSD setup script.

Basic Rules
set skip on lo0
scrub in all
antispoof for lo0
table <fail2ban> persist
pass out quick all
pass quick on lo0 all
block in all
block in quick from <fail2ban>
pass in quick inet proto icmp all
pass in quick inet6 proto icmp6 all
pass in quick inet proto tcp from any to any port 22 keep state
pass in quick inet proto tcp from any to any port 80 keep state
pass in quick inet proto tcp from any to any port 443 keep state
pass in quick inet proto tcp from any to any port 5060 keep state
pass in quick inet proto udp from any to any port 5060 keep state
pass in quick inet proto tcp from any to any port 5080 keep state
pass in quick inet proto udp from any to any port 5080 keep state
pass in quick inet proto udp from any to any port 16384:32768 keep state
Firewall Devices

Firewall device settings that help with SIP connections.

  • SIP ALG- Most of the time this setting is set to off or disabled and varies. Rarely this will be enabled.

Accounts

In the Accounts menu you have access to devices, extensions, gateways and user manager.
_images/fusionpbx_accounts.jpg

Gateway

_images/logo_right.png

Gateways provide access into other voice networks. These can be voice providers or other systems that require SIP registration. Check out the Youtube video .

In this example we will be using VoiceTel . Each Gateway provider has their own setings to use.

_images/fusionpbx_voicetel.jpg

Click to visit

Select Accounts from the drop-down list and click on Gateways.

_images/fusionpbx_gateway.jpg _images/fusionpbx_gateway1.jpg

Click the

_images/plus4.png

button on the right. Enter the gateway information below and Click on Save once complete.

Gateway: VoiceTel
Username: 0123456789
Password: 1b3d5f7h9j
From user: 0123456789
From domain: sbc.voicetel.com
Proxy: sbc.voicetel.com
Register: true
Enabled: true

_images/fusionpbx_gateway2.jpg

XMPP Manager


_images/fusionpbx_xmpp.jpg

XMPP Manager is an optional menu item. In order to have the option for XMPP Manager there are a few step to take to enble XMPP.

_images/fusionpbx_xmpp1.jpg

XMPP Profile

FusionPBX menu.
Accounts -> XMPP manager.
Click the
_images/plus2.png
on the right to create a profile.
In this example we will setup Google Talk and by creating a profile called gtalk.
Profile Name: gtalk
Username: your_user_account@gmail.com (use your account)
Password: use the correct password
Auto-Login: yes
XMPP Server: talk.google.com

_images/fusionpbx_xmpp2.jpg
Two approaches can be used for the next part.
Option 1.
Lets say my gmail number was 13051231234. This approach will send the inbound calls to the inbound routes with a destination number that is the default extension number that is set.
Default extension: 13051231234
Advanced -> Context: public
Option 2.
On a single tenant system. This will send the call to extension 1001 in the default context.
Default extension: 1001
Advanced -> Context: default
Option 3.
On a single tenant system. This will send the call to extension 1001 in the multi-tenant domain name.
Default extension: 1001
Advanced -> Context: your.domain.com
Save the settings and restart the module. Restart the ‘XMPP’ module from Advanced -> Modules page.
Go back to Accounts -> XMPP if the status says ‘AUTHORIZED’ then you are ready to go.
Note If you are not getting AUTHORIZED you might need to goto the google account settings and choose “Allow less secure apps: ON” under the Sign-in & security section.

_images/fusionpbx_xmpp5.jpg

Outbound Routes
For this example we will use 11 digit dialing.
Gateway: XMPP
Dialplan Expression: 11 digits
Description: Google Talk
Press Save
If your XMPP profile is named something other than gtalk edit the outbound route you just created.
Bridge statement should look like: dingaling/gtalk/+$1@voice.google.com replace gtalk with the profile name you chose and then save it.

Enable XMPP

XMPP manager is used to configure client side XMPP profiles. It can be used as a client to register to make and receive call with Google Talk or other XMPP servers.

GIT Manually add XMPP

After version 3.8 XMPP is optional. To add XMPP do the following
Goto command line
cd /tmp
git clone https://github.com/fusionpbx/fusionpbx-apps.git
cd fusionpbx-apps/
mv xmpp/ /var/www/fusionpbx/app/
cd /var/www/fusionpbx/app
chown www-data:www-data -R xmpp/

Goto Fusionpbx GUI

Goto the GUI and click advanced > menu manager > edit icon > click “Restore Defaults” at top right

Then goto Advanced > Upgrade click Schema, Data Types, and Permission Defaults then click execute

Click status > sip status > Flush Memcache

Log out then back in

You should now have XMPP Manager under Accounts

Dialplan

In the Dialplan menu you have access to Destinations, Dialplan Manager, Inbound Routes and Outbound Routes.
_images/fusionpbx_dialplan_menu.jpg

Destinations

Inbound destinations are the DID/DDI, DNIS or Alias for inbound calls. Click here for the youtube video

Configure Inbound Destinations: (This will auto-configure an Inbound Route also)

Select Dialplan from the drop-down list and then click Destinations.

_images/fusionpbx_inboundd.jpg

Click on the

_images/plus3.png

button on the right.

_images/fusionpbx_inboundd1.jpg

Enter the route information below and Click Save once complete.

_images/fusionpbx_inboundd2.jpg
Type: Inbound
Destination Number: ^(?:\+?1)?(\d{10})$
Action: Select desired destination from the drop-down list.  We choose "Extension 100" in our example.
This is where the call will route to.
Enabled: true
Description: VoiceTel-in


Optional: Replace ^(?:\+?1)?(\d{10})$ in Inbound Routes with either 0123456789 or a DID Number
depending on the Route Destination setting.

Dialplan Manager

The dialplan is used to setup call destinations based on conditions and context. You can use the dialplan to send calls to gateways, auto attendants, external numbers, to scripts, or any destination.

Inbound Routes

Route incoming calls to destinations based on one or more conditions. It can send incoming calls to an IVR Menu, Call Group, Extension, External Number, Script. Order is important when an anti-action is used or when there are multiple conditions that match.

Inbound routes can be used for advanced reasons. Dialplan > Destinations will create and configure the Inbound Route for you.

_images/fusionpbx_inbound_routes.jpg

Outbound Routes

Route outbound calls to gateways, tdm, enum and more. When a call matches the conditions the call to outbound routes. Check out the youtube video .


Configure Outbound Route.

Select Dialplan from the drop-down list and then click Outbound Routes .

_images/fusionpbx_outbound.jpg

Click the

_images/plus3.png

button on the right. Enter the route information below and Click Save once entry is complete.



_images/fusionpbx_outbound1.jpg


_images/fusionpbx_outbound2.jpg


Gateway: VoiceTel
Dialplan Expression: ^(?:\+?1)?(\d{10})$ (You can also choose more than one from the drop down list also as needed)
Order: 000
Enabled: true
Description: VoiceTel-out


By using VoiceTel you help support FusionPBX. Thank you for your support!

Applications

In the Applications menu (Apps) section you will find Call Block, Call Broadcast, Call Center, Call Detail Records, Call Flows, Conference Center, Contacts, Fax Server, Follow Me, IVR Menu, Music on Hold, Operator Panel, Phrases, Queues, Recordings, Ring Groups, Time Conditions and Voicemail.
_images/fusionpbx_apps.jpg

Call block

A list of numbers from which to block calls.

_images/fusionpbx_call_block1.jpg
  • To block a call click on the plus icon on the right
  • Fill out the fields with pertinent information
Action:
Reject- Will reject the call
Busy- Will send a busy signal
Hold- Will put the call on hold
Voicemail- Will send the call to the specified voicemail box

_images/fusionpbx_call_block.jpg

Call Broadcast

Broadcast calls (a light dialer) to a defined list of phone numbers.

_images/fusionpbx_call_broadcast.jpg
  • To create a call broadcast click the plus on the right

Fill in the following fields

  • Name- Name for the Call Broadcast
  • Accountcode Used by some billing systems
  • Timeout- Amount of time till hangup
  • Concurrent Limit- Number of calls at once
  • Caller ID Name- Name that will be used on outbound caller id
  • Caller ID Number- Number that will be used on outbound caller id
  • Destination Number- Where the Phone Number List will connect to
  • Phone Number List- List of phone numbers to call in the call broadcast
  • Voicemail Detection- Set True or false to detect an answering machine
  • Description Help organize and label what the call broadcast is for
_images/fusionpbx_call_broadcast1.jpg
  • Once you have everything filled out click the Call Broadcast name you just created. On the top right click the Send Broadcast button to start the call broadcast. To stop the call broadcast click STOP BROADCAST on the top right.

Call Center

List of queues for the call center.

_images/fusionpbx_call_center1.jpg
Call Center Queues
_images/fusionpbx_call_center_queue.jpg
  • To add a Call Center Queue click the plus edit icon on the right
  • Once a Queue is created click the edit pencil icon on the right. At the top right you can view, stop, start, restart and save the queue
Call Center Agents

List of call center agents.

_images/fusionpbx_call_center_agents.jpg
  • From Apps > Call Center click Agents at the top right to access Call Center Agents
  • Click the plus icon on the top right to add agents

Call Detail Records

Call Detail Records (CDRs) are detailed information on the calls. Use the fields to filter the information for the specific call records that are desired. Records in the call list can be saved locally using the Export button.

_images/fusionpbx_cdr.jpg
  • CID Name- Caller ID Name
  • Source- Where the call came from
  • Destination- Where the call went to
  • Recording- A link will appear if the call recorded
  • Start- Time the call entered the system
  • TTA- Time To Answer the call
  • Duration- How long the call was
  • PDD- Post Dial Delay
  • MOS- Mean Opinion Score is a measure of voice call quality
  • Hangup Cause- Details about the entire calls. Usually will be “Normal Clearing”

Call Flows

Direct calls between two destinations by calling a feature code.

_images/fusionpbx_call_flow1.jpg


  • Name: Define the name of the call flow
  • Extension: Define what extension to use. (This will make an extension not allready created)
  • Feature Code: Define what * number to use
  • Context: Domain context (typically leave as is)
  • Status: Define what currently is in use.
  • Pin Number: Define a pin number in order to execute either mode.
  • Destination: Define where the call will go in the intial mode.
  • Sound: Define the sound that will play once mode is engaged.
  • Destination: Define what the destination will be.
  • Alternative Label: Label that will show when alternative mode is in use.
  • Alternative Sound: Define the sound that will play once alternative mode is engaged.
  • Alternative Destination: Define where the call will go in the alternative mode.
  • Description: Label what this call flow does.


Call Flow Example

In the Call Flow example below we have the name as Call Flow. Made the Extension number 30 that didn’t exist until now. Feature code we made with a *code as *30. Kept the context as is with training.fusionpbx.com . Status to show which mode. Made a pin number to help secure the call flow. Made the detination label as Day Mode. Picked a sound to familiarize which mode is activated. Choose a destination for the alternative mode. Made the alternative detination label as Night Mode. Picked an alternative sound to familiarize which mode is activated. Choose a destination for the alternative mode. Finally describe what this call flow does.



_images/fusionpbx_call_flow.jpg

Conference

Conferences is used to setup conference rooms with a name, description, and optional pin number.

注解

For advanced conferencing use Apps -> Conference Center

_images/fusionpbx_conferences.jpg
Enable Conference

By default Conferences are hidden from the menu.

  • To add Conferences to the menu goto Advanced > Menu Manager and click the pencil edit icon on the right
  • Then click the pencil edit icon on the right of Conferences
_images/fusionpbx_conferences1.jpg
  • Select from the Groups dropdown list superadmin and click add then save
_images/fusionpbx_conferences2.jpg

Conference Center

Conference Centers are a group of conference rooms. They can be organized by cost center, geographically, or other criteria.

_images/fusionpbx_conference_center.jpg
  • To Acess Conference Center goto Apps > Conference Center
  • To view rooms click the ROOMS at the top right.

注解

For basic conferencing use Apps -> Conferences

Contacts

Contacts is a list of individuals and organizations.

_images/fusionpbx_contacts.jpg
  • To create a contact click the plus and to edit a contact click the pencil icon on the right.
  • Fill out the fields with pertinent information and click save.
  • Users- Select the users that are allowed to view the contact
  • Groups- Select the group that are allowed access to the contact.
_images/fusionpbx_contacts1.jpg
  • Go back into the contact to fill out more information that wasn’t available when you first created the contact.
_images/fusionpbx_contacts2.jpg
  • To generate a QR code click the QR CODE button at the top right
_images/fusionpbx_qr_code.jpg

Fax Server

To receive a FAX setup a fax extension and then direct the incoming to it. Click here for the Youtube video

_images/fusionpbx_fax.jpg
  • New: Create a new fax to send.
  • Inbox: Faxes received.
  • Sent: Faxes sent.
  • Log: Sucessful and failed attempts for both incoming and outgoing.
  • Active: Shows the faxes in queue.
Fax Server Settings

There are more settings for fax under Advanced > Default Settings then fax category.

To create a fax server goto App > Fax Server. Click the + on the right. Leave the Destination Number blank or faxing wont work. Destination Number is used in the Fax Server Dial Plan and is set based on the fax server internal extension number. Define the fields, the ones in bold are required. It is a good idea to organize so define the name thoughtfully. The extension you must use one that is not allready created. Account Code should autofill. Again, leave the Destination Number blank. A prefix can be defined when sending a fax. Email is for inbound faxes and will be on the server and sent to the defines email. Define the Caller ID Name and Number. Leave the Forward Number and Greeting blank for normal settings. Number of channels define with a numerical value. Keep organized by adding a Description.

_images/fusionpbx_fax5.jpg
New

To send a fax the items in bold are required. To send a proper fax it is best to fill out all fields and attach any documents. Keep in mind that the upload max MB is limited by Nginx and PHP config files.

_images/fusionpbx_fax1.jpg
Inbox

Click PDF to view the fax or right click on PDF and left click on Save Link As. If you defined and email address in the email field you will receive the fax also to that email address.

_images/fusionpbx_fax4.jpg
Sent

Click PDF to view the fax or right click on PDF and left click on Save Link As.

_images/fusionpbx_fax3.jpg
Fax ATA

To connect to a fax machine with an ATA you will most likely need to adjust settings in the ATA web interface and in FusionPBX.

Create an extension for the FAX machine. You can optionally set bypass media to true under advanced in the extension settings.

FAX Default Settings

Goto Menu -> Advanced -> Default Settings then category Fax

  • Variables are used as defaults for the dialplan for sending and receiving faxes
_images/fax_variables.jpg
  • fax_enable_t38_request=false (Can be true or false)
  • ignore_early_media=true (Can be true or false)
  • Some carriers it’s better for fax_enable_t38_request=true and for some its better for it to be false.
  • It’s best not to make an assumption and to do testing with different settings to get the best results for your particular carrier.
  • The variable fax_enable_t38_request=false will send a T38 reinvite when a fax tone is detected. In some cases the re-invite always fails for some carriers which is why it is default to false.
Troubleshooting Tips

Faxing will fail at times. Fax Server should automatically try different methods for sending. There are different combinations like;

  • With T-38 on/off
  • ECC on/off
  • Sending a wav file
  • Send a fax to HP faxback. This will test sending and receiving 1-888-473-2963
  • Test sending with Faxtoy.net This will display what is faxed on their website. 1-855-330-1239 or 1-213-294-2943

Follow Me

Define alternate inbound call handling for the following extensions.

_images/fusionpbx_follow_me.jpg
  • Call Forward- (Disabled or Enabled) Input the destination number
  • On Busy- (Disabled or Enabled) If enabled, it overrides the value of voicemail enabling in extension
  • No Answer- (Disabled or Enabled) If enabled, it overrides the value of voicemail enabling in extension
  • Not Registered- (Disabled or Enabled) If endpoint is not reachable, forward to this destination before going to voicemail
  • Follow Me- (Disabled or Enabled)
  • Destinations- Can set Delay, Timeout and Prompt to accept the call.
  • Ignore Busy- (Disabled or Enabled)
  • Do Not Disturbe- (Disabled or Enabled)

This example has both the extension 1301 itself and and external number to call. If you don’t put the extension itself the extension wont ring when in Follow Me. This is due to the flexible nature of FusionPBX where if you didn’t want that extension to ring like if you were out of the office on a business trip.

_images/fusionpbx_follow_me1.jpg

IVR Menu

Welcome to the adding IVR section. Here you will find how to add IVR’s. Click here for the youtube video


Click on Apps then IVR Menu

_images/fusionpbx_ivr.jpg

Then click the

_images/plus1.png

on the right.

_images/fusionpbx_ivr1.jpg

  • Options in bold are mandatory.
  • Name: Enter a name for the IVR menu
  • Extension: Enter the extension number (This must a new extension that isn’t allready created)
  • Greet Long: The long greeting when entering the menu.
  • Greet Short: The short greeting is played when returning to the menu.
  • Options: Define caller options for the IVR menu.
  • Timeout: The number of milliseconds to wait after playing the greeting or the confirm macro.
  • Exit Action: Select the exit action to be performed if the ivr exists.
  • Direct Dial: Define whether the callers can dial directly to registered extensions.
  • Ring Back: Defines what the caller will hear while the destination is being called.
  • Caller ID Name Prefix: Set a prefix on the caller ID name.
  • Enabled: set the status of the IVR Menu.

_images/fusionpbx_ivr2.jpg

You can get very creative with IVR’s and are almost limitless in possibilities. In the basic example below we;

  • Name the IVR “IVR Main”
  • Extension “200”
  • Greet Long a phrase that was made from the phrase section under apps
  • Number entry in options ,choose an extension for Destination and descriptions ie sales, billing, tech support, and after hours. timeout 3000 milliseconds
  • Exit Action to the extension 109 (after hours)
  • Direct Dial to False and Ring back to Default.

_images/fusionpbx_ivr3.jpg

You now have a list of IVR’s to go back to and edit or delete as needed.


_images/fusionpbx_ivr4.jpg


Phrases

Create phrases of audio files to be played in sequence.

_images/fusionpbx_phrases.jpg
  • Click the plus on the right to create a phrase and the pencil icon to edit a phrase

Music on Hold

Music on hold can be in WAV or MP3 format. To play an MP3 file you must have mod_shout enabled on the ‘Modules’ tab. You can adjust the volume of the MP3 audio from the ‘Settings’ tab. For best performance upload 16 bit, 8/16/32/48 kHz mono WAV files.

_images/fusionpbx_moh.jpg
  • Click the edit pencil on the right to customize music on hold options. This can be done on each kHz group.
_images/fusionpbx_moh1.jpg

When a new music on hold category mod_local_stream will be restarted. If it is busy then it will not restart automatically. A manual restart of the module is required when it is not in use. The module can be restarted from the Menu -> Advanced -> Modules or from the console and fs_cli with following command.

reload mod_local_stream

Each music on hold category is given a name. If the domain is set to global the name will be the name in the example below the protocol that is used is local_stream and the music on hold category is default and domain is set to global.

local_stream://default

It is possible that a domain or tenant can have its own category of music. In this example the name is ‘custom’ and the domain was assigned automatically to the current domain.

local_stream://domain_name/custom

Queues

Queues are used to setup waiting lines for callers. Also known as FIFO Queues.

_images/fusionpbx_queue.jpg _images/fusionpbx_queue1.jpg

Recordings


Dial ‘*‘732 to create a recording, or (for best results) upload a 16bit 8khz/16khz mono WAV file. Click here for the youtube video.


To view and set the pin number goto Dialplan > Dialplan Manager > Click on Recordings > pin_number=8675309 at the bottom.


_images/fusionpbx_recordings.jpg

Create a Recording

  1. Dial ‘*‘732 and wait for the voice prompt
  2. Enter the password (pin_number) followed by the pound sign# Enter at least a 3 digit number. This will label the recording file. (recording100.wav)
  3. start talking to make the recording after the voice prompt and press the pound key #
  4. Press 1 to accept the recording then hang up or press 2 to start over.

_images/fusionpbx_recordings1.jpg

Applying Recordings

Once you have a recording made you can use the recordings in different area’s of FusionPBX. Custom IVR’s and phrases would be the typical uses.


Ring Group


A ring group is a set of destinations that can be called with a ring strategy.

To add a ring group click the plus. Click for the youtube video .

_images/fusionpbx_ring_group.jpg
  • Name Simply the meaningful name of the Ring group (shows after the Extension in menu selections).
  • Extension The Dial-able extension for this group standard config states as a 2-7 number extension.
  • Strategy The selectable way in which the destinations are being used.
  • Simultaneous Rings all defined Destinations.
  • Sequence Where order that is lower goes first.
  • Enterprise Works with follow me.
  • Rollover calls destinations in sequence and skips busy destinations.
  • Random A random destination will ring.
  • Destinations The extensions that this ring group applies to.
  • Prompt Where you determine if the call must have a dial to confirm before a pickup event.
  • CID Name Prefix The string that is added to the caller ID when it displays on the ringing extension.
  • CID Number Prefix The Number that is added to the caller ID when it displays on the ringing extension.
  • Ring Back What the caller hears when they are waiting for the Destinations to answer.
  • Context The grouping that this ring group will search as specified in the configuration of your Extensions (if this excludes an extension it will not ring)
_images/fusionpbx_ring_group1.jpg
Ring Group Example

In our example we will have 4 extensions all ring at the same time until one of them pick up first. Click the + to create a ring group. Fill in the fields that are in bold. In the Extension box type a number that is NOT allready created. This new extention won’t be in the extension list. The strategy will be Simultaneous. Enter in the destination the 4 extensions 1001, 1002, 1003, 1004.

_images/fusionpbx_ring_group2.jpg

Time Conditions


Dynamically route calls to an IVR menu, external numbers, scripts, or other destinations based on time conditions. Fields in bold are mandatory.

  • Name Name of the Time Condition.
  • Extension Define an extension number that is NOT allready created.
  • Presets US Holiday presets.
  • Alternate Destination If the condition doesnt match the call will goto the defined alternate destination.
  • Order Changes the order of which condition is evaluated first.
  • Enabled If the ring group is enabled.
_images/fusionpbx_time_conditions.jpg
Time Conditions Example

In our example we have an employee that will receive calls during a set time range and set days. Below is what the settings look like for Monday through Friday at 5:00pm to 11:00pm. If the employee doesnt answer the call will be directed to the Timeout Destination. Label the Name as Oncall and invent the Extension as 10011. In the Settings choose from the dropdown lists for Day of Week for the condition, Monday for the Value and Friday for the Range. Next set of dropdown list choose Time of Day for the condition, 5:00 PM for the value and 11:00 PM for the Range. If other options are needed just click the + to the right of Range.


_images/fusionpbx_time_conditions1.jpg

The next dropdown choose the extension where the call is intended for. If the call is outside the date and time specified the call will goto the Alternate Destination dropdown. Be sure Enabled is set True and click save.


_images/fusionpbx_time_conditions2.jpg

Voicemail

To edit voicemail settings click the pencil edit icon on the right of the extension number.

_images/fusionpbx_voicemail.jpg

Here you can edit voicemail settings.

  • Play Tutorial- Play the voicemail tutorial after the next voicemail login
  • Greeting- When you dial *97, record a greeting and set a number you can choose which greeting to use
  • Alternate Greet ID- An alternative greet id used in the default greeting
  • Options- Define caller options for the voicemail greeting
  • Mail to- have voicemails emailed to this address
  • Voicemail File- Select a listening option to include with the email notification
  • Keep Local- Choose whether to keep the voicemail in the system after sending the email notification
  • Forward Destinations- Forward voicemail messages to additional destinations
  • Enabled- Enable or disable the voicemail box
_images/fusionpbx_voicemail2.jpg

注解

Starting version 4.2 remote access to voicemail by interupting the greeting message by pressing “*” and entering the password is disabled by default.

Voicemail Options

To access an extensions voicemail away from the extension.

  • Dial the extension and interupt the greeting with the *star key.
*97 To access that extensions voicemail from the extension or the voicemail button
*98 To access any extensions voicemail
*99[ext] To access a specific extension voicemail
  Main Menu
press 5 For advanced options
  Advanced Options
press 1 Record a greeting
press 2 Choose a greeting
press 3 Record name
press 6 Change password
press 0 For main menu
Voicemail Transcription

Uses API services to transcribe voicemails into text to be used in the app-sms and the voicemail to email options.

The following services are supported. Others can be added but would need to be developed.

  • Microsoft Bing

Sign up and language information is located on Microsoft Site

警告

We cannot use mod_shout to record Voicemails because the transcription service needs an uncompressed version of the audio. Therefore we will record in WAV and then use LAME to re-encode in MP3. This could cause added resource utilization to your system.

Goto Advanced > Default Settings. Add the following entries

Category Subcategory Type Value Enabled
voicemail transcribe_provider text microsoft True
voicemail microsoft_key1 text {your microsoft key #1} True
voicemail microsoft_key2 text {your microsoft key #2} True
voicemail transcribe_language text en-US True
voicemail transcribe_enabled boolean true True
Click “Reload” at the top of the page.

Goto Status > Sip Status.

Click “Flush Memcache”, “Reload XML” and “Rescan”.

If you entered your key’s correctly, you should now start getting transcriptions delivered in your voicemail to email and you will also see them on the Messages page.

Status

In the Status menu you have the options for Active Call Center, Active Calls, Active Conferences, Active Queues, Agent Status, CDR Statistics, Emails, Extension Summary, Log Viewer, Registrations, Services, SIP Status, System Status and Traffic Graph.
_images/fusionpbx_status_menu.jpg

Status

Active Call Center

Select a Call Center Queue from the list below to view its activity.

Active Calls

Use this to monitor and interact with the active calls.

Active Conferences

List all the conferences that are currently active with one or more members.

Active Queues

List all the queues that are currently active with one or more callers.

Agent Status

List all the call center agents with the option to change the status of one or more agents.

CDR Statistics

Call Detail Records Statics summarize the call information.

Emails

Manage failed email messages.

Extension Summary

Extenson number, Number Alias, Missed, No Answer, Busy, ALOC, Inbound Calls, Inbound Duration, Outbound Calls, Outbound Duration and Description.

Log Viewer

View recent PBX activity and option to download the logs.

Registrations

View the devices that are registered. This will show User, Agent, IP, Port Number, Hostname and Status. You can also UNREGISTER, PROVISION and REBOOT supported devices from here.

Services

Shows a list of processes, the status of the process and provides control to start and stop the process.

SIP Status

This will show sofia status of internal, internal-ipv6, external, and external-ipv6 profiles. With profiles you can see REGISTRATIONS, and START/RESTART/RESCAN/FLUSH REGISTRATIONS. You can also FLUSH MEMCACHE, RELOAD ACL, RELOAD XML and REFRESH. View UP time, sessions since startup, max sessions, and current stack size/max.

System Status

System Information, FusionPBX Version, Git Version, Switch Version, Memory Information, CPU Information, Hard Drive Information and Memcache Information.

Traffic Graph

A browser (or plugin) that supports Scalable Vector Graphics (SVG) is required to view the traffic graph.

Advanced

In the Advanced menu you will find Access Controls, Adminer, App Manager, Backup, Command, Databases, Default Settings, Domain, Grammer Editor, Group Manager, Menu Manager, Modules, Notifications, PHP Editor, Provision Editor, Script Editor, Settings, SIP Profiles, SQL Query, Upgrade, Variables and XML Editor.
Welcome to the adding a domain section. Here you will find how to add a domain so that you can reach the specific tenant from the multi-tenant domain side menu to configure and allow secure administration from the world wide web.

Adminer

Adminer provides a way to access FusionPBX database.

  • To enable auto login goto Advanced > Default settings and change False to True
_images/fusionpbx_adminer.jpg
  • To access Adminer goto advanced > adminer.

Access Controls

Access control list can allow or deny ranges of IP addresses. There are several purposes for using the ACL.

  • The main purpose is for your carriers ip addresses.
  • Be careful with what and how you use ACL.
  • Most common mistakes result in calls not working between extensions and other undesirable results.
  • Be sure to keep Domains access control to default deny.
  • Do not put your public ip or phone IP addresses in the domains access control list.
  • Don’t supply both the domain and the cidr on the same node.
  • If adding a single IP address to the CIDR field make sure to add /32 on the end of the IP address.
Access Control Example

Goto Advanced > Access Controls. Click the edit icon for domains. At the bottom under nodes click the plus icon.

Type choose allow
CIDR enter the 123.456.789.000/32
Domain (Leave Blank, used for advanced scenarios)
Description (Carrier Name)

Click save

Goto > Status > Sip Status and click reloadacl.

Under Status > log viewer you should notice the ip added. This can be seen also from command line fs_cli by using reloadacl

[NOTICE] switch_utils.c:545 Adding 123.456.789.000/32 (allow) [] to list domains

Command

Provides a conventient way to execute system, PHP, switch and SQL commands.

_images/fusionpbx_command.jpg
  • Click the drop down box on the right to choose from Switch, PHP, Shell and SQL to execute commands.

Domains

Welcome to the adding a domain section. Here you will find how to add a domain so that you can reach the specific tenant from the multi-tenant domain side menu to configure and allow secure administration from the world wide web. Click here for the youtube video

_images/fusionpbx_domain.jpg
Adding a domain

Control the list of domains to manage.

There are several reasons to create a domain (tenant). One reason would be to organize customers and so customers have a unique login ie superadmin@domain.tld or superadmin@subdomain.domain.tld as the username.

In this example we will create a domain.

Goto advanced then click Domains.

_images/fusionpbx_domain.jpg

Then click the

_images/plus.png

on the right.

_images/fusionpbx_domain1.jpg

This will bring you to enter domain info. (Be sure to create an “A record” from your domain hosting account)

_images/fusionpbx_domain2.jpg

Click save once entry is complete.

_images/fusionpbx_domain1.jpg
Domain Selection

Changing to a different domain click the stack of three dashes on the top right

_images/fusionpbx_domain5.jpg

A menu will pop open on the right of the screen. Click on the domain that you want to manage. You will always see the domain you are in by looking at the top right beside the three stacked dashes.

_images/fusionpbx_domain6.jpg

Group Manager

Permit access levels to different group of users. The group permissions allow customizing permissions for existing groups or custom groups.

_images/fusionpbx_group_manager.jpg
  • superadmin- the global administrator
  • admin- the domain administrator
  • users- the group for regular users

User Manager

Create, edit, remove users.

  • Goto Advanced > Group Manager and click USERS at the top right to create, edit or remove a user.
_images/fusionpbx_click_users.jpg
  • Click the plus at the right to add a user or pencil to edit an existing user.
_images/fusionpbx_users.jpg
  • Fill in the boxes with pertinent information.
  • Group- assign the user to a group. Be wise as to who has access to what.
_images/fusionpbx_add_user.jpg

Sip Profiles

  • Advanced -> SIP Profiles
_images/fusionpbx_sip_profiles.jpg
Internal

Internal sip profiles (port 5060/5061) require registration or access controls cidr range to allow the IP address in without SIP authentication. Once the access controls are setup correctly, the carrier will be allowed to send calls to the internal profile.

External

External sip profiles (port 5080-5081) allow anonymous connection to FusionPBX and is optional. External profile is optional when freewitch has a public ip address. Can be useful when setting behind nat. Being anonymous doesn’t mean totally open due to the inbound routes call conditions.(call filtering)

Internal ipv6

Internal ipv6 sip profiles (port 5060/5061) require registration or access controls cidr range to allow the IP address in without SIP authentication. Once the access controls are setup correctly, the carrier will be allowed to send calls to the internal ipv6 profile.

  • If you don’t have ipv6 then the ipv6 profiles should be disabled.
  • Be sure to stop the profile before disabling it. To disable goto Advanced > SIP Profiles and click the pencil edit icon to the right of the profile you want to disable. From the dropdown box select enabled to false.
External ipv6

External ipv6 sip profiles (port 5080-5081) allow anonymous connection to FusionPBX and is optional.

  • If you don’t have ipv6 then the ipv6 profiles should be disabled.
  • Be sure to stop the profile before disabling it. To disable goto Advanced > SIP Profiles and click the pencil edit icon to the right of the profile you want to disable. From the dropdown box select enabled to false.

Upgrade

The FusionPBX code is constantly evolving. Bug fixes being submitted, additions to improve security, making FusionPBX look nicer, to be more flexible, more scalable, and new features. A complete summary of the changes can be found on the github code page https://github.com/fusionpbx/fusionpbx/commits/master.

Go to the menu then click on Advanced and then Upgrade. This tool allows you to update the source code, update the database structure, restore the default menu and permissions. Click here for the Youtube video.

_images/fusionpbx_upgrade.jpg

Update the source from command line
* cd /var/www/fusionpbx
git pull
chown -R www-data:www-data *
Back to the GUI
*Upgrade Database with advanced -> upgrade schema
*Update permissions
*Update the menu
*Logout and back in
How to Upgrade
_images/fusionpbx_upgrade_green.jpg

To upgrade you will need to get the latest source code. Depending on how extreme the changes have been or the version you currently are on since your last update, you may need to follow version specific upgrade instructions to bring your install up to date.
Step 1: Update FusionPBX Source
1. GUI -> Advanced -> Upgrade (doesn’t update all files)

Used to update FusionPBX to the latest release.

Upgrade the code via Github/GIT

Login into the web interface with a user account assigned to the superadmin group.
Login to the console with either the ssh, the locally.
Backup It’s a good idea to make a backup. If using sqlite, your backup will easily include the SQL database.
mkdir /etc/fusionpbx
mv /var/www/fusionpbx/resources/config.php /etc/fusionpbx
mv /usr/local/freeswitch/scripts/resources/config.lua /etc/fusionpbx
cd /var/www
cp -R fusionpbx fusionpbx_backup
Change the directory''' to the FusionPBX directory
cd /var/www/fusionpbx

Update the source code (example assumes fusionpbx is in /var/www/fusionpbx)

cd /var/www/fusionpbx
git pull
Permissions
Reset the permissions on the fusionpbx directory tree. When you do git pull it sets the permissions on any updated files to match the account that you are running git pull with. If that account is different to the web server account it will result in some files no longer being accessible and a red bar error at the top of the upgrade screen on the GUI. To fix this you should reapply the permissions in fusionpbx and recursively in all directories inside it.

The example assumes the web server runs as user ‘www-data’ and fusionpbx is installed to /var/www/fusionpbx. (chown -Rv Ownername:GroupName /var/www/fusionpbx)
cd /var/www/fusionpbx
chown -R www-data:www-data *
Step 2: Update Freeswitch Scripts
NOTE: As of FusionPBX 3.8.3 (Stable Branch), the scripts should be automatically updated when updating the Source Code, using the Advanced > Upgrade page. Any customized scripts, having the same name as the default scripts, will be overwritten. (An option to disable this default behavior is available using Default Setting: switch > scripts_update > false) Missing scripts will be restored, and any additional files within the scripts folder will remain untouched.
FusionPBX is a fast moving project where features are constantly being added and bugs are being fixed on a daily basis so I would also suggest upgrading the Freeswitch scripts directory as part of any normal upgrade process.

Update Freeswitch

Use github to get the updated files. You have to do this from an empty directory.
cp -R /usr/local/freeswitch/scripts /usr/local/freeswitch/scripts-bak
rm -Rf /usr/local/freeswitch/scripts/
cd /usr/src
git clone https://github.com/fusionpbx/fusionpbx.git
cp -R /var/www/fusionpbx/resources/install/scripts /usr/local/freeswitch
chown -R www-data:www-data /usr/local/freeswitch/scripts
cp -R /usr/local/freeswitch/scripts-bak/resources/config.lua /usr/local/freeswitch/scripts/resources/config.lua

(The last step above is not required if your config.lua file is being stored in a different location, such as the /etc/fusionpbx folder.)

Clean out this scripts directory
An alternative is to remove the Lua scripts. Only do this if you haven’t customized any LUA scripts
cp -R /usr/local/freeswitch/scripts /usr/local/freeswitch/scripts-bak
rm -rf /usr/local/freeswitch/scripts/*
Pull the most recent scripts down
Here you need to go directly to step 3 and make sure you run upgrade schema from the GUI immediately otherwise your calls will not complete.
Restore the config.lua file (IMPORTANT!!)
If your config.lua file was located in scripts/resources/, then you’ll need to restore it (from the backup previously performed) to scripts/resources/config.lua.
Step 3: Upgrade Schema
Many updates have changes to the database and to the Freeswitch scripts. The upgrade_schema script
Upgrade from the GUI
From the GUI, run Advanced -> Upgrade Schema which will add any needed newer tables or columns.
Then run App Defaults. If you removed the scripts on Step 2 then run this twice.
_images/fusionpbx_upgrade_schema_data_types.jpg

Upgrade from the Command Line
An alternative to running upgrade_schema.php from the GUI is to run the upgrade.php from the command line. It was designed to make the upgrade easier. If you did not login when updating the FusionPBX source code then you will need to run the upgrade.php file from the command line. Make sure to use the full path to the PHP file.
As root run the following
cd /var/www/fusionpbx
/usr/bin/php /var/www/fusionpbx/core/upgrade/upgrade.php
If your screen was nicely formatted with a fusionpbx theme, and suddenly now goes to a black and white screen with familiar text but no theme, it is because you were using a theme which no longer exists in the latest version of the code. If this happens to you navigate to:
http://domain_or_ip/mod/users/usersupdate.php
Then scroll down to where it says “Template” and select one of the valid templates from the drop down list. Then press Save. It will be fixed now and you can continue with the remaining steps below.
(Note that any users who have invalid templates selected will also have the same problem you did. You can fix them from the user manager option in the accounts menu)
Step 4: Apply permissions and Restart Freeswitch
Make sure that the freeswitch directory has the correct permissions
chown -Rv www-data:www-data /usr/local/freeswitch/
Restart Freeswitch
systemctl restart freeswitch
Step 5: Menu
Needed if your menu disappeared.
v1 and v2
Now update the menu to the latest version.
http://domain_or_ip/core/menu/menu_restore_default.php
Press ‘Restore Default’ on the top right.
v3
click ‘e’ next to the default menu
click the restore default button.
Step 6: Re-generate Settings
Sometimes variable names changes. In rev 1877 v_config_cli.php variable names changed which caused no fax to email emails or voicemail emails to be sent. Problem was the SMTP details did not exist.
Go to Advanced -> Settings and then click save. This will re-generate v_config_cli.php and any other needs config files.
Move to a different Branch

FusionPBX has a stable and a master(development) branch. You can switch from stable to master but not recomended to downgrade.

Move to the Stable Branch
mv /var/www/fusionpbx /var/www/fusionpbx-master
cd /var/www && git clone -b 4.2 https://github.com/fusionpbx/fusionpbx.git
chown -R www-data:www-data /var/www/fusionpbx

Make sure config.php exists in /etc/fusionpbx If missing then move it into this directory.

cp /var/www/fusionpbx-master/resources/config.php /etc/fusionpbx
Move to the Master Branch
mv /var/www/fusionpbx /var/www/fusionpbx-old
cd /var/www && git clone https://github.com/fusionpbx/fusionpbx.git
chown -R www-data:www-data /var/www/fusionpbx
  • Complete the normal upgrade process at Advanced -> Upgrade
  • If the menu disappears you have to upgrade schema then restore the default menu to get it back.

Version Upgrade

Version Upgrade can take several steps to perform. Below will show how to upgrade from specific versions.

Version 4.2 to 4.4
  1. Normal upgrade procedure update the source code, schema, menu and permissions.
  2. Need to delete the following dialplans user_exists and user_record, call_forward_all, and local_extension dialplans from all domains. Then run Advanced -> Upgrade -> App Defaults to get new up to date diaplans.
  3. Update old recordings set the record_name and record_path.
cd /usr/src
wget https://raw.githubusercontent.com/fusionpbx/fusionpbx-scripts/master/upgrade/record_path.php
php record_path.php
Version 4.0 to 4.2

1. Update the source code. From the web interface go to the Menu -> Advanced > Upgrade page. Check the source box and the press execute. If you see a red bar it indicates there was a git conflict and you will need to update from console instead. If you don’t see the source box then you will need to update from the console.

cd /var/www/fusionpbx
git stash
git pull
chown -R www-data:www-data /var/www/fusionpbx
  1. If the page goes blank type in the url http://domain.com/logout.php This should bring you back to the login screen.

3. Udate the Schema. Advanced -> Upgrade Check the Schema box and then then press execute. https://domain.com/core/upgrade/index.php

  1. Check the box for App Defaults and run execute.
  2. Check the box for Menu Defaults and run execute. This will update the menu to the default menu. The menu should now look like this.
_images/fusionpbx_new_menu.jpg
  1. Check the box for Permission Defaults and run execute. Permissions are store in a session to get new permissions logout and back in.
  2. Goto Dialplan > Dialplan Manager and delete “local_extension”. Then goto Advanced > Upgrade and only check box App Defaults and click execute. This will regenerate the new local_extension version.
  3. Go to Applications > Conference profiles. Edit each profile and replace $${hold_music} with local_stream://default
  4. Goto Advanced > Variables hold_music. Make sure it’s value is set as local_stream://default
Check Applications > Music On Hold to see if music is listed properly.
You should see in red default for the category and the kHz sub categories should be in blue.
If not, do the following

* Edit (Pencil icon on the right) the Category names to reflect default for 8, 16, 32, and 48kHz.
* After you click the pencil icon choose at the bottom the domain for the rates and click save.
* If the category is blank, you may have missed running Advanced > check box app defaults > execute or you may not have renamed autoload_configs/local_stream.conf.xml file to local_stream.conf.
* For custom music on hold check the path for the domain name and set select for the domain name to match the domain used in the path.
  1. Remove .xml from the end of the following file names
**Before**
autoload_configs/callcenter.conf.xml
autoload_configs/conference.conf.xml
autoload_configs/local_stream.conf.xml
**After**
autoload_configs/callcenter.conf
autoload_configs/conference.conf
autoload_configs/local_stream.conf
  1. Edit autoload_configs/lua.conf.xml adding “languages”. Restart of FreeSWITCH is required.
<param name="xml-handler-bindings" value="configuration,dialplan,directory,languages"/>
  1. Update Time Conditions (Bug Fix)

Goto Advanced > Upgrades page. Check box Update Source, execute. Goto Advanced > Default settings > Category > delete the category: time condition presets. Goto Advanced > Upgrade > check box App Defaults, execute. Goto Advanced > Default settings. Click “Reload” at the top right. (This will get the new presets)

Next steps are for existing Time Conditions Goto Apps > Time Conditions and edit the time conditions remove all holidays and hit save. Select the holidays over again.

注解

Many of the provisioning templates were updated. If you use custom provisioning templates you should consider updating them with the new versions.

Version 3.8 to 4.0

Remove the comments from the script-directory in /usr/local/freeswitch/conf/autoload_configs/lua.conf.xml

If using the FreesWITCH package then remove $${base_dir} and set the full path to the scripts directory.

before:  <!--<param name="script-directory" value="$${base_dir}/scripts/?.lua"/>-->

after:   <param name="script-directory" value="/usr/local/freeswitch/scripts/?.lua"/>

Rebooting FreeSWITCH is required for this to take effect.

Version 3.6 to 3.8
Note: Upgrading can get very complex. If the production system is critical or you are intimidated from these upgrade instructions you may want FusionPBX paid support at http://www.fusionpbx.com/support.php
A standard ‘upgrade’ procedure should always be followed:
(1. Make a Backup!, 2. Advanced > Upgrade steps, 3. Update switch scripts, 4. Restart FreeSWITCH).

Beyond the standard upgrade procedure just described, the following will also need to be performed:

uncomment: <param name="script-directory" value="$${base_dir}/scripts/?.lua"/>
in: /usr/local/freeswitch/conf/autoload_configs/lua.conf.xml
* Rebuild all time conditions.
* After you edit a particular time condition, click the Dialplan button on the top right to see what was there originally.
* Delete the following dialplans from each domain then run Advanced -> Upgrade -> App Defaults. If using XML handler for the dialplan flush memcache. If using dialplans XML on the file system resave one of the dialplans to have FusionPBX rewrite the XML files.
* user_exists - call_timeout variable was added
* extension-intercom - It has been renamed to ‘page-extension’
* eavesdrop - Change ‘*‘88[ext] to ‘*‘33[ext] so that it doesn’t conflict with page-extension at ‘*‘8[ext]
* user_status - Has been renamed to ‘agent_status’
* page - Dialplan has been simplified.
* valet_park_out - Changed regex variable from $1 to $2
* local_extension - failure handler was added to support call forward on busy and no answer
* If using call center feature code ‘*‘22 edit each agent and add an agent id and password (pin number)
* Delete any dialplan with the ‘features’ context. These have been moved into the dialplan domain contexts.
* If using App -> XMPP, Content Manager, or Schema they have been moved dev -> branches -> apps directory need to pull files from there if you want to use any of them.
* For single tenant systems ‘default’ context is no longer used by default.
* Easiest way to update your system is go to Advanced -> Domains and edit your domain.
* Copy your current domain name then change the name to default then save the change.
* Now edit the domain name again and paste your original domain name or IP address whatever the domain originally was and save the changes
* Go to accounts extensions and save one extension. (not needed if using the XML handler)
* Go to Dialplan Manager and save one of the dialplans. (not needed if using the XML handler)
* FAX ( may require adjusting the paths and web server user account to match your server ‘www-data’ is used in this example)
* Delete all previous FAX dialplans
* Resave each fax server in the GUI.
* cd /var/www/fusionpbx/app/fax
* chown -R www-data:www-data fax_import.php
* Login into the GUI and use this path in your browser http://<domain-or-ip>/app/fax/fax_import.php
* rm /var/www/fusionpbx/app/fax/fax_import.php
* Groups and Permissions
If you go to Advanced Group Manager -> And you see what looks like duplicates of user, admin and superadmin groups then you need do the following instructions.

Remove permissions associated with all domain groups with names that match default global groups...
Use the Advanced -> SQL Query tool to do the following.
delete from v_group_permissions where domain_uuid is not null
   and (
       group_name = 'user'
       or group_name = 'admin'
       or group_name = 'superadmin'
       or group_name = 'agent'
       or group_name = 'public'
   )

Remove all domain groups having the same names as the default global groups
(retains any custom domain groups)...

   delete from v_groups where
   domain_uuid is not null
   and (
       group_name = 'user'
       or group_name = 'admin'
       or group_name = 'superadmin'
       or group_name = 'agent'
       or group_name = 'public'
   )

Empty the group_uuid field for any group user with a group_name value having
the same name as the default global groups (retains user assignments to custom domain groups)...

   update v_group_users set group_uuid = null where
   group_name = 'user'
   or group_name = 'admin'
   or group_name = 'superadmin'
   or group_name = 'agent'
   or group_name = 'public'

For group users with a null group_uuid, insert the group_uuid of the global group that matches the group_name value...
Run this code from Advanced -> Command -> PHP Command.
$sql = "select group_user_uuid, group_name ";
   $sql .= "from v_group_users where group_uuid is null";
   $prep_statement = $db->prepare(check_sql($sql));
   $prep_statement->execute();
   $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
   $result_count = count($result);
   unset($prep_statement);
   if ($result_count > 0) {
       foreach($result as $field) {
           //note group user uuid
               $group_user_uuid = $field['group_user_uuid'];
               $group_name = $field['group_name'];
           //get global group uuid
               $sql = "select group_uuid from v_groups ";
               $sql .= "where domain_uuid is null ";
               $sql .= "and group_name = '".$group_name."' ";
               $prep_statement = $db->prepare($sql);
               $prep_statement->execute();
               $sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC);
               $sub_result_count = count($sub_result);
               unset ($prep_statement);
           //set group uuid
               if ($sub_result_count > 0) {
                   $sql = "update v_group_users ";
                   $sql .= "set group_uuid = '".$sub_result['group_uuid']."' ";
                   $sql .= "where group_user_uuid = '".$group_user_uuid."' ";
                   $count = $db->exec(check_sql($sql));
                   unset($sql);
               }
       }
   }

Apps menu disappeared
If your apps menu disappeared check that it wasn’t set to protected in the menu manager.
(advanced -> menu manager). If protected is true, it won’t show up.
Version 3.5 to 3.6

When running Upgrade -> Schema
If you see ALTER TABLE v_xml_cdr ADD json json; every time you run the upgrade schema then you likely have an old version of Postgres. To fix this either upgrade to the latest Postgres server or run the following SQL statement from advanced -> sql query.
ALTER TABLE v_xml_cdr ADD json text;
Potential issue with call recording after upgrading/switch to latest 3.6 stable.
After upgrading to 3.6 stable from 3.5 dev I noticed that calls were no longer being recorded. This was due to the file extension being missing from the recording path. If this is happening to you it is an easy fix.
Go to Advanced -> variables -> category default and add the variable record_ext and set it to either wav or mp3. Choosing mp3 depends upon whether or not you have mod_shout installed and enabled.
Version 3.4 to 3.5

Gateways now use the gateway_uuid as the name that is used when interacting with FreeSWITCH. This script is needed to help change the gateway names used in the outbound routes. You may need to remove the old gateway file names from the conf/sip_profiles/external directory.
cd /var/www/fusionpbx
wget http://fusionpbx.googlecode.com/svn/branches/dev/scripts/upgrade/gateway_uuid.php
http://x.x.x.x/gateway_uuid.php
rm gateway_uuid.php
* Go To Advanced -> Default Settings -> Switch Category -> Sub category gateways change to sip_profiles
Permissions Issues - (access denied errors)
Due to changes which improve consistency throughout the product, some Users have had problem with superadmin receiving “access denied” errors after the upgrade.

* Go To Advanced -> Group Manager
* On superadmin click Permissions and then Restore Default

You may need to execute this operation for each group.
Default Settings
In the switch category change gateways to sip_profiles

Version 3.3 to 3.4

Update the source as described on this page, menu manager restore default, group manager edit a group restore default, advanced -> upgrade schema.

FusionPBX 3.4 hunt groups have been deprecated. Use the following script run it only one time to move existing hunt groups to ring groups.
cd /var/www/fusionpbx
wget https://github.com/fusionpbx/fusionpbx-scripts/tree/master/upgrade/hunt_group_export.php
http://x.x.x.x/hunt_group_export.php
rm -r hunt_group_export.php

Ring groups were expanded to add ability to call external numbers and match other missing hunt group features. A new table was created to accomodate this.
cd /var/www/fusionpbx
wget https://github.com/fusionpbx/fusionpbx-scripts/tree/master/upgrade/ring_group_extensions.php
http://x.x.x.x/ring_group_extensions.php
rm ring_group_extensions.php

Version 3.2 to 3.3

FreeSWITCH changed the syntax to connect to the database so numerous LUA scripts had to be updated. If you customized any of the lua scripts make a backup of the FreeSWITCH scripts directory. Then remove the contents of the freeswitch/scripts directory and then run advanced -> upgrade schema (which will detect the missing scripts and replace them).

Version 3.1.4 to 3.2

Ubuntu/Debian
cd /var/www/fusionpbx
git pull
Advanced -> Upgrade Schema
Menu
If you cant see the menu after upgrading try the following in your browser replace x.x.x.x with your ip or domain name.
x.x.x.x/core/menu/menu.php
Edit the menu make sure the language is set to en-us.
Press **Restore Default**
Default settings
x.x.x.x/core/default_settings/default_settings.php
category: language
type: code
value: en-us
Email

Migrating email to the new FusionPBX native voicemail.

wget https://github.com/fusionpbx/fusionpbx-scripts/tree/master/upgrade/voicemail_export.php
Run from the browser it will take the voicemail data from the FreeSWITCH database and copy the information into the FusionPBX database.
http://x.x.x.x/voicemail_export.php

Remove the export file

rm voicemail_export.php
Call Forward / Follow Me
No longer using hunt groups. So the backend has changed so keep in mind that you need to reset call forward and follow me settings. They are still listed in app -> hunt groups. After updating the info in call forward, follow me you should delete the hunt group.

Version 2 to 3.0

LESS than or EQUAL to revision 1877, use the migration tool. https://github.com/fusionpbx/fusionpbx-scripts/tree/master/upgrade
If greater than revision 1877, use latest.
| When upgrading from previous versions, you may encounter the following issues:
Changes to your dial plan or extensions don’t take effect
* Go to the Advanced -> Default Settings page
* Remove “/default” from the end of your dialplan and extensions directories

Missing menus
* Go to hxxps://yourdomain.com/core/menu/menu.php
* Click the edit (e) button beside default
* Click the Restore Default button
* Check that all the entries in the list are accessible by the appropriate groups
Emails not being sent for voicemail or fax
* Double check the SMTP settings on the System -> Settings page
* Save it, even if you haven’t changed anything

Release Revisions

  • r0001 is 1.0 release - 6 Nov 2009
  • r2523 is 3.0 release - 3 May 2012
  • r2585 is 3.0.4 release - 24 May 2012
  • r2757 is 3.1 release - 18 Aug 2012
  • r2777 is 3.1.1 release - 26 Aug 2012
  • r2827 is 3.1.2 release - 12 Sep 2012
  • r2897 is 3.1.3 release - 26 Sep 2012
  • r2907 is 3.1.4 release - 27 Sep 2012
  • r3694 is 3.2 release - 19 Jan 2013
  • r3978 is 3.3 release - 1 May 2013
  • r4605 is 3.4 release - 28 Sep 2013
  • r6747 is 3.6.1 release - 22 Aug 2014
  • r8481 is 3.8.3 release - 11 May 2014
  • r793d386 is 4.0 release - Aug 2015
  • r4fdb6e9 is 4.1 release - Dec 2015
  • rxxxxxxx is 4.2 release - xxx 2016

SQLite

SQLite is the FreeSWITCH default. Databases are located in the freeswitch/db directory.

Postgres

Postgres native support will be in FreeSWITCH 1.2.4 but has been available in the Main GIT branch.

Dependencies

libpq and the associated dev packages are required

Configure

To enable PostgresSQL as a native client in FreeSWITCH you must enable it during the build when running configure. ** ./configure –enable-core-pgsql-support **

switch.conf.xml

Under the Settings area insert the following line

<param name=”core-db-dsn” value=”pgsql;hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password=’’ options=’-c client_min_messages=NOTICE’ application_name=’freeswitch’” />

Additional Information

Fail2Ban

For information about Fail2Ban on FreeSWITCH, http://wiki.freeswitch.org/wiki/Fail2ban see their wiki.
Logs
This will log FusionPBX authentication failures to syslog (AUTH_LOG). This file can be in different places depending on how rsyslog, or syslog is configured.
Ubuntu
/var/log/auth.log
Examples
GUI Login
incorrect username
Feb  1 11:35:11 your_hostname FusionPBX: [w.x.y.z] authentication failed for login_username
incorrect password
Feb  1 12:07:27 your_hostname FusionPBX: [w.x.y.z] authentication failed for superadmin
Provisioning
Created from the code in /fusionpbx/mod/provision/index.php Please doublecheck this!
Feb  1 12:07:27 your_hostname FusionPBX: [w.x.y.z] provision attempt bad password for AA:BB:CC:DD:EE:FF
Setting up Fail2Ban
RegEx
You can test the regex with fail2ban-regex
'[hostname] FusionPBX: \[<HOST>\] authentication failed'

Configuration
Jail Options
Every jail can be customized by tuning the following options:
Name Default Description
filter Campground Name of the filter to be used by the jail to detect matches. Each single match by a filter increments the counter within the jail
logpath /var/log/messages Path to the log file which is provided to the filter
maxretry 3 Number of matches (i.e. value of the counter) which triggers ban action on the IP.
findtime 600 sec The counter is set to zero if no match is found within “findtime” seconds.
bantime 600 sec Duration (in seconds) for IP to be banned for.

Filter Rules
vim /etc/fail2ban/filter.d/fusionpbx.conf
# Fail2Ban configuration file
#
# Author: soapee01
#

[Definition]

# Option:  failregex
# Notes.:  regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values:  TEXT
#
#failregex = [hostname] FusionPBX: \[<HOST>\] authentication failed
#[hostname] variable doesn't seem to work in every case. Do this instead:
failregex = .* FusionPBX: \[<HOST>\] authentication failed for
          = .* FusionPBX: \[<HOST>\] provision attempt bad password for

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =
add the following to /etc/fail2ban/jail.local
[fusionpbx]

enabled  = true
port     = 80,443
protocol = tcp
filter   = fusionpbx
logpath  = /var/log/auth.log
action   = iptables-allports[name=fusionpbx, protocol=all]
#          sendmail-whois[name=FusionPBX, dest=root, sender=fail2ban@example.org] #no smtp server installed
Add /etc/fail2ban/filter.d/freeswitch.conf with the contents:
# Fail2Ban configuration file
#
# Author: Rupa SChomaker (first two regex)

[Definition]

# Option:  failregex
# Notes.:  regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values:  TEXT
#
failregex = \[WARNING\] sofia_reg.c:\d+ SIP auth failure \(REGISTER\) on sofia profile \'\w+\' for \[.*\] from ip <HOST>
            \[WARNING\] sofia_reg.c:\d+ SIP auth failure \(INVITE\) on sofia profile \'\w+\' for \[.*\] from ip <HOST>
            \[WARNING\] sofia_reg.c:\d+ SIP auth challenge \(REGISTER\) on sofia profile \'\w+\' for \[.*\] from ip <HOST>

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =
Modify /etc/fail2ban/jail.conf. Add the following make sure the freeswitch.log file path is correct.
[freeswitch-tcp]

enabled  = true
port     = 5060,5061,5080,5081
protocol = tcp
filter   = freeswitch
logpath  = /usr/local/freeswitch/log/freeswitch.log
action   = iptables-allports[name=freeswitch-tcp, protocol=all]
           sendmail-whois[name=FreeSwitch, dest=root, sender=fail2ban@example.org]

[freeswitch-udp]

enabled  = true
port     = 5060,5061,5080,5081
protocol = udp
filter   = freeswitch
logpath  = /usr/local/freeswitch/log/freeswitch/freeswitch.log
action   = iptables-allports[name=freeswitch-udp, protocol=all]
           sendmail-whois[name=FreeSwitch, dest=root, sender=fail2ban@example.org]
/var/log/fail2ban.log will log this after 3 missed logins.
2011-02-01 12:32:18,151 fail2ban.actions: WARNING [fusionpbx] Ban 192.168.100.1
hostname # iptables -n -L fail2ban-fusionpbx
Chain fail2ban-fusionpbx (1 referecnes)
target    prot opt source        destination
DROP      all  --  192.168.100.1 anywhere
RETURN    all  --  anywhere      anywhere
Important
You can easily ban yourself, including current active ssh connections.
To unban:
hostname # iptables -n -D fail2ban-fusionpbx 1
Keep yourself from getting banned.
add to /etc/fail2ban/jail.local
[DEFAULT]

# "ignoreip" can be an IP address, a CIDR mask or a DNS host
ignoreip = 127.0.0.1 192.168.0.99
bantime  = 600
maxretry = 3
Errors
If you’re seeing something like this in your fail2ban logfile:
2011-02-27 14:11:42,326 fail2ban.actions.action: ERROR  iptables -N fail2ban-freeswitch-tcp
add the time.sleep(0.1) to /usr/bin/fail2ban-client
def __processCmd(self, cmd, showRet = True):
beautifier = Beautifier()
for c in cmd:
'''time.sleep(0.1)'''
beautifier.setInputCmd(c)
or
sed -i -e s,beautifier\.setInputCmd\(c\),'time.sleep\(0\.1\)\n\t\t\tbeautifier.setInputCmd\(c\)', /usr/bin/fail2ban-client

Freeswitch install


Upgrade Move Source
mv /usr/src/freeswitch freeswitch-version
Git Release
cd /usr/src
git clone -b v1.4 https://freeswitch.org/stash/scm/fs/freeswitch.git
cd freeswitch
./bootstrap.sh
or
Git Head
cd /usr/src
git clone https://freeswitch.org/stash/scm/fs/freeswitch.git
cd freeswitch
./bootstrap.sh
or
files.freeswitch.org
cd /usr/src
wget http://files.freeswitch.org/freeswitch-1.4.26.zip
unzip freeswitch-1.4.26.zip
cd freeswitch-1.4.26

1.4.x is considered EOL use the steps below for 1.6.x

cd /usr/src
wget http://files.freeswitch.org/freeswitch-1.6.6.zip
unzip freeswitch-1.6.6.zip
cd freeswitch-1.6.6
Ubuntu Dependencies
apt-get install autoconf automake devscripts gawk g++ git-core libjpeg-dev libncurses5-dev libtool make python-dev gawk pkg-config libtiff-dev libperl-dev libgdbm-dev libdb-dev gettext libssl-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libedit-dev libldns-dev libpq-dev memcached libmemcached-dev
Debian Dependencies
apt-get install autoconf automake devscripts gawk g++ git-core libjpeg-dev libncurses5-dev libtool libtool-bin make python-dev gawk pkg-config libtiff5-dev libperl-dev libgdbm-dev libdb-dev gettext libssl-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libedit-dev libldns-dev libpq-dev memcached libmemcached-dev
CentOS
yum install git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel libmemcached-devel
Configure services to auto start
chkconfig --add memcached && chkconfig --levels 33 memcached on
chkconfig --add freeswitch && chkconfig --levels 35 freeswitch on
modules.conf
uncomment the FreeSWITCH modules that are needed.
mod_avmd
mod_callcenter
mod_memcache
mod_cidlookup
mod_curl
Used for MP3 support
mod_shout
Postgres driver
./configure --enable-core-pgsql-support
Run Make
make
Remove FreeSWITCH files
This step is only needed for a FreeSWITCH upgrade.
Once it has been confirmed that the compile was successful then remove files from previous version of FreeSWITCH
rm -rf /usr/local/freeswitch/{lib,mod,bin}/*
Install
make install
File Permissions
Set the file permissions instructions may vary based on the OS and install directory.
Debian and Ubuntu
chown -R www-data:www-data /usr/local/freeswitch
CentOS or Other Unix operating systems
(need make sure that the web server has access to IVR recordings, Fax, and Voicemail)
adduser --disabled-password  --quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH Voice Platform" --ingroup daemon freeswitch
chown -R freeswitch:daemon /usr/local/freeswitch/
chmod -R o-rwx /usr/local/freeswitch/
Install Sound Files
Run this on new installs.
cd /usr/src/freeswitch
make sounds-install moh-install
make hd-sounds-install hd-moh-install
make cd-sounds-install cd-moh-install

Startup Script

Run on new install only. Create the file ‘/etc/init.d/freeswitch’ with the following code:
#!/bin/bash
### BEGIN INIT INFO
# Provides:          freeswitch
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Description:       Freeswitch debian init script.
# Author:            Matthew Williams
#
### END INIT INFO
# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
DESC="Freeswitch"
NAME=freeswitch
DAEMON=/usr/local/freeswitch/bin/$NAME
DAEMON_ARGS="-nc -nonat -reincarnate"
PIDFILE=/usr/local/freeswitch/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

FS_USER=www-data #freeswitch
FS_GROUP=www-data #daemon

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that sets ulimit values for the daemon
#
do_setlimits() {
       ulimit -c unlimited
       ulimit -d unlimited
       ulimit -f unlimited
       ulimit -i unlimited
       ulimit -n 999999
       ulimit -q unlimited
       ulimit -u unlimited
       ulimit -v unlimited
       ulimit -x unlimited
       ulimit -s 240
       ulimit -l unlimited
       return 0
}

#
# Function that starts the daemon/service
#
do_start()
{
   # Set user to run as
       if [ $FS_USER ] ; then
     DAEMON_ARGS="`echo $DAEMON_ARGS` -u $FS_USER"
       fi
   # Set group to run as
       if [ $FS_GROUP ] ; then
         DAEMON_ARGS="`echo $DAEMON_ARGS` -g $FS_GROUP"
       fi

       # Return
       #   0 if daemon has been started
       #   1 if daemon was already running
       #   2 if daemon could not be started
       start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null -- \
               || return 1
       do_setlimits
       start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --background -- \
               $DAEMON_ARGS \
               || return 2
       # Add code here, if necessary, that waits for the process to be ready
       # to handle requests from services started subsequently which depend
       # on this one.  As a last resort, sleep for some time.
}

#
# Function that stops the daemon/service
#
do_stop()
{
       # Return
       #   0 if daemon has been stopped
       #   1 if daemon was already stopped
       #   2 if daemon could not be stopped
       #   other if a failure occurred
       start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
       RETVAL="$?"
       [ "$RETVAL" = 2 ] && return 2
       # Wait for children to finish too if this is a daemon that forks
       # and if the daemon is only ever run from this initscript.
       # If the above conditions are not satisfied then add some other code
       # that waits for the process to drop all resources that could be
       # needed by services started subsequently.  A last resort is to
       # sleep for some time.
       start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
       [ "$?" = 2 ] && return 2
       # Many daemons don't delete their pidfiles when they exit.
       rm -f $PIDFILE
       return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
       #
       # If the daemon can reload its configuration without
       # restarting (for example, when it is sent a SIGHUP),
       # then implement that here.
       #
       start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
       return 0
}

case "$1" in
 start)
       [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
       do_start
       case "$?" in
               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
       esac
       ;;
 stop)
       [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
       do_stop
       case "$?" in
               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
       esac
       ;;
 status)
      status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
      ;;
 #reload|force-reload)
       #
       # If do_reload() is not implemented then leave this commented out
       # and leave 'force-reload' as an alias for 'restart'.
       #
       #log_daemon_msg "Reloading $DESC" "$NAME"
       #do_reload
       #log_end_msg $?
       #;;
 restart|force-reload)
       #
       # If the "reload" option is implemented then remove the
       # 'force-reload' alias
       #
       log_daemon_msg "Restarting $DESC" "$NAME"
       do_stop
       case "$?" in
         0|1)
               do_start
               case "$?" in
                       0) log_end_msg 0 ;;
                       1) log_end_msg 1 ;; # Old process is still running
                       *) log_end_msg 1 ;; # Failed to start
               esac
               ;;
         *)
               # Failed to stop
               log_end_msg 1
               ;;
       esac
       ;;
 *)
       #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
       echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
       exit 3
       ;;
esac

exit 0

Make the script executable and make it auto start on system boot:

chmod +x /etc/init.d/freeswitch
update-rc.d freeswitch defaults

Testimonials

_images/logo.png

Businesses of all sizes use FusionPBX daily. We love to see folks happy saving money using FusionPBX. Here are some of the testimonials we received.


Just want to give a thankful shout out to everyone at FusionPBX that have helped in education, contribution and support. The FusionPBX team have developed a leading product. Its been a joy from day one joining this community and I look forward to the road ahead.

-Kissvoice


We have been using FusionPBX for many of our clients and just want to express our gratitude to Mark and the team for not only providing a great product, but being extremely helpful in bringing out new features and helping us maintain the service. Every new release amazes us with the work and development put into it.

-Kloudphone


SureVoIP have been using FusionPBX since 2010. SureVoIP sponsored the first versions of multi-tenant domains and hot desking. SureVoIP sponsors and contributes fixes and features when possible.

Because of FusionPBX’s highly configurable nature, responsive support team and sane design, SureVoIP have been able to win many large customers because proprietry systems are so rigid and slow to innovate. We have been proud to support and deploy FusionPBX for 7 years.

-SureVoIP

Winner of the Best Business ITSP (Medium Enterprise) 2016! http://www.surevoip.co.uk/2016-best-provider


I would like to tell everyone there that I have been trying to get an open source PBX to work for me for over three months now and since I am not a linux guy, I haven’t been able to get any of them working the way I wanted. FusionPBX installation script installed ALL required packages and libraries in one go and it was up and running in 10 mins. Once I followed the youtube videos It took me no time to setup and migrate my clients to FusionPBX. One of the best features I love in FusionPBX is the automatic dialplan expression as I have always struggled with remembering the expression syntax. The user interface and the way all the features are grouped is awesome.

Again, Thanks for the effort

-BareVOIP Limited


We would love to hear from you! Please reach out to us at http://fusionpbx.com/support.php if you would like to be featured on this page.

Password Reset

The steps below are outdated but useful for older installations. Click here for the new youtube video on password recovery.

Here some rough steps to change the password of the database. The password can only be changed and not recovered.

The database contains a table called v_users which contains the username, password and salt. The password is the md5 hash of the password and the salt.
Password Hash
Use the following commands to generate the password hash. Don’t forget to provide your own salt and password.
echo '<?php $salt = "random-salt-goes-here";$password = "put your password here"; echo md5($salt.$password)."\n"; ?>' > /tmp   /test.php
Run the php file from command line.
php /tmp/test.php
SQLite
Install sqlite3 which can be be used to modify the database fusionpbx.db. Then open the database with the following:
sqlite3 fusionpbx.db
PostgreSQL
Connect to the PostgreSQL database. Once you are running psql you can use:
  • \l to list the databases.
  • \c to connect to one of them.
  • After running the SQL Query then use q to quit.
su postgres
psql
\c fusionpbx
Change the Password

The hashed password and the salt can be updated using the command:

update v_users set password = 'replace-with-password-hash-from-php-script', salt = 'replace-with-your-random-salt' where       username = 'superadmin';

Feature Codes

Below are the “*” codes used with FusionPBX. You can also create more as needed. If you do be sure to pick ones that are not currently in use.

Basic
Feature Code Name Detail
*1 Call Transfer Transfer a call to another extension
*2 Record Active Call  
*4 Attended Call Transfer Attended call transfer to another extension. After extension number press #
*411 Directory *DIR to dial by name.
*3472 DISA *DISA followed by Administrative PIN to receive a dialtone and call out
*67<phone number> Call Privacy Activate call privacy
*69 Call Return Call back the last incoming number
*732 Record *REC followed by Administrative PIN to record a message
*8[ext] Extension Intercom Page a specific extension.
*870 Redial Redial a number
*9171 Talking Date Current server date
*9170 Talking Time Current server time
*9172 Talking Date & Time Current server data & time
*925 Wakeup Call Schedule a wakeup call
*78 Enable DND Enable Do Not Disturb
*79 Disable DND Disable Do Not Disturb
*9888 FreeSWITCH Conference Connects to Cluecon Weekly
*0[ext] Speed Dial Speed dial an extension
*21 Follow Me Set the Follow Me number
*72 Enable Call Forward Enables Call Forward
*73 Disable Call Forward Disables Call Forward
*74 Call Forward Toggle Call Forward enable/disable
Administrative PIN (Recordings pin) can be found here Administrative PIN page
Call Parking
Feature Code Name Detail
*5900 Valet Park Attended Transfer (park). The park extension will be played back to you
*5901-5999 Valet Un-Park Retrieve a Valet Parked call
Advanced
Feature Code Name Detail
*8[ext] Extension Intercom Page a specific extension
*33 <ext> Eavesdrop Listen to the call. Press 1 remote, 2 local, 3 full conversation, 0 mute
** <ext> Intercept an extension Intercept a specific extension
Voicemail
Feature Code Name Detail
*97 Voicemail The system detects the extension, and will prompt for your password
*98 Check any Voicemail box The system will prompt for both your id (extension number) and password
*4000 Check any Voicemail box The system will prompt for both your id (extension number) and password
*99<extension> Send to Voicemail Send a call directly to voicemail
Miscellaneous
Feature Code Name Detail
*9192 Info Sends information to the console
*9193 Video Record Record Video
*9194 Video Playback Playback Video
*9195 Delay Echo Audio is played back after a slight delay
*9196 Echo Test Echo Test
*9197 Milliwatt Tone Tone Playback
*9664 Test MoH Test Music on Hold

*You can also add extra feature codes

Toll Allow

Toll Allow is a variable that can be set per extension. It allows you to limit who can make what type of calls. Note that although the variable is provided in the extension configuration, the default dialplan DOES NOT make use of it. Therefore if you want to use it you need to add statements to the dialplan to enable it.

An example for the contents of the toll_allow variable would be:

You can then add information to your dialplan to process this variable. In the example XML below, if the valid allow value isn’t present then an extension shouldn’t be able to dial out. However extension -> extension should still work.

The following code are example XML for standard outbound routes (Dialplan->OutboundRoutes). Effectively you are applying an additional condition to EACH outbound route that you want to limit. So in the FusionPBX GUI select an outbound route and add

condition, type "${toll_allow}", data "local".
Order is important, this should be the FIRST condition of your outbound route.

You’ll need to do that for all of your outbound routes, tag them local, domestic, or international depending on what they are. On some installations this example file will be present in /usr/local/freeswitch/conf/dialplan/default/01_example.com.xml:

PERMIT TOLL CALLS

This example assumes all calls are bad (except internal) unless they are flagged as good by the value of the toll_allow variable.

<include>
<extension name="local.example.com">
<condition field="${toll_allow}" expression="local"/>
<condition field="destination_number" expression="^(\d{7})$">
  <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
  <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
  <action application="bridge" data="sofia/gateway/${default_gateway}/1${default_areacode}$1"/>
</condition>
</extension>

<extension name="domestic.example.com">
<condition field="${toll_allow}" expression="domestic"/>
<condition field="destination_number" expression="^(\d{11})$">
  <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
  <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
  <action application="bridge" data="sofia/gateway/${default_gateway}/$1"/>
</condition>
</extension>

<extension name="international.example.com">
<condition field="${toll_allow}" expression="international"/>
<condition field="destination_number" expression="^(011\d+)$">
  <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
  <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
  <action application="bridge" data="sofia/gateway/${default_gateway}/$1"/>
</condition>
</extension>
</include>

PREVENT TOLL CALLS

This example takes the opposite approach and is how to PREVENT toll calls. The below example takes the opposite approach. It assumes that all calls are good unless they are flagged as bad.

Put this in your advanced dialplan. In the toll allow of whatever extension you wanted to restrict put the value ‘local’. This example restricts from calling 10 or 11 digit numbers.

<extension name="localcalls" >
<condition field="${toll_allow}" expression="local"/>
<condition field="destination_number" expression="(^\d{10}$|^\d{11}$)">
<action application="hangup"/>
</condition>
</extension>

TFTP

Several models of phone out there that still only use TFTP for provisioning. Even though they have reached end of life, some of the popular ones are the Cisco 7960 and 7940.

Install TFTPD

apt-get install tftpd
service xinetd

Change the configuration

edit the /etc/xinetd.d/tftp

Enable TFTP in FusionPBX Gui

Goto Advanced > Default Settings > Provision

Set Enabled to True and define the path to where the TFTP files will be.

_images/fusionpbx_tftp.jpg

Test TFTP

tftp x.x.x.x
get 000000000000.cnf

See the file getting requested for tftp

tail -f /var/log/syslog | grep tftp

Network Address Translation

NAT is Network Address Translation. When your FusionPBX and/or FreeSWITCH are inside NAT then then you may experience one way audio or no audio in either direction the following information can help you get audio working in both directions.

Default config

The external_rtp_ip and external_sip_ip are set to $${local_ip_v4} in Advanced -> Variables by default or Advanced > Sip Profile settings. The local_ip_v4 variable is auto detected by FreeSWITCH. The variable can be also be overidden as a preset variable before it is used if you want to control the IP address that it represents.

  • This works good when the server has a public IP address.
  • It also works well when all phones are inside the same network and nothing needs to traverse the NAT. For example if you are using a SIP to TDM gateway and all your phones are in the same network.
SIP ALG

A SIP Application Layer Gateway (ALG) is a tool designed to help SIP traverse NAT. While the SIP ALG is good in theory it often causes more problems than it solves. Because of this it’s usually best to disable the SIP ALG on your firewall. An alternative way to disable it is to move SIP to a non standard port.

Static IP

FusionPBX is behind NAT and you have a static public IP address and you have phones on the same network and/or outside the network.

  • Set external_rtp_ip to autonat:xxx.xxx.xxx.xxx
  • Set external_sip_ip to autonat:xxx.xxx.xxx.xxx
  • If you don’t register a gateway to the carrier you may need to port forward SIP and RTP.
UPnP or PMP

FusionPBX is behind NAT and you don’t have a static ip address. You do have a firewall that is capable of UPnP or PMP.

  • Enable UPnP or PMP in your firewall
  • In Debian OS /etc/default/freeswitch remove -nonat
  • Make systemd aware of the changes. systemctl daemon-reload
  • Set external_rtp_ip to auto-nat
  • Set external_sip_ip to auto-nat
  • Restart FreeSWITCH. service freeswitch restart

Contributing

There are many ways to help the FusionPBX project.

What We Need:

  1. Developers
  2. Technical Writers
  3. Translators
  4. Quality Assurance Testers
  5. Documentors

注解

If you are planning to contribute to any of our github repos we require that you sign the FusionPBX Contributor License Agreement. This mainly protects FusionPBX and our users read: you from code that could be inserted that might pose a legal problem. It does this by verifying that the code you are contributing is yours to give and the you give it freely and irrevocably to the project.

How to Get Started:

  1. Watch the “FusionPBX Pull Requests with Github” Youtube Video https://youtu.be/SPUe7S4Z6ms
  2. If you have a good handle on PHP, Lua or SQL Development Might be the thing for you head over to the Development Manual
  3. Are you a FusionPBX power user and do you possible love to write? Check out the Documentation Guide or the Testing Guide
  4. Would you like to see FreePBX in your native language and have the time to commit to staying on top of translations for releases? Check out the translation section to learn how to use our translation server.

注解

Contributing Code or Documentation requires knowledge of Git, Github and how to create pull requests on Github. This is not as bad as it sounds and if you are willing to learn we will help you through it.


Contributing Code

Note to External Contributors

Hello, External Person!

We at FusionPBX are eager to work with you.

In particular, in order for us to accept any patches from you, you will have to electronically sign the contributor license agreement [Signing the CLA]/en/latest/contributing/signing_the_cla.html

Thanks, FusionPBX!

Signing the CLA

https://github.com/fusionpbx/open-source

Open Source at FusionPBX

This repository serves as the umbrella project to represent the various open source efforts of Mark J. Crane(https://fusionpbx.com). Come here to get an overview of the various projects, to learn how to contribute to them, and to sign up as a contributor.

Table Of Contents
Note to External Contributors

Hello, External Person!

We at FusionPBX are eager to work with you.

In particular, in order for us to accept any patches from you, you will have to electronically sign a statement that indicates two things:

  • You are willingly licensing your contributions under the terms of the open source license of the project that you’re contributing to.
  • You are legally able to license your contributions as stated.

The reason we do this is to ensure, to the extent possible, that we don’t “taint” the projects we manage with contributions that turn out to be improper. This protects everyone who wants to use the projects, including you! If you want a longer explanation, then you can check out the [CLA Rationale page](https://github.com/Fusionpbx/opensource/blob/master/cla-rationale.md).

Once you sign the Contributor License Agreement (the “CLA”), we will then be able to merge your contributions with a clear conscience and with only the friction that results from the usual technical back-and-forth of a vibrant open source project.

To get started with this process, visit the [Sign the CLA](https://github.com/Fusionpbx/opensource/blob/master/sign-cla.md) page.

Thanks, FusionPBX!

List of Projects

Contributing Documentation

Note to External Contributors

Hello, External Person!

We at FusionPBX are eager to work with you.

In particular, in order for us to accept any patches from you, you will have to electronically sign the contributor license agreement [Signing the CLA]/en/latest/contributing/signing_the_cla.html

Thanks, FusionPBX!

Contributing Translations

Note to External Contributors

Hello, External Person!

We at FusionPBX are eager to work with you.

In particular, in order for us to accept any patches from you, you will have to electronically sign the contributor license agreement [Signing the CLA]/en/latest/contributing/signing_the_cla.html

Thanks, FusionPBX!

Quality Assurance Testing

Note to External Contributors

Hello, External Person!

We at FusionPBX are eager to work with you.

In particular, in order for us to accept any patches from you, you will have to electronically sign the contributor license agreement [Signing the CLA]/en/latest/contributing/signing_the_cla.html

Thanks, FusionPBX!

Rebasing a branch with GitHub

Welcome to the rebasing a branch with GitHub guide.

1. Open the GitHub client application and make sure you are on the branch you want to rebase

_images/github_rebase_1.png

Select the setting icon and choose Open on Git Shell

_images/github_rebase_2.png

You will be presented with a new shell

_images/github_rebase_new_shell.png

2. Next execute the following two commands and notepad will appear

git fetch --all
git rebase --ignore-date --interactive fusionpbx/master

change the first commit to reword and the following commit(s) to fixup (similar to screenshot below)

_images/github_rebase_3.png

Close and save the text, next it will pop up another notepad for the commit message. Enter the commit title on the first line, leave a line blank and enter the commit message (similar to screenshot below)

_images/github_rebase_4.png

Close and save the text again.

3. Switch back to the github client and switch between history/changes to make it update and check it has done what you want.

_images/github_rebase_5.png

4. If the changes are correct switch back to the git shell and execute this to push the changes

git push --force-with-lease
exit

All done!

Coding Standards

  • FusionPBX Best practice coding practices

    Command (example):

# contributing/directory_structure

Documentation Guide

This page shows an nice overview of the reStructuredText syntax. This is not a comprehensive list of everything you can do, but should be enough to get you up and running to contribute some really nice documentation. It is based on resources found at Sphinx .

To get your own local documentation repository running, simply

Getting Started

Getting Git Right

Learn Git in 15 Minutes Git Tutorial that will help you get started if you prefer. There is also awesome Git Tutorials on the Atlassian Git site. Here is the link on installing Git if you don’t have it yet Git Install

Setting up the Docs Locally

One of the great things about Git and documentation is that all people who contribute are encouraged to setup their own local copy of the docs for off-line editing. This by default will ensure that many backups of the documents exist and there is never any concern about losing them.

Assuming you have Python already, install Sphinx locally:

$ pip install sphinx sphinx-autobuild

Clone the FusionPBX Github documentation repository:

$ cd /path/to/where_you_want_the_docs
$ git clone https://github.com/fusionpbx/fusionpbx-docs.git
$ cd fusionpbx-docs

Edit files or add new ones then build your changes:

$ make html

Open index.html with your web browser and check your changes:

fusionpbx-docs/build/html/index.html

Edit your files and rebuild until you like what you see, then commit your changes and push to the public repository. Assuming the file you changed is called myfile.rst:

$ git add myfile.rst
$ git commit -m 'your commit message'
$ git push -u origin master

Text Formatting

Inline markup and special characters (e.g., bold, italic, verbatim)

There are a few special characters used to format text. The special character * is used to defined bold and italic text as shown in the table below. The backquote character ` is another special character used to create links to internal or external web pages as you will see in section Internal and External Links.

usage syntax HTML rendering
italic *italic* italic
bold **bold** bold
link `python <www.python.org>`__ python
verbatim ``*`` *

The double backquote is used to enter in verbatim mode, which can be used as the escaping character. There are some restrictions about the * and `` syntax. They

  • cannot not be nested,
  • content may not start or end with whitespace: * text* is wrong,
  • it must be separated from surrounding text by non-word characters like a space.

The use of backslash is a work around to second previous restrictions about whitespaces in the following case:

  • this is a *longish* paragraph is correct and gives longish.
  • this is a long*ish* paragraph is not interpreted as expected. You should use this is a long\ *ish* paragraph to obtain longish paragraph

In Python docstrings it will be necessary to escape any backslash characters so that they actually reach reStructuredText. The simplest way to do this is to use raw strings by adding the letter r in front of the docstring.

Python string Typical result
r"""\*escape* \`with` "\\"""" *escape* `with` "\"
"""\\*escape* \\`with` "\\\\"""" *escape* `with` "\"
"""\*escape* \`with` "\\"""" escape with ""
Headings

In order to write a title, you can either underline it or under and overline it. The following examples are correct titles.

*****
Title
*****

subtitle
########

subsubtitle
**********************
and so on

Two rules:

  • If under and overline are used, their length must be identical
  • The length of the underline must be at least as long as the title itself

Normally, there are no heading levels assigned to certain characters as the structure is determined from the succession of headings. However, it is better to stick to the same convention throughout a project. For instance:

  • # with overline, for parts
  • * with overline, for chapters
  • =, for sections
  • -, for subsections
  • ^, for subsubsections
  • , for paragraphs
List and bullets

The following code:

* This is a bulleted list.
* It has two items, the second
  item uses two lines. (note the indentation)

1. This is a numbered list.
2. It has two items too.

#. This is a numbered list.
#. It has two items too.

gives:

  • This is a bulleted list.
  • It has two items, the second item uses two lines. (note the indentation)
  1. This is a numbered list.
  2. It has two items too.
  3. This is a numbered list.
  4. It has two items too.

注解

if two lists are separated by a blanck line only, then the two lists are not differentiated as you can see above.

What are directives

Sphinx and the RST syntax provides directives to include formatted text. As an example, let us consider the code-block syntax. It allows to insert code (here HTML) within your document:

.. code-block:: html
    :linenos:

    <h1>code block example</h1>

Its rendering is:

1
 <h1>code block example</h1>

Here, code-block is the name of the directive. html is an argument telling that the code is in HTML format, lineos is an option telling to insert line number and finally after a blank line is the text to include.

Note that options are tabulated.

Code and Literal blocks

How to include simple code

This easiest way to insert literal code blocks is to end a paragraph with the special marker made of a double coulumn ::. Then, the literal block must be indented:

This is a simple example::

    import math
    print 'import done'

or:

This is a simple example:
::

    import math
    print 'import done'

gives:

This is a simple example:

import math
print 'import done'
code-block directive

By default the syntax of the language is Python, but you can specify the language using the code-block directive as follows:

.. code-block:: html
   :linenos:

   <h1>code block example</h1>

produces

1
<h1>code block example</h1>
Include code with the literalinclude directive

Then, it is also possible to include the contents of a file as follows:

.. literalinclude:: filename
    :linenos:
    :language: python
    :lines: 1, 3-5
    :start-after: 3
    :end-before: 5

Tables

There are several ways to write tables. Use standard reStructuredText tables as explained here. They work fine in HTML output, however, there are some gotchas when using tables for LaTeX output.

The rendering of the table depends on the CSS/HTML style, not on sphinx itself.

Simple tables

Simple tables can be written as follows:

+---------+---------+-----------+
| 1       |  2      |  3        |
+---------+---------+-----------+

which gives:

1 2 3

Size of the cells can be adjusted as follows:

+---------------------+---------+---+
|1                    |        2| 3 |
+---------------------+---------+---+

renders as follows:

1 2 3

This syntax is quite limited, especially for multi cells/columns.

Multicells tables, first method

A first method is the following syntax:

+------------+------------+-----------+
| Header 1   | Header 2   | Header 3  |
+============+============+===========+
| body row 1 | column 2   | column 3  |
+------------+------------+-----------+
| body row 2 | Cells may span columns.|
+------------+------------+-----------+
| body row 3 | Cells may  | - Cells   |
+------------+ span rows. | - contain |
| body row 4 |            | - blocks. |
+------------+------------+-----------+

gives:

Header 1 Header 2 Header 3
body row 1 column 2 column 3
body row 2 Cells may span columns.
body row 3 Cells may span rows.
  • Cells
  • contain
  • blocks.
body row 4
Multicells table, second method

The previous syntax can be simplified:

=====  =====  ======
   Inputs     Output
------------  ------
  A      B    A or B
=====  =====  ======
False  False  False
True   False  True
=====  =====  ======

gives:

Inputs Output
A B A or B
False False False
True False True

注解

table and latex documents are not yet compatible in sphinx, and you should therefore precede them with the a special directive (.. htmlonly::)

The tabularcolumns directive

The previous examples work fine in HTML output, however there are some gotchas when using tables in LaTeX: the column width is hard to determine correctly automatically. For this reason, the following directive exists:

.. tabularcolumns:: column spec

This directive gives a “column spec” for the next table occurring in the source file. It can have values like:

|l|l|l|

which means three left-adjusted (LaTeX syntax). By default, Sphinx uses a table layout with L for every column. This code:

.. tabularcolumns:: |l|c|p{5cm}|

+--------------+---+-----------+
|  simple text | 2 | 3         |
+--------------+---+-----------+

gives

title    
simple text 2 3
The csv-table directive

Finally, a convenient way to create table is the usage of CSV-like syntax:

.. csv-table:: a title
   :header: "name", "firstname", "age"
   :widths: 20, 20, 10

   "Smith", "John", 40
   "Smith", "John, Junior", 20

that is rendered as follows:

a title
name firstname age
Smith John 40
Smith John, Junior 20

The toctree directive

Sooner or later you will want to structure your project documentation by having several RST files. The toctree directive allows you to insert other files within a RST file. The reason to use this directive is that RST does not have facilities to interconnect several documents, or split documents into multiple output files. The toctree directive looks like

.. toctree::
    :maxdepth: 2
    :numbered:
    :titlesonly:
    :glob:
    :hidden:

    intro.rst
    chapter1.rst
    chapter2.rst

It includes 3 RST files and shows a TOC that includes the title found in the RST documents.

Here are a few notes about the different options

  • maxdepth is used to indicates the depth of the tree.
  • numbered adds relevant section numbers.
  • titlesonly adds only the main title of each document
  • glob can be used to indicate that * and ? characters are used to indicate patterns.
  • hidden hides the toctree. It can be used to include files that do not need to be shown (e.g. a bibliography).

The glob option works as follows:

.. toctree::
    :glob:

    intro*
    recipe/*
    *

Note also that the title that appear in the toctree are the file’s title. You may want to change this behaviour by changing the toctree as follows:

.. toctree::
    :glob:

    Chapter1 description <chapter1>

So that the title of this section is more meaningful.

Images and figures

Include Images

Use:

.. image:: _static/images/logo.png
    :width: 200px
    :align: center
    :height: 100px
    :alt: alternate text

to put an image

alternate text
Include a Figure
.. figure:: _static/images/logo.png
    :width: 200px
    :align: center
    :height: 100px
    :alt: alternate text
    :figclass: align-center

    figure are like images but with a caption

    and whatever else youwish to add

    .. code-block:: python

        import image

gives

alternate text

figure are like images but with a caption

and whatever else youwish to add

import image

The option figclass is a CSS class that can be tuned for the final HTML rendering.

Boxes

Colored boxes: note, seealso, todo and warnings

There are simple directives like seealso that creates nice colored boxes:

参见

This is a simple seealso note.

created using:

.. seealso:: This is a simple **seealso** note.

You have also the note directive:

注解

This is a note box.

with

.. note::  This is a **note** box.

and the warning directive:

警告

note the space between the directive and the text

generated with:

.. warning:: note the space between the directive and the text

There is another todo directive but requires an extension. See Useful extensions

Topic directive

A Topic directive allows to write a title and a text together within a box similarly to the note directive.

This code:

.. topic:: Your Topic Title

    Subsequent indented lines comprise
    the body of the topic, and are
    interpreted as body elements.

gives

Your Topic Title

Subsequent indented lines comprise the body of the topic, and are interpreted as body elements.

Others

Comments

Comments can be made by adding two dots at the beginning of a line as follows:

.. comments
Substitutions

Substitutions are defined as follows:

.. _Python: http://www.python.org/

and to refer to it, use the same syntax as for the internal links: just insert the alias in the text (e.g., Python_, which appears as Python ).

A second method is as follows:

.. |longtext| replace:: this is a very very long text to include

and then insert |longtext| wherever required.

glossary, centered, index, download and field list
Field list
Whatever:this is handy to create new field and the following text is indented
:Whatever: this is handy to create new field
glossary
.. glossary::
     apical
        at the top of the plant.

gives

apical
at the top of the plant.
index
.. index::
download
:download:`download samplet.py <_downloads/sample.py>`

gives download sample.py

hlist directive

hlist can be use to set a list on several columns.

.. hlist::
.. hlist::
    :columns: 3

    * first item
    * second item
    * 3d item
    * 4th item
    * 5th item
  • first item
  • second item
  • 3d item
  • 4th item
  • 5th item
Footnote

For footnotes, use [#name]_ to mark the footnote location, and add the footnote body at the bottom of the document after a “Footnotes” rubric heading, like so:

Some text that requires a footnote [#f1]_ .

.. rubric:: Footnotes

.. [#f1] Text of the first footnote.

You can also explicitly number the footnotes ([1]_) or use auto-numbered footnotes without names ([#]_). Here is an example [1].

Citations

Citation references, like [CIT2002] may be defined at the bottom of the page:

.. [CIT2002] A citation
          (as often used in journals).

and called as follows:

[CIT2002]_
More about aliases

Directives can be used within aliases:

.. |logo| image:: _static/images/logo.png
    :width: 20pt
    :height: 20pt

Using this image alias, you can insert it easily in the text |logo|, like this logo. This is especially useful when dealing with complicated code. For instance, in order to include 2 images within a table do as follows:

+---------+---------+-----------+
| |logo|  | |logo|  | |longtext||
+---------+---------+-----------+
logo logo this is a longish text to include within a table and which is longer than the width of the column.

注解

Not easy to get exactly what you want though.

Intersphinx

When you create a project, Sphinx generates a file containing an index to all the possible links (title, classes, functions, ...).

You can refer to those index only if Sphinx knowns where to find this index. THis is possible thanks to the intersphinx option in your configuration file.

For instance, Python provides such a file, by default Sphinx knows about it. The following code can be found at the end of a typical Sphinx configuration file. Complete it to your needds:

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None, }
file-wide metadata

when using the following syntax:

:fieldname: some contents

some special keywords are recognised. For instance, orphan, nocomments, tocdepth.

An example of rendering is the toctree of top of this page.

orphan

Sometimes, you have an rst file, that is not included in any rst files (when using include for instance). Yet, there are warnings. If you want to supprresse the warnings, include this code in the file:

:orphan:

There is also tocdepth and nocomments metadata. See Sphinx homepage.

metainformation
.. sectionauthor:: name <email>

Specifies the author of the current section.:

.. sectionauthor:: John Smith <js@python.org>

By default, this markup isn’t reflected in the output in any way, but you can set the configuration value show_authors to True to make them produce a paragraph in the output.

contents directives
.. contents::
.. contents:: a title for the contents
    :depth: 2
  • depth indicates the max section depth to be shown in the contents

Useful extensions

In the special file called conf.py, there is a variable called extensions. You can add extension in this variable. For instance:

extensions = [-
    'easydev.copybutton',
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'sphinx.ext.coverage',
    'sphinx.ext.graphviz',
    'sphinx.ext.doctest',
    'sphinx.ext.intersphinx',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.pngmath',
    'sphinx.ext.ifconfig',
    'matplotlib.sphinxext.only_directives',
    'matplotlib.sphinxext.plot_directive',
 ]
pngmath: Maths and Equations with LaTeX

The extension to be added is the pngmath from sphinx:

extensions.append('sphinx.ext.pngmath')

In order to include equations or simple Latex code in the text (e.g., \(\alpha \leq \beta\) ) use the following code:

:math:`\alpha > \beta`

警告

The math markup can be used within RST files (to be parsed by Sphinx) but within your python’s docstring, the slashes need to be escaped ! :math:`\alpha` should therefore be written :math:`\\alpha` or put an “r” before the docstring

Note also, that you can easily include more complex mathematical expressions using the math directive:

.. math::

    n_{\mathrm{offset}} = \sum_{k=0}^{N-1} s_k n_k

Here is another:

\[n_{\mathrm{offset}} = \sum_{k=0}^{N-1} s_k n_k\]

It seems that there is no limitations to LaTeX usage:

\[s_k^{\mathrm{column}} = \prod_{j=0}^{k-1} d_j , \quad s_k^{\mathrm{row}} = \prod_{j=k+1}^{N-1} d_j .\]
TODO extension

Similarly to the note directive, one can include todo boxes but it requires the sphinx.ext.todo extension to be added in the conf.py file by adding two lines of code:

extensions.append('sphinx.ext.todo')
todo_include_todos=True

待处理

a todo box

Footnotes

[1]this is a footnote aimed at illustrating the footnote capability.

Bibliography

[CIT2002]A citation (as often used in journals).