Skip to content

About

Twilio recording to vCon adapter - receives Twilio webhooks and creates vCons

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

vCon Telephony Adapters

PyPI version Python 3.12+ License: MIT

A monorepo of webhook-based adapters that convert telephony platform recordings into vCon (Virtual Conversation) format and post them to a vCon conserver.

Overview

This project provides a unified framework for converting call recordings from various telephony platforms into the standardized vCon format:

  • Twilio - Convert Twilio call recordings via webhooks
  • FreeSWITCH - Convert FreeSWITCH recordings via mod_http_cache events
  • Asterisk - Convert Asterisk recordings via ARI events
  • Telnyx - Convert Telnyx call recordings via webhooks
  • Bandwidth - Convert Bandwidth call recordings via webhooks
  • VAPI - Convert VAPI voice-AI end-of-call reports via webhooks
  • Pipecat - Emit vCons from a running Pipecat voice-AI pipeline (in-process observer, no webhook)
  • ElevenLabs - Convert ElevenLabs Conversational AI post-call events via webhooks
  • SignalWire - Convert SignalWire call recordings by polling the Compatibility API

Architecture

vcon-telephony-adapters/
├── core/                    # Shared core modules
│   ├── base_builder.py      # Abstract vCon builder
│   ├── base_config.py       # Base configuration
│   ├── poster.py            # HTTP posting to conserver
│   └── tracker.py           # State tracking for duplicates
├── adapters/                # Platform-specific adapters
│   ├── twilio/              # Twilio adapter
│   ├── freeswitch/          # FreeSWITCH adapter
│   ├── asterisk/            # Asterisk adapter
│   ├── telnyx/              # Telnyx adapter
│   ├── bandwidth/           # Bandwidth adapter
│   ├── vapi/                # VAPI adapter (webhook)
│   ├── pipecat/             # Pipecat adapter (in-process observer, no webhook)
│   ├── elevenlabs/          # ElevenLabs adapter (webhook)
│   └── signalwire/          # SignalWire adapter (poller)
├── tests/                   # Test suite
└── main.py                  # CLI entry point

Requirements

  • Python 3.12+
  • vcon - The vCon library for creating vCon objects (declared as a dependency, installed automatically)

Installation

From PyPI (Recommended)

pip install vcon-telephony-adapters

The vcon library is a declared dependency and installs automatically.

From Source

git clone https://github.com/vcon-dev/vcon-telephony-adapters.git
cd vcon-telephony-adapters
pip install .

Optional extras

# S3 media publishing (adds boto3; only needed with MEDIA_BACKEND=s3)
pip install ".[s3]"

# Development / test tooling
pip install ".[dev]"

# Everything
pip install ".[all]"

Quick Start

Running an adapter

# Twilio
vcon-adapter twilio

# FreeSWITCH
vcon-adapter freeswitch

# Asterisk
vcon-adapter asterisk

# Telnyx
vcon-adapter telnyx

# Bandwidth
vcon-adapter bandwidth

# VAPI
vcon-adapter vapi

# Pipecat (health check only; see the Pipecat Adapter section below)
vcon-adapter pipecat

# ElevenLabs
vcon-adapter elevenlabs

# SignalWire (poller)
vcon-adapter signalwire

Twilio Adapter

Configuration

# Required
CONSERVER_URL=https://your-conserver.example.com/api/vcons
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token_here

# Optional
PORT=8080
VALIDATE_TWILIO_SIGNATURE=true
WEBHOOK_URL=https://your-domain.com
DOWNLOAD_RECORDINGS=true
RECORDING_FORMAT=wav

Twilio Configuration Options

Variable Required Default Description
TWILIO_ACCOUNT_SID Yes* - Your Twilio Account SID
TWILIO_AUTH_TOKEN Yes** - Your Twilio Auth Token
VALIDATE_TWILIO_SIGNATURE No true Validate webhook signatures
WEBHOOK_URL No - Public URL for signature validation

* Required when DOWNLOAD_RECORDINGS=true. ** Required when VALIDATE_TWILIO_SIGNATURE=true (the default): the adapter refuses to start otherwise, rather than accept unauthenticated webhooks. See Webhook authentication below for the escape hatch.

Configuring Twilio

  1. In your Twilio console, configure your phone number or TwiML app to record calls.

  2. Set the Recording Status Callback URL to your adapter endpoint:

    https://your-domain.com/webhook/recording
    
  3. Select the recording status events you want to receive (at minimum, completed).

Using with TwiML

<Response>
    <Record
        recordingStatusCallback="https://your-domain.com/webhook/recording"
        recordingStatusCallbackEvent="completed"
    />
</Response>

FreeSWITCH Adapter

Configuration

# Required
CONSERVER_URL=https://your-conserver.example.com/api/vcons

# FreeSWITCH-specific
FREESWITCH_HOST=localhost
FREESWITCH_ESL_PORT=8021
# Required if/when the ESL path is used; no stock default (FreeSWITCH ships
# with "ClueCon", which this adapter deliberately does not default to)
FREESWITCH_ESL_PASSWORD=your_esl_password
FREESWITCH_RECORDINGS_PATH=/var/lib/freeswitch/recordings
FREESWITCH_RECORDINGS_URL_BASE=https://fs.example.com/recordings
FREESWITCH_WEBHOOK_SECRET=your_webhook_secret

# Optional
PORT=8082
VALIDATE_FREESWITCH_WEBHOOK=true
DOWNLOAD_RECORDINGS=true
RECORDING_FORMAT=wav

FreeSWITCH Configuration Options

