Introducing a new way to review your PRs.

Read the announcement

frappe / crm

Fully featured, open source CRM

View on GitHub

24 documents · Updated Nov 23, 2026

docs / telephony-integrations

Telephony integrations

Telephony integrations connect CRM users with Twilio or Exotel so they can place and receive calls from the CRM. Each call becomes a call-log record that keeps the call state, people, numbers, provider data, recording, and related customer work in one place. This page is part of Customer communications and relates to Activities and notifications and External business integrations.

Telephony model

Call-log records

The CRM Call Log is the shared record for manual calls and provider calls. It describes call direction, caller or receiver, source and target numbers, status, duration, time range, medium, and an optional recording. A provider call uses Twilio or Exotel as its telephony medium. A call entered by a user uses Manual when no medium is supplied. crm/…/crm_call_log.json.

The record can point to a lead or deal and can carry links to notes and tasks. Number matching helps a provider call find the related contact or customer record. When a lead or deal is already linked, the call uses that record only when the user can read it. A call with no known match can later create a lead from its details. crm/…/crm_call_log.py• L197-226, crm/…/api.py• L112-137, crm/…/handler.py• L198-245.

References: crm/…/crm_call_log.json• L33-160 crm/…/crm_call_log.py• L50-55 crm/…/crm_call_log.py• L197-226 crm/…/api.py• L112-137 crm/…/handler.py• L198-245

Call-log lifecycle

Provider events create a call-log record and later fill in its final state. The record starts with the provider call ID and basic routing data. Status events add duration and time values. Recording events add the provider recording address. This keeps the CRM record useful while a call is active and complete after the provider finishes its work.

The main status set is shared across providers. It includes Initiated, Ringing, In Progress, Completed, Failed, Busy, No Answer, Queued, and Canceled. The interface shows No Answer as Missed Call only for an incoming call. Exotel values are normalized before they enter this shared set. Empty leg values are ignored, and a busy leg can remain Ringing while another leg is still active. crm/…/crm_call_log.json• L50-55, frontend/…/callLog.js• L63-93, crm/…/handler.py• L261-320.

flowchart LR
    A[Call event] --> B[Provider handler]
    B --> C[Create or find call log]
    C --> D[Status and duration updates]
    D --> E[Recording update]
    C --> F[Contact, lead, or deal link]
    F --> G[Notes and tasks]

References: crm/…/crm_call_log.py• L50-55 crm/…/api.py• L140-191 crm/…/handler.py• L261-352 frontend/…/callLog.js• L63-93

Telephony agents

A CRM Telephony Agent is the per-user telephony profile. It connects a CRM user to the user's personal phone data and to the numbers that the enabled providers use for calls. It also stores the user's default calling medium and the device used for incoming calls: Computer or Phone. crm/…/crm_telephony_agent.json• L22-96.

The profile keeps one primary phone in its phone list. The primary phone is also the profile's mobile number. When that number changes, the profile keeps the phone list aligned. More than one primary number is not allowed. crm/…/crm_telephony_agent.py• L30-72.

References: crm/…/crm_telephony_agent.json• L22-96 crm/…/crm_telephony_agent.py• L30-72 crm/…/crm_telephony_phone.json• L12-29

Provider call flows

Twilio calls

Twilio supports browser calls and phone forwarding. For browser calls, the CRM gives the user's browser a short-lived voice access token. The user must have a Twilio number mapped to the telephony profile before the browser can make calls. The browser refreshes the token when it is near expiry. Twilio then sends call events to the CRM so the call log can track the call. For incoming calls, the system finds users mapped to the called Twilio number and routes the call to a configured phone or to an active browser session. crm/…/api.py• L30-51, crm/…/twilio_handler.py• L26-32, crm/…/twilio_handler.py• L39-53, crm/…/twilio_handler.py• L127-150, frontend/…/TwilioCallUI.vue• L263-305.

Twilio validates the account and application data on its webhook requests. The voice handler creates the call log before it returns call instructions. Later status and recording callbacks update that same record by call ID. crm/…/api.py• L13-27, crm/…/api.py• L54-103, crm/…/api.py• L140-207.

The Twilio flow links the call to a lead or deal by the external party's number. It can record both incoming and outgoing calls when recording is enabled. The call window shows the matched person and number. It supports incoming-call accept and reject actions, outgoing-call cancel, mute, hang-up, and a note action. crm/…/twilio_handler.py• L76-113, frontend/…/TwilioCallUI.vue• L14-105, frontend/…/TwilioCallUI.vue• L308-465.

sequenceDiagram
    participant U as CRM user
    participant C as CRM
    participant T as Twilio
    participant P as Customer phone

    U->>C: Start call or receive browser alert
    C->>T: Use configured number and voice access
    T->>P: Connect the call
    T-->>C: Voice, status, and recording events
    C->>C: Create or update call log
    C-->>U: Show call state and customer details

