Architecture Overview
The tenant system consists of three main components:- Phone-Tenant Mapping - Maps incoming phone numbers to tenant IDs
- Tenant Configuration - Stores tenant-specific settings and features
- Tenant Prompts - Manages versioned prompts per tenant
Phone Number to Tenant Mapping
Database Collection: phone-tenant-map
This collection maps incoming phone numbers to tenant identifiers.
Schema
The incoming phone number in E.164 format (e.g.,
+33676530019)This is the number that callers dial to reach this tenant’s agent.Unique identifier for the tenant. Used to look up configuration and prompts.Format:
tenant-{environment}-{number} (e.g., tenant-prod-001)Stable business identifier for the client organizationExample:
axeoguyane, axeoservicesCreating a Phone Mapping
Tenant Resolution Process
When a call arrives:- Extract the
phone_numberfrom the incoming call - Query
phone-tenant-mapcollection for matching record - Retrieve the
tenant_idfrom the result - Load tenant configuration using the
tenant_id
src/apps/calls/app/tenant_resolution.py:18
Tenant Configuration
Database Collection: tenant_config
This collection stores detailed configuration for each tenant.
MongoDB Schema
Configuration Fields
Primary key - should match
tenant_idUnique tenant identifier
Stable business identifier for display and naming purposes
Human-readable name for the tenant (e.g., “AXEO Services Guyane”)
Email addresses to receive post-call summariesExample:
["[email protected]", "[email protected]"]Optional reply-to email address for summary emails
IANA timezone for the tenant’s localeExamples:
Europe/Paris, America/New_York, Asia/TokyoOptional locale code for language/region settingsExamples:
fr-FR, en-US, es-ESTenant activation statusOptions:
active- Tenant can receive callsdisabled- Tenant is deactivated
Feature configuration object. See Feature Configuration below.
Reserved for future use. Can store routing policies, tool configurations, etc.
Configuration schema version for migrations
Tenant creation timestamp
Last configuration update timestamp
Example Tenant Configuration
Feature Configuration
Thefeatures object controls optional functionality for each tenant.
Refer Feature (Call Transfer)
The refer feature enables call transfer to specific departments or phone numbers. Model:src/models/instructions/features/refer.py:52
Enable or disable call transfer functionality
Whether to ask caller for confirmation before transferring
Custom phrase to say when transferring (overrides default)
List of available transfer destinations
Destination Configuration
Unique identifier for the destination (lowercase, alphanumeric with underscores)Pattern:
^[a-z][a-z0-9_]{1,40}$Examples: commercial, planning, comptabiliteHuman-readable label used in conversationExamples:
"Mme Gogny", "le service planning", "la comptabilité"Transfer target in URI formatFormats:
tel:+33123456789(phone number in E.164)sip:[email protected](SIP address)
Description that helps the AI decide when to use this destinationExample:
"For sales inquiries, quotes, and new customer requests"Whether this destination is currently available
Priority ordering for display/selection (lower = higher priority)
Optional business hours restriction for this destination
Timezone for business hours (IANA format)
Recurrence rule (RFC 5545 RRULE format) defining when destination is availableExample:
"FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=9;BYMINUTE=0"Duration in minutes that the destination is availableRange: 1 to 1440 (24 hours)
Fallback destination ID to use when outside business hoursMust reference another valid
destination_id in the same tenant’s destinations list.Example: Business Hours Configuration
Python Models
The tenant configuration is validated using Pydantic models:TenantConfig Model
File:src/models/instructions/tenant_config.py:14
Fields
Tenant identifier
IANA timezone
Locale code
Version of the tools configuration
Feature configuration object
Creating a New Tenant
To set up a new tenant:Step 1: Create Phone Mapping
Step 2: Create Tenant Configuration
Step 3: Create Tenant Prompts
See Prompts Configuration for details on setting up tenant-specific prompts.After creating a new tenant, test the phone mapping by making a test call to the configured phone number.