Freeswitch Voicemail On Alpine Linux

From Alpine Linux
Revision as of 19:48, 26 April 2015 by Ttrask (talk | contribs) (Fix command for /etc/freeswitchvmail.conf because it does not exist at first)

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 should not be needed, but are caused by 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 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.

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.lua,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.

  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