References: crm/…/twilio_handler.py• L68-113 crm/…/twilio_handler.py• L127-212 crm/…/api.py• L13-27 crm/…/api.py• L54-103 frontend/…/TwilioCallUI.vue• L263-305 frontend/…/TwilioCallUI.vue• L318-465

Exotel calls

Exotel places outgoing calls through its call-connect service. The CRM supplies the user's phone, the selected Exotel number, the target number, and the callback address. Exotel then sends event updates to the CRM. The CRM publishes those events to the active interface and creates or updates the related call log. crm/…/handler.py• L78-147, crm/…/handler.py• L18-75.

Exotel incoming events identify the agent who receives the call. Outgoing events identify the user who started it. The handler links the log to a contact, lead, or deal when the external number matches a CRM record. It converts Exotel's lowercase and hyphenated status values to the call-log status set. Empty leg statuses are treated as missing, while a busy leg is treated as Ringing when another call leg can still connect. A webhook verify token protects incoming Exotel events because Exotel does not provide request-signature checks. crm/…/handler.py• L182-190, crm/…/handler.py• L198-245, crm/…/handler.py• L261-320.

The Exotel call window shows live status and duration. It also lets the user add or update a note or task and open the linked lead or deal. A task can include its title, description, status, priority, assignee, and due date before it is saved to the call log. frontend/…/ExotelCallUI.vue• L140-222, frontend/…/TaskPanel.vue• L1-110.

References: crm/…/handler.py• L18-75 crm/…/handler.py• L78-147 crm/…/handler.py• L168-190 crm/…/handler.py• L245-352 frontend/…/ExotelCallUI.vue• L179-225 frontend/…/ExotelCallUI.vue• L386-433 frontend/…/TaskPanel.vue• L1-110

Telephony settings

Integration settings

CRM Twilio Settings and CRM Exotel Settings are single settings records that enable a provider for the site. They hold the provider account details needed for calls and the option to record calls. Twilio also uses a selected Twilio app. Exotel also uses a subdomain and a webhook verify token. When Exotel is enabled, the settings record checks the account details against Exotel before it can be saved. crm/…/crm_twilio_settings.json• L27-120, crm/…/crm_exotel_settings.json• L21-94, crm/…/crm_exotel_settings.py• L28-45.

Only users with manager access see the provider configuration controls in the telephony settings view. Turning off a provider removes it from the available calling choices after the settings are saved. frontend/…/TelephonySettings.vue• L158-212, frontend/…/TwilioSettings.vue• L171-186, frontend/…/ExotelSettings.vue• L144-159.

References: crm/…/crm_twilio_settings.json• L27-120 crm/…/crm_exotel_settings.json• L21-94 crm/…/crm_exotel_settings.py• L28-45 frontend/…/TelephonySettings.vue• L158-212 frontend/…/TwilioSettings.vue• L171-186 frontend/…/ExotelSettings.vue• L144-159

User calling settings

Each user can choose a default calling medium. The same screen shows the user's Twilio number when Twilio is enabled and the user's Exotel number and personal mobile number when Exotel is enabled. The profile is created when needed, so a user can set a default medium before a full profile exists. frontend/…/TelephonySettings.vue• L34-156, crm/…/api.py• L47-72.

When more than one provider is enabled and no default exists, the call control asks the user to choose a medium. The choice can be saved as that user's default. frontend/…/CallUI.vue• L65-112.

References: crm/…/crm_twilio_settings.json• L27-120 crm/…/crm_exotel_settings.json• L21-94 frontend/…/TelephonyPage.vue• L1-24 frontend/…/TelephonySettings.vue• L34-212 crm/…/api.py• L36-72

Frontend call controls

Call controls

The shared call control checks the enabled provider set before it exposes calling. A phone action can then start a Twilio or Exotel call. If the user has one enabled provider or a saved default, the call starts at once. If the user has several choices and no default, a short selection dialog appears. frontend/…/telephony.js• L4-40, frontend/…/CallUI.vue• L65-101.

The call window resolves the number to a CRM contact when possible. It shows the person's name and number during the call. The Twilio window also keeps a compact state for active, outgoing, and incoming calls so the user can restore the full controls. The provider-specific window then handles its own live state and actions. frontend/…/TwilioCallUI.vue• L14-168, frontend/…/TwilioCallUI.vue• L199-223, frontend/…/ExotelCallUI.vue• L263-293.

References: frontend/…/TwilioCallUI.vue• L14-168 frontend/…/TwilioCallUI.vue• L199-223 frontend/…/ExotelCallUI.vue• L263-293

Call-log workspace

The Call Logs page provides a list view for CRM Call Log records. Users can filter and sort the list, open a call-detail window, or create a manual call-log record. The detail window presents direction, participants, linked customer record, time, duration, status, recording, note, and task when those values exist. frontend/…/CallLogs.vue• L19-59, frontend/…/CallLogDetailModal.vue• L53-153.

