/Restcomm-Docker

Docker Image for RestComm at https://github.com/RestComm/RestComm-Core

Primary LanguageShellGNU Affero General Public License v3.0AGPL-3.0

Restcomm Docker image

Restcomm is a next generation Cloud Communications Platform to rapidly build voice, video, and messaging applications, using mainstream development skills. Created by the people at Telestax.

Learn more at http://www.restcomm.com

Using the Restcomm docker image you will be able to run Restcomm with the minimum effort and no pain.

Restcomm binds to the ip address of the host and following ports:

  • http: 8080
  • sip/udp: 5080
  • sip/tcp: 5080
  • sip/tls: 5081
  • sip/ws: 5082 (Used for WebRTC - SIP Over WebSockets)
  • sip/wss: 5083 (Used for WebRTC - Secure SIP Over WebSockets)
  • rtp/udp: 65000 - 65535

If you use -e USE_STANDARD_PORTS, Restcomm will binds to the ip address of the host and following ports:

  • http: 80
  • sip/udp: 5060
  • sip/tcp: 5060
  • sip/tls: 5061
  • sip/ws: 5062 (Used for WebRTC - SIP Over WebSockets)
  • sip/wss: 5063 (Used for WebRTC - Secure SIP Over WebSockets)
  • rtp/udp: 65000 - 65535

Please report any issues at https://github.com/mobicents/Restcomm-Docker/issues

Prerequisites

The image has been tested with Docker 1.7.

Supported Tags

  • latest: Using this tag you will get the latest Restcomm build. mobicents/restcomm:latest
  • 7.4.0: Using this tag you will get the Restcomm 7.4.0.GA release. mobicents/restcomm:7.4.0
  • 7.3.1: Using this tag you will get the Restcomm 7.3.1.GA release. mobicents/restcomm:7.3.1
  • 7.3.0: Using this tag you will get the Restcomm 7.3.0.GA release. mobicents/restcomm:7.3.0

Environment variables

The Restcomm docker image supports a set of environment variables to configure the application.

  • STATIC_ADDRESS Set the public ip address that Restcomm should use
  • USE_STANDARD_PORTS Use Default ports such as 80, 443, 5060, ...
  • OUTBOUND_PROXY Set the SIP Outbound proxy
  • OUTBOUND_PROXY_USERNAME Set the SIP Outbound proxy username
  • OUTBOUND_PROXY_PASSWORD Set the SIP Outbound proxy password
  • MEDIASERVER_LOWEST_PORT Set the Media Server lowest RTP port
  • MEDIASERVER_HIGHEST_PORT Set the Media Server highest RTP port
  • PROVISION_PROVIDER Set the Provision Provider, choose one of the following: VI (VoipInnovation), BW (Bandwidth), NX (Nexmo), VB (Voxbone)
  • DID_LOGIN Set the DID Provider username
  • DID_PASSWORD Set the DID Provider password
  • DID_ENDPOINT Set the Endpoint ID for VoipInnovation Provision Provider
  • DID_SITEID Set the Site Id for Bandwidth Provision Provider
  • DID_ACCOUNTID Set the Account Id for Bandwidth Provision Provider
  • INTERFAX_USER Set the Interfax username
  • INTERFAX_PASSWORD Set the Interfax password
  • ISPEECH_KEY Set the iSpeech speech recognition key
  • VOICERSS_KEY Set the VoiceRss Text-To-Speech key
  • ACAPELA_APPLICATION Set the Acapela Text-To-Speech application key
  • ACAPELA_LOGIN Set the Acapela Text-To-Speech username
  • ACAPELA_PASSWORD Set the Acapela Text-To-Speech password
  • SMPP_TYPE Set the SMPP Type ie the unique name for the SMPP Connection and sets the SMPP to be enabled for the SMS API and RVD Tag
  • S3_BUCKET_NAME Set the S3 Bucket Name so that Restcomm stores the Recording in Amazon Web Services S3 Service
  • S3_ACCESS_KEY Set the S3 Access Key so that Restcomm stores the Recording in Amazon Web Services S3 Service
  • S3_SECURITY_KEY Set the S3 Security Key so that Restcomm stores the Recording in Amazon Web Services S3 Service
  • SMTP_USER Set the SMTP User so that Restcomm configures the SMTP Service for the Email API and RVD Tag
  • SMTP_PASSWORD Set the SMTP Password so that Restcomm configures the SMTP Service for the Email API and RVD Tag
  • SMTP_HOST Set the SMTP Host so that Restcomm configures the SMTP Service for the Email API and RVD Tag
  • MYSQL_USER Set the MySQL User so that Restcomm configures RestComm to use a MySQL DB instead of In memory DB
  • MYSQL_PASSWORD Set the MySQL Password so that Restcomm configures RestComm to use a MySQL DB instead of In memory DB
  • MYSQL_HOST Set the MySQL Host so that Restcomm configures RestComm to use a MySQL DB instead of In memory DB
  • MYSQL_SCHEMA Set the MySQL Schema so that Restcomm configures RestComm to use a MySQL DB instead of In memory DB
  • SECURE Configure RestComm to be used in secure mode ie only on HTTPS not HTTP and SIP Over Secure WebSockets + TLS
  • TRUSTSTORE_FILE Set the file to use for Restcomm to configure the certificate for HTTPS and SIP TLS
  • TRUSTSTORE_PASSWORD Set the password to use for Restcomm to configure the certificate for HTTPS and SIP TLS
  • TRUSTSTORE_ALIAS Set the Alias to use for Restcomm to configure the certificate for HTTPS and SIP TLS
  • SSL_MODE Set the SSL Mode for Restcomm and RVD to query External Service over HTTPS. Values : allowall, strict
  • NFS_LOCATION Set the NFS Location for Restcomm Visual Designer to store the workspaces in a shared filesystem
  • LOG_LEVEL Set the Log Level for Restcomm and MMS
  • LOG_LOCATION Set the location were to store Restcomm logs
  • HOSTNAME Set the hostname for this machine for RestComm to recognize it and use it for relative URL requests

