Asterisk Calls

by
Odoo 1
v 11.0 Third Party 28

350.00 €

You bought this module and need support ? Click here !
Technical name asterisk_calls
LicenseOPL-1
Read description for v 12.0 v 10.0
Technical name asterisk_calls
LicenseOPL-1
Read description for v 12.0 v 10.0

Asterisk Calls

Manage your Asterisk calls from Odoo!

Features:

  • Odoo open source, enterprise and odoo.sh are supported!
  • Works with any Asterisk distribution (only AMI connection used)!
  • Click to call from Contacts and User directories.
  • Call history analytics.
  • Active calls management: pickup, spy, hangup, mute.
  • Auto open partner's form on partner's call!
  • Web callback form - let your WEB site visitors request a call.
  • Quality of call status and monitoring.
  • Call recording, sharing and discussion.
  • Automatic arhiving.
  • Dashboards with top callers, company missed calls, daily traffic and more.
  • Asterisk support is available. See Support section below.

Manage

Call monitor

When you click Calls top menu you are immediately sent to Active Calls view.

Accroding to your permissions set by Calls Administrator you can pickup an active call, spy on it, whisper privately to your collegue, or even barge into active call and talk to both parties.

User directory

User directory - this is your company internal phone book with click to call feature.

Map your Asterisk phone extensions to Odoo users to allow dialing features.

Partner calls

You can see partner calls.

You can call your partners with one click.

WEB Callback

Website callback form

Let your site visitors request a call from You!

After submitting the form the call will be placed to the queue or directly connected to a responsible personnel.

Callback directives are configured on Asterisk side and you have unlimited flexibility here.

Analize

Call history

Search and filter calls:

  • Answered
  • Missed
  • Incoming
  • Outgoing
  • Call from Partners
  • More...
Group calls by:
  • Partner
  • From user
  • To user
  • Date
  • Call Dispostion (status)

Visualize your phone traffic by your own criterias. Amount of calls per month can give you an idea on how your company grows.

Add your favorite graphs to your dashboard and keep an eye on the phone traffic.

Special Calls Dashboard shows you special call statistics where you will see top blabbers, top partners and phone traffic distribution.

Pivot view will give you an advanced call reporting tool.

Support

Bugs, feature requests

For bugs and feature requests please send email to odooist@gmail.com.

Tips & tricks

To ask questions about module setup and use join our Telegram support chat.

Asterisk / FreePBX support

This module requires running Astrerisk instance (docker deploy included for new installations).
Network connection between Asterisk and Odoo instance is requied.
Please refer to Asterisk documentaion for Asterisk configuration.
Asterisk installation and support are not included in price of this module.

If you are a novice in Asterisk/FreePBX and do not know how to complete Asterisk part of installation you can request paid support to help you setup your PBX. Please submit a request here.

Asterisk! Enjoy with Odoo!

Asterisk Calls Odoo Application documentation

Change Log

1.0.9

  • Asterisk manager connection watchdog added (ping action sent every 30 seconds).
  • Local channels excluded on Agent level (no local channels events sent to Odoo).
  • Added deploy/docker-compose.agent.yml for pulling Agent from docker hub.
  • FreePBX videos added to documentation.
  • User notification refactored not to send double notifications.
  • Channel and call user matching refactoring to handle situations where not exten is sent (queues, ring groups).
  • Odoo bus.bus agent channel secured. Now on every connect Agent generates a secret channel token and polls to this channel. Now it's impossible to guess the channel name Agent is listening.
  • Save settings bugfix.
  • "Remove plus" option added to settings. Now you can configure either send numbers with + or not.
  • A dozen of small usability improvements.

1.0.8

  • Click2call partner's extension refactored. New field Phone extension added. When You click on Phone extension call button partner's Phone is dialed with Phone extension added to the number. By default one second pause is used before entering extension. To add more delay prefix Phone extension with more #, e.g. ####1001.
  • Asterisk AgentCalled event is now handled. So if call is terminated with Queue application queue agents can have calling partner form opened. Don't forget to add agent permission of odoo AMI account.
  • Systemd unit fix (deploy/agent/astcalls_agent.service) that is used to make Agent start on boot.
  • Now you can keep your numbers in E.164 format .e.g +1234567890. When click2call is used + is removed before sending to Asterisk. Also remove + before calling get_caller_name URL from Asterisk dialplan. You can keep + in partner numbers to let SMS module work.
  • Fixed issue with call recording and PJSIP multiple registrations and getting several channels with same uniquid.
  • Statistics -> Custom -> Call report fix (Odoo 11 & 12 porting bug fix)

