Freeswitch Voicemail On Alpine Linux: Difference between revisions

From Alpine Linux
(And commands to switch to postgresql instead of sqlite)
(Fix typo)
(3 intermediate revisions by the same user not shown)
Line 25: Line 25:
And modify ''/etc/freeswitch/autoload_configs/modules.conf.xml'' to load the mod_xml_curl module
And modify ''/etc/freeswitch/autoload_configs/modules.conf.xml'' to load the mod_xml_curl module
  <load module="mod_xml_curl"/>
  <load module="mod_xml_curl"/>
{{Note|These following items should not be needed, but are caused by bad default paths in the freeswitch package}}
{{Note|These following items are not needed for Alpine Linux 3.2 or later. They are needed on earlier versions due to bad default paths in the Freeswitch package.}}
Fix the voicemail storage directory in ''/etc/freeswitch/autoload_configs/voicemail.conf.xml'' to point to ''/var/lib/freeswitch/voicemail''
Fix the voicemail storage directory in ''/etc/freeswitch/autoload_configs/voicemail.conf.xml'' to point to ''/var/lib/freeswitch/voicemail''
  <param name="storage-dir" value="/var/lib/freeswitch/voicemail"/>
  <param name="storage-dir" value="/var/lib/freeswitch/voicemail"/>
Line 35: Line 35:
  rc-update add freeswitch
  rc-update add freeswitch
  /etc/init.d/freeswitch start
  /etc/init.d/freeswitch start
You should now be able to dial into Freeswitch voicemail by registering a SIP user agent to freeswitch (user=1000-1019, password=12345 as defined above) and directing a SIP call to any of the other extensions between 1000 and 1019, or the extension 4000. For each voicemail account, the default password is the same as the extension. For more details on this, please refer to Freeswitch documentation. Please keep in mind that these extensions and voicemail are part of the sample config and are not managed by ACF. We will add ACF-managed voicemail accounts below.
You should now be able to dial into Freeswitch voicemail by registering a SIP user agent to one of the Freeswitch default local extensions (user=1000-1019, password=12345 as defined above) and directing a SIP call to any of the other extensions between 1000 and 1019, or the extension 4000. For each voicemail account, the default password is the same as the extension. For more details on this, please refer to Freeswitch documentation. Please keep in mind that these extensions and voicemail are part of the sample config and are not managed by ACF. We will add ACF-managed voicemail accounts below.


== 5. Configure acf-freeswitch-vmail ==
== 5. Configure acf-freeswitch-vmail ==
Add the voicemail authenticator to the ACF configuration. This will allow voicemail users to log into ACF to check their voicemail.
Add the voicemail authenticator to the ACF configuration. This will allow voicemail users to log into ACF to check their voicemail.
  echo "authenticator = authenticator-freeswitch-vmail.lua,authenticator-plaintext" >> /etc/acf/acf.conf
  echo "authenticator = authenticator-freeswitch-vmail,authenticator-plaintext" >> /etc/acf/acf.conf
Change the ACF voicemail domain to match the domain from the sample config. You should use the IP address of your voicemail server, as this is what the sample config uses.
Change the ACF voicemail domain to match the domain from the sample config. You should use the IP address of your voicemail server, as this is what the sample config uses.
  sed -i /^domain=/d /etc/freeswitchvmail.conf
  sed -i /^domain=/d /etc/freeswitchvmail.conf
Line 47: Line 47:
You can now browse to https://IPADDRESS to access the web interface. To log in for administration, use the root user and the system root password (this is the default configuration set up by setup-acf).
You can now browse to https://IPADDRESS to access the web interface. To log in for administration, use the root user and the system root password (this is the default configuration set up by setup-acf).
== Users ==
== Users ==
The Voicemail | Users tab will display all of the voicemail users that are managed through the ACF web interface. At the start, this will be empty. When you create Users in the ACF, it will modify the freeswitch dialplan and directory (using xml_curl) to allow these users to receive and retrieve voicemail. It will also allow these users log into the ACF interface to check their voicemail and modify voicemail settings. The password defined here will control both ACF and IVR access.
The Voicemail | Users tab will display all of the voicemail users that are managed through the ACF web interface. At the start, this will be empty. When you create Users in the ACF, it will modify the Freeswitch dialplan and directory (using xml_curl) to allow these users to receive and retrieve voicemail. It will also allow these users log into the ACF interface to check their voicemail and modify voicemail settings. The password defined here will control both ACF and IVR access.
== Voicemail ==
== Voicemail ==
The Voicemail | Voicemail tab will allow you to view, listen to, download, forward, and delete voicemail messages.
The Voicemail | Voicemail tab will allow you to view, listen to, download, forward, and delete voicemail messages.
Line 56: Line 56:


