Axivox User guide
Back to the site

Odoo request

Queries your Odoo during the call and stores the response in variables: an order status, a balance, an appointment date, to route accordingly.

In brief

OutputsOK and Error
FieldsOdoo instance, Timeout, Model, Method, Args (JSON), Kwargs (JSON), and an extraction array of Variable and JSON path
Timeout offered2, 3, 5 or 8 s, 5 s by default
Timeout actually applied8 seconds maximum
Method suggested on creationsearch_read
Circuit breaker5 consecutive failures on the same server open the circuit for 30 seconds
Trial before going liveTest button, which actually queries your Odoo

The help text shown in the window is: "Calls execute_kw(model, method, args, kwargs) on Odoo. args/kwargs = JSON with {{variables}} ({{caller_e164}} = E.164 forms of the caller). Extracts the JSON response into variables. 'Error' output if Odoo fails/times out."

How it works

This is the most technical module of the set. Where Odoo, contact resolution answers a single, ready-made question, this one asks any question of your Odoo. In exchange, you need to know where the information lives in Odoo.

The four fields of the question

FieldWhat it isExample
Modelthe internal name of the Odoo table being queriedres.partner for contacts
Methodwhat you're asking of that tablesearch_read to search then read
Args (JSON)the arguments, in practice the search filter[[["phone_sanitized","in","{{caller_e164}}"]]]
Kwargs (JSON)the named options: which fields to read, how many rows{"fields":["name","user_id"],"limit":1}

The model's name is read in Odoo, by enabling developer mode, or asked of the person who administers your Odoo. It's the only part of this page you can't guess.

JSON, in one sentence

Args and Kwargs are written in JSON, a format where square brackets [ ] delimit a list, braces { } a set of named fields, and where all text is between straight quotes. One missing comma or an unclosed brace is enough to make the request fail.

Variables in the question

Write {{my_variable}} anywhere in Args or Kwargs. A useful nuance: a variable wrapped in quotes, like "{{caller_e164}}", is replaced by its value in JSON form, quotes included. A list therefore stays a list, which lets you write a filter of the type "the phone is among these forms."

Extraction

The table at the bottom links a JSON path to a Variable name. Levels are separated by dots; lists are counted from zero. search_read responds with a list, so the path to a first result starts with 0.: 0.name refers to the name of the first contact found.

A path left blank returns the entire response. This is essential for methods that respond with a number or a word with no structure around it, such as a count: without this, the variable would stay empty and any condition testing it would always be false.

The circuit breaker

As with the API request, after 5 consecutive failures toward the same server, the module stops calling it for 30 seconds and takes the Error output immediately, without any request. A first success resets the counter to zero.

What to fill in

FieldWhat is expectedIf you leave it empty
Odoo instancethe Odoo to query, among those declared in Integrations, OdooDefault instance, the resolution instance declared for your installation
Timeoutthe wait delay, capped at 8 s maximum at run time5 s
Modelthe Odoo model name, for example res.partnerthe Error output is taken without any request being sent
Methodthe method to call, pre-filled with search_readthe Error output is taken without any request being sent
Args (JSON)the arguments, in valid JSONempty list
Kwargs (JSON)the named options, in valid JSONno options
Variable of an extractionthe name to store the read value underthe row is ignored
JSON path of an extractionthe path to the value, for example 0.namethe entire response is stored in the variable

The window's buttons are Add an extraction, Test, Cancel and Save.

Steps

  1. Check that your Odoo is connected, in Integrations, Odoo, and that the instance is active there.
  2. Identify in Odoo the model and the fields that carry the information you want. Get help from the person who administers your Odoo if needed.
  3. Place the Odoo request module and connect the previous node to its input.
  4. Open it, choose the Odoo instance and set the Timeout as short as possible: two to three seconds, the caller is waiting on the line.
  5. Enter the Model and the Method.
  6. Write the Args (JSON) and the Kwargs (JSON), limiting the number of rows read with "limit":1 when one is enough.
  7. Click Add an extraction and pair a JSON path with a Variable name.
  8. Click Test, fill in the trial variables, then click Run. Fix things until the value obtained is correct.
  9. Click Save, then connect OK to the rest of the plan and Error to a fallback that handles the call without the data.
  10. Click Save, then Apply changes in the top banner.
  11. Call your number and check the routing, with the help of a Debugging module that writes the extracted variables.

If it doesn't work

The Error output is taken immediately, without any request being sent. Three causes. The Model or the Method is empty. The chosen Odoo instance no longer exists or is no longer active. Or the circuit breaker is open, after five consecutive failures, for thirty seconds.

The request fails even though the JSON looks correct to me. It must stay valid once the variables are replaced, and that's where most errors happen. Click Test: the screen shows the request actually sent, args and kwargs after replacement. For a variable to be replaced by its JSON value, wrap it in quotes: "{{caller_e164}}".

The extracted variable stays empty even though the response contains the data. The path doesn't match. search_read responds with a list: start with 0. for the first element. A method that responds with a single number, on the other hand, requires an empty path. The Value obtained column of the trial flags empty extractions.

The trial asks me to confirm before running. The requested method writes to Odoo instead of just reading. The trial actually runs against your production Odoo: only confirm if you accept that write.

The call cuts off when Odoo responds badly. The Error output is not connected to anything. This module does not have the contact resolution module's automatic fallback: connect Error, at minimum toward the usual greeting.

How the call flow is built, explained in pictures

See the Dial plans page