1.0.7

  • Ooops with "number translations" - feature removed.
  • Multiple odoo databases are supported now by Agent.
  • Set caller name fix when multiple partners with same numbers.
  • Incoming call notification popup :-P
  • Added (really) ability to dial partner's extension setting partner number like 1234567890#101. Every # adds 1 second of pause before sending DTMF digits after the calls is answered.

1.0.6

  • Free post-sale asterisk support is not available anymore.
  • Nginx service added to docker deploy.
  • Call recording refactoring (sending recording on CDR event instead of Hangup).
  • Docker deploy refactored (again :-P), now all services are started from one compose file.
  • Added call routing controller to allow Asterisk find calling partner's manager extension.
  • Added ability to dial internal extensions setting partner number like 1234567890#101.
  • Added number transforming and cutting spaces, brakets and dashes. So 1(23)123-23-23 will be correctly dialed.
  • Asterisk IP address default False settings bug fix.

1.0.5

  • PJSIP support added for click2call (Agent update required).
  • Auto answer (Alert-Info SIP header) bug fix.
  • Added Auto reload channels setting to handle call overloads.
  • res_config_settings now properly inherited.
  • FreePBX screenshots in doc fix.

1.0.4

  • FreePBX setup screenshots added to the doc.
  • Permissions fix (Access denied error if user was not in any asterisk calls group).
  • Asterisk calls CRM addon ready.
  • Calls history store days parameter added to the settings (old calls are deleted)

1.0.3

  • Call history tree view now has a button either to open call's partner or create a new partner for call.
  • Partner form click2dial for mobile field added.
  • Minor bug fixes.
  • Docker deploy moved to Postgres 10.
  • Docker deploy added odoo.conf.
  • Documentation update with FreePBX examples.

1.0.2

  • Bug fixes :-P
  • Odoo 12.0 version released!
  • Documentation rewrite :-)
  • Asterisk Odoo Agent broker script now can be downloaded directly from Odoo site.
  • Added Asterisk allowed IP addresses restriction - you can limit potential sources of requests.
  • Added ability to query callerid name from Asterisk dialplan using CURL function.
  • Web callback features added:
    • Callback order - controls who is dialed first: customer phone or queue.
    • Callback days, attempts and call interval control dialing attempts.
    • Start time of callback - when requesting a callback from IVR menu you can specify callback start time (in Odoo datetime format) so that it will start on work hours.
  • Added possibility to request a callback from Asterisk voice menu.
  • Web notify addon is automatically downloaded during docker deploy.
  • Asterisk example dialplan refactored (CURL example added).
  • Systemd startup unit file added in deploy folder.

1.0.1

  • Initial release.

Installation

To get this working You need:

  • Install Odoo module and do some Odoo users <-> Asterisk extensions configuration.
  • Do some Asterisk configuration - add getting caller name from Odoo and more.
  • Run Odoo Asterisk agent - a script that connects to Asterisk Manager Interface (AMI) and listens for events / sends actions. Agent can be run from any place: Odoo server, Asterisk server or just a docker service.

Here is the architecture of the solution:

img/asterisk_calls_dia.png

Docker compose deploy