SMPP related configuration

  • GENERIC_SMPP_TYPE The SMPP type
  • GENERIC_SMPP_ID The SMPP id
  • GENERIC_SMPP_PASSWORD The SMPP password
  • GENERIC_SMPP_PEER_IP The SMPP peer IP Address
  • GENERIC_SMPP_PEER_PORT The SMPP peer port
  • GENERIC_SMPP_SOURCE_MAP The SMPP source map
  • GENERIC_SMPP_DEST_MAP The SMPP destination map

Using self signed certificate

In case you want to start Restcomm container using a self signed certificate you need to pass just the SECURE environment variable. For example:

docker run -e SECURE="true" -e SSL_MODE="allowall" -e USE_STANDARD_PORTS="true" -e VOICERSS_KEY="VOICERSS_KEY_HERE" --name=restcomm -d -p 80:80 -p 443:443 -p 9990:9990 -p 5060:5060 -p 5061:5061 -p 5062:5062 -p 5063:5063 -p 5060:5060/udp -p 65000-65535:65000-65535/udp mobicents/restcomm:latest

The generated truststore file will be located at /opt/Mobicents-Restcomm-JBoss-AS7/standalone/configuration/restcomm.truststore and the password changeit

Running the image

  • Using the default values docker run --name=restcomm -d -p 8080:8080 -p 5080:5080 -p 5082:5082 -p 5080:5080/udp -p 65000-65535:65000-65535/udp mobicents/restcomm:latest
  • Provide your VoiceRSS key for Text-To-Speech by setting environment variable VOICERSS_KEY docker run -e USE_STANDARD_PORTS="true" -e VOICERSS_KEY="YOUR_VOICESS_KEY_HERE" --name=restcomm -d -p 80:80 -p 443:443 -p 9990:9990 -p 5060:5060 -p 5061:5061 -p 5062:5062 -p 5063:5063 -p 5060:5060/udp -p 65000-65535:65000-65535/udp mobicents/restcomm:latest
  • Provide your VoiceRSS key for Text-To-Speech and Outbound proxy by setting environment variable VOICERSS_KEY and OUTBOUND_PROXY docker run -e USE_STANDARD_PORTS="true" -e VOICERSS_KEY="YOUR_VOICESS_KEY_HERE" -e OUTBOUND_PROXY="YOUR_OUTBOUND_PROXY_HERE" --name=restcomm -d -p 80:80 -p 443:443 -p 9990:9990 -p 5060:5060 -p 5061:5061 -p 5062:5062 -p 5063:5063 -p 5060:5060/udp -p 65000-65535:65000-65535/udp mobicents/restcomm:latest
  • To automatically restart the container in case of a failure or host restart, you have to use the --restart-always flag docker run -e USE_STANDARD_PORTS="true" -e VOICERSS_KEY="YOUR_VOICESS_KEY_HERE" --name=restcomm --restart=always -d -p 80:80 -p 443:443 -p 9990:9990 -p 5060:5060 -p 5061:5061 -p 5062:5062 -p 5063:5063 -p 5060:5060/udp -p 65000-65535:65000-65535/udp mobicents/restcomm:latest
  • To run on standard ports ie 80 for HTTP, 443 for HTTPs, 5060 for SIP, you have to use the USE_STANDARD_PORTS docker run -e USE_STANDARD_PORTS="true" -e VOICERSS_KEY="YOUR_VOICESS_KEY_HERE" --name=restcomm -d -p 80:80 -p 443:443 -p 9990:9990 -p 5060:5060 -p 5061:5061 -p 5062:5062 -p 5063:5063 -p 5060:5060/udp -p 65000-65535:65000-65535/udp mobicents/restcomm:latest