Variable Required Default Description
FREESWITCH_HOST No localhost FreeSWITCH host
FREESWITCH_ESL_PORT No 8021 ESL port
FREESWITCH_ESL_PASSWORD No* - ESL password; no default (required if/when the ESL path is used)
FREESWITCH_RECORDINGS_PATH No /var/lib/freeswitch/recordings Local recordings path
FREESWITCH_RECORDINGS_URL_BASE No - URL base for HTTP downloads
FREESWITCH_WEBHOOK_SECRET Yes** - HMAC secret for webhook validation
VALIDATE_FREESWITCH_WEBHOOK No true Enable webhook signature validation

** Required when VALIDATE_FREESWITCH_WEBHOOK=true (the default): the adapter refuses to start otherwise. See Webhook authentication below.

Configuring FreeSWITCH

Add mod_http_cache or a custom event handler to send recording events to the webhook:

# In your dialplan, after recording:
<action application="curl" data="https://your-domain.com/webhook/recording post ${recording_data}"/>

The webhook expects JSON data with FreeSWITCH event variables (uuid, caller_id_number, destination_number, etc.).


Asterisk Adapter

Configuration

# Required
CONSERVER_URL=https://your-conserver.example.com/api/vcons

# Asterisk-specific (for ARI access)
ASTERISK_HOST=localhost
ASTERISK_ARI_PORT=8088
ASTERISK_ARI_USERNAME=asterisk
ASTERISK_ARI_PASSWORD=asterisk
ASTERISK_RECORDINGS_PATH=/var/spool/asterisk/recording

# Optional
PORT=8083
VALIDATE_ASTERISK_WEBHOOK=true
ASTERISK_WEBHOOK_SECRET=your_webhook_secret
DOWNLOAD_RECORDINGS=true
RECORDING_FORMAT=wav

Asterisk Configuration Options

Variable Required Default Description
ASTERISK_HOST No localhost Asterisk host
ASTERISK_ARI_PORT No 8088 ARI HTTP port
ASTERISK_ARI_USERNAME No - ARI username
ASTERISK_ARI_PASSWORD No - ARI password
ASTERISK_RECORDINGS_PATH No /var/spool/asterisk/recording Local recordings path
ASTERISK_WEBHOOK_SECRET Yes* - HMAC secret for webhook validation
VALIDATE_ASTERISK_WEBHOOK No true Enable webhook signature validation

* Required when VALIDATE_ASTERISK_WEBHOOK=true (the default): the adapter refuses to start otherwise. See Webhook authentication below.

Configuring Asterisk

Use a Stasis application or AGI script to send recording events to the webhook endpoint:

// ARI recording finished handler example
client.on('RecordingFinished', function(event) {
    // POST to https://your-domain.com/webhook/recording
});

Telnyx Adapter

Configuration

# Required
CONSERVER_URL=https://your-conserver.example.com/api/vcons
TELNYX_API_KEY=KEY_xxxxxxxxxxxxx

# Optional
PORT=8084
VALIDATE_TELNYX_WEBHOOK=true
TELNYX_PUBLIC_KEY=your_public_key_for_signature_validation
# Protects /webhook/texml-recording (see "Smart trunk TeXML callback" below)
TELNYX_TEXML_CALLBACK_TOKEN=a_long_random_shared_secret
DOWNLOAD_RECORDINGS=true
RECORDING_FORMAT=wav

Telnyx Configuration Options