There is a deploy folder in the application package that contains docker-compose style installation. The deploy folder contains 3 directories:

  • agent (a middleware between Odoo and Asterisk, you already have Odoo and Asterisk you may want to run only a docker based Agent installation).
  • odoo (installation of Odoo and PostgreSQL, if you already have Asterisk running then you may want to run docker based Odoo and Agent.
  • asterisk (If you want a complete all-in-one suite run all components).

To customize your installation use docker-compose.override.yml to set your custom values.

Odoo

Install asterisk_calls Odoo module in usual way. Do a database backup before installation (just in case :-P).

Odoo configuration

Be sure to enable Odoo long polling feature and make sure long polling port is available for Odoo users.

Be sure to use it as a base service for WEB requests! If You see in your Odoo logs this message it means your users try to use click to call feature using a process worker (8069) not a gevent one (8072). So either let users open http://your-odoo:8072 or configure nginx to proxy all backend requests to port 8072.

To activate long polling start Odoo with at least --workers=2 or set it in odoo.conf:

[options]
workers = 2
longpolling_port = 8072

Attention! This is just an example of conf file options that must be set! Don't throw away your own options!!!

Be sure to have the following record in your Odoo startup logs:

astcall_odoo | 2018-09-10 15:37:58,920 18 INFO ? odoo.service.server: Evented Service (longpolling) running on 0.0.0.0:8072

Change account password

Not required but strictly recommended! By default Agent is configured to use asterisk_service Odoo account (this account is created on asterisk_calls module installation).

It's advised to change its password in Odoo and also ODOO_PASSWORD environment variables for Agent (see below).

Configure users and groups

Map Odoo users with Asterisk user's extensions.

Users who use Asterisk Calls must have Asterisk Calls User permission.

For SIP users you can specify SIP alert-info header to enable auto answer feature. Check you SIP phone manuals for that.

After you mapped Odoo users with Asterisk extensions users can use click to call feature.

When you map Odoo user to Asterisk extensions in Asterisk Calls -> Users menu user is automatically added to Asterisk Calls group.

When you delete Asterisk user mapping Asterisk call permission is automatically removed from Odoo user.

Additional modules

To enable call status notifications install OCA module web_notify. No additional configuration is needed here.

Website callback form issue

Odoo 10.0 attention! Be sure that your web site is served by worker on port 8069 and not by gevent port 8072! There is a bug in Python 2.7.9 and gevent regarding SSL module so ReCaptcha will not work if form is loaded from gevent worker. This is a known limitation that is solved in Odoo 11 and I still think about workaround (send me your idea if you have one!).

If you get in your log the following error message

__init__() got an unexpected keyword argument 'server_hostname'

that means your web server is served by gevent worker (port 8072). Reconfigure your proxy server to pass requests to process worker (port 8069).

Asterisk

You need is to allow Agent to connect to your Asterisk server AMI port (usually 5038). This app does not use asterisk database connection to Odoo.

You need to cut leading + on numbers incoming from trunks before passing it to get_caller_name.

Here are the examples of required configuration options.

cdr.conf:

[general]
enable=yes
unanswered = yes
congestion = yes

cdr_manager.conf:

[general]
enabled = yes

[mappings]
start => started
answer => answered
end => ended
linkedid => linkedid
sequence => sequence

manager.conf:

[general]
enabled = yes
webenabled = no # Asterisk calls does not use HTTP interface
port = 5038 # You can put any port here but adjust MANAGER_PORT variable for Agent.
bindaddr = 0.0.0.0 # You can put your IP here and set ASTERISK_HOST variable for Agent.

[odoo] # Adjust also MANAGER_LOGIN for Agent
secret=odoo # Adjust also MANAGER_PASSWORD for Agent
displayconnects = yes
read=call,dialplan,cdr
write=call,originate
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1

Important! For security reasons always use deny/permit options in your manager.conf. Change permit option to IP address of your Asterisk server if agent is not started on the same box.

Dialplan configuration

Call recording

To enable call recording call MixMonitor(${UNIQUEID}.wav)

Set Caller ID name on channel

Here you have 2 options:

  • Set caller name by Agent.
  • Fetch caller name from Odoo using Asterisk CURL function.

This is controlled by Asterisk Calls -> Settings -> Set caller name type.

If Agent sets caller name on calling channel you need to make a pause in call handling dialplan to give Agent a reasonable time to fetch caller name from Odoo and set it in the channel.

Here is the example dialplan to summarize the above:

 ; Call from DID numbers e.g. PSTN numbers connected to Asterisk box.
[test-incoming]
exten => _X.,1,Set(CURLOPT(conntimeout)=3)
exten => _X.,n,Set(CURLOPT(dnstimeout)=3)
exten => _X.,n,Set(CURLOPT(httptimeout)=3)
exten => _X.,n,Set(CURLOPT(ssl_verifypeer)=0)
; Record call
exten => _X.,n,MixMonitor(${UNIQUEID}.wav)
; Get caller ID name from Odoo
exten => _X.,n,Set(CALLERID(name)=${CURL(http://odoo:8072/asterisk_calls/get_caller_name?number=${CALLERID(number)})})

; Get partner's manager channel if set.
exten => _X.,n,Set(manager_channel=${CURL(http://odoo:8072/asterisk_calls/get_partner_manager?number=${CALLERID(number)})})
exten => _X.,n,ExecIf($["${manager_channel}" != ""]?Dial(${manager_channel}/${EXTEN},60,t))
;
exten => _X.,n,Answer
exten => _X.,n,Playback(demo-thanks)
exten => _X.,n,Queue(sales)

[post-dial-send-dtmf]
exten => s,1,NoOp(DTMF digits: ${dtmf_digits})
same => n,ExecIf($["${dtmf_digits}" = ""]?Return)
same => n,Wait(${dtmf_delay})
same => n,SendDTMF(${dtmf_digits})
same => n,Return

[test-users]
exten => _X.,1,MixMonitor(${UNIQUEID}.wav)
; Local users pattern
exten => _XXXX,2,Dial(SIP/${EXTEN},30,TU(post-dial-send-dtmf))
; Outgoing calls pattern
exten => _XXXXX.,2,Dial(SIP/provider/${EXTEN},30,TU(post-dial-send-dtmf))

FreePBX setup

Setup and configuration videos are available here.

Configure custom dialplans
img/FreePBX-context.png
Set custom context for trunks
img/FreePBX-trunk.png
Set custom context for users
img/FreePBX-user.png

Agent

The Agent connects to Asterisk Manager Interface (AMI) and listen for events like Newchannel, Cdr, Hangup, etc. These events are sent to Odoo using odoorpc library.

Agent can be run in any place. But the prefereable one is the same server where Asterisk is installed. In this case Agent can have access to call recording files and can forward them to Odoo. This is the only difference from other cases like running Agent on the Odoo server or as a docker service (set RECORDING_UPLOAD_ENABLED=0 environment variable to disable call recording uploads).

Installation steps:

  • Download Agent package from Odoo Asterisk Calls -> Settings -> Download Asterisk Agent green button.
  • Copy it to your Asterisk server.
  • Install requirements from requirements.txt
  • Edit start_agent.sh and adjust configuration variables.
  • Run start_agent.sh

To install the required libraries:

cd /agent/
pip install -r requirements.txt

Now you can start_agent.sh:

bash-4.4# DEBUG=1 ./agent.py
2018-09-11 19:35:04,883 - DEBUG - __main__ - Connecting to 127.0.0.1:5038 with odoo:odoo
2018-09-11 19:35:04,890 - INFO - __main__ - Connecting to Odoo at odoo:8069
2018-09-11 19:35:04,893 - DEBUG - __main__ - Notify on start not set
2018-09-11 19:35:04,926 - INFO - __main__ - Managed connected
2018-09-11 19:35:06,220 - INFO - __main__ - Connected to Odoo as asterisk_agent
2018-09-11 19:35:06,221 - DEBUG - __main__ - Starting odoo bus polling at http://odoo:8072/longpolling/poll

To get it up when system starts add this script to the startup scripts of your system.

Set DEBUG=1 to enable debug mode.

Settings

You should visit Asterisk Calls -> Settings and do some configuration.

Call originate settings

  • Originate Context - this is Asterisk context name (without brackets) where local users extensions can be found. Common contexts for local users are users, from-users, local-users, etc. Also outgoing routes should be defined in this context to allow dialing customers.
  • Originate Timeout - dial timeout when originating a call to user's device (SIP phone).

Calls

  • Keep days - every day call history clean up process is run deleting all calls older than specified days.
  • Auto Reload Channels - this option enables automatic live refresh of active calls.

Callback

  • Callback Order - controls who is dialed first: customer phone or asterisk queue.
  • Callback Queue - if set the queue must have available agents before call is placed otherwise call is placed on next call interval.
  • Queue Exten - Asterisk extension used to dial the queue or anyother Asterisk application.
  • Originate context - Asterisk context used to search queue extension and outgoing route.
  • Callback Days - how many days try to dial the customer.
  • Daily attempts - how many attempts per day are done to dial the customer.
  • Call interval (minutes) - pause between dialing attempts in minutes.
  • ReCaptcha Enabled - use Google ReCaptcha v2 service (https://www.google.com/recaptcha/)

Caller ID Name setting

  • Set Caller Name Type - AMI (Wait) or dialplan (CURL).

    • When AMI (Wait) is selected caller name is set by Agent on NewChannel event. You have to give Agent a reasonable time to fetch caller name from Odoo and set it on the channel using Asterisk Wait() dialpan command (see asterisk dialplan example above).
    • When Dialplan (CURL) is selected Agent does not fetch caller name from Odoo instead you have to use Asterisk CURL function to fetch it from dialplan.

    The first option is easier to implement in Asterisk but wastes some milliseconds. Also sometimes when Odoo is busy the is a risk of not getting caller name in specified time. So using CURL is more time saving and reliable.

IP Security

  • Asterisk IP address(es) - comma separated list of IP addresses of your Asterisk servers or just one ip address if you have one server. As Asterisk CURL function cannot authenticate with Odoo /asterisk_calls/get_caller_name URL is public. So you should restrict IP address here for better security. Also this URL is forbidden when Caller ID Name setting is not *Dialplan (CURL).

Asterisk Agent

  • Restart Asterisk Agent - when you click this button and Agent is alive you will get a notification message telling that Agent was restarted. If you click and get nothing you should look at the Agent process.
  • Download Asterisk Agent - download a .tar archive with files required for Agent installation. See #agent section of this manual.

Web callback

In order to use web callback You have to install Website Builder application.

Odoo 10 requirement: be sure to pass Odoo process worker instance (port 8069) to website site visitors.

Web callback form is accessible at http://localhost:8069/contact_call URL (put your hostname).

Callback from IVR menu

In example below callers getting out of the sales queue have a choice to press 0 and request a WEB callback.

exten => 500,1,Queue(sales,RtC,,,15)
same => n,Background(ask-for-callback)
same => n,WaitExten(3)
same => n,Hangup()

exten => 0,1,Set(foo=${CURL(http://localhost:8072/asterisk_calls/callback?queue=sales&phone=${CALLERID(num)}&exten=500)})
same => n,Playback(thanks-for-callback-order)
same => n,Hangup()

You can also specify a callback time so that call will come on work hours. Here is an example of dialplan:

exten => 500,1,Queue(sales,RtC,,,15)
same => n,Background(ask-for-callback)
same => n,WaitExten(3)
same => n,Hangup()

exten => 0,1,Set(foo=${CURL(http://localhost:8072/asterisk_calls/callback?queue=sales&phone=${CALLERID(num)}&exten=500)})
same => n,Playback(thanks-for-callback-order)
same => n,Hangup()

Upgrade

Upgrade steps:

  • Backup previous version of this module.
  • Copy a new version of this module.
  • Update Asterisk Calls application in Odoo Apps menu.
  • Restart Odoo.
  • Download a new Agent pack and update agent.py in your asterisk installation.

If something goes wrong during the upgrade process replace module folder with the previous one and contact support.

Support

Module price DOES cover support on installation :-)

Please get in contact if you have any issue on getting it to work.

If you need more features or found some bugs please send your requests to odooist@gmail.com.

This module requires running Astrerisk instance (docker deploy included for new installations).

Network connection between Asterisk and Odoo instance is requied. Please refer to Asterisk documentaion for Asterisk configuration.

Asterisk installation and support are not included in price of this module.

If you are a novice in Asterisk/FreePBX and do not know how to complete Asterisk part of installation you can request paid support to help you setup your PBX. Please submit a request here.

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

Odoo
The best App I have bought here
by on

I had many attempts to ingrate Odoo and Asterisck before. BUT now I am very happy about this APP! This is the best (the only one) way to implement VoiP service in Odoo. The developer is very kind and helpful and provides support!!!!


Odoo
Amazing
by on

the most useful and amazing integration with Asterisk right now I'm listening to all calls and i can search call records by partner