Asterisk PBX Management Application

by
Odoo          
v 10.0 v 12.0 Third Party 434
Download for 10.0 series Deploy on Odoo.sh
You bought this module and need support ? Click here !
Technical name asterisk_base
LicenseOPL-1
Also available in version v 12.0
Technical name asterisk_base
LicenseOPL-1
Also available in version v 12.0

Asterisk PBX Manager

Manage your Asterisk servers from Odoo!

VERSION 10 IS NOT CURRENTLY SUPPORTED. ONLY 12.0 FOR NOW!!!

Features:

  • Works with any Asterisk installation (FreePBX, etc) without its changes!
  • Basic PBX features: SIP peers, users, dialplans, incoming and outgoing routing, queues, call stats and call recordings, dashboards and more...
  • Advanced WEB based asterisk .conf editor with asterisk syntax highlight.
  • Full Asterisk WEB console inside Odoo!
  • Multi server support - manager all your Asterisk servers from one Odoo instance!
  • Loosely coupled architecture - your asterisk server (bare metal or virtual) become like stateless docker containers. Automatic new server registration and recovery.
  • Status monitoring and alarming.
  • More features to come!!!

Support

Bugs, feature requests

For bugs and feature requests please visit Gitlab issues or send email to odooist@gmail.com.

Tips & tricks

To talk about Asterisk & Odoo integration join our Telegram chat

Developers

If you are an Odoo and Asterisk developer and think about your contribution please visit Gitlab project and request a developer access.

Asterisk! Enjoy with Odoo!

Asterisk Base Application documentation

DOCUMENTATION IS UNDER CONSTRUCTION

Installation manual

Docker based development installation

In a module package asterisk_base there is a deploy folder where Docker compose style installation is available.

This is the prefered way of installing the complete PBX.

You get Odoo with Asterisk connected to it.

Current docker-compose.dev.yml starts in a development mode with Asterisk at 127.0.0.1.

For real environment you'd better run asterisk container with network_mode: host. See docker-compose.prod.yml for production deploy.

ln -s docker-compose.dev.yml docker-compose.yml
docker-compose up -d

