Skip to main content

Asterisk connector for Asterisk Calls Odoo application.

Project description


Asterisk Calls Agent is a middleware software used as a bridge between Odoo and Asterisk IP-PBX.

Using Asterisk Calls client makes Odoo a phone applications platform because all development is done on Odoo level so every Odoo developer can quickly and easily integrate Asterisk features with any Odoo module.

The Agent architecture is a callback based where every callback is an Odoo method.

In many cases the Agent will just work as is without any modification like it works in Asterisk Calls application.


Asterisk Calls Agent is based on Nameko - a wonderful microservice framework for Python.

Asterisk Calls Agent is very small because Odoo related operations come from nameko-odoo library and Asterisk related operations come from nameko-ami library.

Though Asterisk Calls Agent was developed as a base for commercial module Asterisk Calls it was decided to make the Agent open and free under LGPL license so that all the Odoo world can benefit from it.


Currently before installing this package your should manually installed the required dependencies:

pip3 install -r requirements.txt

After that you can install it from PyPi:

pip3 install asterisk-calls-agent



Nameko style config is used. See config.yml for a default config.

#TODO: Describe configuration options here.


See Asterisk Calls module documentation on preparing Asterisk for the Agent.

Running Asterisk Calls Agent

You can start the Agent manually from any place like this:

nameko run --config=config.yml asterisk_calls_client

You can also create a systemd service file asterisk_calls_agent.service and install it for starting the Agent at boot (adjust it for your environment).

Description=Asterisk Calls Odoo connector

ExecStart=/usr/local/bin/nameko run --config=/etc/asterisk_calls_agent.yml asterisk_calls_agent


And activate it:

systemctl daemon-reload
systemctl enable asterisk_calls_agent
systemctl start asterisk_calls_agent
systemctl status asterisk_calls_agent

Support & Contributing

Feel free to create new tickets on issues and ideas.


As was said in the very beginning development is done on Odoo layer.

The Agent will forward to Odoo specified AMI messages.

In order to know which AMI messages to forward your should define your EVENT_MAP in config file.

Let’s imagine that we want to collect call details records. In this case you need to map Cdr event to Odoo’s model and method which will receive it. Add the following section to config.yml:

  - name: Cdr
    type: AMI
    method: create_cdr

Now in Odoo application named asterisk_calls (just an example) create a method create_cdr with the following contents:

class Call(models.Model):
  _name = ''
  _description = 'Call Log'

  src = fields.Char()
  dst = fields.Char()
  channel = fields.Char()
  # The rest fields are ommited...

  def create_cdr(self, event):
      get = event['headers'].get
      data = {
          'accountcode': get('AccountCode'),
          'src': get('Source'),
          'dst': get('Destination'),
          'dcontext': get('DestinationContext'),
          'clid': get('CallerID'),
          'channel': get('Channel'),
          'dstchannel': get('DestinationChannel'),
          'lastapp': get('LastApplication'),
          'lastdata': get('LastData'),
          'started': get('StartTime') or False,
          'answered': get('AnswerTime') or False,
          'ended': get('EndTime') or False,
          'duration': get('Duration'),
          'billsec': get('BillableSeconds'),
          'disposition': get('Disposition'),
          'amaflags': get('AMAFlags'),
          'uniqueid': get('UniqueID') or get('Uniqueid'),
          'linkedid': get('Linkedid'),
          'userfield': get('UserField'),
          'system_name': get('SystemName'),
      return True

That’s it.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for asterisk-calls-agent, version 1.8
Filename, size File type Python version Upload date Hashes
Filename, size asterisk-calls-agent-1.8.tar.gz (19.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page