The detail window also supports the work that follows a call. A user can edit the call log, add or edit a note, add or edit a task, open the linked lead or deal, or create a lead when no lead or deal is linked. frontend/…/CallLogDetailModal.vue• L12-51, frontend/…/CallLogDetailModal.vue• L210-260, frontend/…/CallLogDetailModal.vue• L352-386.

References: frontend/…/CallLogs.vue• L117-143 frontend/…/CallLogDetailModal.vue• L12-51 frontend/…/CallLogDetailModal.vue• L210-260 frontend/…/CallLogDetailModal.vue• L352-386

Recording access

The browser does not play a provider recording URL directly. The detail view asks the CRM for the recording through the call-log record. The CRM checks read permission, applies the provider credentials when needed, and streams the recording to the browser. If the source is missing or no longer works, the UI shows Recording not available. crm/…/api.py• L249-299, crm/…/crm_call_log.py• L141-155, frontend/…/CallLogDetailModal.vue• L92-107.

References: frontend/…/telephony.js• L4-40 frontend/…/CallUI.vue• L65-133 frontend/…/CallLogs.vue• L19-159 frontend/…/CallLogDetailModal.vue• L263-347 crm/…/crm_call_log.py• L141-155 crm/…/api.py• L249-299

Change checklist

When these files or sections are changed, remember to consider these:

  • When a call-log field or status changes, update provider status mapping and the list and detail display together. The same value crosses the DocType, provider handlers, and frontend label map.
  • When provider credentials or callback routes change, update the provider settings screen and the webhook validation path together. A saved setting that does not match the provider callback can stop call-log updates.
  • When phone ownership or primary-number rules change, check outgoing caller selection, incoming agent routing, and number-to-contact matching as one contract.
  • When recording behavior changes, keep provider recording callbacks, call-log medium values, recording credential selection, and browser playback aligned.
  • When the default medium contract changes, update the per-user agent profile and the frontend provider-selection state together.
  • When Exotel call follow-up fields change, keep the in-call task editor, call-log task persistence, and the call-detail task view aligned.
  • When Twilio browser identity rules change, keep the mapped user number, access-token response, and browser call setup aligned.
  • When Exotel credential checks change, keep the save-time validation and webhook or outgoing-call connection settings aligned.

Important failure modes

TriggerConsequenceGuard
A provider is enabled without valid account details or a selected caller numberThe user cannot start a call or the provider cannot return valid call instructionsComplete the provider settings and the user's provider number before calling
A Twilio user has no number mapped to the telephony profileThe browser client cannot get a usable calling identityMap a Twilio number to the user's Telephony Agent
Twilio receives a callback for the wrong account or applicationThe callback is rejected and the call log is not created or updatedKeep Twilio account and application identifiers equal to the configured settings
An Exotel webhook has a missing or wrong verify tokenThe event is rejected as unauthorizedUse the same secret in Exotel and CRM Exotel Settings
Exotel sends an unknown call statusThe status is logged as an error and the call log keeps its prior statusKeep the Exotel status map aligned with the provider's status contract
A user has no mobile number for a phone-routed incoming callTwilio cannot forward the call to that userSelect Computer or add a valid primary phone number
A call log points to an expired or unreachable recordingThe detail view cannot play the recordingTreat the recording as optional and use the CRM recording proxy
Call-log creation fails after an Exotel call startsThe call connects but its history is missingSurface the creation warning and inspect the server error log
A task is changed in the Exotel call window but not savedThe call keeps no follow-up work or keeps older task dataUse the save or update action after changing the task

Key files

FileWhy to read it
crm/…/crm_call_log.jsonDefines the shared call-log record and its business fields.
crm/…/crm_call_log.pyShows how call details are shaped and how leads, notes, tasks, permissions, and recordings relate to a call.
crm/…/crm_telephony_agent.jsonDefines the per-user provider numbers, device choice, default medium, and phone list.
crm/…/crm_telephony_agent.pyExplains the primary-phone rule for a user profile.
crm/…/api.pyShows Twilio webhook validation, browser identity, and call-log updates.
crm/…/twilio_handler.pyShows Twilio routing between a user's phone and browser.
crm/…/handler.pyShows Exotel call creation, webhook events, status normalization, and call-log updates.
crm/…/crm_exotel_settings.pyShows Exotel credential checks when the integration is enabled.
crm/…/api.pyShows shared provider state, user defaults, related-record lookup, and recording access.
frontend/…/CallUI.vueShows provider choice and the shared outgoing-call entry point.
frontend/…/TwilioCallUI.vueShows browser call state, contact display, token setup, and Twilio call actions.
frontend/…/ExotelCallUI.vueShows Exotel event handling and post-call work.
frontend/…/TaskPanel.vueShows the task fields available during an Exotel call.
frontend/…/CallLogs.vueShows the call-log list and detail entry points.
frontend/…/CallLogDetailModal.vueShows the call-detail view and follow-up actions.
frontend/…/TelephonySettings.vueShows user defaults and provider configuration entry points.