Important Notice for Restcomm networking

When using a sip client that is not running on the same machine as the Restcomm docker image, for example when calling from sip desk phone to Restcomm docker image, you won't be able to properly setup the call and receive any RTP traffic, because Restcomm docker image will be using the ip address of the container, that docker assigned to the container, thus all the SIP and SDP messages will be tagged with the container's ip address that can't be reached outside the local machine.

The fix for that is to provide the IP Address of the host machine using the STATIC_ADDRESS environment variable so Restcomm will properly configured:

docker run -e USE_STANDARD_PORTS="true" -e VOICERSS_KEY="YOUR_VOICESS_KEY_HERE" -e HOSTNAME="YOUR_HOST_IP_ADDRESS_OR_DNS_HOSTNAME-HERE" -e STATIC_ADDRESS="YOUR_HOST_IP_ADDRESS_HERE" -e OUTBOUND_PROXY="YOUR_OUTBOUND_PROXY_HERE" --name=restcomm -d -p 80:80 -p 443:443 -p 9990:9990 -p 5060:5060 -p 5061:5061 -p 5062:5062 -p 5063:5063 -p 5060:5060/udp -p 65000-65535:65000-65535/udp mobicents/restcomm:latest

Using the STATIC_ADDRESS and given that the sip client can reach the host's ip address, you will be able now to properly setup a call and receive RTP traffic.


Quick test

After you started the Restcomm container, you can quickly make a call to verify that everything works by using the Olympus WebRTC applicatin that is shipped with Restcomm.

  1. Point your browser to http://HOST_IP_ADDRESS/olympus
  2. Press "Sign in" (username alice or bob and password 1234)
  3. Your browser will ask for permission to share microphone and camera, press allow
  4. Go to "Contact", click on the "+1234" and press the "Audio Call" button (phone icon)
  5. You should hear the "Welcome to Restcomm, a Telestax Sponsored project" announcement

You can access the Admin UI by following the steps below:

  1. Point your browser to http://HOST_IP_ADDRESS
  2. Use administrator@company.com for username and RestComm as password
  3. Press "Sign in"
  4. You should be asked to change your password for the first time

To stop container: docker stop restcomm

To start container: docker start restcomm

To remove container: docker rm restcomm

Persist your work using shared filesystem

You can persist the logs, database, recordings, text-to-speech cache and RVD workspace using shared filesystem, so even if you stop and remove your container, your work won't be lost.

Download the restcomm_workspace that contains the default database, default RVD workspace and the required folders and unzip it to a folder in your filesystem.

