> ## Documentation Index
> Fetch the complete documentation index at: https://omniloy.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Inbound Calls (Voice)

> How MarIA handles inbound patient calls: appointment management, FAQ resolution, and center information

MarIA autonomously handles inbound patient calls. When a patient calls the center's number, MarIA answers, identifies the need, and acts: schedules appointments, cancels or modifies them, answers frequently asked questions, and provides information about centers and services.

## For whom

* **Hospitals and clinics** looking to automate phone reception.
* **Integrators** connecting MarIA to the client's EHR/HIS.
* **Operations** monitoring call quality and volume.

## Agent capabilities during a call

| Capability               | Description                                                                    |
| ------------------------ | ------------------------------------------------------------------------------ |
| **Schedule appointment** | Queries available slots in the EHR and creates the appointment during the call |
| **Cancel appointment**   | Patient indicates which appointment to cancel; MarIA cancels it in the EHR     |
| **Modify appointment**   | Combines cancellation and new scheduling in a single conversation              |
| **Center FAQs**          | Answers questions about schedules, locations, coverage, and specialties        |
| **General information**  | Informs about available services, required documentation, etc.                 |
| **Escalation to human**  | Transfers the call with full context when the situation requires it            |

## Inbound call flow

```mermaid theme={null}
sequenceDiagram
  autonumber
  participant P as Patient
  participant M as MarIA
  participant E as EHR/HIS

  P->>M: Calls the configured number
  M-->>P: Greets and identifies need

  alt Schedule appointment
    M->>E: appointment.getBenefits (centerId, serviceId)
    E-->>M: List of coverage/benefits
    M->>E: appointment.getSlots (benefitId, centerId, fromDate...)
    E-->>M: Available slots
    M-->>P: "I have Tuesday the 10th at 11:00 available, does that work?"
    P-->>M: Confirms
    M->>E: appointment.create (slot, patientId, benefitId)
    E-->>M: appointmentId confirmed
    M-->>P: Appointment confirmed
  else Cancel appointment
    M->>E: appointment.getList (patientId)
    E-->>M: Patient's appointments
    M-->>P: Presents appointments and confirms which to cancel
    P-->>M: Confirms cancellation
    M->>E: appointment.cancel (appointmentId)
    E-->>M: OK
    M-->>P: Appointment successfully cancelled
  else FAQ / Information
    M-->>P: Responds using the FAQ knowledge base
  else Escalation
    M-->>P: "Let me transfer you to an agent"
    M->>+Agent: Transfers with full context
  end

  M-->>P: Farewell
```

## Notifications after the call

After scheduling an appointment, MarIA can send the patient a **WhatsApp confirmation** with the details. Before the appointment day it can also send an **automatic reminder**.

See the [WhatsApp](/maria/en/whatsapp) guide for template configuration.

## Call webhooks

MarIA emits the following events during the call lifecycle:

| Event                       | When emitted                                               |
| --------------------------- | ---------------------------------------------------------- |
| `voice.call.status.updated` | On each call status change                                 |
| `voice.call.escalated`      | When the call is transferred to a human                    |
| `voice.answer.updated`      | When a response is captured during the call                |
| `voice.transcript.created`  | When the call ends (includes transcript and recording URL) |

Register your endpoints at `POST /webhooks` to receive these events. See [APIs: Webhook events](/maria/en/webhooks-eventos) and [APIs: EHR integrations](/maria/en/integraciones-ehr) for applicable contracts.

## Knowledge base configuration

The agent answers FAQs using documents indexed at `POST /faq/documents`. Keep these documents up to date with your center information:

* Schedules and locations
* Available specialties per center
* Insurance and coverage
* Documentation the patient needs to bring

## Querying centers and services

Query the centers, services, and coverage available in MarIA:

```bash theme={null}
# List centers with their services and coverage
curl -H "Authorization: Bearer $TOKEN" "$BASE_URL/api/v1/centers"

# List services with their coverage
curl -H "Authorization: Bearer $TOKEN" "$BASE_URL/api/v1/centers/services"
```

See the full reference in the **API Reference → Centers** section.

## Outbound calls

MarIA also supports follow up campaigns using questionnaires agreed with the client.

See [Outbound Calls (Voice)](/maria/en/flujos-salientes) for the flow and related integration points.

## Operational metrics

* **Automatic resolution rate**: % of calls resolved without human escalation.
* **Average call duration**: average time to complete an appointment management task.
* **Escalation rate**: percentage of calls transferred to a human agent.
* **Appointment creation success rate**: % of scheduling attempts that result in a confirmed appointment.
