> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oduist.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent installation

> Deploy the Agent Docker service, connect AMI, and reinitialize if needed.

# Agent installation

The Agent bridges Odoo and Asterisk:

* Sends required AMI events/recordings to Odoo.
* Executes AMI actions from Odoo.
* Implements billing; optional SIP attack protection; optional web CLI backend.

## Requirements

* Docker and docker-compose.
* AMI user on Asterisk (example `manager.conf`):

```
[general]
enabled = yes
webenabled = no
port = 5038
bindaddr = 127.0.0.1

[asterisk_plus_agent]
secret=odoo              ; change this
allowmultiplelogin=no
displayconnects = yes
read=call,dialplan,security,user
write=originate,system,message
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.255
```

Reload and verify: `manager show user asterisk_plus_agent`.

## Configure AMI in Odoo

PBX → Settings → Server. Fill AMI host/port/login/password. (See screenshot `agent-ami-settings.png` if needed.)

## Run the Agent (docker-compose)

```yaml theme={null}
services:
  agent:
    init: true
    image: oduist/pbx-agent:latest   # pin to your module version in production
    restart: unless-stopped
    command: https://your.odoo.server
    volumes:
      - srv:/srv
      - /var/spool/asterisk:/var/spool/asterisk   # for recordings upload
    privileged: true   # only if SIP security enabled
    network_mode: host
    environment:
      - TZ=Europe/London
volumes:
  srv:
```

Use the correct scheme (http/https) and version tag. Open port 48000 on firewall/port-forwarding for Odoo→Agent.

## Agent in action

<img src="https://mintcdn.com/test-99895540/4eQ6AIbO89AUVLyN/pbx/images/agent-terminal.png?fit=max&auto=format&n=4eQ6AIbO89AUVLyN&q=85&s=11edfbed32ef16a374d19b824ef3bd42" alt="Agent terminal" width="1920" height="625" data-path="pbx/images/agent-terminal.png" />

## Server URL in Odoo

PBX → Settings → Server → set Agent URL.

<img src="https://mintcdn.com/test-99895540/4eQ6AIbO89AUVLyN/pbx/images/agent-server-settings.png?fit=max&auto=format&n=4eQ6AIbO89AUVLyN&q=85&s=34dd9c1dbc776b805808571a8918e089" alt="Server settings" width="1920" height="840" data-path="pbx/images/agent-server-settings.png" />

## Initialization / reconnection

* First successful connect locks initialization.
* To re-init (e.g., container recreated), permit initialization in Odoo Settings (Initialization section), then rerun the Agent.
  <img src="https://mintcdn.com/test-99895540/4eQ6AIbO89AUVLyN/pbx/images/agent-init-permit.png?fit=max&auto=format&n=4eQ6AIbO89AUVLyN&q=85&s=fcf4290c72c07283490470f8ab77524b" alt="Allow init" width="1920" height="857" data-path="pbx/images/agent-init-permit.png" />
* To point Agent to a new Odoo URL, run once with `--init https://your.odoo.server`, then remove `--init` and run normally.

## Troubleshooting

* AMI login fails: ensure manager.conf reloaded (`core reload`) and user shows in Asterisk console.
* `init: true` unsupported: remove `init` key in compose.