During the installation procedure new postgresql database asterisk_base is created and asterisk_base addon is automatically installed. During the installation process Asterisk Agent cannot connect to Odoo (as it's not ready yet) and gives Odoo connect errors but you can safely ignore them as Agent will connect to Odoo when asterisk_base addon is completely setup.

Docker based production installation

ln -s docker-compose.prod.yml docker-compose.yml
docker-compose up -d

The difference of production deploy from development:

  • All communications are proxied by Nginx
  • PostgreSQL port 5432 is not mapped
  • Odoo ports 8069 & 8072 are not mapped so Odoo is available only from Nginx.
  • Asterisk network_mode=host
  • Nginx / location is password protected, default password is pbx / open (please change it in nginx/passwd)
  • Asterisk console port 8010 is not mapped is also available only from Nginx.
  • Remote Asterisk Agent connects though Nginx on port 44444 where only json-rpc is allowed.

Connecting existing server

In this case you have Odoo installation separated from your (existing) Asterisk server. You can install Odoo as you wish either from the above docker examples or anyhow. Asterisk base application must already be installed.

Now you need to install Agent script to your Asterisk server.

Docker based Agent installation

You can download the Agent image from the Hub:

agent:
  image: odooist/asterisk_base_agent:latest
  restart: unless-stopped
  volumes:
    - /etc/asterisk/:/etc/asterisk/
    - /var/spool/asterisk/monitor:/var/spool/asterisk/monitor/
  environment:
    - DEBUG=0
    - ODOO_REGISTRATION_TOKEN=change-me
    - ODOO_DB=asterisk_base
    - ODOO_LOGIN=agent_test
    - ODOO_PASSWORD=agent_pass
    - ODOO_HOST=odoo
    - ODOO_PORT=8072
    - ODOO_SCHEME=http
    - ODOO_RECONNECT_INTERVAL=1
    - HOSTNAME=localhost
    - DOWNLOAD_CONF_AT_START=1
    - MANAGER_HOST=localhost
    - MANAGER_PORT=5038
    - MANAGER_LOGIN=odoo
    - MANAGER_PASSWORD=odoo
    - AMI_EVENT_AGENT_CALLED=0
    - TZ=Europe/Amsterdam
    - ASTERISK_CONF_DIR=/etc/asterisk
    - ASTERISK_SOUNDS_DIR=/var/lib/asterisk/sounds/
    - ASTERISK_BINARY=/usr/sbin/asterisk
    - MONITOR_DIR=/var/spool/asterisk/monitor
    - DELETE_RECORDING_FAILED_UPLOAD=1
    - REC_UPLOAD_DELAY=5
    - CONSOLE_LISTEN_ADDRESS=0.0.0.0
    - CONSOLE_LISTEN_PORT=8010
    - ORIGINATE_CONTEXT=odoo-outgoing
    - ORIGINATE_TIMEOUT=60

Manual installation

From the Asterisk->Settings->Base Settings click Download Agent installation package.

Copy it to your asterisk server. Run:

tar xfz asterisk_base_agent.tar.gz
cd asterisk_base_agent
pip install -r requirements.txt

Review start.sh and correct environment variables if required. Start it:

./start.sh
2018-12-22 15:51:12,475 INFO Starting asterisk_base agent with UID s2482660048902
2018-12-22 15:51:12,478 INFO Connecting to Asterisk.
2018-12-22 15:51:12,479 INFO Registering to https://nginx:44444/asterisk_base/register_server with UID s2482660048902
2018-12-22 15:51:12,514 INFO protocol version: '4.0.3'
2018-12-22 15:51:12,518 INFO FullyBooted
2018-12-22 15:51:12,771 INFO Register status: Server created
2018-12-22 15:51:12,771 DEBUG Requesting all conf download
2018-12-22 15:51:12,773 DEBUG Starting Odoo bus poll for asterisk_agent/s2482660048902
2018-12-22 15:51:12,774 INFO Connecting to Odoo at https://nginx:44444
2018-12-22 15:51:12,775 DEBUG Odoo authenticate
....

Architecture description

Asterisk configuration from database is not used here (neither realtime nor static).

Instead, all Asterisk .conf files are stored in Odoo database and are delivered to Asterisk server with special Asterisk agent script running on the same server.

All PBX entities are implemented as Odoo models. When a model is changed (new record created, updated or deleted) it calls its build_conf() method to generate a special .conf file that is included from main .conf file.

The following .conf files are created:

  • extensions_odoo.conf - here are extension numbers defined in Odoo Extensions menu.
  • extensions_odoo_incoming.conf - Routes -> Incoming
  • extensions_odoo_outgoing.conf - Routes -> Outgoing
  • extensions_odoo_custom.conf - Dialplans menu records come here.
  • extensions_odoo_menu.conf - Odoo Menus come here.
  • extensions_odoo_users.conf - User's individual call logic that comes from Users menu is here.
  • sip_odoo_user.conf - SIP trunks of users with context set to odoo-outgoing.
  • sip_odoo_trunk.conf - SIP trunks with context set to odoo-incoming
  • voicemail_odoo.conf - if user defined a voicemail logic he will have a mailbox here.
  • queues_odoo.conf - Odoo Queues come here.

Change Log

1.0.1

  • Initial release.

Troubleshooting

Loosing executable flag

When your get this issue the following error message is displayed when you try to run the container:

ERROR: for asterisk_base_asterisk_1_fce11df9f715  Cannot start service asterisk:
OCI runtime create failed: container_linux.go:348: starting container process
caused "exec: \"/docker-entrypoint.sh\": permission denied": unknown

The problem is than on module unpack operation executable flags where lost. To fix it do the following:

chmod +x deploy/asterisk/*.sh
chmod +x deploy/asterisk/services/*.py

Now rebuild the asterisk image.

OS X network_mode=host issue

Please don't use docker-compose.prod.yml on Mac as it has limitations with network in host mode.

So your only option is to use docker-compose.dev.yml and map SIP and RTP ports. But it does not work well actually so you will not have RTP on calls. For me it's ok because I just place calls for test purposes.

But for normal calling you should stick to Linux.

Additional information

How to install Docker on Ubuntu 16.04

Install Docker:

sudo apt-get update
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
apt-get update
sudo apt-get install -y docker-engine

Install Docker compose:

sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.