= Demonstration =
= Demonstration =
We are now ready to create voicemail accounts with ACF. The freeswitch sample config creates a fairly full dialplan and we do not want to stomp on any of its features, so we will demonstrate accounts in the 2100 - 2199 range, which is unused.
We are now ready to create voicemail accounts with ACF. The Freeswitch sample config creates a fairly full dialplan and we do not want to stomp on any of its features, so we will demonstrate accounts in the 2100 - 2199 range, which is unused. Once again, to dial into Freeswitch you can use one of the Freeswitch default local extensions as explained above.
# Dial extension 2100 to verify what happens when an unsupported extension is called
# Dial extension 2100 to verify what happens when an unsupported extension is called
# Logged into ACF as root, create a voicemail user with extension 2100 and some password
# Logged into ACF as root, create a voicemail user with extension 2100 and some password
Line 64: Line 64:


= Other Features =
= Other Features =
== Switching From wav to mp3 Recording (Recommended) ==
{{Note|The mp3 format is supported in acf-freeswitch-vmail-0.6.2 and later, available on Alpine Linux 3.2 or later.}}
By default, Freeswitch will store voicemail recordings in wav format. Freeswitch also has the option of storing the recordings in mp3 format if mod_shout is installed. As mp3 format requires less storage/bandwidth and enjoys better support by web browsers, I would recommend making this change:
=== 1. Add the mod_shout module ===
Modify ''/etc/freeswitch/autoload_configs/modules.conf.xml'' to load the mod_shout module
<load module="mod_shout"/>
=== 2. Change Record Format to mp3 ===
sed -i s/'name="file-extension" value="wav"'/'name="file-extension" value="mp3"'/ /etc/freeswitch/autoload_configs/voicemail.conf.xml
=== 3. Restart Freeswitch ===
/etc/init.d/freeswitch restart
== Using PostgreSQL ==
== Using PostgreSQL ==
Freeswitch-1.2.5 and acf-freeswitch-vmail-0.5.0 fully support Postgresql as the voicemail database. These versions are available in Alpine Linux 3.2 and later. To configure it:
Freeswitch-1.2.5 and acf-freeswitch-vmail-0.5.0 fully support Postgresql as the voicemail database. These versions are available in Alpine Linux 3.2 and later. To configure it:
Line 84: Line 94:
=== 6. Restart Freeswitch ===
=== 6. Restart Freeswitch ===
  /etc/init.d/freeswitch start
  /etc/init.d/freeswitch start
[[Category:ACF]]

Revision as of 20:15, 8 September 2016

Overview

This page describes how to install a basic voicemail server based upon Freeswitch including a web interface based upon ACF. It is built and tested on Alpine Linux 2.7, 3.0, 3.1, and the future 3.2.

Setup Procedure

1. Configure the machine

Install and configure a basic Alpine Linux server with the ACF web interface.

setup-alpine
setup-acf

2. Install Freeswitch

apk add freeswitch freeswitch-sounds-en-us-callie-8000 freeswitch-flite acf-freeswitch acf-freeswitch-vmail

3. Configure Freeswitch

We will use the Freeswitch sample configuration for the purposes of this document. It is not recommended to use this config in production, but it will allow us to quickly get voicemail up and running. Rather than installing the package, we will use apk to fetch the files.

apk fetch --quiet --stdout freeswitch-sample-config | tar -C / -zvx

Modify the default password to avoid warnings and delays (obviously, you can choose something other than 12345 if you want)

sed -i s/"default_password=1234"/"default_password=12345"/ /etc/freeswitch/vars.xml

Use Freeswitch XML curl to call into ACF to determine voicemail accounts. To do so, edit /etc/freeswitch/autoload_configs/xml_curl.conf.xml and add the following bindings:

    <binding name="voicemaildialplan">
      <param name="gateway-url" value="https://127.0.0.1/cgi-bin/acf/freeswitch-vmail/vmail/processdialplanxml" bindings="dialplan"/>
    </binding>
    <binding name="voicemaildirectory">
      <param name="gateway-url" value="https://127.0.0.1/cgi-bin/acf/freeswitch-vmail/vmail/processdirectoryxml" bindings="directory"/>
    </binding>

And modify /etc/freeswitch/autoload_configs/modules.conf.xml to load the mod_xml_curl module

<load module="mod_xml_curl"/>
Note: These following items are not needed for Alpine Linux 3.2 or later. They are needed on earlier versions due to bad default paths in the Freeswitch package.

Fix the voicemail storage directory in /etc/freeswitch/autoload_configs/voicemail.conf.xml to point to /var/lib/freeswitch/voicemail

<param name="storage-dir" value="/var/lib/freeswitch/voicemail"/>

Set the sounds directory in /etc/freeswitch/vars.xml by adding the following line:

<X-PRE-PROCESS cmd="set" data="sounds_dir=/usr/share/freeswitch/sounds"/>

4. Start Freeswitch

Start Freeswitch and add it to the default runlevel.

rc-update add freeswitch
/etc/init.d/freeswitch start

