AI Voice Bot: Twilio — telephony adapter

Odoo 19 · Community · Part of AI Voice Bot

AI Voice Bot: Twilio

The telephony adapter for AI Voice Bot. Places outbound calls through Twilio's REST API, and turns Twilio's own call-status and recording webhooks into updates on the call queue — with the real terminal outcome (busy, no answer, failed, completed) always written before any retry is scheduled, never the other way around.

This page describes the adapter's own contribution. For the campaign/call/review workflow it plugs into, see the AI Voice Bot product page.

What it does

The base module defines a pluggable VoiceProvider interface and never calls a real telephony API itself. This module is one concrete implementation of that interface, registered under the code twilio: create_call, cancel_call, get_call_status and get_recording, all plain REST calls against api.twilio.com with HTTP Basic Auth — the same raw-REST pattern core's own payment_stripe uses, since Twilio has no Python SDK already implied anywhere in this workspace.

Signature verification, not just a shared secret

validate_webhook implements Twilio's own documented HMAC-SHA1 signing algorithm, verified against Twilio's official documentation rather than assumed. A signature check needs the exact public HTTPS URL Twilio saw for the request — behind a reverse proxy this needs Odoo's --proxy-mode, or every signature check fails even with fully correct credentials. That deployment requirement is documented directly in the adapter's own code, not only here.

A real ordering bug, caught before it shipped

A customer's opt-out, detected mid-conversation by the AI Voice Service, is applied to the call and the suppression list the moment that webhook lands. Twilio's own "completed" status webhook for the same call commonly arrives after that — and without an explicit guard, that later event would silently flip the call's state back and overwrite the opt-out. The status-webhook handler refuses to touch a call that is already opted_out, full stop.

Configuration

SettingPurpose
Account SID / Auth TokenTwilio account credentials.
From NumberThe Twilio number calls are placed from.
Voice Webhook URLThe external AI Voice Service's TwiML endpoint for a connected call.
Status Callback Base URLThis Odoo instance's own public HTTPS base URL, used to build the callback URL Twilio posts status/recording events back to.

Dependencies

do_ai_voice_bot only. No extra Python package.