Next run Restcomm image using the following volume arguments:

  • Restcomm logs -v $YOUR_FOLDER/restcomm_workspace/restcomm/log:/opt/Mobicents-Restcomm-JBoss-AS7/standalone/log
  • Restcomm recordings -v $YOUR_FOLDER/restcomm_workspace/restcomm/recordings:/opt/Mobicents-Restcomm-JBoss-AS7/standalone/deployments/restcomm.war/recordings
  • Restcomm tts cache -v $YOUR_FOLDER/restcomm_workspace/restcomm/cache:/opt/Mobicents-Restcomm-JBoss-AS7/standalone/deployments/restcomm.war/cache
  • Restcomm HSQL database -v $YOUR_FOLDER/restcomm_workspace/restcomm/data:/opt/Mobicents-Restcomm-JBoss-AS7/standalone/deployments/restcomm.war/WEB-INF/data/hsql
  • Media Server logs
    -v $YOUR_FOLDER/restcomm_workspace/mms/log:/opt/Mobicents-Restcomm-JBoss-AS7/mediaserver/log
  • Restcomm Visual Designer workspace -v $YOUR_FOLDER/restcomm_workspace/rvd/workspace:/opt/Mobicents-Restcomm-JBoss-AS7/standalone/deployments/restcomm-rvd.war/workspace

For example if you unzip the restcomm_workspace.zip to /opt/restcomm_workspace/ then the docker run command will be: docker run --name=restcomm --restart=always -d -e VOICERSS_KEY="YOUR_VOICERSS_KEY" -p 8080:8080 -p 5080:5080 -p 5080:5080/udp -p 65000-65535/udp -v /opt/restcomm_workspace/restcomm/log:/opt/Mobicents-Restcomm-JBoss-AS7/standalone/log -v /opt/restcomm_workspace/restcomm/recordings:/opt/Mobicents-Restcomm-JBoss-AS7/standalone/deployments/restcomm.war/recordings -v /opt/restcomm_workspace/restcomm/cache:/opt/Mobicents-Restcomm-JBoss-AS7/standalone/deployments/restcomm.war/cache -v /opt/restcomm_workspace/restcomm/data:/opt/Mobicents-Restcomm-JBoss-AS7/standalone/deployments/restcomm.war/WEB-INF/data/hsql -v /opt/restcomm_workspace/mms/log:/opt/Mobicents-Restcomm-JBoss-AS7/mediaserver/log -v /opt/restcomm_workspace/rvd/workspace:/opt/Mobicents-Restcomm-JBoss-AS7/standalone/deployments/restcomm-rvd.war/workspace mobicents/restcomm:latest

To get bash console (for debugging only)

You can start the container and get a bash console to manually setup Restcomm and test it using the following command:

docker run --name=restcomm --entrypoint=/bin/bash -it -p 8080:8080 -p 5080:5080 -p 5082:5082 -p 5080:5080/udp -p 65000-65535/udp mobicents/restcomm:latest

To execute a command at the container

docker exec rc [command]

For example

docker exec rc ps -ef | grep java

Running RestComm Docker image in OSX host

We 've had some issues running RestComm Docker image using the official Docker for OSX installation found at https://docs.docker.com/engine/installation/mac/ (more details on the issues at: RestComm#10). Here's an alternative that works until those issues are fixed:

  • Install Virtual Box
  • Install a Docker-capable linux distribution as a guest in the Virtual Box (in this example we installed Ubuntu Server 14.04)
  • Shut down guest
  • Setup networking for guest, use 'Bridged Adapter' setting. That will make the guest reachable in the local LAN (for example if host is 192.168.2.3, guest would most likely get 192.168.2.4) and you won't have to do any special port mapping
  • Start up the guest
  • Install latest docker inside the guest (https://docs.docker.com/engine/installation/ubuntulinux/)
  • Download the latest docker image for RestComm $ sudo docker pull mobicents/restcomm:latest
  • Start up the docker image using commands found above, in my case that I wanted a secure installation the command is: $ sudo docker run -e SECURE="true" -e SSL_MODE="allowall" -e USE_STANDARD_PORTS="true" -e VOICERSS_KEY="VOICERSS_KEY_HERE" --name=restcomm -d -p 80:80 -p 443:443 -p 9990:9990 -p 5060:5060 -p 5061:5061 -p 5062:5062 -p 5063:5063 -p 5060:5060/udp -p 65000-65535:65000-65535/udp mobicents/restcomm:latest
  • The RestComm installation is available from the host system at: https://<guest ip>/
  • You can use the Olympus WebRTC Web App at: https://<guest ip>/olympus