You should now be able to dial into Freeswitch voicemail by registering a SIP user agent to one of the Freeswitch default local extensions (user=1000-1019, password=12345 as defined above) and directing a SIP call to any of the other extensions between 1000 and 1019, or the extension 4000. For each voicemail account, the default password is the same as the extension. For more details on this, please refer to Freeswitch documentation. Please keep in mind that these extensions and voicemail are part of the sample config and are not managed by ACF. We will add ACF-managed voicemail accounts below.

5. Configure acf-freeswitch-vmail

Add the voicemail authenticator to the ACF configuration. This will allow voicemail users to log into ACF to check their voicemail.

echo "authenticator = authenticator-freeswitch-vmail,authenticator-plaintext" >> /etc/acf/acf.conf

Change the ACF voicemail domain to match the domain from the sample config. You should use the IP address of your voicemail server, as this is what the sample config uses.

sed -i /^domain=/d /etc/freeswitchvmail.conf
echo "domain=IPADDRESS" >> /etc/freeswitchvmail.conf

ACF Web interface

You can now browse to https://IPADDRESS to access the web interface. To log in for administration, use the root user and the system root password (this is the default configuration set up by setup-acf).

Users

The Voicemail | Users tab will display all of the voicemail users that are managed through the ACF web interface. At the start, this will be empty. When you create Users in the ACF, it will modify the Freeswitch dialplan and directory (using xml_curl) to allow these users to receive and retrieve voicemail. It will also allow these users log into the ACF interface to check their voicemail and modify voicemail settings. The password defined here will control both ACF and IVR access.

Voicemail

The Voicemail | Voicemail tab will allow you to view, listen to, download, forward, and delete voicemail messages.

Config

The Voicemail | Config tab allows administrators to modify the acf-freeswitch-vmail configuration.

Settings

The Voicemail | Settings tab allows voicemail users to modify their settings.

Demonstration

We are now ready to create voicemail accounts with ACF. The Freeswitch sample config creates a fairly full dialplan and we do not want to stomp on any of its features, so we will demonstrate accounts in the 2100 - 2199 range, which is unused. Once again, to dial into Freeswitch you can use one of the Freeswitch default local extensions as explained above.

  1. Dial extension 2100 to verify what happens when an unsupported extension is called
  2. Logged into ACF as root, create a voicemail user with extension 2100 and some password
  3. Dial extension 2100 again to verify that you can now leave a voicemail for extension 2100
  4. Dial extension 4000 and log in as user 2100 with the password you defined above to listen to the message
  5. Log out of ACF as root and log in again as user 2100 with the password you defined above to view your message

Other Features

Switching From wav to mp3 Recording (Recommended)

Note: The mp3 format is supported in acf-freeswitch-vmail-0.6.2 and later, available on Alpine Linux 3.2 or later.

By default, Freeswitch will store voicemail recordings in wav format. Freeswitch also has the option of storing the recordings in mp3 format if mod_shout is installed. As mp3 format requires less storage/bandwidth and enjoys better support by web browsers, I would recommend making this change:

1. Add the mod_shout module

Modify /etc/freeswitch/autoload_configs/modules.conf.xml to load the mod_shout module

<load module="mod_shout"/>

2. Change Record Format to mp3

sed -i s/'name="file-extension" value="wav"'/'name="file-extension" value="mp3"'/ /etc/freeswitch/autoload_configs/voicemail.conf.xml

3. Restart Freeswitch

/etc/init.d/freeswitch restart

Using PostgreSQL

Freeswitch-1.2.5 and acf-freeswitch-vmail-0.5.0 fully support Postgresql as the voicemail database. These versions are available in Alpine Linux 3.2 and later. To configure it:

1. Install Postgresql

apk add postgresql acf-postgresql

2. Setup and Start Postgresql

rc-update add postgresql
/etc/init.d/postgresql setup
/etc/init.d/postgresql start

3. Create the Database

psql -U postgres -c "CREATE DATABASE voicemail"

4. Stop Freeswitch

/etc/init.d/freeswitch stop
Note: Freeswitch does not always stop properly. You might need to run 'ps ax' to find the process and 'kill' it. Running '/etc/init.d/freeswitch zap' might also be necessary.

5. Configure Freeswitch and acf-freeswitch-vmail

Edit /etc/freeswitch/autoload_configs/voicemail.conf.xml to set the odbc-dsn param to "pgsql://hostaddr=127.0.0.1 dbname=voicemail user=postgres password= options="

<param name="odbc-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=voicemail user=postgres password= options=" />

Edit /etc/freeswitchvmail.conf and set the dsn param to "pgsql://hostaddr=127.0.0.1 dbname=voicemail user=postgres password= options="

dsn=pgsql://hostaddr=127.0.0.1 dbname=voicemail user=postgres password= options=

6. Restart Freeswitch

/etc/init.d/freeswitch start