Variable Required Default Description
TELNYX_API_KEY Yes* - Telnyx API key for downloading recordings
TELNYX_PUBLIC_KEY Yes** - Public key for Call Control webhook signature validation
TELNYX_TEXML_CALLBACK_TOKEN Yes** - Shared-secret token that protects /webhook/texml-recording
TELNYX_ADDONS_FROM_RELAY No false Read Annotation-addons from a trusted relay into the tenant attachment's body.addons (see Relayed annotations). Leave it off until the relaying receiver strips a copy of that field sent by a carrier; while off, the field is dropped and addons is never written
TELNYX_SCREEN_RESULT_FROM_RELAY No false Read Annotation-screen_result from a trusted relay, beside a tenant that counts, into one voice-screen analysis entry (see Relayed annotations). Leave it off until the relaying receiver strips a copy of that field sent by a carrier; while off, the field is dropped and no entry is written. The field is never kept as a tag, on or off
VALIDATE_TELNYX_WEBHOOK No true Enable webhook validation (both Call Control signatures and the TeXML token)
TELNYX_WEBHOOK_TOLERANCE_SECONDS No 300 Replay-window tolerance for Telnyx-Timestamp (Telnyx's own provider default; see Webhook replay window for the full resolution order)

* Required when DOWNLOAD_RECORDINGS=true. ** Required when VALIDATE_TELNYX_WEBHOOK=true (the default): the adapter refuses to start otherwise. See Webhook authentication below. The cryptography package is also a hard requirement whenever validation is on, since it is what verifies the Ed25519 Call Control signature.

Configuring Telnyx

  1. In the Telnyx Mission Control Portal, configure your Call Control Application.

  2. Set the Webhook URL for recording events:

    https://your-domain.com/webhook/recording
    
  3. Enable call.recording.saved events.

Smart trunk TeXML callback

Telnyx's TeXML recordingStatusCallback (path B of the smart trunk, handled at /webhook/texml-recording) is a Twilio-compatible form POST with no Ed25519 signature of its own, unlike the Call Control JSON webhooks above. It is gated instead with a shared-secret token compared using a constant-time comparison (hmac.compare_digest). Set TELNYX_TEXML_CALLBACK_TOKEN to a long random value and configure the callback URL with it as a query parameter:

https://your-domain.com/webhook/texml-recording?token=<TELNYX_TEXML_CALLBACK_TOKEN>

With VALIDATE_TELNYX_WEBHOOK=true (the default), the adapter refuses to start unless this token is set.

Relayed annotations and the tenant attachment

A service that relays this callback can add Annotation-<name> form fields. The smart trunk receiver does, on the three recording callbacks it forwards here: Telnyx TeXML, a bridge leg, and SignalWire record_call reshaped into this form. Each field whose name after the prefix is 1 to 64 letters, digits or underscores becomes an annotation_<name> tag. Annotations are exactly as trusted as the rest of the form.

One annotation also builds an attachment, because it decides whose data the call is. It is honoured only from a request trusted as coming from the relay:

  • the request carries ?token= and it matches TELNYX_TEXML_CALLBACK_TOKEN, from any peer; or
  • the request carries no token and the connection comes from loopback (127.0.0.1 or ::1).

A request with a wrong token is never trusted, even from loopback. The peer is the client address the server reports, never a header the client sends. Under uvicorn.run, as main.py starts it, that address is rewritten from X-Forwarded-For only when the connecting peer is in FORWARDED_ALLOW_IPS (127.0.0.1 by default). So never set FORWARDED_ALLOW_IPS=*, and make sure a reverse proxy on the same host as the adapter sets X-Forwarded-For; otherwise everything it forwards looks local. Where either cannot be guaranteed, set the token and have the relay send it. An untrusted request is still processed as before, tag included, and the adapter logs one line naming only the reason the field was ignored.

From a trusted relay, when the form carries Annotation-tenant, in exactly that case, and its value is a tenant id (t- and 16 lowercase hex digits), the vCon gains this attachment after all the others:

{"purpose": "tenant", "start": "2026-11-06T18:00:00+00:00", "party": 0, "session": 0,
 "mediatype": "application/json", "encoding": "json", "body": {"id": "t-00000000000000a1"}}
  • start is the vCon's created_at, as on every other attachment the adapter writes.
  • body is the JSON object itself (draft-ietf-vcon-vcon-core-05), and a store reads the tenant from body.id. A json.dumps string under encoding: "none" would read as no tenant.
  • The annotation_tenant tag is kept as before.
  • With no Annotation-tenant field the vCon is exactly what it was before this attachment existed. Any other value adds no attachment and logs a warning naming only the value's type, never the value.
  • If the field appears more than once with different values, no attachment is added and a warning says why. The same value repeated counts once. The tag still takes the last field, as before.
  • The lawful basis of a vCon with this attachment is the tenant's own, never LAWFUL_BASIS (next section).
  • When TELNYX_ADDONS_FROM_RELAY is on (it is off by default) and the same trusted relay also sends Annotation-addons, the tenant's add-on choice as comma separated ids, body gains addons: {"id": "t-00000000000000a1", "addons": ["conv-triage"]}. The list is sorted and unique, and an id outside conv-triage and voice-screen is dropped. A value that does not parse (an empty id, a space, a different case, text that is not a list, or two different values on the form) gives "addons": [] and one warning naming only the reason. With no Annotation-addons field, body is {"id": ...} with no addons key at all. The list is never an annotation_addons tag, and from an untrusted request, or with no tenant that counts, it is dropped: no attachment carries it. A reader such as the triage link takes the choice from body.addons alone. Turn the setting on only after the receiver that forwards to this adapter strips an Annotation-addons field that a carrier sent (any letter case, percent-encoded names included); until then a carrier could choose a tenant's add-ons. With the setting off the field is dropped as if the request were untrusted, and the vCon has no addons key.
  • When TELNYX_SCREEN_RESULT_FROM_RELAY is on (it is off by default), the same trusted relay sends Annotation-screen_result, and a tenant counts, the call's deepfake-screening outcome becomes one analysis entry on dialog 0: type voice-screen, vendor modulate, product velma-2-synthetic-voice-detection-streaming, schema voice-screen-result-v1, encoding json, and a body of status, mode, threshold, windows, frames, synthetic_frames, max_confidence, decided_at, action, action_result, acted_at and telnyx_status. A call whose result never reached the relay sends {"status": "missing"}, alone or with the four action keys, and that is written as sent. The value is one JSON object of at most 1024 bytes (the receiver sends it compact; spacing and key order are not checked) with exactly those keys, each checked for its type and range (statuses, modes and actions against fixed lists; counts as whole numbers in range; the threshold and confidence from 0 to 1; times as ISO 8601 with a zone). acted_at and telnyx_status must be set exactly when action_result is accepted or gone, and null otherwise. Anything else is dropped with one warning that names only the reason, and nothing is written. The body is rebuilt from the checked values, so no text from the request is copied. The field is never an annotation_screen_result tag, in any letter case, with the setting on or off, and no other Annotation-screen_* name is kept as a tag either (the receiver reserves that prefix). From an untrusted request, with no tenant that counts, or with the setting off, it is dropped and the vCon is as it was. Turn the setting on only after the receiver that forwards to this adapter strips an Annotation-screen_result field that a carrier sent, and a reader should take the outcome from the voice-screen entry alone.

A vCon with no tenant attachment is one that a store enforcing tenancy cannot file under a tenant.

The tenant's own lawful basis

Beside Annotation-tenant the relay sends the tenant's lawful basis record, one Annotation-basis_<key> field per key the record holds (a null field is absent, never empty). When the tenant counts by the rule above, the vCon's lawful_basis attachment is built from these fields alone, in place of the global LAWFUL_BASIS. When the tenant does not count (no field, an untrusted request, two tenants, or a value that is not a tenant id), the basis fields are ignored and the vCon is exactly what it was before, global basis included; an untrusted request logs Annotation-basis_* ignored: <reason>. Without a tenant that counts, each basis field also stays an annotation_basis_<key> tag, as every annotation does. With one, whether the attachment is built or refused, the annotation_basis_* tags are dropped, so the justification and names are not in the vCon twice; annotation_tenant and every other tag stay.

Field Goes to
Annotation-basis_lawful_basis body.lawful_basis: one of the six bases
Annotation-basis_justification body.metadata.justification, where LAWFUL_BASIS_JUSTIFICATION goes
Annotation-basis_consent_record body.metadata.consent_record: off or jlinc
Annotation-basis_chosen_by body.metadata.chosen_by
Annotation-basis_chosen_at body.metadata.chosen_at, as sent
Annotation-basis_entered_by body.metadata.entered_by: customer, partner or staff
Annotation-basis_evidence body.metadata.evidence, and the proof's proof_data.document
Annotation-basis_checked_by body.metadata.checked_by, and the proof's proof_data.checked_by
Annotation-basis_checked_at body.metadata.checked_at, and the proof's timestamp
  • purpose_grants are the adapter's LAWFUL_BASIS_PURPOSES, the same for every tenant, each granted at build time. expiration is always null. Neither comes from the relay.
  • A signed document is recorded as proof only when one was uploaded and staff checked it: when evidence, checked_by and checked_at all arrive, whoever entered the basis, the attachment gets one proof_mechanisms entry, {"proof_type": "signed_document", "timestamp": <checked_at>, "proof_data": {"document": <evidence>, "checked_by": <checked_by>}}. A partner or staff entry always has all three (or is refused, below). A customer's own entry without all three records no proof; who chose it, when, and that the customer entered it are in metadata.
  • metadata is the record as entered and the proof refers to it, so two values appear twice on purpose. evidence is in metadata and is the proof's proof_data.document. metadata.checked_at keeps the value as relayed, while the proof's timestamp comes out as vcon-lib normalises it, with +00:00 for Z; both carry a zone.
  • Nothing else of the global configuration is used: not LAWFUL_BASIS, LAWFUL_BASIS_JUSTIFICATION or LAWFUL_BASIS_EXPIRATION.

A customer's own entry gives (values synthetic):

{"purpose": "lawful_basis", "encoding": "json",
 "body": {"lawful_basis": "contract", "expiration": null,
          "purpose_grants": [{"purpose": "recording", "granted": true,
                              "granted_at": "2026-11-12T16:15:56.839624+00:00"}],
          "metadata": {"justification": "Synthetic: recordings serve the synthetic service contract.",
                       "consent_record": "off", "chosen_by": "synthetic customer admin",
                       "chosen_at": "2026-11-01T09:00:00Z", "entered_by": "customer"}},
 "party": 0, "session": 0, "mediatype": "application/json",
 "start": "2026-11-12T16:15:56.839532+00:00"}

Fail closed. A tenant gets no lawful_basis attachment at all, and never the global one, when the relay sent no basis fields, or when any of these holds; the adapter logs one line naming only the reason, never a value:

  • a field the relay never sends (Annotation-basis_purposes, _expiration, _source, or any other key), or one field with two different values (the same value twice counts once);
  • a value that is blank or not text;
  • lawful_basis, justification, consent_record, chosen_by or entered_by missing, or a partner or staff entry without evidence, checked_by and checked_at;
  • a basis outside the six, a consent record other than off or jlinc, or entered_by other than customer, partner or staff, compared exactly;
  • checked_by without checked_at or the reverse, or a checked_at that is not an ISO 8601 time with a zone;
  • LAWFUL_BASIS_PURPOSES empty.

Because an unknown key refuses the whole basis, deploy order matters when the relay starts sending a new Annotation-basis_<key>: deploy the adapter that knows the key first, then the receiver. The other way round, every tenant's vCon goes without a basis until the adapter catches up.

Such a vCon carries its tenant and no basis. It is noticed in the adapter's log line, by vcon-mcp's lawful basis warnings when it is stored (no lawful_basis attachment), and by any consent check further down the chain.

vcon-mcp's lawful basis warnings also flag a tenant's basis that is built: expiration is missing for any basis but legitimate_interests, since a tenant's basis has no expiration, and proof_mechanisms is empty for an entry with no checked document. Both are accepted for now and expected.


Bandwidth Adapter

Configuration

# Required
CONSERVER_URL=https://your-conserver.example.com/api/vcons
BANDWIDTH_ACCOUNT_ID=your_account_id
BANDWIDTH_USERNAME=your_api_username
BANDWIDTH_PASSWORD=your_api_password

# Optional
PORT=8085
VALIDATE_BANDWIDTH_WEBHOOK=true
BANDWIDTH_WEBHOOK_USERNAME=webhook_user
BANDWIDTH_WEBHOOK_PASSWORD=webhook_pass
DOWNLOAD_RECORDINGS=true
RECORDING_FORMAT=wav

Bandwidth Configuration Options

Variable Required Default Description
BANDWIDTH_ACCOUNT_ID Yes - Bandwidth Account ID
BANDWIDTH_USERNAME Yes* - API username for downloading recordings
BANDWIDTH_PASSWORD Yes* - API password for downloading recordings
BANDWIDTH_WEBHOOK_USERNAME Yes** - HTTP Basic Auth username for webhook
BANDWIDTH_WEBHOOK_PASSWORD Yes** - HTTP Basic Auth password for webhook
VALIDATE_BANDWIDTH_WEBHOOK No true Enable HTTP Basic Auth validation

* Required when DOWNLOAD_RECORDINGS=true. ** Both required when VALIDATE_BANDWIDTH_WEBHOOK=true (the default): the adapter refuses to start otherwise. See Webhook authentication below.

Configuring Bandwidth

  1. In the Bandwidth Dashboard, configure your Voice Application.

  2. Set the Callback URL for recording events:

    https://your-domain.com/webhook/recording
    
  3. Optionally configure HTTP Basic Authentication credentials.


VAPI Adapter

Configuration

# Required
CONSERVER_URL=https://your-conserver.example.com/api/vcons
VAPI_WEBHOOK_SECRET=your_webhook_secret

# Optional
PORT=8086
VALIDATE_VAPI_WEBHOOK=true
VAPI_CUSTOMER_NAME=Customer
VAPI_AGENT_NAME=AI Agent
DOWNLOAD_RECORDINGS=true

VAPI Configuration Options

Variable Required Default Description
VAPI_WEBHOOK_SECRET Yes* - Shared secret VAPI echoes back in the x-vapi-secret header
VALIDATE_VAPI_WEBHOOK No true Enable webhook secret validation
VAPI_CUSTOMER_NAME No Customer Display name for the customer party
VAPI_AGENT_NAME No AI Agent Display name for the agent party

* Required when VALIDATE_VAPI_WEBHOOK=true (the default): the adapter refuses to start otherwise. See Webhook authentication below.

VAPI also offers HMAC-signature and OAuth authentication with a configurable header name (https://docs.vapi.ai/server-url/server-authentication); this adapter implements the simpler, documented shared-secret header, not the HMAC variant.

Configuring VAPI

  1. In the VAPI dashboard, set your assistant's Server URL to your adapter endpoint:

    https://your-domain.com/vapi
    
  2. Configure the same value as VAPI_WEBHOOK_SECRET on the server URL's credential.


Pipecat Adapter

Pipecat (https://github.com/pipecat-ai/pipecat) is a voice-AI pipeline framework, not a service that calls a webhook: the integration runs inside your own pipeline process. python main.py pipecat / vcon-adapter pipecat only starts a /health endpoint so the adapter registers and containerizes like the others.

Integration

from adapters.pipecat import VconConversationObserver

observer = VconConversationObserver(
    conversation_id="call-123",
    on_vcon=lambda v: my_poster.post(v),
    publisher=config.build_publisher(),
    lawful_basis=config.build_lawful_basis(),
)

pipeline = Pipeline([
    transport.input(),
    stt,
    observer,           # intercepts user transcripts
    llm,
    observer,           # same instance also intercepts LLM output
    tts,
    transport.output(),
])

See adapters/pipecat/observer.py for the full frame-processor wiring, including as_frame_processor() for plugging directly into a Pipecat Pipeline.

Configuration

Variable Required Default Description
PIPECAT_USER_NAME No - Display name for the user party
PIPECAT_AGENT_NAME No Agent Display name for the agent party

No webhook-validation variables apply; there is no inbound request to authenticate.


ElevenLabs Adapter

Configuration

# Required
CONSERVER_URL=https://your-conserver.example.com/api/vcons
ELEVENLABS_WEBHOOK_SECRET=your_webhook_signing_secret

# Optional
PORT=8087
VALIDATE_ELEVENLABS_WEBHOOK=true
ELEVENLABS_WEBHOOK_TOLERANCE_SECONDS=1800
DOWNLOAD_RECORDINGS=true

ElevenLabs Configuration Options

Variable Required Default Description
ELEVENLABS_WEBHOOK_SECRET Yes* - HMAC signing secret from the ElevenLabs post-call webhook config
VALIDATE_ELEVENLABS_WEBHOOK No true Enable elevenlabs-signature HMAC validation
ELEVENLABS_WEBHOOK_TOLERANCE_SECONDS No 1800 Replay-window tolerance for the t= timestamp (ElevenLabs' own provider default, matching its SDK verifier; see Webhook replay window for the full resolution order)
ELEVENLABS_API_KEY No - Only needed to fetch additional conversation detail from the API

* Required when VALIDATE_ELEVENLABS_WEBHOOK=true (the default): the adapter refuses to start otherwise. See Webhook authentication below.

Signature verification caveat: ElevenLabs' public docs confirm the header name (elevenlabs-signature) and that it carries an HMAC signature with a timestamp, but do not spell out the exact signed-string format. This adapter implements the widely-used t=<timestamp>,v0=<hex_hmac_sha256> convention the header shape resembles. Verify against a real signed request (or the elevenlabs Python SDK's webhooks.construct_event) before relying on it in production; a mismatch fails closed (rejects the webhook), it does not silently accept.

Configuring ElevenLabs

  1. In the ElevenLabs dashboard, configure a post-call webhook for your agent, pointed at:

    https://your-domain.com/webhook/post-call
    
  2. Copy the signing secret shown into ELEVENLABS_WEBHOOK_SECRET.

  3. ElevenLabs sends post_call_transcription and post_call_audio as separate webhook calls; this adapter emits one vCon per call, tagged with the same conversation_id so they can be correlated downstream.


SignalWire Adapter

SignalWire's Compatibility API doesn't push a "recording complete" webhook, so this adapter polls GET /Recordings.json on an interval instead.

Configuration

# Required
CONSERVER_URL=https://your-conserver.example.com/api/vcons
SIGNALWIRE_PROJECT_ID=your_project_id
SIGNALWIRE_AUTH_TOKEN=your_auth_token
SIGNALWIRE_SPACE_URL=https://your-space.signalwire.com

# Optional
PORT=8088
SIGNALWIRE_POLL_INTERVAL_SECONDS=300
SIGNALWIRE_RETENTION_DAYS=30
DOWNLOAD_RECORDINGS=true

SignalWire Configuration Options

Variable Required Default Description
SIGNALWIRE_PROJECT_ID Yes - SignalWire project ID
SIGNALWIRE_AUTH_TOKEN Yes - SignalWire API token (outbound API auth, not a webhook secret)
SIGNALWIRE_SPACE_URL Yes - Your SignalWire space URL
SIGNALWIRE_POLL_INTERVAL_SECONDS No 300 How often to poll for new recordings
SIGNALWIRE_RETENTION_DAYS No 30 How long to retain processed-call dedupe state

There is no VALIDATE_*_WEBHOOK variable for SignalWire: it is a poller, not a webhook receiver, so there is no inbound request to authenticate. Dedupe state (which calls have already been shipped) only advances past a call once its vCon has been built and successfully posted to the conserver; a build or post failure leaves the call unmarked and inside the next poll's fetch window, so it is retried rather than silently dropped.


Common Configuration

All adapters share these common configuration options:

Variable Required Default Description
CONSERVER_URL Yes - URL of your vCon conserver endpoint
CONSERVER_API_TOKEN No - API token for conserver authentication
CONSERVER_HEADER_NAME No x-conserver-api-token Header name for API token
HOST No 0.0.0.0 Host to bind the server to
PORT No 8080 Port to run the server on
DOWNLOAD_RECORDINGS No true Download and embed recording audio
RECORDING_FORMAT No wav Recording format (wav or mp3)
INGRESS_LISTS No - Comma-separated routing lists for conserver
STATE_FILE No .{adapter}_state.json State tracking file
LOG_LEVEL No INFO Logging level
ALLOW_UNSIGNED_WEBHOOKS No false See Webhook authentication
WEBHOOK_TIMESTAMP_TOLERANCE_SECONDS No unset Shared replay-window tolerance override for adapters with a signed timestamp (Telnyx, ElevenLabs); applies only when explicitly set. See Webhook replay window
MEDIA_BACKEND No embed Where recording audio goes: embed (inline base64url), filesystem, or s3
MEDIA_BASE_URL No - Public base URL prepended to re-hosted media (filesystem/s3)
MEDIA_URL_SIGNING_KEY No - filesystem only. Appends ?sig=<HMAC-SHA256 of the file name> to each media URL, for a server that checks it. Unset leaves URLs unchanged
MEDIA_FILESYSTEM_PATH Only if MEDIA_BACKEND=filesystem - Directory to write published recordings to
MEDIA_S3_BUCKET Only if MEDIA_BACKEND=s3 - S3 (or S3-compatible) bucket for published recordings. Needs the s3 extra: pip install ".[s3]"
MEDIA_S3_REGION No - S3 region
MEDIA_S3_PREFIX No - Key prefix for published recordings in the bucket
MEDIA_S3_ENDPOINT_URL No - Endpoint URL for an S3-compatible store (DigitalOcean Spaces, MinIO, Telnyx Cloud Storage); leave unset for AWS
LAWFUL_BASIS No - Why this deployment may hold the recording: consent, contract, legal_obligation, vital_interests, public_task, or legitimate_interests. Unset means no lawful_basis attachment is emitted; never defaulted. On the Telnyx TeXML route a call whose tenant a trusted relay names never takes it (see "The tenant's own lawful basis")
LAWFUL_BASIS_PURPOSES No recording Comma-separated purposes granted under the basis. Stripped, empties dropped; set but empty means none. The Telnyx adapter's GET /health returns X-Purposes-Sha12, the first 12 hex of the sha256 of the parsed list joined by commas, so a deploy check can compare it with the receiver's and the media host's. Downstream readers such as the triage link require analysis among the granted purposes, so a deployment that uses the add-ons must list it explicitly rather than rely on the default. The fingerprint depends on the order configured, so all three hosts must list purposes in the same order
LAWFUL_BASIS_EXPIRATION No - ISO 8601 timestamp when the lawful basis expires
LAWFUL_BASIS_JUSTIFICATION No - Free-text justification, stored in the attachment's metadata

The lawful_basis attachment (and every other JSON-encoded attachment these adapters emit, such as the platform tags attachment) follows draft-ietf-vcon-vcon-core-05 §2.3.2: for encoding: "json", body is the raw JSON value itself (an object or array), not a json.dumps string. mediatype: "application/json" is set alongside it, and start, party and a session (or, for per-recording metadata, dialog) scope are always present, as the Attachment Object requires. The lawful basis is scoped to the call's Session, per the core-05 lawful basis draft.

Tracing (OpenTelemetry)

Every adapter can export traces over OTLP/HTTP. It is off until you set OTEL_EXPORTER_OTLP_ENDPOINT; unset, no OpenTelemetry code is imported and behavior is unchanged. main.py starts tracing before the server serves, so the command line does not change.

Variable Required Default Description
OTEL_EXPORTER_OTLP_ENDPOINT No unset Collector base URL, for example http://localhost:4318. Setting it turns tracing on
OTEL_SERVICE_NAME No vcon-telephony-adapter-<adapter> Service name, so two instances can report as different services
OTEL_DEPLOYMENT_ENVIRONMENT No unset Sets deployment.environment. OTEL_RESOURCE_ATTRIBUTES also works
OTEL_SDK_DISABLED No false true keeps tracing off even with an endpoint set

What you get: a server span per webhook, and a client span for each requests call, including the conserver post, which carries a W3C traceparent so the conserver continues the trace. The Telnyx recording routes add call.session_id, call.control_id, call.carrier, tenant.id and vcon.uuid (when known) to the webhook span and to a vcon.post span, so one call can be found by its session id. These are span attributes only, never metric labels.

What never leaves the process: every span is sanitized on a copy before export. Query strings and fragments are cut from names and URL attributes (a webhook token and a signed recording URL both sit in a query), exception.stacktrace is dropped, exception text goes through redact_text, phone numbers are masked to their last four digits, and header and credential-named attributes are dropped. Propagation is W3C trace context only, with no baggage. The exporter timeout and the shutdown wait are each bounded at 3 seconds, so a collector that is down never holds up a webhook or a stop. Only traces are exported.

Webhook authentication

Every webhook-based adapter validates its incoming webhooks by default (VALIDATE_*_WEBHOOK=true): an HMAC secret for Asterisk/FreeSWITCH, Twilio's own signature scheme, Telnyx's Ed25519 Call Control signature plus a token on the TeXML callback, HTTP Basic Auth for Bandwidth, a shared secret header for VAPI, or an HMAC signature for ElevenLabs, depending on the platform. SignalWire is a poller, not a webhook receiver, so it has no VALIDATE_*_WEBHOOK setting; Pipecat has no inbound request at all (the integration runs inside your own process).

If validation is enabled but the corresponding secret/key/credentials are not configured, the adapter refuses to start rather than silently accepting unauthenticated webhooks. This is deliberate: a webhook receiver that fails open when misconfigured is a receiver anyone can post fabricated recording events to.

To run an adapter without webhook authentication anyway (a lab box, a local demo, a platform that genuinely offers no way to verify these particular requests), set:

ALLOW_UNSIGNED_WEBHOOKS=true

This is a loud, explicit opt-out: it logs a warning at startup and again wherever a secret is actually missing, but it lets every adapter start and accept unauthenticated webhooks. Do not set this in production.

Webhook replay window

A valid signature only proves who sent a request, not when: without also checking the age of a signed timestamp, a captured, validly-signed webhook stays replayable indefinitely. Telnyx (Telnyx-Timestamp) and ElevenLabs (the t= field of elevenlabs-signature) both sign a Unix-seconds timestamp alongside the body, so both adapters check it, in core/webhook_security.py, once signature verification succeeds. The check rejects a timestamp too far in the past or too far in the future, and rejects outright if the timestamp is missing or non-numeric. It runs after signature verification (so only an authenticated timestamp is trusted), returns the same error response as a bad signature, and logs a distinct message so an operator can tell replay from tampering. It is skipped, along with signature verification itself, whenever ALLOW_UNSIGNED_WEBHOOKS=true bypasses signature checks for that adapter.

Each adapter resolves its tolerance in this order:

  1. its own per-platform override, if set (TELNYX_WEBHOOK_TOLERANCE_SECONDS, ELEVENLABS_WEBHOOK_TOLERANCE_SECONDS);
  2. else the shared WEBHOOK_TIMESTAMP_TOLERANCE_SECONDS, if it is explicitly set in the environment;
  3. else that adapter's own provider default: 300s (5 minutes) for Telnyx, 1800s (30 minutes) for ElevenLabs, matching the tolerance ElevenLabs' own SDK verifier defaults to. The two provider defaults differ deliberately: setting the shared variable is opt-in, so a deployment that never touches either tolerance setting keeps the behavior each adapter always had, rather than having ElevenLabs silently tightened to Telnyx's window and risking rejection of valid delayed deliveries.

All three settings (the shared one and both overrides) refuse to start the adapter if set to anything other than a positive integer.

Of the remaining adapters, none currently has a signed timestamp to check: Twilio's X-Twilio-Signature is an HMAC over the URL and form parameters with no timestamp component; Asterisk and FreeSWITCH sign the raw body alone with a shared-secret HMAC; Bandwidth uses HTTP Basic Auth; VAPI compares a static shared-secret header; and the Telnyx TeXML recordingStatusCallback path is gated by a static token in the callback URL, not a signature. SignalWire polls rather than receiving webhooks, and Pipecat has no inbound request at all.

API Endpoints

All adapters expose the same endpoint structure:

POST /webhook/recording

Receives recording events from the telephony platform.

Response: Always returns 200 OK with body "OK" to acknowledge receipt.

GET /health

Health check endpoint.

Response:

{
    "status": "healthy",
    "service": "vcon-{platform}-adapter"
}

GET /status/{recording_id}

Get the processing status for a specific recording.

Response (200):

{
    "recording_id": "rec-xxxxx",
    "vcon_uuid": "550e8400-e29b-41d4-a716-446655440000",
    "status": "success"
}

vCon Structure

All adapters write vCon core-05 (draft-ietf-vcon-vcon-core-05, syntax 0.5.0) and need vcon>=1.0.3,<2. The structure:

  • One Session Object per call in sessions[]. Its parties are everyone who received the call, its dialog lists the call's Dialogs, and originator is set only when it is not the first party (an inbound call is originated by party 1).
  • Each Dialog's parties are its contributors: both parties for a call recording, the speaker alone for a text turn (ElevenLabs, Pipecat, VAPI). A SignalWire call with several recording segments is one Session listing every segment; there is no recording-set Dialog.
  • Telnyx call lifecycle facts are Events in events[]: join and drop, and a SIP REFER becomes blind-transfer, or consultation-start plus consultative-transfer. Transfers are never Dialogs.
{
    "vcon": "0.5.0",
    "uuid": "auto-generated-uuid",
    "created_at": "2025-01-21T10:30:00+00:00",
    "parties": [
        {"tel": "+15551234567"},
        {"tel": "+15559876543"}
    ],
    "sessions": [
        {
            "start": "2025-01-21T10:30:00+00:00",
            "duration": 120.0,
            "parties": [0, 1],
            "originator": 1,
            "dialog": [0]
        }
    ],
    "dialog": [
        {
            "type": "recording",
            "start": "2025-01-21T10:30:00+00:00",
            "duration": 120.0,
            "parties": [0, 1],
            "mediatype": "audio/wav",
            "body": "base64url-encoded-audio-data",
            "encoding": "base64url"
        }
    ],
    "attachments": [
        {
            "purpose": "lawful_basis",
            "start": "2025-01-21T10:30:00+00:00",
            "party": 0,
            "session": 0,
            "mediatype": "application/json",
            "encoding": "json",
            "body": {
                "lawful_basis": "consent",
                "expiration": null,
                "purpose_grants": [
                    {"purpose": "recording", "granted": true, "granted_at": "2025-01-21T10:30:00+00:00"}
                ]
            }
        }
    ]
}

Platform-Specific Tags

Each adapter adds metadata tags to the vCon:

Twilio:

  • source: twilio_adapter
  • recording_sid, call_sid, account_sid
  • direction, recording_source
  • Caller/called geographic info

FreeSWITCH:

  • source: freeswitch_adapter
  • freeswitch_uuid, caller_name
  • account_code, freeswitch_context
  • sip_user_agent

Asterisk:

  • source: asterisk_adapter
  • asterisk_channel, asterisk_uniqueid
  • linkedid, dialplan_context
  • sip_user_agent, asterisk_language

Telnyx:

  • source: telnyx_adapter
  • telnyx_recording_id, telnyx_call_session_id
  • telnyx_call_control_id, telnyx_connection_id
  • recording_channels
  • annotation_<name>, one per relayed Annotation-<name> field on the TeXML callback (see "Relayed annotations and the tenant attachment")

Bandwidth:

  • source: bandwidth_adapter
  • bandwidth_recording_id, bandwidth_call_id
  • bandwidth_account_id, bandwidth_application_id
  • recording_channels

Development

Running tests

# Run all tests with coverage
pytest

# Run tests for a specific adapter
pytest tests/adapters/twilio/
pytest tests/adapters/freeswitch/
pytest tests/adapters/asterisk/
pytest tests/adapters/telnyx/
pytest tests/adapters/bandwidth/
pytest tests/adapters/vapi/
pytest tests/adapters/pipecat/
pytest tests/adapters/elevenlabs/
pytest tests/adapters/signalwire/

# Run with verbose output
pytest -v

The test suite includes 600+ tests covering all adapters with configuration, builder, and webhook (or observer/poller) tests.

tests/e2e/freeswitch/ is a separate manual harness against a real, locally running FreeSWITCH instance; it is excluded from the default pytest run (see its own README).

tests/adapters/telnyx/test_tenant_contract.py runs vcon-mcp's own tenant extractor and lawful basis reader, unmodified, on the JSON this adapter posts. It is skipped unless VCON_MCP_DIR names a vcon-mcp checkout with its node dependencies installed. CI runs it in the tenant-contract job against a pinned vcon-mcp commit. Locally:

VCON_MCP_DIR=/path/to/vcon-mcp pytest tests/adapters/telnyx/test_tenant_contract.py

Code formatting

black .
ruff check .

Type checking

mypy core adapters

Adding New Adapters

To add support for a new telephony platform:

  1. Create a new directory in adapters/:

    adapters/
    └── yourplatform/
        ├── __init__.py
        ├── config.py      # Extend BaseConfig
        ├── builder.py     # Extend BaseVconBuilder
        └── webhook.py     # FastAPI endpoints
    
  2. Implement the platform-specific recording data class by extending BaseRecordingData

  3. Implement the builder by extending BaseVconBuilder and implementing _download_recording()

  4. Create the webhook endpoints in a create_app() function

  5. Register the adapter in main.py

Deployment

Running in Docker

The repo ships a single Dockerfile. The adapter name is the container's command (see main.py), so one image serves every adapter:

docker build -t vcon-telephony-adapters .

docker run --rm -d \
  --name vcon-twilio \
  -p 8080:8080 \
  --env-file .env \
  vcon-telephony-adapters twilio

The image runs as a non-root user and exposes a HEALTHCHECK against GET /health on PORT (default 8080):

curl http://localhost:8080/health
# {"status": "healthy", "service": "vcon-telephony-adapters-twilio"}

CONSERVER_URL is required (see .env.example); the container exits at startup without it.

Docker Compose (Multiple Adapters)

Copy compose.example.yaml to compose.yaml and .env.example to .env, then start the adapters you need:

docker compose up twilio

Each service in the example file builds the same image and only differs by command (the adapter name) and the PORT it publishes.

Publishing images

.github/workflows/docker-publish.yml builds and pushes ghcr.io/<org>/vcon-telephony-adapters on any v* tag push. It is not wired to run outside of a tag push, and no tag is pushed as part of this change.

Production Checklist

  1. Enable webhook validation for your platform
  2. Store credentials securely (e.g., in a secrets manager)
  3. Use HTTPS for all endpoints
  4. Configure a persistent volume for the state file
  5. Set appropriate LOG_LEVEL (e.g., WARNING or ERROR for production)
  6. Consider running multiple adapter instances behind a load balancer

License

MIT

About

Twilio recording to vCon adapter - receives Twilio webhooks and creates vCons

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages